Hello, if i add a Vimeo Video to more then one Node i get this Error

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'vimeo://v/32138283' for key 'uri'

Comments

kreynen’s picture

Status: Active » Postponed (maintainer needs more info)

Does this happen when you add media_youtube files too? My guess this is an issue with the version of the Media modle you are using. If it does happen with media_youtube as well, please open an issue in the main Media module issue queue. If not, please add the rest of the error and the version of Media you are using and I'll look into it.

Nightwalker3000’s picture

Thanks for reply,
in media_youtube i get this message:
Error: You have entered a URL for a video that is already in your library.
in media_vimeo i get this error:

Error message
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'vimeo://v/33025640' for key 'uri'

and it breaks the lightbox.
I'm using 7.x-1.0-beta4 .

I think its better when the user can add links as often as he wants. If a site has more then 1000 Links to Youtube/Vimeo , nobody wants to search the library to find where the video is,

Nightwalker3000’s picture

I dont know how to submit a patch, it seems like its a known issue in media_youtube. Look at http://drupal.org/node/952422

This patch works also for Vimeo:

File: MediaInternetVimeoHandler.inc
Add this Code in class "MediaInternetVimeoHandler extends MediaInternetBaseHandler "

  public function validate() {
    /* @todo Media module currently fails when two files try to have the same
    //   URI, so catch that in the validation step. Some day, it would be nice
    //   to allow it, however. See http://drupal.org/node/952422. */

    $uri = $this->parse($this->embedCode);
    $existing_files = file_load_multiple(array(), array('uri' => $uri));
    if (count($existing_files)) {
      throw new MediaInternetValidationException(t('You have entered a URL for a video that is already in your library.'));
    }
  }
  
lyhcode’s picture

In content management, change tab to "media", and remove the previous vimeo media.
If you delete a vimeo media in a gallery or a content.
The exists record in media will not remove automatically.
So you may remove it manually.

nikosnikos’s picture

Status: Needs review » Postponed (maintainer needs more info)
StatusFileSize
new615 bytes

I try to clarify because this issue is postoned (maintainer needs more info) :
When I try to add a vimeo url that was already inserted before, it fails with this exception :
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'vimeo://v/32138283' for key 'uri'

In my opinion, it shouldn't fail when we try to insert an already inserted vimeo url. It should take the already inserted video without any warning.

It is possible to do that in MediaInternetVimeoHandler. I attach a patch that do that.

Edit : I've just seen that this is the solution used by media_youtube : #1213184: Allow YouTube videos to be re-used

nikosnikos’s picture

Status: Postponed (maintainer needs more info) » Needs review
krazykellie’s picture

Status: Postponed (maintainer needs more info) » Needs review

lyhcode, where do you delete this media from? I have several that I need to readd and I keep getting the same error as listed above. But if I know where to find the files, I can delete them.

Please help!

nikosnikos’s picture

krazykellie there's two possibilities :

  1. Apply the patch #5 so you can add the same video how many time you want it will override the existing
  2. Go to admin/content/media and select the medias you want to delete.

I think possibility number 1 is the best, it is how media_youtube do the thing now in dev version and it's really more user friendly, and you will be able to provide your feed back on this patch.

RobW’s picture

Status: Needs review » Fixed

Based on the patch in #5, the work in #1213184: Allow YouTube videos to be re-used, and the commit in http://drupalcode.org/project/media_youtube.git/commit/989be74, I think it's fine to commit this. It's been working in Media: Youtube for a while.

Committed here: http://drupalcode.org/project/media_vimeo.git/commit/959486432721e64e8fb....

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.