The video should be uploaded ONLY IF the node (that contains the video) is marked as published. This is helpful in a scenario when an admin wants to review the uploaded videos before he allows to them to be published in the site. If the admin decides to reject the videos (say because of offensive content or irrelevant videos), he can simply delete it from his server. That way the video never reaches YouTube.

Comments

sainzu’s picture

Status: Needs work » Active
happydrupal’s picture

I agree with this.....

YouTube will cancel the account automatically if your videos cross the YouTube Community Guidelines twice. Anyone who has bad intention is pretty easy to upload some bad video and shut your service down without notice.

jhedstrom’s picture

I'll try to work this into the upcoming stable release.

happydrupal’s picture

Great appreciated.

agileware’s picture

Subscribing

Andrew Kaufmann’s picture

I too am greatly interested in workflow being implemented -- for the very reason happydrupal mentioned. Subscribing.

agileware’s picture

Assigned: Unassigned » agileware

I'm working on this currently I have a patch that works but I am adding one more feature to it first.

That feature is the ability to link the published status of the node to the private status of the You Tube video so once the video is uploaded, if you change the node to unpublished the video goes private and vice versa.

This second feature relies on
#439170: update youtube video if node is updated and
#611380: Call to undefined function _video_upload_node_set_video_status() in video_upload.admin.inc on line 421

So I will do those and then finish this.

agileware’s picture

Status: Active » Needs review
StatusFileSize
new5.29 KB

Here is the patch.

It gives two new options on the admin/settings/video-upload screen (at the moment they are in the You Tube fieldset but they could be outside of that if that is preferred).
One is to only copy videos up once the node they are on is published.
The second is to sync the nodes published flag with the you tube videos private flag.

You will need to apply the patches in these two issues before you apply this one as they are all required for the syncing of status to work:
#439170: update youtube video if node is updated
#611380: Call to undefined function _video_upload_node_set_video_status() in video_upload.admin.inc on line 421

Andrew Kaufmann’s picture

Thanks for doing this, Justin! I'll give this a shot as soon as I can...

Andrew Kaufmann’s picture

I just ran the three patches, and gave it a shot... and it appears to work as advertised. It wasn't a thorough review, by any stretch... but the video did not get uploaded, as desired, until after the node was set to published.

Good work!

agileware’s picture

Assigned: agileware » Unassigned
Andrew Kaufmann’s picture

Doesn't look like this was ever worked into stable release? Is there a problem with the patch?

shopdogg’s picture

sub

bojanz’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

It was never worked into a release.
The supporting patches (that this functionality depended on) were committed though.
It could be considered for 2.x, but I won't be able to take a look before late september.

itserich’s picture

I would like to install this patch. This is the first attempt I have made to install via command line.

Please let me know if this is correct:

1-install module in sites/all/modules (is it okay to use 1.x or 2.x-dev)
2-download patch to sites/all/modules
3-command: patch -p) sites/all/modules/video_upload-453458-8.patch

So the name of the module to which the patch is applied is self contained in the patch?

Is there a better place to install the patch, a separate folder perhaps to make tracking easier?

Thanks to anyone for advice.

EDIT Then there is this http://drupal.org/patch/apply

"Applying patches, modifying files according to instructions in the patch file, is the domain of patch programs. There are many different programs with this functionality, some stand-alone (patch), some integrated in IDEs (Eclipse, XCode).

Warning: Patching is something that should never be done on your production site unless you have sufficient backup and testing performed. While patching itself is relatively easy, understanding the implications of a patch is not. Patching your system can lead to loss of data and/or site instabilities.

This page only deals with some basic principles using the command line utility patch. Patch can be found on most UNIX systems and is included in the packages UnxUtils and Cygwin for use on Windows. There is also a video on Applying patches to Drupal core in the videocasts section.

Provided that the patch was made relative to the root directory of the concerned project, navigate to the that directory (using cd). For a patch on Drupal, that will be the Drupal directory; for a contrib module or theme, that is the root directory of the project. Once there, issue the command:

patch -p0 < path/file.patch

If the patch was not made relative to the project's root directory, you can place the patch in the same directory as the file being patched and run the patch command without the -p option. To do so, cd to the directory and type:

patch < file.patch

Patch will usually auto-detect the format. You can also use the -u command line option to indicate a unified patch, and the -b option creates a backup copy of the file before modifying it. In case of problems, you can then easily restore the backup file."

itserich’s picture

Well it appears that is correct but I get a command not found error because my host does not allow users to install patches via command line.

bojanz’s picture

StatusFileSize
new458.79 KB
new7.26 KB

Here's an updated patch for 2.x.
I'm also attaching a patched archive so that itserich and others can test more easily.
If you've already installed 2.x, just replace the old files with the new ones.

This also contains the patch from #439170: update youtube video if node is updated, so getting that one tested so that I can commit it would speed this one up too.

bojanz’s picture

StatusFileSize
new6.5 KB

Updated patch, since I've committed some conflicting issues since then.
The archive above is still okay for testing.

itserich’s picture

Thank you bojanz.

I tried to apply the patch manually and apparently failed.

I am trying to figure out Tortoise but have not yet.

To confirm, if I try it again manually should I apply the patch in #18 to the current development version?

Thanks for this module, it is the only way I know of to upload directly to youtube.

bojanz’s picture

Yes. However, you can just use the zip archive I provided and skip patching completely.

itserich’s picture

Thank you. The zip seems to install fine.

However, it did not cause videos of unpublished nodes to be set to private.

Attached are configuration screen images.

I created a node, did not publish it, and it still appeared on Youtube as "This video is public."

I then published it, ran cron, still public. Unpublished, ran cron, still public

