INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Retrieveing Cover Art  (Read 3510 times)

666JackTheKnife666

  • World Citizen
  • ***
  • Posts: 150
Retrieveing Cover Art
« on: August 01, 2009, 02:39:38 pm »

I subscribe to a website that distributes highres inspected coverart. they have a web ui that will allow the automated retrieval of there content. is it possible to make MC14 retrieve there art instead of what ever is being used now ?

here is all the info on the api.
Code: [Select]

What is the FreeCovers API

The FreeCovers API has been created to allow folks to easily add content to their site, by integrating our content into their design.

The API allows full-freedom in how you use the content you retrieve, and is a great way to add that extra something to your site.
How to use the API

The API accepts REST requests and returns results as a simple XML file.

To receive an XML file with search results, send a request to a url formatted like this:
http://www.freecovers.net/api/search/:search_phrase:

Note that all sample code in this page is written in PHP and uses the SimpleXML functions.

Here is an example of constructing a url for a cover search:

   1.
      <?php
   2.
      $search_phrase 
'terror twilight';
   
3.
      $xml_request_url 
'http://www.freecovers.net/api/search/'.urlencode($search_phrase);
   
4.
      ?>


To retrieve the xml results file, simply send a query to the url we constructed in the previous step:

   1.
      $xml = new SimpleXMLElement($xml_request_url, null, true);

The results you will receive in XML will take this form:

   1.
      <rsp stat="ok">
   2.
        <title>
   3.
          <name>Pavement - Terror Twilight</name>
   4.
          <id>c481c3a34958fe24483cff939148e4d9</id>
   5.
          <added>2007-03-11 22:40:48</added>
   6.
          <uploader>i said woof</uploader>
   7.
          <category>Music CD</category>
   8.
          <image>http://www.freecovers.net/thumb/0/c481c3a34958fe24483cff939148e4d9/preview.jpg</image>
   9.
          <covers>
  10.
            <cover>
  11.
              <type>front</type>
  12.
              <width>1600</width>
  13.
              <height>800</height>
  14.
              <filesize>2709598</filesize>
  15.
              <url>http://www.freecovers.net/view/0/c481c3a34958fe24483cff939148e4d9/Pavement_-_Terror_Twilight-front.html</url>
  16.
              <thumbnail>http://www.freecovers.net/thumb/0/c481c3a34958fe24483cff939148e4d9/front.jpg</thumbnail>
  17.
              <preview>http://www.freecovers.net/preview/0/c481c3a34958fe24483cff939148e4d9/big.jpg</preview>
  18.
            </cover>
  19.
              <cover>
  20.
              <type>back</type>
  21.
              <width>1025</width>
  22.
              <height>800</height>
  23.
              <filesize>1263268</filesize>
  24.
              <url>http://www.freecovers.net/view/1/c481c3a34958fe24483cff939148e4d9/Pavement_-_Terror_Twilight-back.html</url>
  25.
              <thumbnail>http://www.freecovers.net/thumb/1/c481c3a34958fe24483cff939148e4d9/back.jpg</thumbnail>
  26.
              <preview>http://www.freecovers.net/preview/1/c481c3a34958fe24483cff939148e4d9/big.jpg</preview>
  27.
            </cover>
  28.
          </covers>
  29.
        </title>
  30.
      </rsp>

Now all you have to do is go over the results file and format your output.

   1.
      foreach ($xml as $title) {
   2.
        echo 'Title: '.$title->name;
   3.
        echo 'Category: '.$title->category;
   4.
        echo 'Upload date: '.$title->added;
   5.
        echo 'Image: '.$title->image;
   6.
        foreach ($title->covers->cover as $cover) {
   7.
          echo 'Cover type:'.$cover->type;
   8.
          echo 'Resolution:'.$cover->width.'x'.$cover->height;
   9.
          echo 'Filesize:'.$cover->filesize;
  10.
          echo 'Download page:'.$cover->url;
  11.
          echo 'Thumbnail:'.$cover->thumbnail;
  12.
        }
  13.
      }
  14.
      ?>

Limiting results by category

You can limit the results returned to just one category of titles - such as Xbox 360, Music CD, or Wii - by adding the category name to the end of the request url. There is a list of our categories at the bottom of this page.

For example, a search for Radiohead covers:
http://www.freecovers.net/api/search/radiohead

Becomes a search for Radiohead Music DVD covers:
http://www.freecovers.net/api/search/radiohead/Music+DVD
Complete working example

The following example connects to the site, retrieves all results for "terror twilight" and displays them.

   1.
      <?php
   2.
      $search_phrase 
'terror twilight';
   
3.
      $xml_request_url 
'http://www.freecovers.net/api/search/'.urlencode($search_phrase);
   
4.
      $xml 
= new SimpleXMLElement($xml_request_urlnulltrue);
   
5.
      
if (isset($xml->err)) {
   
6.
        
echo $xml->err['msg'];
   
7.
      
} else {
   
8.
        
foreach ($xml as $title) {
   
9.
          
echo 'Title: '.$title->name;
  
10.
          
echo 'Category: '.$title->category.': '.$title->subcategory;
  
11.
          
echo 'Upload date: '.$title->added;
  
12.
          
echo 'Image: '.$title->image;
  
13.
          
foreach ($title->covers->cover as $cover) {
  
14.
            
echo 'Cover type:'.$cover->type;
  
15.
            
echo 'Resolution:'.$cover->width.'x'.$cover->height;
  
16.
            
echo 'Filesize:'.$cover->filesize;
  
17.
            
echo 'Download page:'.$cover->url;
  
18.
            
echo 'Thumbnail:'.$cover->thumbnail;
  
19.
          
}
  
20.
        
}
  
21.
      
}
  
22.
      ?>


And that's it… Simple as that.

Just remember to use the urlencode function!

Categories are:

Anime DVD
Blu-Ray Movie
DVD Movie
HD-DVD Movie
GameCube
Music CD
Music DVD
Other
Other Console
PC Apps
PC Games
Playstation
Playstation 2
Playstation 3
PSP
Soundtrack
TV Series
VCD
VHS
Wii
Xbox
Xbox 360
Logged

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: Retrieveing Cover Art
« Reply #1 on: August 02, 2009, 05:52:44 am »

You could try setting it up as a link on the link bar
using the URL http:////www.freecovers.net//search.php?search=Hexify([Artist] - [Album])

Then I suspect when you hit download MC will ask you if you'd like to use it as cover art.
I don't have an account so I can't test this theory.
Pages: [1]   Go Up