I have a feature request ...
My site uses media_youtube in conjunction with media_mover. Users may upload a video, either as a node attachment or as a filefield. Media_mover then harvests the video file, and media_youtube then uploads the harvested file to youtube. That part works fine.

My request pertains to file deletion.
If the user deletes the node attachment or filefield, I would like media_youtube to then delete the corresponding youtube video.
That is, I would like to add a 'delete' case to the media_mover hook:

function media_youtube_media_mover($op = NULL, $action = NULL, $configuration = NULL, &$file=array(), $job = NULL, $nid = NULL) {
  switch ($op){
    case 'delete':
        if (user wishes to delete youtube video whenever video file is deleted){
          media_youtube_delete ($file['process_file']);  // eg media_youtube_delete ('http://www.youtube.com/watch?v=X4iG8nTijp');
        }
  }

I would be happy to provide the patch, if you can point me at code for issuing a youtube "delete" request.

Thanks very much.

Comments

armyofda12mnkeys’s picture

subscribing...
Just curious kobnim ... I am pretty much trying to do the same steps as you except maybe i convert the file to flv... Can you post your MM/Youtube configuration steps... I get a
"Cannot authenticate. Error: Authentication with Google failed. Reason: NoLinkedYouTubeAccount" error when it tries to upload the converted flv file ... Think my username email/password are fine (a linked Google account so the username is an email). Not sure if its my configuration or username steps.

kobnim’s picture

@armyofda12monkys:
I have not succeeded in uploading flv files to youtube. I do not know the list of filetypes officially supported by youtube, by these filetypes work: mpg, mov, mp4.

- Mindy

P.S. The "process" step of my mediamover configuration looks like this:

Category: "Sports"
My default title: "my title"
Default description: "my description"
Description field: body

I left the tags field empty.
The only tricky part is the Category. It must be a legal youtube category.

armyofda12mnkeys’s picture

Yep I have same setup, tried Sports cause I wasnt sure of if encoded correctly ampersands in categories like 'Nonprofits & Activism'... Still getting an error about authentication. Have an API key and Youtube/Google Account so not sure why its erroring. Is your username an email or non-email username?

Could you maybe take a peek at my configuration after holidays (Im in SanFran now for holidays :) )? My email is at armyofda12mnkeys@gmail.com

kobnim’s picture

For the youtube username, I enter just the username, not the email address.
fyi, my youtube and google username/password are different. On the media_youtube form it is essential to enter the youtube email/password, not the googleemail/password.

Also, I noticed that after submitting the media_youtube form, the "username" gets prepopulated with my drupal username/password rather than my youtube username/password. If I then mistakenly submit the form, without fixing the prepopulated fields, the database will contain the wrong username/password.

If this doesn't address your problem, then please post your media-mover configuration here.

armyofda12mnkeys’s picture

hey kobnim,
I posted my configuration in my issue here if you want to take a look:
http://drupal.org/node/999726#comment-3888918