# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: contributions/modules/ffmpeg_converter/README.txt
--- contributions/modules/ffmpeg_converter/README.txt Base (1.8)
+++ contributions/modules/ffmpeg_converter/README.txt Locally Modified (Based On 1.8)
@@ -32,7 +32,7 @@
    them):
    
    - FileField: http://drupal.org/project/filefield
-   - Job queue: http://drupal.org/project/job_queue
+   - Drupal Queue: http://drupal.org/project/drupal_queue
    - Rules: http://drupal.org/project/rules
    
 4. Optionally download and install MimeDetect, which will set proper MIME types 
@@ -72,7 +72,7 @@
    Add another rule for "After updating existing content" if you like.
 
    All media files uploaded to the source field should now be automatically
-   converted if you have Job queue installed and cron set up (see
+   converted if you have Drupal Queue installed and cron set up (see
    http://drupal.org/cron). On Administer > Reports > Queued jobs you can find a
    list of all conversions that have not yet run.
    
Index: contributions/modules/ffmpeg_converter/ffmpeg_converter.install
--- contributions/modules/ffmpeg_converter/ffmpeg_converter.install Base (1.4)
+++ contributions/modules/ffmpeg_converter/ffmpeg_converter.install Locally Modified (Based On 1.4)
@@ -89,7 +89,7 @@
     );
     $rec_missing = array();
     $recommended = array(
-      'job_queue' => $t('Job Queue'),
+      'drupal_queue' => $t('Drupal Queue'),
       'rules' => $t('Rules'),
       'filefield' => $t('FileField'),
     );
Index: contributions/modules/ffmpeg_converter/ffmpeg_converter.module
--- contributions/modules/ffmpeg_converter/ffmpeg_converter.module Base (1.44)
+++ contributions/modules/ffmpeg_converter/ffmpeg_converter.module Locally Modified (Based On 1.44)
@@ -200,6 +200,37 @@
 
 
 /**
+ * Implementation of hook_cron_queue_info().
+ */
+function ffmpeg_converter_cron_queue_info() {
+  return array(
+    'ffmpeg_converter' => array(
+      'worker callback' => 'ffmpeg_converter_worker',
+      'time' => 15,
+    ),
+  );
+}
+
+
+/**
+ * Drupal Queue worker implementation.
+ */
+function ffmpeg_converter_worker($data) {
+  // Clear the cached list of queued files.
+  cache_clear_all('ffmpeg_converter_queued_files', 'cache');
+
+  // Run the conversion.
+  if (function_exists($data['function'])) {
+    call_user_func_array($data['function'], $data['arguments']);
+    watchdog('ffmpeg_converter', 'Ran queued job "!description"', array('!description' => t($data['description'], $data['arguments'])));
+  }
+  else {
+    watchdog('ffmpeg_converter', 'Failed to run queued job "!description" because the function %function is not defined.', array('!description' => $data['description'], '%function' => $data['function']), WATCHDOG_ERROR);
+  }
+}
+
+
+/**
  * Add a file field to the process queue.
  *
  * @param $nid
@@ -214,12 +245,20 @@
  * @param $preset_key
  *   The key of the FFmpeg Converter preset to use.
  * @return
- *   FALSE if Job queue is unavailable, NULL otherwise.
+ *   FALSE if Drupal Queue is unavailable, NULL otherwise.
  */
 function ffmpeg_converter_queue_filefield($nid, $source_field, $dest_field, $field_instance, $preset_key) {
-  if (function_exists('job_queue_add')) {
+  if (function_exists('drupal_queue_include')) {
     cache_clear_all('ffmpeg_converter_queued_files', 'cache');
-    return job_queue_add('ffmpeg_converter_convert_filefield', t('Convert a file field with FFmpeg.'), array($nid, $source_field, $dest_field, $field_instance, $preset_key));
+
+    $job = array(
+      'function' => 'ffmpeg_converter_convert_filefield',
+      'description' => t('Convert a file field with FFmpeg'),
+      'arguments' => array($nid, $source_field, $dest_field, $field_instance, $preset_key),
+    );
+    drupal_queue_include();
+    $queue = DrupalQueue::get('ffmpeg_converter');
+    $queue->createItem($job);
   }
   else {
     return false;
@@ -249,9 +288,10 @@
     $files = $cache->data;
   }
   else {
-    $jobs = db_query("SELECT * FROM {job_queue} WHERE function = 'ffmpeg_converter_convert_filefield'");
+    $res = db_query("SELECT data FROM {queue} WHERE name = 'ffmpeg_converter'");
     $files = array();
-    while ($job = db_fetch_array($jobs)) {
+    while ($data = db_result($res)) {
+      $job = unserialize($data);
       $args = unserialize($job['arguments']);
       $files[] = $args[0] . '-' . $args[1] . '-' . $args[2] . '-' . $args[3];
     }
@@ -299,9 +339,6 @@
 
   $node = node_load($nid, null, true);
 
-  // Clear the cached list of queued files.
-  cache_clear_all('ffmpeg_converter_queued_files', 'cache');
-  
   // Check the necessary prerequisites.
   if (empty($node) || empty($node->{$source_field}[$field_instance]['fid']) || !function_exists('content_fields')) {
     return false;
Index: contributions/modules/ffmpeg_converter/plugins/export_ui/ffmpeg_converter_presets_ui.class.php
--- contributions/modules/ffmpeg_converter/plugins/export_ui/ffmpeg_converter_presets_ui.class.php Base (1.2)
+++ contributions/modules/ffmpeg_converter/plugins/export_ui/ffmpeg_converter_presets_ui.class.php Locally Modified (Based On 1.2)
@@ -22,7 +22,7 @@
       $help .= ' ' . t('Your presets will appear in <a href="@rules">Rules</a> using the "Queue file field for conversion" action, which lets you create rules that convert all media files that are uploaded to a certain file field automatically.', array('@rules' => url('admin/rules/trigger')));
     }
     else {
-      $help .= ' ' . t('If you install and enable the Rules, Job Queue and FileField modules, your presets will appear on rule configuration pages, which allows you to have all media files that are uploaded to a certain file field processed automatically.');
+      $help .= ' ' . t('If you install and enable the Rules, Drupal Queue and FileField modules, your presets will appear on rule configuration pages, which allows you to have all media files that are uploaded to a certain file field processed automatically.');
     }
     $help .= ' ' . t('Other modules may also make this conversion functionality available in their own specific contexts.');
     $help = '<p class="ffmpeg-converter-help">' . $help . '</p>';
