Page 1 of 7 123 ... LastLast
Results 1 to 10 of 63

Thread: code to access AMG website from girder 4

  1. #1
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default code to access AMG website from girder 4

    via a link in my sig., you can get a .lua file to help access the AMG,Rolling Stone & last.fm website from Girder 4/5.

    put it in luascript\marcel and call like :

    Code:
    require "marcel\\AMG"
     
    local AMGDATA = {}
     
    AMGDATA = Marcel.AMG.GetAMG("Alison Krauss","test")
     
    if (AMGDATA ~= nil) then
      print (AMGDATA.Biography);
    end
    (see below for a more elaborate example)

    functionality :
    * returns artist biography
    * writes all artist related images to disk (AMG+Rolling Stone+last.fm)
    * returns table with all 'main albums' for the artist : title, release year, amg pick, rating (-1=not rated)
    * returns table for selected album with : album cover, review, release year, genre, amg pick, rating, track list (name, track#, amg pick)
    * returns table with similar artists from Jinzora and Last.FM
    * get album cover from Amazon

    The main requirement is a 112 hex-character 'token' that identifies your (free) AMG account.
    So you must have an account and auto-logon set up!!!

    Your token string will automatically be read from the AMG cookie stored in your internet explorer cache....


    for the amazon stuff to work, you need to request an access key id at http://aws.amazon.com (create an account)
    then you need to create a [string] key in the registry :
    Code:
    HKEY_LOCAL_MACHINE\SOFTWARE\Promixis\Girder\4\Amaz onAccessKeyID

    and enter the key...


    Note that the AMG website is pretty slow, so you need a lot of patience...
    Don't think that girder has crashed. it's just busy....

    you need the most recent build of G4

    Marcel
    Last edited by mhwlng; January 13th, 2008 at 07:44 AM.

  2. #2
    Join Date
    Sep 2003
    Location
    reading / bournemouth UK
    Posts
    1,106

    Default

    if the process is slow then it should be run in a seperate thread rather than locking up the main girder thread

  3. #3
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default

    added functionality to get all artist images and write them to disk

    I then display those images in NR via the embedded web browser :
    (see end of this thread)
    http://www.promixis.com/phpBB2/viewtopic.php?t=10022

    Marcel

  4. #4
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default

    The next step is to link this with JRMC.

    luacom/MCIO is used to connect to JRMC and retrieve the artist list.

    more info about MCIO here (G3) :
    http://www.promixis.com/phpBB2/viewtopic.php?t=11520

    Code:
    require "marcel\\JRMC"
    require "marcel\\AMG"
     
    local Artist_objects = {}
     
    Artist_objects = Marcel.JRMC.GetArtistList()
     
    for i = 1, table.getn (Artist_objects) do
      print (Artist_objects[i].title);
     
      local AMGDATA = {}
     
      AMGDATA = Marcel.AMG.GetAMG(Artist_objects[i].title,"")
     
    end
    JRMC.LUA is also available for download at address in my sig.

    functionality :
    * returns table with : artist names
    * returns table with albums for selected artist : title,year,genre,complete album,review,bios
    * function to write to any field for all tracks in an album
    * function to write to year field for all tracks in an album
    * function to write to album art field for all tracks in an album
    * function to get all tracks in a smartlist

    Marcel
    Last edited by mhwlng; June 4th, 2006 at 09:47 AM.

  5. #5
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default

    code updated to read album review and artist biography from AMG for all albums in JRMC that don't have one and then write it to all tracks in that album....
    (AMG artist images are also written to disk)

    Code:
    require "marcel\\JRMC"
    require "marcel\\AMG"
    local Artist_objects = {} 
    Artist_objects = Marcel.JRMC.GetArtistList() 
    for i = 1, table.getn (Artist_objects) do 
     
      print (Artist_objects[i].name); 
     
      local Album_objects = {} 
     
      Album_objects = Marcel.JRMC.GetAlbumList(Artist_objects[i].name) 
     
      for j = 1, table.getn (Album_objects) do 
     
        print ("    "..Album_objects[j].title); 
     
        local AMGDATA = {} 
     
        AMGDATA = Marcel.AMG.GetAMG(Artist_objects[i].name,Album_objects[j].title) 
     
        if (AMGDATA ~= nil) then 
          if (string.len(AMGDATA.AlbumReview)>100) then 
            print (AMGDATA.AlbumReview); 
            Marcel.JRMC.WriteAlbumTag (Artist_objects[i].name,Album_objects[j].title,"Review",AMGDATA.AlbumReview) 
     
          end 
          if (string.len(AMGDATA.Biography)>100) then 
            print (AMGDATA.Biography); 
            Marcel.JRMC.WriteAlbumTag (Artist_objects[i].name,Album_objects[j].title,"Bios",AMGDATA.Biography) 
     
          end 
     
        end 
      end 
    end
    Marcel
    Last edited by mhwlng; June 3rd, 2006 at 03:04 AM.

  6. #6
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default

    added album genre, album release year and album cover....

    Marcel

  7. #7
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default

    updated code to return a table with all the 'main albums'+years for the selected artist

  8. #8
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default

    In the latest A23, win.InternetGetCookie has been changed for some reason ????

    (I can't find any documentation, but it looks like cookie and err are reversed and final ';' is removed from the cookie string. jump in, Mike C, if I'm wrong)

    Updated AMG.lua to fix this...


    Marcel

  9. #9
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Hm, I didn't INTENTIONALLY change anything

    are you sure? I haven't touched that code since we first worked on it.

  10. #10
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    2,140

    Default

    are you sure?
    well, apparently not...

    The order of cookie and err hasn't changed, as I thought previously...

    I don't know where the semicolon went, but it is probably that the cookie data is written slightly different by the amg webserver

    my mistake, Sorry

    Marcel

Page 1 of 7 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •