Adding to VideoDrive import queue with Hazel

View previous topic View next topic Go down

Adding to VideoDrive import queue with Hazel

Post  sentience on Wed Mar 20, 2013 7:39 am

Because I find OS X Folder Actions to be somewhat unreliable, I use Hazel to monitor a folder for new video files, and open them with VideoDrive.

The problem with this is that if VideoDrive is partway through converting a video with HandBrakeCLI when Hazel attempts to open another video file with VideoDrive, VideoDrive prompts you to stop HandBrakeCLI and process the new file instead.

What Iíd prefer is for the new file to be added to the VideoDrive Import Queue, to be processed when the currently-converting file is finished processing.

Is there some way to pass VideoDrive a file to be handled this way, rather than interrupting the import already in process?

sentience

Posts : 7
Join date : 2010-04-21

View user profile

Back to top Go down

Re: Adding to VideoDrive import queue with Hazel

Post  sentience on Wed Mar 20, 2013 7:52 am

It appears what Iím looking for is what is done by the add - VideoDrive import video.scpt folder action script bundled in VideoDrive. Unfortunately, the script is saved as run-only, so I canít see inside it.

Any chance of getting an editable version of this script so that I can implement the equivalent action with Hazel?

sentience

Posts : 7
Join date : 2010-04-21

View user profile

Back to top Go down

Re: Adding to VideoDrive import queue with Hazel

Post  Aroona on Fri Mar 22, 2013 12:06 am

Hi, while we do not offer official support for this at the moment, you can probably go a long way as follows. VideoDrive is not officially scriptable (there is no dictionary available due to technical reasons) but it does understand Applescript. You can add new videos to the queue with the following two lines:

Code:
tell application "VideoDrive" to set contents of text field "AutoParameters" of window "MainWindow" to newVideos
tell application "VideoDrive" to tell button "AutoImportButton" of window "MainWindow" to perform action

So, the following simple applescript will ask you to select a file and then it will launch VideoDrive and queue the video:

Code:
set newVideos to choose file
set newVideos to newVideos as string
tell application "VideoDrive"
  launch
  set contents of text field "AutoParameters" of window "MainWindow" to newVideos
  tell button "AutoImportButton" of window "MainWindow" to perform action
end tell

As you can see in the code above, the only tricky part is that the variable newVideos needs to be string containing the full path of the video you want to queue. If you want to queue multiple videos at once, you should put a semicolon between each file path. Also, VideoDrive does not like single quotes, double quotes and semicolons in paths.

Please post back your experiences so we can further assist you and help others that might want to try similar scenarios.


Last edited by Aroona on Fri Mar 22, 2013 11:22 am; edited 1 time in total
avatar
Aroona
Admin

Posts : 689
Join date : 2008-05-17

View user profile http://www.aroona.net

Back to top Go down

Re: Adding to VideoDrive import queue with Hazel

Post  sentience on Fri Mar 22, 2013 3:00 am

Thanks for the pointers! I can certainly give that a try.

Is that AppleScript likely to work while a video import is already in progress, as per my first post?

sentience

Posts : 7
Join date : 2010-04-21

View user profile

Back to top Go down

Re: Adding to VideoDrive import queue with Hazel

Post  Aroona on Fri Mar 22, 2013 9:01 am

Yes, it will. But you might want to put everything between ignoring application responses just to make sure that your script does not hang when VideoDrive does not respond immediately.

Code:

ignoring application responses
...
end ignoring
avatar
Aroona
Admin

Posts : 689
Join date : 2008-05-17

View user profile http://www.aroona.net

Back to top Go down

Re: Adding to VideoDrive import queue with Hazel

Post  sentience on Thu Apr 04, 2013 11:25 am

Itís working perfectly! Hereís the exact AppleScript Iím using to process files in Hazel:
Code:
set newVideos to theFile as string
ignoring application responses
   tell application "VideoDrive"
      launch
      set contents of text field "AutoParameters" of window "MainWindow" to newVideos
      tell button "AutoImportButton" of window "MainWindow" to perform action
   end tell
end ignoring

sentience

Posts : 7
Join date : 2010-04-21

View user profile

Back to top Go down

Re: Adding to VideoDrive import queue with Hazel

Post  Aroona on Thu Apr 04, 2013 11:41 am

Great! Note that you can also pass on entire folders in the exact same way.

Hot Folders will also soon be able to process folders. If you add subfolders to a hot folder, the next version (2.7.04) will process their content.
avatar
Aroona
Admin

Posts : 689
Join date : 2008-05-17

View user profile http://www.aroona.net

Back to top Go down

Re: Adding to VideoDrive import queue with Hazel

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum