[WS] Last.fm

Hey mates, someone explained to me how to fix the script, I only applied it to the 'Last.fm#Top Tags 3 Genres.src' script but it should work similar for the others (1 genre, artist pic, etc.) Open it with Notepad++ or something similar to edit and save.

Improved: Last.fm#Top Tags 3 Genres.src

# Mp3tag (2.38 or higher) Parsing for Last.fm by dano
# Save it in your Mp3tag data directory, 
# e.g. C:\Documents and Settings\*username*\Application Data\Mp3tag\data\sources
#
#	DO NOT COPY/MODIFY AND REDISTRIBUTE THIS WITHOUT PERMISSION
#
#   Get the first 3 Top Tags as Genre to categorize your music
#
[Name]=Last.fm TopTags
[BasedOn]=www.last.fm
[AlbumUrl]=http://ws.audioscrobbler.com/2.0/?method=artist.gettoptags&artist=%s&api_key=YOUR_API_KEY
[WordSeperator]=+
[SearchBy]=$replace(%artist%,/,'%'252F,&,'%'2526)
[Encoding]=url-utf-8

[ParserScriptAlbum]=...
# ###################################################################
#					A  L  B  U  M
# ###################################################################
#debug "on" "C:\debug_Last.fm-Artist-TopTags_B.html" "20"

joinuntil "</toptags>"

regexpreplace "(?<=<name>)(\l)" "\u$1"
regexpreplace "\s(\l)" " \u$1"
regexpreplace "-(\l)" "-\u$1"

outputto "Genre"

findinline "<name>"
sayuntil "</name>"
findinline "</tag>" 1 1
if "<tag"
    do  
        say ", "
        findinline "<name>"
        sayuntil "</name>"
        
        findinline "</tag>" 1 1
    while "<tag" 1 # Change second parameter to determine the amount of style tags 1=3 Genres, 2=4 Genres,...
endif

Line 11 was changed, the only thing you need to do is insert your personal API key where it says 'YOUR_API_KEY' on line 11. You can register or login to Last.fm and obtain one here: http://www.last.fm/api/account/create

Only Contact email and Application name are required, and can be filled out with whatever you like. You do not need to access the provided email account to verify anything. Click Submit and copy/paste the API Key over YOUR_API_KEY in the line above

Good luck with it! It worked for me, it should for you. Am a happy man today.

Explanation by person that helped me:

Thanks so much, been waiting for this for a LONG time! I edited it to do just the ONE top tag by deleting the last couple of lines:

findinline "</tag>" 1 1
if "<tag"
do
say ", "
findinline "<name>"
sayuntil "</name>"

findinline "</tag>" 1 1
while "<tag" 1 # Change second parameter to determine the amount of style tags 1=3 Genres, 2=4 Genres,...
endif

A change that would be super helpful would be if it could do a selection of multiple artists in one go in mp3tag, rather than just one artist at a time. (If multiple artists are selected, I'm sure you know, it only applies the genre pulled from the first artist it finds) Any chance that would be a possibility?

QUOTE (ouisltagger @ Mar 17 2017, 22:58) <{POST_SNAPBACK}>
Thanks so much, been waiting for this for a LONG time! I edited it to do just the ONE top tag by deleting the last couple of lines:
findinline "</tag>" 1 1
if "<tag"
do
say ", "
findinline "<name>"
sayuntil "</name>"

findinline "</tag>" 1 1
while "<tag" 1 # Change second parameter to determine the amount of style tags 1=3 Genres, 2=4 Genres,...
endif

A change that would be super helpful would be if it could do a selection of multiple artists in one go in mp3tag, rather than just one artist at a time. (If multiple artists are selected, I'm sure you know, it only applies the genre pulled from the first artist it finds) Any chance that would be a possibility?


hi
i got always this error , can i fix it?

thanks

Check whether mp3tag has access to the internet at all or whether it is blocked e.g. by the firewall:
Use function Help>Check for new version.
If you do not get a message box then MP3tag is blocked.

hi
i have checked it works , i can connect to the net
i use now the script @ post 1 #1 post
thanks

hi
is there a way to change the "\\" with ";"
thanks

The \\ looks to me like the indicator for a multi-value field.
You can merge several fields of the same type to just one with an action of the type
Merge duplicate fields http://help.mp3tag.de/options_format.html#merge
There you can also set the separator.

hi
i mean the script add many keywords separated by \\ , i would like to change the script to add many keywords separated by ;
thanks
happy new year in late :wink:

The scripts are plain text, so you can edit them as you like.
If you feel uncomfortable with the scripting language, you could use the action as an alternative.

I adapted the script from dano, so it can be used to get correct title, artist. album, cover and genre. it does work with the current last.fm API 2.0 - you still need to create an API account as described before.
also I could not find a way, to make the parser "fool proof" - which means, if last.fm does not have a genre set, the script will throw an error:

best regards

Hi Dano,

sorry, first I wrote in german. Now in english again.

Is it possible to add the script with the two tags "Mood" and "Occasion" from Last.fm. I use the script from user "h4de5" and it works. But I would like to add this two tags. Can you help me?

Would be nice. :slight_smile:

Best regards

AFAIK these "tags" are just themed lists of regular tags. The program checks if a certain tag is present and then adds it for example as Mood tag.
They are not actual categories.
Do you mean that?

Hi Dano,

I read this post: Mood und Occasion als Tag-Felder im MP3tag-Editor. And the author has listed the examples of "Mood" and "Occasion".

If it's only themed lists and you can add it as "Mood" or "Occasion" tag, it would be perfect. :slight_smile:

Best regards

Hi Dano,

I've found this post: [WS] Last.fm Genre/Mood with Whitelist. It mentions a - actually not working - last.fm-script, which adds a mood tag. Only a Occasion tag is missing.

Can you update the script with the both new tags from this themed lists of last.fm?

Best regards

We need a separate script for this. I've made this:

Thank you for this script!!!! :slight_smile: :slight_smile: :slight_smile:

If I use e.g. "Bob Marley & The Wailers", it looks like this:
image

When I search the artist: Bob Marley & The Wailers and the song "Three little Birds", the script finds only mood = "mellow". But if I search the song directly on the website last.fm, I find for mood "mellow", "happy" and "feel good". Can you say why the latter two are missing?

The script adds the keywords separated by "\". Is it possible to use the separation ","?

I get 8 mood and 3 occasion values for this song.
If you want a different separator then

replace
(?=</name>)" "\\\\"
with
(?=</name>)" ","

2 times in the script.

Hi Dano,
I use Mp3tag v2.99d. If I search with "Bob Marley & The Wailers" and "Three Little Birds", I get this keyword back:

image

I see in the xml-file via ws.audioscrobbler.com, that the script use the album "Legend".

image

But my tag for "Album" is "Exodus".

Is it possible, that the script use "Album" and "Title" for searching? Or what is my mistake?

Best regards

Small error, try this update:
Last.fm#Track Tags.zip (1.5 KB)

It works!!!!!! Thank you!!!! :slight_smile: :slight_smile: :slight_smile: