Page 1 of 1

Last.fm Popularity of Tracks

Posted: Fri Jun 06, 2008 12:16 pm
by Akinonyx
I'm looking for something to automatically tag (in one of the custom fields) tracks with the "popularity value" that AudioScrobbler returns (looks to be the "reach" field in the XML webservices). It would be similar to what the Last.FM Node does when you click on the Favorite Artists node, where it returns a playlist of tracks by that artist in order of popularity. But, if there were a way to store those values, one wouldn't be limited to a playlist of just one artist. I'm guessing Last.FM Node gets its data from the Artist Top Tracks XML (http://ws.audioscrobbler.com/1.0/artist ... tracks.xml), but then you're limited to only those tracks that are returned. To get data for all albums, you would have to use the Album Info XML (http://ws.audioscrobbler.com/1.0/album/ ... g/info.xml), for each album. Any ideas anyone?
Thanks!

C# solution

Posted: Sat Jun 07, 2008 6:28 pm
by Akinonyx
Well, I put together a lame C# solution to this problem. It tags on a song by song basis, so to prevent thousands of calls to the audioscrobbler server, I adjusted the JustListAlbums script to make a list of links to the XML's that I downloaded to a folder. It's slow going, but it's getting the job for me. Perhaps though someone would like to enhance it to make it run out of MM. Here's the code I used in C#:

Code: Select all

            InitializeComponent();
            SongsDB.SDBApplication SDB = new SongsDB.SDBApplication();
            SDB.ShutdownAfterDisconnect = false;
            for (int i = 0; i < SDB.SelectedSongList.Count; i++ )
            {
                SongsDB.ISDBSongData sd = SDB.SelectedSongList.get_Item(i);
                string artist = sd.ArtistName;
                string album = sd.AlbumName;
                string title = sd.Title;

                string path = @"F:\Music\XML\1.0\album\" + artist + "\\" + album + "\\" + artist + "___" + album + ".xml";
                XmlTextReader reader = new XmlTextReader(path);
                reader.WhitespaceHandling = WhitespaceHandling.Significant;
                string xmlTitle = "";
                while (reader.Read())
                {

                    // Print out info on node  
                    Console.WriteLine("{0}: {1}", reader.NodeType.ToString(), reader.Name);
                    
                    if (reader.Name == "track" && reader.NodeType.ToString() == "Element")
                    {
                        xmlTitle = reader.GetAttribute(0);
                    }

                    if (reader.Name == "reach" && reader.NodeType.ToString() == "Element")
                    {
                        reader.Read();
                        string reach = reader.Value;
                        if (xmlTitle == "")
                            sd.Custom5 = reach;
                        else if (xmlTitle.ToLower() == title.ToLower())
                            sd.Custom4 = reach;
                    }
                }
                SDB.SelectedSongList.UpdateAll();
                
            }

Posted: Sat Jun 07, 2008 6:32 pm
by Akinonyx
P.S. This is kind of a way to see which tracks aren't tagged correctly (ie. misspelled), at least according to AudioScrobbler's data, which would also be a nice script.

Posted: Mon Jun 09, 2008 3:22 am
by GuHu
Hi,

nice idea. I think the scrobbling number of a song is an important information. Unfortunately, it is not reachable from webservices to my knowledge. A song can be on different albums, and you have to add all number from all albums.

I think you have to read the plain html page of the song and to fiddle out the number.

GuHu

Re:

Posted: Fri Oct 06, 2023 10:19 am
by Aaronn78
GuHu wrote: Mon Jun 09, 2008 3:22 am Hi,

nice idea. I think the scrobbling number of a song is an important information. Unfortunately, it is not reachable from webservices to my knowledge. A song can be on different albums, and you have to add all number from all albums.

I think you have to read the plain html page of the song and to fiddle out the number.

GuHu
Hi,

I completely agree that the scrobbling number of a song is crucial information for music enthusiasts. It's unfortunate that this data isn't readily available through web services, as songs can indeed appear on various albums.

Re:

Posted: Sun Oct 08, 2023 8:52 am
by Aaronn78
Akinonyx wrote: Sat Jun 07, 2008 6:32 pm P.S. This is kind of a way to see which tracks aren't tagged correctly (ie. misspelled), at least according to AudioScrobbler's data, which would also be a nice script.
Hi
Such a script would undoubtedly be a valuable asset for music aficionados seeking to maintain precise and well-organized collections.