Only import into iTunes when when iTunes is running

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Hello,

I'm currently in my trial period for Hazel and loving it.
There is only one problem or action I'm looking for, so far I haven't figured it out.

I want to have a watched folder where audio files automatically get imported into iTunes.
The only problem is my iTunes library resides on an external HDD which isn't always connected.

Is it possible to have the "import into iTunes" line run only when the external HDD is connected or iTunes is actually open? (I prefer the last one).

I hope someone can help me with this.

Cheers
David
adamchrist
 
Posts: 3
Joined: Sun Jul 28, 2013 1:47 pm

I think I actually cracked the problem :shock:

Using an Applescript

Code: Select all
on hazelProcessFile(theFile)
   
   if application "iTunes" is running then
      tell application "iTunes"
         launch
         try
            
            add theFile
            
            set the file_path to the quoted form of the POSIX path of theFile
            do shell script ("rm -f " & file_path)
            
         end try
      end tell
   end if
   
end hazelProcessFile


I'm not an experienced scripter at all, so if the above can be more efficient please tell me.
Also if it can be made so it imports into a specific playlist, please do share :mrgreen:

Well for now this seems to be doing the trick
adamchrist
 
Posts: 3
Joined: Sun Jul 28, 2013 1:47 pm

An alternative might be to make use of the "Automatically Add to iTunes" folder.
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Ah great, way simpler, thanks sjk!
adamchrist
 
Posts: 3
Joined: Sun Jul 28, 2013 1:47 pm


Return to Open Discussion