Download & Extend

All videos uploaded everytime cron is run creating duplicate entries in YouTube

Project:Video Upload
Version:6.x-1.4
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I am using the latest version of the video upload module, drupal 6.14 on windows server. Everything works fine, except that video upload doesn't remember which videos have already been uploaded and which are new. So when cron is run it uploads all videos to youtube, this creating duplicates.

Comments

#1

true

#2

Priority:normal» critical

#3

Priority:critical» normal

Actually this is only a problem when cron runs frequently and processing of the previously uploaded videos has not yet finished. In that case, it uploads all unprocessed videos again thus creating duplicates.

#4

Subscribing. I've experienced the same thing.

#5

The fix would be to update the video status before the upload, in function video_upload_upload($field, $video) (video_upload.module).

<?php
function video_upload_upload($field, $video) {
 
$node = node_load($video->nid);
 
// Attach file information.
 
$file = db_fetch_object(db_query("SELECT * FROM {files} WHERE fid = %d", array(':fid' => $video->fid)));
 
$video->filepath = $file->filepath;
 
$video->filemime = $file->filemime;
 
 
// Change it now, so that it doesn't get uploaded again when cron is started next time.
 
$video->video_status = VIDEO_UPLOAD_STATUS_UNKNOWN;
 
$video->video_status_ts = $_SERVER['REQUEST_TIME'];
 
_video_upload_update_video($video);
 
 
$result = video_upload_provider_upload($video, $node, $field);
 
  if (
$result['video_id']) {
   
$video->video_id = $result['video_id'];
   
$video->video_status = VIDEO_UPLOAD_STATUS_UNKNOWN;
   
$video->video_status_ts = $_SERVER['REQUEST_TIME'];
   
$update = TRUE;
  }

  return
_video_upload_update_video($video);
}
?>

My changes are between:
$video->filemime = $file->filemime;
and
$result = video_upload_provider_upload($video, $node, $field);

There's probably a nicer way to do this, but it does the trick.

#6

I have the same problem. Trying with latest dev version and latest Zend Gdata library, then returned to 6.x-1.5 and Gdata 1.7.2, but I still have the same problem. Videoes get uploaded each time I run cron, creating duplicates. The videoes get in to youtube fine, but I never get the videos to show up in my drupal installation.

The code about doesn't seem to help me. I still get duplicates.

#7

Thanks bojanz this got me going again in 6.x-1.5

Module worked great the first time, but I have a sneaking suspicion that I unsynced it by manually deleting videos from YouTube and from running cron too much... like comment #3. After that no dice until the modification above.

#8

Just curious, did you have a default title set for the uploaded video in the CCK field definition? It's not required on the CCK field settings page. If it's not there, couldn't things go a bit haywire until YouTube ping backs with a video title?

#9

Uploaded 30-40 videos yesterday. I run cron every hour and now I have 246 duplicates on youtube. Makes sense that I would have dups if some weren't processed by the next cron, but even after the last one was processed, my site still kept sending them.