Simplequeue.handbrake is a project mainly written in Ruby, it's free.
fork of my simplequeue framework to support handbrake conversion of different video files
simplequeue is a simple queueing utility, which can read tasks from a text file. Everything that can be expressed as a single line in a plain-text file is a task.
success
- and error
-scripts after processing tasksfor running the unit tests, you'll also need fakefs
To get started, copy the file config/config.yml.example
to config/config.yml
abd add the absolute path to your queue_dir
. All the files necessary for queueing will be stored in this directory. Specify a queue_prefix
if you want the queue files to start differently than queue.txt
.
Write the script for the task to be executed in scripts/process
. The task will be given as a string as first parameter to the script.
If you want you can add custom handling for success and error in scripts/success
and scripts/error
.
To enable growl notification just ensure that the path to the growlnotify binary is set correctly in growlnotify_cli
.
To add a task to the queue execute simplequeu.rb <taskname> -p<prio>
. For adding multiple tasks, separate them by spaces (shell globs are supported - especially handy for adding filenames as tasks). The tasks will be added to a .txt file in queue_dir
. The priority will be appended to this file.
For example: simplequeue "a simple task" -p7
adds the task "a simple task" to the file /opt/queue/queue.txt.7
. The queue files with the highest priority (smalles number) will be executed first. When all the tasks in this file are executed, the next queue_file which has the next highest priority (next greater number) will be executed. Task executing will not be interrupted. If you add a prio 1 task, while a prio 9 task is executed, the prio 1 task is executed next.
Additionally you have the opportunity to assign a priority according to the task-name, current date (or incoming prio).
Just implement the method (task_name, prio, current_date)
in the file task_filter.rb
(plain ruby). If you add the tasks using the simplequeue.rb
command-line tool, you'll get 3 parameters:
The default behaviour is:
Here's an example implementation of assigning priorities according to their name:
class TaskFilter
def filter(task_name, prio, current_date);
search_hash = { "work" => 1, "fun" => 7, "something in between" => 3}
prio_to_return = 9
search_hash.each do |key, value|
if task_name.downcase.include?(key.downcase)
prio_to_return = value
break;
end
end
return prio_to_return
end
end
To start queue process simply start simplequeue_daemon.rb
.
For daemonizing execute simplequeue_daemon_control.rb start
.
The icons I used for the growl notification I took from here: http://www.icojoy.com/articles/46/.