Skip to content

Instantly share code, notes, and snippets.

@TheFireRed
Forked from PBXg33k/VGMdb#Search by &Album
Created September 24, 2015 08:27
Show Gist options
  • Save TheFireRed/82c4f6b128d1a447a542 to your computer and use it in GitHub Desktop.
Save TheFireRed/82c4f6b128d1a447a542 to your computer and use it in GitHub Desktop.
MP3Tag - VGMdb source file
# ###################################################################
# Mp3tag (v2.39+) parsing for VGMdb.net, created by dano on 2010-01-20
# Updated and maintained by PBX_g33k starting from 2015-09-01
#
#
# This file should be in your sources directory
# On Windows XP it's
# C:\Documents and Settings\*username*\Application Data\Mp3tag\data\sources
#
# Changelog:
# [2015-09-01]
# - FIX: Coverurl fixed
#
# ###################################################################
[Name]=VGMdb - Search by Album
[BasedOn]=vgmdb.net
[IndexUrl]=http://vgmdb.net/search?q=%s
[AlbumUrl]=http://vgmdb.net/album/
[WordSeperator]=+
[IndexFormat]=%Catalog%|%_url%|%Album%|%Year%
[SearchBy]=%album%
[Encoding]=url-utf-8
[ParserScriptIndex]=...
# ###################################################################
# I N D E X
# ###################################################################
#debug "on" "C:\\tmp\\debug_vgmdb_A.htm" "10"
#debugwriteinput "C:\\tmp\\vgmdb_search by album.htm"
findline "<tr rel='rel_" 1 1
ifnot "<tr rel"
say "|"
sayoutput "CurrentURL"
say "|"
say "|"
exit
endif
do
replace "|" "/"
findinline "span class=" #'catalog'>
findinline ">"
sayuntil "</span"
say "|"
# URL
findinline "http://vgmdb.net/album/"
sayuntil "\""
say "|"
# Album
findinline "class=\"albumtitle\""
findinline "\">"
sayuntil "</span>"
say "|"
# Year
findinline "</tr>"
movechar -1
findinline "\"" -1
findinline ">"
sayuntil "</"
saynewline
moveline 1 1
unspace
while "<tr rel='rel_" 999
[ParserScriptAlbum]=...
# ###################################################################
# A L B U M
# ###################################################################
#debug "on" "C:\\tmp\\debug_VGMdb_B.htm" "10"
#debugwriteinput "C:\\tmp\\VGMdb_B.htm"
# Album
outputto "Album"
findline "class=\"albumtitle"
replace "|" "$verticalBar()"
findinline "class=\"albumtitle"
findinline ">"
sayuntil "</span"
# Coverurl
outputto "coverurl"
findline "id=\"coverart\""
findinline "style=\"background-image: url("
if "'"
movechar 1
sayuntil "'"
else
findinline "../"
sayuntil "\""
endif
# set "coverurl"
# Catalog
outputto "Catalog"
findline "<b>Catalog Number</b>"
joinuntil "</tr>"
findinline "<td width=\"100%\">"
ifnot "N/A"
if "<span id="
findinline "#\">"
sayuntil "</a>"
else
regexpreplace "<a[^>]+>" ""
replace "</a>" ""
findinline "<td width=\"100%\">"
sayuntil "</td>"
endif
endif
# Release Date
outputto "Year"
findline "<b>Release Date</b>"
moveline 1
sayregexp "(?<=<td>)\d{4} *(?=</td>)" ""
if "<td><a "
findinline "title=\"View albums released on"
sayregexp "\d{4}(?=\" href)" "" "</a>"
endif
# Publish Format
outputto "Format"
findline "<b>Publish Format</b>"
joinuntil "</tr>"
findinline "<td>"
sayuntil "</td>"
# Media Format
outputto "Mediatype"
findline "<b>Media Format</b>"
joinuntil "</tr>"
findinline "<td>"
sayuntil "</td>"
# Classification (Genre)
outputto "Genre"
findline "<b>Classification</b>"
joinuntil "</tr>"
findinline "<td>"
sayuntil "</td>"
# Publisher
findline "<b>Published by</b>"
outputto "Publisher"
moveline 1
regexpreplace "<span style=\"display:none\"><em> */ *</em></span>" ""
regexpreplace "<span title=\"[^\"]*\" class=\"artistname\" lang=\"en\" style=\"display:inline\">([^<]+)</span>" "$1"
regexpreplace "<span title=\"[^\"]*\" class=\"artistname\" lang=\"ja\" style=\"display:none\">.+?</span>" ""
regexpreplace "<span class=\"productname\" lang=\"en\" style=\"display:inline\">([^<]+)</span>" "$1"
regexpreplace "<span class=\"productname\" lang=\"[-\w]+\" style=\"display:none\">([^<]+)</span>" ""
regexpreplace "<a[^>]+>" ""
replace "</a>" ""
sayregexp "(?<=<td>)[^<]+(?=</td>)" ""
# Composer
findline "<b>Composed by</b>"
outputto "Composer"
moveline 1
regexpreplace "<span style=\"display:none\"><em> */ *</em></span>" ""
regexpreplace "<span title=\"[^\"]*\" class=\"artistname\" lang=\"en\" style=\"display:inline\">([^<]+)</span>" "$1"
regexpreplace "<span title=\"[^\"]*\" class=\"artistname\" lang=\"ja\" style=\"display:none\">.+?</span>" ""
regexpreplace "<a[^>]+>" ""
replace "</a>" ""
sayregexp "(?<=<td>)[^<]+(?=</td>)" ""
# Arranged
findline "<b>Arranged by</b>"
outputto "Writer"
moveline 1
regexpreplace "<span style=\"display:none\"><em> */ *</em></span>" ""
regexpreplace "<span title=\"[^\"]*\" class=\"artistname\" lang=\"en\" style=\"display:inline\">([^<]+)</span>" "$1"
regexpreplace "<span title=\"[^\"]*\" class=\"artistname\" lang=\"ja\" style=\"display:none\">.+?</span>" ""
regexpreplace "<a[^>]+>" ""
replace "</a>" ""
sayregexp "(?<=<td>)[^<]+(?=</td>)" ""
# Performed
findline "<b>Performed by</b>" 1 1
unspace
if "<tr><td"
outputto "Artist"
moveline 1
regexpreplace "<span style=\"display:none\"><em> */ *</em></span>" ""
regexpreplace "<span title=\"[^\"]*\" class=\"artistname\" lang=\"en\" style=\"display:inline\">([^<]+)</span>" "$1"
regexpreplace "<span title=\"[^\"]*\" class=\"artistname\" lang=\"ja\" style=\"display:none\">.+?</span>" ""
regexpreplace "<a[^>]+>" ""
replace "</a>" ""
sayregexp "(?<=<td>)[^<]+(?=</td>)" ""
else
findline "nff44455553333332_____-------" -1 1
endif
# Tracks
# findline "<b>Disc 2</b></span>"
findline "class=\"smallfont\"><span class=\"label\">"
do
outputto "Tracks"
moveline 1
findinline "width=\"100%\">"
sayuntil "</td>"
say "|"
outputto "_Length"
moveline 1
sayregexp "(?<=<span class=\"time\">)[\d:]+(?=</span>)" ""
say "|"
findline "class=\"smallfont\"><span class=\"label\">" 1 1
while "<td "
# Notes
gotoline 1
outputto "Notes"
findline "<h3>Notes</h3>"
findline "class=\"smallfont\">"
regexpreplace "\s*<br ?\/?>\s*" "\r\n"
findinline "class=\"smallfont\">"
ifnot "<i class='label'>"
sayuntil "</div>"
endif
# VGMdb Album URL
outputto "VGMdb Album Url"
sayoutput "CurrentUrl"
# ... Customization ...
#set "genre" "Game"
# Fields that you want to remove
# (to remove a field write: set "field")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment