Audioscrobbler (last.fm) support for MediaPortal! (4 Viewers)

How do you rate this feature?

  • Sorry, I cannot use internet stuff on my HTPC

    Votes: 0 0.0%
  • Sorry, I need to read more about my privacy first

    Votes: 0 0.0%

  • Total voters
    427

zombiepig

Portal Pro
March 21, 2005
408
0
Melb, Aus
Home Country
one more thing i've noticed - i *think* that in order for last.fm to return results properly, any &'s need to be replaced by 'and'.

eg - i've got track tagged with an artist "bob marley & the wailers", and these never return results from last.fm for top album tracks, no artist pictures, etc...

if you view
http://ws.audioscrobbler.com/1.0/artist/bob marley and the wailers/similar.xml
you get results, but when you view
http://ws.audioscrobbler.com/1.0/artist/bob marley & the wailers/similar.xml
you get an error.

maybe getValidURLLastFMString needs to have a search and replace for & -> and in it?
 

rtv

Retired Team Member
  • Premium Supporter
  • April 7, 2005
    3,622
    301
    Osnabruck
    Home Country
    Germany Germany
    maybe getValidURLLastFMString needs to have a search and replace for & -> and in it?
    Thanks for finding that one out - added to svn.

    btw: The 15 second flip I described only applies when not using visualizations. As I am currently testing / working for stable release I won't dig into Steve's code for now..
     

    zombiepig

    Portal Pro
    March 21, 2005
    408
    0
    Melb, Aus
    Home Country
    ok, thanks rtv. i'll switch off visualizations and keep testing for now :)

    in the meantime, i think i've discovered another potential problem -
    getValidURLLastFMString is stripping any .'s from album and artist names, but it seems like this information is required by the last.fm services.
    eg. Artist="Dr. Octagon", album="The Return of Dr. Octagon"

    with the .'s present, audioscrobbler returns valid results:
    http://ws.audioscrobbler.com/1.0/album/Dr. Octagon/The Return of Dr. Octagon/info.xml

    without the .'s, you get the no valid results page:
    http://ws.audioscrobbler.com/1.0/album/Dr Octagon/The Return of Dr Octagon/info.xml
     

    zombiepig

    Portal Pro
    March 21, 2005
    408
    0
    Melb, Aus
    Home Country
    hmmmm - still getting the same problem with visualization disabled. for first track by a given artist, now playing window switches between album and artist art, but not for any subsequent tracks. here's a sample of the log:

    Code:
    2006-10-17 21:12:22.450731 [Info.][MPMain]: PlaylistPlayer: Play - C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Tragic Kingdom\10 Don't Speak.mp3
    2006-10-17 21:12:22.450731 [Info.][MPMain]: add cmd:MediaPortal.TV.Recording.StopRadioCommand #1
    2006-10-17 21:12:22.450731 [Info.][MPMain]: g_Player.Play(C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Tragic Kingdom\10 Don't Speak.mp3)
    2006-10-17 21:12:22.460745 [Debug][MPMain]: BASS: FadeOutStop of stream -1342177271
    2006-10-17 21:12:22.460745 [Info.][6]: Command:Stop radio
    2006-10-17 21:12:22.490788 [Info.][6]: Command:MediaPortal.TV.Recording.StopRadioCommand failed reason:No tuner cards installed time:0 msec
    2006-10-17 21:12:22.500803 [Info.][MPMain]: BASS: playback started
    2006-10-17 21:12:22.500803 [Info.][MPMain]: g_Player.OnStarted() C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Tragic Kingdom\10 Don't Speak.mp3 media:Music
    2006-10-17 21:12:22.500803 [Debug][MPMain]: GUIMusicPlayingNow: g_Player_PlayBackStarted for C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Tragic Kingdom\10 Don't Speak.mp3
    2006-10-17 21:12:22.500803 [Debug][14]: AudioScrobblerUtils.RemoveRequest:GetAlbumInfo, requestID:2
    2006-10-17 21:12:22.510817 [Debug][14]: AudioScrobblerUtils.RemoveRequest:GetArtistInfo, requestID:1
    2006-10-17 21:12:22.510817 [Debug][14]: AudioScrobblerUtils.RemoveRequest:GetAlbumInfo, requestID:3
    2006-10-17 21:12:22.550875 [Debug][MPMain]: GUIMusicPlayingNow: adding image to container - C:\Program Files\Team MediaPortal\MediaPortal\thumbs\music\albums\No Doubt-Tragic Kingdom.jpg
    2006-10-17 21:12:22.580918 [Debug][14]: AudioScrobblerUtils.AddRequest:GetArtistInfo, requestID:4
    2006-10-17 21:12:22.580918 [Debug][14]: AudioscrobblerUtils: thread status:Background, WaitSleepJoin, pending requests:0
    2006-10-17 21:12:22.590932 [Debug][14]: AudioScrobblerUtils.AddRequest:GetAlbumInfo, requestID:5
    2006-10-17 21:12:22.590932 [Debug][14]: AudioscrobblerUtils: thread status:Background, WaitSleepJoin, pending requests:1
    2006-10-17 21:12:22.590932 [Debug][14]: AudioScrobblerUtils.AddRequest:GetAlbumInfo, requestID:6
    2006-10-17 21:12:22.590932 [Debug][14]: AudioscrobblerUtils: thread status:Background, WaitSleepJoin, pending requests:2
    2006-10-17 21:12:22.590932 [Debug][MPMain]: GUITVCropManager.g_Player_PlackBackStarted: media: Music tv:False ts:False
    2006-10-17 21:12:22.661033 [Debug][10]: BASS: PlaybackStreamFreedProc of stream -1342177271
    2006-10-17 21:12:24.964345 [Debug][AudioScrobblerUtils thread]: MyMusic: Trying to get thumb: http://static.last.fm/proposedimages/sidebar/6/3656/238044.jpg
    2006-10-17 21:12:27.057355 [Debug][AudioScrobblerUtils thread]: MyMusic: better thumb No Doubt.jpg already exists - do not save
    2006-10-17 21:12:27.067369 [Debug][AudioScrobblerUtils thread]: GUIMusicPlayingNow: adding image to container - C:\Program Files\Team MediaPortal\MediaPortal\thumbs\music\artists\No Doubt.jpg
    2006-10-17 21:12:27.858507 [Debug][AudioScrobblerUtils thread]: MyMusic: Trying to get thumb: http://images.amazon.com/images/P/B000001Y79.01._SCMZZZZZZZ_.jpg
    2006-10-17 21:12:28.068809 [Debug][AudioScrobblerUtils thread]: MyMusic: better thumb No Doubt-Tragic Kingdom.jpg already exists - do not save
    2006-10-17 21:12:28.108867 [Debug][AudioScrobblerUtils thread]: GUIMusicPlayingNow: adding image to container - C:\Program Files\Team MediaPortal\MediaPortal\thumbs\music\albums\No Doubt-Tragic Kingdom.jpg
    2006-10-17 21:12:29.701156 [Debug][AudioScrobblerUtils thread]: AudioScrobblerUtils: Tag rock in blacklist, randomly chosing another one
    2006-10-17 21:12:29.701156 [Debug][AudioScrobblerUtils thread]: AudioScrobblerUtils: Tag rock in blacklist, randomly chosing another one
    2006-10-17 21:12:29.701156 [Debug][AudioScrobblerUtils thread]: AudioScrobblerUtils: Tag rock in blacklist, randomly chosing another one
    2006-10-17 21:12:29.701156 [Debug][AudioScrobblerUtils thread]: AudioScrobblerUtils: Tag rock in blacklist, randomly chosing another one
    2006-10-17 21:12:29.701156 [Debug][AudioScrobblerUtils thread]: AudioScrobblerUtils: Tag rock in blacklist, randomly chosing another one
    2006-10-17 21:12:32.224785 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Holiday found db song - C:\Documents and Settings\Nyall\My Documents\My Music\Green Day\American Idiot\03 Holiday.mp3
    2006-10-17 21:12:32.234800 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for American Idiot found db song - C:\Documents and Settings\Nyall\My Documents\My Music\Green Day\American Idiot\01 American Idiot.mp3
    2006-10-17 21:12:32.234800 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Such Great Heights found db song - C:\Documents and Settings\Nyall\My Documents\My Music\The Postal Service\Give Up\02 Such Great Heights.flac
    2006-10-17 21:12:32.244814 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for By the Way found db song - C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Beacon Street Collection\06 By the Way.mp3
    2006-10-17 21:12:32.545246 [Debug][MPMain]: MusicDatabase: increased playcount for song C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Tragic Kingdom\10 Don't Speak.mp3 to 1
    2006-10-17 21:12:48.297897 [Info.][MPMain]: Playlist: Insert C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Beacon Street Collection\06 By the Way.mp3 at 3
    2006-10-17 21:12:48.307912 [Info.][MPMain]: GUIMusicPlayingNow: Song inserted: No Doubt - By the Way
    2006-10-17 21:12:51.432404 [Info.][MPMain]: PlaylistPlayer: Play - C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Beacon Street Collection\06 By the Way.mp3
    2006-10-17 21:12:51.432404 [Info.][MPMain]: add cmd:MediaPortal.TV.Recording.StopRadioCommand #1
    2006-10-17 21:12:51.432404 [Info.][MPMain]: g_Player.Play(C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Beacon Street Collection\06 By the Way.mp3)
    2006-10-17 21:12:51.432404 [Debug][MPMain]: BASS: FadeOutStop of stream -1342177267
    2006-10-17 21:12:51.432404 [Info.][6]: Command:Stop radio
    2006-10-17 21:12:51.552577 [Info.][6]: Command:MediaPortal.TV.Recording.StopRadioCommand failed reason:No tuner cards installed time:10.0144 msec
    2006-10-17 21:12:51.572606 [Info.][MPMain]: BASS: playback started
    2006-10-17 21:12:51.572606 [Info.][MPMain]: g_Player.OnStarted() C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Beacon Street Collection\06 By the Way.mp3 media:Music
    2006-10-17 21:12:51.572606 [Debug][MPMain]: GUIMusicPlayingNow: g_Player_PlayBackStarted for C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Beacon Street Collection\06 By the Way.mp3
    2006-10-17 21:12:51.572606 [Debug][14]: AudioScrobblerUtils.RemoveRequest:GetAlbumInfo, requestID:5
    2006-10-17 21:12:51.572606 [Debug][14]: AudioScrobblerUtils.RemoveRequest:GetArtistInfo, requestID:4
    2006-10-17 21:12:51.572606 [Debug][14]: AudioScrobblerUtils.RemoveRequest:GetAlbumInfo, requestID:6
    2006-10-17 21:12:51.612664 [Debug][MPMain]: GUIMusicPlayingNow: adding image to container - C:\Program Files\Team MediaPortal\MediaPortal\thumbs\music\albums\No Doubt-Beacon Street Collection.jpg
    2006-10-17 21:12:51.632692 [Debug][10]: BASS: PlaybackStreamFreedProc of stream -1342177267
    2006-10-17 21:12:51.642707 [Debug][14]: AudioScrobblerUtils.AddRequest:GetAlbumInfo, requestID:7
    2006-10-17 21:12:51.642707 [Debug][14]: AudioscrobblerUtils: thread status:Background, WaitSleepJoin, pending requests:0
    2006-10-17 21:12:51.642707 [Debug][14]: AudioScrobblerUtils.AddRequest:GetAlbumInfo, requestID:8
    2006-10-17 21:12:51.642707 [Debug][14]: AudioscrobblerUtils: thread status:Background, WaitSleepJoin, pending requests:1
    2006-10-17 21:12:51.642707 [Debug][MPMain]: GUITVCropManager.g_Player_PlackBackStarted: media: Music tv:False ts:False
    2006-10-17 21:12:52.554017 [Debug][AudioScrobblerUtils thread]: MyMusic: Trying to get thumb: http://images.amazon.com/images/P/B000001Y4W.01._SCMZZZZZZZ_.jpg
    2006-10-17 21:12:52.674190 [Debug][AudioScrobblerUtils thread]: MyMusic: better thumb No Doubt-Beacon Street Collection.jpg already exists - do not save
    2006-10-17 21:12:52.674190 [Debug][AudioScrobblerUtils thread]: GUIMusicPlayingNow: adding image to container - C:\Program Files\Team MediaPortal\MediaPortal\thumbs\music\albums\No Doubt-Beacon Street Collection.jpg
    2006-10-17 21:12:53.675630 [Debug][AudioScrobblerUtils thread]: AudioScrobblerUtils: Tag picking successful - selecting ska
    2006-10-17 21:12:56.359489 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for My Girl found db song - C:\Documents and Settings\Nyall\My Documents\My Music\Lee 'Scratch' Perry\Africa's Blood\07 My Girl.mp3
    2006-10-17 21:12:56.459633 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Don't Speak found db song - C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Tragic Kingdom\10 Don't Speak.mp3
    2006-10-17 21:12:56.459633 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Have the Time found db song - C:\Documents and Settings\Nyall\My Documents\My Music\The Slackers\The Question\03 Have the Time.mp3
    2006-10-17 21:12:56.459633 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Santeria found db song - C:\Documents and Settings\Nyall\My Documents\My Music\Various Artists\Look at all the Love we Found (a Tribute to Sublime)\05 Santeria.flac
    2006-10-17 21:12:56.469648 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Rat Race found db song - C:\Documents and Settings\Nyall\My Documents\My Music\Bob Marley & The Wailers\Babylon by Bus\05 Rat Race.flac
    2006-10-17 21:12:56.469648 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Drinking For 11 found db song - C:\Documents and Settings\Nyall\My Documents\My Music\The Mad Caddies\Just One More\01 Drinking For 11.flac
    2006-10-17 21:12:56.469648 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Roots Radicals found db song - C:\Documents and Settings\Nyall\My Documents\My Music\Rancid\Live Nottingham 2003\02 Roots Radicals.mp3
    2006-10-17 21:12:56.479662 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Monkey Man found db song - C:\Documents and Settings\Nyall\My Documents\My Music\Toots & the Maytals\Pressure Drop, The Best Of\09 Monkey Man.mp3
    2006-10-17 21:12:56.479662 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Garden Grove found db song - C:\Documents and Settings\Nyall\My Documents\My Music\Various Artists\Look at all the Love we Found (a Tribute to Sublime)\12 Garden Grove.flac
    2006-10-17 21:12:56.479662 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Guns of Navarone found db song - C:\Documents and Settings\Nyall\My Documents\My Music\The Skatalites\Hi-Bop Ska\01 Guns of Navarone.mp3
    2006-10-17 21:12:56.479662 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Date Rape found db song - C:\Documents and Settings\Nyall\My Documents\My Music\Various Artists\Look at all the Love we Found (a Tribute to Sublime)\03 Date Rape.flac
    2006-10-17 21:12:56.489676 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Spiderwebs found db song - C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Tragic Kingdom\01 Spiderwebs.mp3
    2006-10-17 21:12:56.489676 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for What I Got found db song - C:\Documents and Settings\Nyall\My Documents\My Music\Various Artists\Look at all the Love we Found (a Tribute to Sublime)\02 What I Got.flac
    2006-10-17 21:12:56.489676 [Debug][AudioScrobblerUtils thread]: Audioscrobber: Track filter for Underneath It All found db song - C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Rock Steady\05 Underneath It All.mp3
    2006-10-17 21:13:01.607035 [Debug][MPMain]: MusicDatabase: increased playcount for song C:\Documents and Settings\Nyall\My Documents\My Music\No Doubt\Beacon Street Collection\06 By the Way.mp3 to 2
    2006-10-17 21:13:31.490004 [Info.][MPMain]: g_Player.Stop()
     

    zombiepig

    Portal Pro
    March 21, 2005
    408
    0
    Melb, Aus
    Home Country
    Hey rtv - i think i've tracked down the problem with missing artist images.

    In GUIMusicPlayingNow.cs:

    function UpdateTrackInfo() has the lines:

    Code:
    if (CurrentTrackTag.Artist != PreviousTrackTag.Artist)
                  UpdateArtistInfo();

    So - if the artist is different to the last artist played, it runs UpdateArtistInfo, starts the ArtistInfoRequest thread, and then runs OnUpdateArtistInfoCompleted when the thread is complete.

    OnUpdateArtistInfoCompleted handles the actual adding of artist art to the viz window:
    Code:
    CurrentThumbFileName = Util.Utils.GetCoverArtName(Thumbs.MusicArtists, Util.Utils.FilterFileName(CurrentTrackTag.Artist));
            if (CurrentThumbFileName.Length > 0)
            {
              AddImageToImagePathContainer(CurrentThumbFileName);
              UpdateImagePathContainer();
            }

    Catch is, if the same artist is played twice in a row, UpdateArtistInfo will never be called and the artist thumbnail is not added to the container.

    The code in UpdateTrackInfo() should be something like:
    Code:
    if (CurrentTrackTag.Artist != PreviousTrackTag.Artist)
                  UpdateArtistInfo();
    else 
    {
       CurrentThumbFileName = Util.Utils.GetCoverArtName(Thumbs.MusicArtists,      Util.Utils.FilterFileName(CurrentTrackTag.Artist));
            if (CurrentThumbFileName.Length > 0)
            {
              AddImageToImagePathContainer(CurrentThumbFileName);
              UpdateImagePathContainer();
            }
    }


    Should fix it up :D

    Also, is there any chance on getting
    Code:
    invalidSingleChars.Add('.');
    Removed from getValidURLLastFMString in AudioscrobblerUtils.cs for the reasons outlined in this post? :D

    Hope that all helps!!
     

    rtv

    Retired Team Member
  • Premium Supporter
  • April 7, 2005
    3,622
    301
    Osnabruck
    Home Country
    Germany Germany
    Thanks for your interest ;-)
    You're right, the artist lookup only happens once therefore the "image adding" is missing. I'll add something like your code.

    Unfortunately the "." is needed and recommended by the last.fm people because there are more occurences of strings like http://ws.audioscrobbler.com/1.0/album/Metallica/St.+Anger/info.xml

    Note: The method you're referring to is NOT stripping the "." and "," but adding a "+" behind them.
     

    zombiepig

    Portal Pro
    March 21, 2005
    408
    0
    Melb, Aus
    Home Country
    hmmm... i should have looked through that . code more closely. i thought my problem was caused because mp was stripping out the .'s, but if that's not the case, i'll have to do a bit more troubleshooting to find out what's causing it! :p
     

    zombiepig

    Portal Pro
    March 21, 2005
    408
    0
    Melb, Aus
    Home Country
    " MediaPortal MyMusic
    25/10/2006 [13:22h] rtv added: fixed: no artist thumb for subsequent album tracks "

    thanks rtv :D
     

    zombiepig

    Portal Pro
    March 21, 2005
    408
    0
    Melb, Aus
    Home Country
    Thanks for your interest ;-)
    You're right, the artist lookup only happens once therefore the "image adding" is missing. I'll add something like your code.

    Unfortunately the "." is needed and recommended by the last.fm people because there are more occurences of strings like http://ws.audioscrobbler.com/1.0/album/Metallica/St.+Anger/info.xml

    Note: The method you're referring to is NOT stripping the "." and "," but adding a "+" behind them.

    Ok - tracked down whats causing my problem, and there's a little problem i've found in AudioscrobblerUtils.cs:

    like you said, getValidURLLastFMString is adding a + behind any .'s in the string. however, if the string already has a space after the .'s, getValidURLLastFMString incorrectly puts another space there (well, a + anyway :p). so, it's turning St. Anger into St.++Anger. This works ok for some strings, since last.fm seems to ignore it and return results anyway, but for other artists/cds, it just returns no results. Replacing the .++ with .+ returns the correct results. if i add a
    Code:
            outString = outString.Replace("++", "+");
    after the
    Code:
            List<Char> invalidSingleChars = new List<Char>();
            invalidSingleChars.Add('.');
            invalidSingleChars.Add(',');
            foreach (Char singleChar in invalidSingleChars)
            {
              do
              {
                dotIndex = urlString.IndexOf(singleChar);
                if (dotIndex > 0)
                  if (dotIndex > lastIndex)
                  {
                    if (dotIndex < urlString.Length -1)
                    {
                      lastIndex = dotIndex;
                      outString = urlString.Insert(dotIndex + 1, "+");
                      urlString = outString;
                    }                
                  }
                  else
                    break;
              }
              while (dotIndex > 0);
            }

    loop, then it fixes this problem.

    hope that helps!
     

    Users who are viewing this thread

    Top Bottom