When I add a node with a soundcloud field it works fine. But if I wanted to edit the node again I get an error.
The website encountered an unexpected error. Please try again later.
When I checked the logs it was an error of duplicate entry as below. Am currently working on Drupal 7.17.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'soundcloud://u/xxxxxx/a/xxxxxx' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp, type) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => xxxxxx [:db_insert_placeholder_2] => soundcloud://u/xxxxxx/a/xxxxxx [:db_insert_placeholder_3] => audio/soundcloud [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => 1360038148 [:db_insert_placeholder_7] => audio ) in drupal_write_record() (line 7106 of /home/xxxxxx/public_html/xxxxxx/includes/common.inc).

Any solution to this?

Comments

victoriachan’s picture

Hi,
What version of Media and File Entity are you using?

karangi’s picture

Hi Thanks for the quick response,
Am using Media 7.x-1.2 and File Entity 7.x-1.2.

victoriachan’s picture

Hi Karangi,

I've just tested this on a new demo build using:

projects[drupal][version] = 7.19
projects[media][version] = 1.2 (In Media 1.x, File Entity is distributed as part of Media module)
projects[media_soundcloud][version] = 1.0-alpha2

I have configured my test soundcloud field as:

  • Field type: File, Widget: Media file selector
  • Allowed file extensions for uploaded files: txt (doesn't matter what this is)
  • Allowed remote media types: Audio
  • Allowed URI schemes: soundcloud:// (SoundCloud audio)

Is your field set up similarly?

How I tested:

  1. create new node, add soundcloud field on node, save as published
  2. edit node, poke around, but not changing soundcloud field, save as published
  3. edit node, poke around, change soundcloud field, save as published

And I couldn't replicate your problem. Can you spot the difference? I'm using a different version of core Drupal, but that shouldn't be a problem.

karangi’s picture

Thanks Victoria,
I created a test version also and realized that the problem arises when you have:

  • Field type: File, Widget: Embedded Media Type

Which is what I had all along.
Thanks so much again for you help!

victoriachan’s picture

StatusFileSize
new80.92 KB

Hi karangi,

No problem.

Did you mean the Media File Selector widget? I didn't get any option for Embedded Media Type. Or is that from another module? If so, that could be the problem.

Otherwise, are you using revisioning or other modules which might be affecting this?

I'm attaching a screenshot of my field edit page, and also here is a list of modules I have installed:

projects[drupal][type] = core
projects[drupal][version] = 7.19
; Media required
projects[ctools][version] = 1.0
projects[views][version] = 3.3
; Other useful
projects[devel][version] = 1.2
projects[ds][version] = 1.5
projects[wysiwyg][version] = 2.2
projects[libraries][version] = 1.0
; MEDIA 7.x-1.2
projects[media][version] = 1.2
projects[media_soundcloud][version] = 1.0-alpha2
projects[media_youtube][version] = 1.0-beta3

I have tried with various media fields, and couldn't replicate the error.

karangi’s picture

Status: Active » Fixed

Hi, I think it comes with a module called emfield which I thought was part of this module.
Thanks anyway for the help, I really appreciate your good work. I'll mark this as fixed.

karangi’s picture

Status: Fixed » Closed (fixed)
korzh-nick’s picture

UPD:Sorry. edited post. Did not work because of the blockage in the browser