Problem

Feeds: Imports feeds (RSS / ATOM / lot's of other parsers) to entities in Drupal. You select a source field from the feed and a target field on an entity (node, user, taxonomy, generic entities to come).

Media: Images, Videos and Audio are media. Media helps manage those assets. Among many other features it provides a field type: A media field on a node can contain all those assets.

TimelessDomain did a good job defining those terms.

However, using just feeds and just media you can't select a media field as a target.

Solution in Drupal 6

There is no media field in Drupal 6. emfield provides that functionality. And it has feeds integration. Perfect.

Solution in Drupal 7

This is where Media Feeds comes in. Most of emfield's functionality is now in media. But there is no feeds mapper for media fields.

Efforts creating one started here: #1109490: media(_youtube) integration in Drupal 7. But it was obviously misplaced.

#1032792: Mapper for Media is a more generic approach, but there are downsides about patching the feeds module. D7 Feeds is still in alpha, but it's already pretty stable. Media, though, evolves fast. As Drupal core improves support for media, APIs change at times (#1086958: Switch from Media Entity to File Entity as an example, the task to add a fine grained permission system as another). #1121808: Change file_uri_to_object to re-use files by default and remove duplicate validation checks in handlers, which is directly related to feeds, also implies changes - either way it's solved.

So I created a sandbox, using the patches created so far.

I'd like to provide well tested integration between those modules, that other people can use by simply enabling it and that I can use on my own Drupal sites.

I'm looking forward to reviews. This is my sandbox project page: http://drupal.org/sandbox/niklas/1150302. The state of the code at the moment I submitted this issue is tagged ready-for-review. .module file attached.

-- Kind regards, Niklas

CommentFileSizeAuthor
media_feeds.module.txt3.87 KBNiklas Fiekas

Comments

Niklas Fiekas’s picture

Component: new project application » module
Niklas Fiekas’s picture

Fixed spacing (Coder module), removed unnecessary files[]. HEAD is at 69d270e. Tested with current HEAD of media.

cpelham’s picture

I tried installing this module but it immediately throws the error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'fetch_task::Feeds' for key 'PRIMARY': INSERT INTO {cache_update} (cid, created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => fetch_task::Feeds [:db_insert_placeholder_1] => 1306110654 ) in _update_create_fetch_task() (line 246 of /home/cpelham/public_html/dev.crsny.org/public/modules/update/update.fetch

Niklas Fiekas’s picture

Thank you for taking the time. I can't reproduce. Was that a clean Drupal 7 installation and what modules are enabled?

Update: There seams to be similar issue in the feeds issue queue: #1065520: PDOException following enable of feeds_import. I'll do some research on it. Also a stack trace would help.

Niklas Fiekas’s picture

New commit: Fixed notices and warnings (which also is an issue for feeds core at #1166100: Notices and warnings on mapping page, when no content type is selected for NodeProcessor). HEAD is at a554685. Tested with current HEAD of media.

cpelham’s picture

I'm not using GIT (I would but I just haven't quite grasped how to use it yet), so as soon as your commit (that was a commit to Feeds?) appears in a dev, I'll download and test again. So I should note that when I got the error message in #3 above, I was using I think the latest dev of media, and not HEAD (if they are different).

Niklas Fiekas’s picture

Only the maintainers of feeds can commit to the feeds repository on drupal.org. All contributors (e.g. me) submit patches and leave it for the maintainers of feeds.
Since I am the maintainer of my Media Feeds sandbox I have commit access to my sandbox. So in #5 I reported a commit to my sandbox.

However, that commit was not related to the problem you reported. I still have to figure that one out. So you should be fine using the alpa (or dev) versions from the other contrib modules and the latest version of Media Feeds from my sandbox.

As for dev <-> HEAD, I think they can be the same, but don't nescesarily have to.

Thanks again,
Niklas

good_man’s picture

The module's code looks very clean, and it's working (you have to apply the patch in #1159316: "Serialization of 'SimpleXMLElement' is not allowed").

jensimmons’s picture

subscribe

Niklas Fiekas’s picture

Niklas Fiekas’s picture

#1181706: Write testcases and #1183876: Check permissions introduce some new commits. The module now has basic test coverage.

Niklas Fiekas’s picture

#1187584: SQLSTATE[23000]: Integrity constraint violation: 19 column uri is not unique introduces a new commit. Clearing cache is required because a new hook implementation (hook_file_presave) and class (MediaFeedsProviderWrapper) have been added.

Niklas Fiekas’s picture

Merged the feature branch of #1181298: Add support for FeedEnclosure into master. Media Feeds now supports mapping from FeedsEnclosures.

JacobSingh’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me. I think it should be its own module to not add bloat to Media (and make it even harder to get to 1.0). But I fully support it being available to others.

greggles’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, Niklas Fiekas Welcome to the community of project contributors on drupal.org. Thanks also to cpelham, Jacob Sign, and good_man for their reviews.

I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Niklas Fiekas’s picture

Thank you cpelham, Jacob Singh, good_man for your reviews, thanks to all who tested the sandbox and thank you greggles for granting me the permissions.

Here is the full project: http://drupal.org/project/media_feeds

Status: Fixed » Closed (fixed)

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