I tried a couple times, and created a new content type, with same result.

I then went to Youtube and set the video to private, and back to the node and published and unpublished it, runninng cron. The video stayed private.

Perhaps something needs to be set at the Youtube account to enable this? Just a guess. Thanks.

Edit Also, deleted node, ran cron, and video remains on Youtube. Also, to confirm, there is no need for a unique cron job, just the regular drupal cron, right?

bojanz’s picture

Yes, just the regular cron.
How did you upload the video to youtube, through direct upload, or browser upload (with the jquery ui based upload dialog?)?

izmeez’s picture

subscribing

itserich’s picture

StatusFileSize
new163.62 KB
new74.46 KB
new63.89 KB

Thanks, I had tried both the direct and the browser upload.

Based on reading the intro comments ("The video should be uploaded ONLY IF the node (that contains the video) is marked as published. This") on this thread it appears browser upload would not be supported for this feature.

The problem I have when I use the direct method, the video does reach my host but does not get uploaded to Youtube.

I think I disabled WYSIWYG for this content type, not sure if that is still required. But that could be the cause, I am not sure what it means to turn it off per node.

Attached are some screen shots. I tried a small file under 2MB.

bojanz’s picture

Okay, thanks, I'll take the testing from here. The patch probably needs some more work then...

itserich’s picture

As to the direct method, I don't think that worked with the versions I have tried, prior to this release, so it may be a problem with my site or host.

That is, the method which is uploaded first to the host and then sent to youtube. I don't think that has worked for me previously.

bojanz’s picture

I'm thinking about what to do with the browser upload workflow.

As you know, browser upload lets the user upload videos directly to
youtube, bypassing the server.
This naturally makes it difficult for us to police the process in any
way. It comes down to two options:
1) We can have an option to have the videos uploaded via browser
upload marked as "private" initially, and then synchronized to the
node status on cron run. Not sure if that is enough for the YouTube
censors (don't know if they prosecute private videos against
guidelines the same as the public ones)
2) The other option is to hide the browser upload until the node has
been published. This is less than ideal in several ways: the user
needs to edit the node in order to publish the video, and you still
have no guarantee he won't upload anything nasty.

That's it... The user can either upload or he can't. The only thing we can do is mark the video as private along the way..
If someone has a bright idea, now's the time to say it.

bojanz’s picture

I got help on Google's forum for the YouTube API, and now have some answers.

There are two ways your video can be "wrong".
1. It can be copyrighted, in which case it's flagged by the automatic system as soon as it's uploaded.
This is something browser upload can't protect you from. If you fear that users might upload copyrighted videos, switch to direct upload, or use YouTube Direct (which is a whole different story).
2. It can be reported by viewers as "inappropriate". This can be avoided by setting the newly uploaded file (even with browser upload) to "private" by default. Then, the status can be synchronized to the node status when cron runs.

westis’s picture

Is this patch considered to be added? I think it's a great option to have.

lucale’s picture

Assigned: Unassigned » lucale

News about the implementation of this feature in new version ?
I've applied the patch downloaded from this discussion and i receive the following error when cron started

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NOT NULL' at line 1 query: SELECT field_youtube_video_id AS video_id, t.nid, field_youtube_fid AS fid, field_youtube_video_status AS video_status FROM content_type_video t, node n WHERE n.nid = t.nid AND field_youtube_video_status = 'unknown' AND IS NOT NULL in /var/www/vhosts/osel.it/subdomains/snsc4el/httpdocs/modules/video_upload/video_upload.admin.inc on line 509.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NOT NULL' at line 1 query: SELECT field_youtube_video_id AS video_id, t.nid, field_youtube_fid AS fid, field_youtube_video_status AS video_status FROM content_type_video t, node n WHERE n.nid = t.nid AND field_youtube_video_status = 'delete' AND IS NOT NULL in /var/www/vhosts/osel.it/subdomains/snsc4el/httpdocs/modules/video_upload/video_upload.admin.inc on line 509.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NOT NULL' at line 1 query: SELECT field_youtube_video_id AS video_id, t.nid, field_youtube_fid AS fid, field_youtube_video_status AS video_status FROM content_type_video t, node n WHERE n.nid = t.nid AND field_youtube_video_status = 'ok' AND IS NOT NULL in /var/www/vhosts/osel.it/subdomains/snsc4el/httpdocs/modules/video_upload/video_upload.admin.inc on line 509.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NOT NULL AND n.status = 1' at line 1 query: SELECT field_youtube_video_id AS video_id, t.nid, field_youtube_fid AS fid, field_youtube_video_status AS video_status FROM content_type_video t, node n WHERE n.nid = t.nid AND field_youtube_video_status = 'upload_pending' AND IS NOT NULL AND n.status = 1 in /var/www/vhosts/osel.it/subdomains/snsc4el/httpdocs/modules/video_upload/video_upload.admin.inc on line 509.

Thanks a lot.

lucale’s picture

Issue tags: +video, +MySQL, +youtube, +cron, +workflow

No help about this kind of error ??

Is this error related on syntax of this line of code?

return db_query("SELECT %s AS video_id, t.nid, %s AS fid, %s AS video_status" . $multiple . " FROM {" . $db_info['table'] . "} t, {node} n WHERE n.nid = t.nid AND %s = '%s' AND %s IS NOT NULL" . $published, $params);
}

Thanks in advance.

avpaderno’s picture

Assigned: lucale » Unassigned
Issue summary: View changes
Status: Needs review » Closed (outdated)
Issue tags: -video, -MySQL, -youtube, -cron, -workflow

I am closing this issue, since it's for a Drupal version no longer supported.