I want to create a music reference website With drupal 7.So explain my diagram and want to help me .

I specified 5 other music website that give direct download link to users.in other 5 sites musics post with a title + description + download links.such as all other websites that post download music or software. I want to take ONE post Title of these websites + ALL direct links and import to drupal .So for every imported music post I have a Title + 5 download direct link from 5 defferent website.So user can Go to my site and download A music from 5 download link from 5 defferent sites.

1- I can give Titles of new posts from feed (rss) of these sites.

2- How Can I merge 5 titles of these sites to One title (equivalent music titles) - for example titles of one website post is "free download of music from SINGER called SONGNAME" . This Title take and other 4 sites title merge or ignore Then Download links Attached (link url ONLY) to same Post.

3- I want to import and show only URL of Download links to user.without upload it to drupal or filefield modules.only url.no file.

please Help me.how can I do it? I Worked with feeds module previously.

Comments

omidehghanZD created an issue. See original summary.

megachriz’s picture

Issue summary: View changes
Priority: Critical » Normal
Status: Active » Fixed

I thought about this one for a while and I think there isn't an elegant out-of-the-box solution for it. For displaying the download link I would recommend using the Link module.

This I think are your options:

  1. When you import content from a source, Feeds will overwrite all fields that you have mapped. Not elegant, but one option would be to create a link field for each source website. Then create an importer for each source website that each imports into an other link field. Set each importer to update existing content and set the title as unique target. Then you also have to ensure that each source website handles exactly the same title for the songs. If one website spells the title slightly differently, for example uses an ampersand (&) instead of 'and' then Feeds will not recognize that it is about the same song. In this case you have to see if each source provides something else that all sources have in common. Else you could use the 'Find replace' plugin or 'Find replace REGEX' plugin from Feeds Tamper to apply a standard to the titles, for example replacing '&' with 'and', removing dots, etc.
  2. Using one link field, you could implement hook_feeds_presave() and in there load the unchanged entity to merge in the existing links. Something like this:
    /**
     * Implements hook_feeds_presave().
     */
    function mymodule_feeds_presave(FeedsSource $source, $entity, $item, $entity_id) {
      // Load the unchanged entity.
      $old_entity = entity_load_unchanged($entity_type, $id);
    
      // Get current set link (if any).
      $current_link = !empty($entity->field_link[LANGUAGE_NONE][0]['url']) ? $entity->field_link[LANGUAGE_NONE][0] : NULL;
    
      // Check for existing links.
      if (!empty($old_entity->field_link[LANGUAGE_NONE])) {
        $links = $old_entity->field_link[LANGUAGE_NONE];
    
        // Check if current set link is already in the list.
        if ($current_link) {
          $found = FALSE;
          foreach ($old_entity->field_link[LANGUAGE_NONE] as $key => $field_value) {
            if ($field_value['url'] == $current_link['url']) {
              $found = TRUE;
              break;
            }
          }
    
          if (!$found) {
            // Link was not found yet, append link to the list.
            $links[] = $current_link;
          }
        }
    
        // Set the merged links back on the entity.
        $entity->field_link[LANGUAGE_NONE] = $links;
      }
    }
    

    Just a solution #1, this solution requires that each website handles the exact same title.
    For this solution you would need to attach your importer to a content type and then create a feed node for each source.

  3. The third option would be to write your own fetcher that pulls in the content of all source websites. Before handing the data over to the parser you would write code yourself to merge the five sources. Hardest part in this process would be to merge individual items together.

Finally, I would recommend to use the Feeds Import Preview module to check how Feeds will import the data. This is a must have if you need to apply corrections to the song titles or if you are using the third solution.

Status: Fixed » Closed (fixed)

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