Created
November 13, 2010 13:13
-
-
Save JamesHarrison/675309 to your computer and use it in GitHub Desktop.
Dropbox script for Myriad 3.5+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dropbox import script | |
require 'find' | |
require 'socket' | |
# This _so_ needs more functions and any sort of error handling whatsoever. | |
class MyriadInterface | |
def initialize | |
@socket = TCPSocket.new( 'localhost', 6950 ) | |
end | |
def import(path,start,finish) | |
puts "Importing file '#{path}' to cart range between #{start} and #{finish}" | |
@socket.write("AUDIOWALL IMPORTFILE \"#{path}\",#{start},#{finish}\r\n") | |
while g = @socket.recv(1024) do | |
return true if g.include?("+Success") | |
end | |
return false | |
end | |
end | |
dropboxes = [ | |
{:path=>'E:/Dropboxes/Chart/', :start=>1001, :end=>4000}, | |
{:path=>'E:/Dropboxes/Metal/', :start=>4000, :end=>8000}, | |
{:path=>'E:/Dropboxes/Indie-Lo-fi-Postrock/', :start=>8001, :end=>10000}, | |
{:path=>'E:/Dropboxes/Acoustic/', :start=>12001, :end=>12000}, | |
{:path=>'E:/Dropboxes/Jazz-Easy-Listening/', :start=>12001, :end=>14000}, | |
{:path=>'E:/Dropboxes/Soul-Blues/', :start=>14001, :end=>16000}, | |
{:path=>'E:/Dropboxes/New Music/', :start=>16001, :end=>18000}, | |
{:path=>'E:/Dropboxes/Folk-Country/', :start=>18001, :end=>22000}, | |
{:path=>'E:/Dropboxes/Classical-Choral/', :start=>22001, :end=>24000}, | |
{:path=>'E:/Dropboxes/RnB/', :start=>24001, :end=>26000}, | |
{:path=>'E:/Dropboxes/Hip-hop-Rap/', :start=>26001, :end=>28000}, | |
{:path=>'E:/Dropboxes/World/', :start=>28001, :end=>30000}, | |
{:path=>'E:/Dropboxes/Funk/', :start=>30001, :end=>32000}, | |
{:path=>'E:/Dropboxes/Progressive/', :start=>32001, :end=>34000}, | |
{:path=>'E:/Dropboxes/Electronic/', :start=>34001, :end=>38000}, | |
{:path=>'E:/Dropboxes/Rock/', :start=>38001, :end=>42000}, | |
{:path=>'E:/Dropboxes/Punk/', :start=>42001, :end=>44000}, | |
{:path=>'E:/Dropboxes/Soundtrack-Musicals/', :start=>44001, :end=>46000}, | |
{:path=>'E:/Dropboxes/Pop/', :start=>46001, :end=>50000} | |
] | |
mi = MyriadInterface.new | |
dropboxes.each do |box| | |
puts "Checking dropbox '#{box[:path]}'" | |
Dir.mkdir(box[:path]) unless File.exists? box[:path] | |
Find.find(box[:path]) do |path| | |
puts "Checking path '#{path}'" | |
next if File.directory?(path) | |
if mi.import(path,box[:start],box[:end]) | |
puts "Deleting path '#{path}'" | |
File.delete(path) | |
else | |
puts "Not deleting, something went wrong!" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment