Last active
August 8, 2018 22:53
-
-
Save h4de5/4425d31e525e362110d88d850f07c9d6 to your computer and use it in GitHub Desktop.
mp3tag Last.fm source plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mp3tag (2.38 or higher) Parsing for Last.fm by h4de5 | |
# 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 correct title, artist, album and cover data from last.fm database | |
# | |
# GET last.fm API key here: https://www.last.fm/api/account/create | |
# | |
[Name]=Last.fm Track Info | |
[BasedOn]=www.last.fm | |
[AlbumUrl]=https://ws.audioscrobbler.com/2.0/?method=track.getInfo&%s&autocorrect=1&username=YOUR_USERNAME&api_key=YOUR_API_KEY | |
[WordSeperator]=+ | |
[SearchBy]=artist=$trim($replace($if2(%artist%,$left(%_filename%,$strstr(%_filename%,' - '))),/,'%'252F,&,'%'2526))&track=$trim($replace($if2(%title%, $cutLeft(%_filename%,$add($strstr(%_filename%,' - '),2))),/,'%'252F,&,'%'2526)) | |
#[Encoding]=url-utf-8 | |
#[Encoding]=utf-8 | |
#[Encoding]=iso-8859-1 | |
[ParserScriptAlbum]=... | |
# ################################################################### | |
# A L B U M | |
# ################################################################### | |
# debug "on" "debug_Last.fm-Track-Info.log" | |
joinuntil "</track>" | |
# make every name start with uppercase | |
#regexpreplace "(?<=<name>)(\l)" "\u$1" | |
# start every new word with uppercase letter | |
#regexpreplace "\s(\l)" " \u$1" | |
# make every letter after a dash uppercase | |
#regexpreplace "-(\l)" "-\u$1" | |
# replace common html entities | |
regexpreplace "'" "'" | |
regexpreplace "&" "&" | |
regexpreplace ""e;" "\"" | |
regexpreplace ">" ">" | |
regexpreplace "<" "<" | |
regexpreplace " " " " | |
# title | |
outputto "Title" | |
findinline "<name>" | |
sayuntil "</name>" | |
# artist | |
outputto "Artist" | |
findinline "<artist>" | |
findinline "<name>" | |
sayuntil "</name>" | |
# start of album data | |
findinline "<album" | |
# albumartist | |
outputto "Albumartist" | |
findinline "<artist>" | |
sayuntil "</artist>" | |
# Album | |
outputto "Album" | |
findinline "<title>" | |
sayuntil "</title>" | |
# cover | |
outputto "coverurl" | |
findinline "<image size=\"large\">" | |
sayuntil "</image>" | |
# end of album data | |
outputto "Rating" | |
findinline "<userloved>" | |
if "1" | |
say "5" | |
endif | |
# genre | |
outputto "Genre" | |
findinline "<toptags>" | |
findinline "<tag>" | |
findinline "<name>" | |
sayuntil "</name>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment