[Name]=discogs.com (Pone Mod 3.3)
[BasedOn]=www.discogs.com
[AlbumUrl]=http://www.discogs.com/release/
[SearchBy]=$if2(%discogs_release_id%,$if2(%DISCOGS_RELEASE_ID%,$if2(%DISCOGSID%,%DISCOGS-ID%)))
[ParserScriptAlbum]=...
##debug "on" "d:\\\\discogs_album.txt"#debugwriteinput "d:\\\\discogs_album_input.html"
# DISCOGS_RELEASE ID
outputto "discogs_release_id"
findline "link rel=\"canonical\""
findinline "/release/"
saynextnumber
# DISCOGS_RELEASE URL
outputto "www"
say "http://www.discogs.com/release/"
sayoutput "discogs_release_id"
# Coverurl
outputto "coverurl"
findline "class=\"image"
joinuntil ""
findinline "img src=" 1 1
if """
movechar 1
sayuntil "-150-"
movechar 4
sayuntil """
endif
DISCOGS_ALBUMARTIST
outputto "albumartist"
findline "class="profile"
findline "href="/artist"
joinuntil ""
replace "-" "-"
findinline "">"
regexpreplace "\s{2,}" " " #changes two or more spaces into one space
replace "|" "/"
replace "" "" #kills the * for discogs artist name variations
regexpreplace " (\d{1,2})" ""
regexpreplace "([^>]), The" "The $1"
replace "href="/artist/Various">Various" "href="/artist/Various">va"
regexpreplace "<[^>]+>" "" #removes all html tags
sayuntil "–"
Album
outputto "album"
findinline "–"
sayuntil ""
DISCOGS_LABEL
outputto "publisher"
findline "class="head">Label:"
findline "<div" 2 1
joinuntil ""
replace ">, <" ">\\<"
killtag "*"
regexpreplace "^\s+Label:\s+" ""
regexpreplace "\s,\s{2,}" ", "
replace " \\ " "\\"
regexpreplace " (\d{1,2})" ""
regexpreplace "([^>]*), The" "The $1"
sayrest
DISCOGS_CATALOG#
outputto "catalog #"
findline "class="head">Catalog#:"
findline "<div" 2 1
joinuntil ""
regexpreplace "\s{2,}" " "
replace ", " "\\"
findinline "content">"
sayuntil ""
DISCOGS_FORMAT, DISCOGS_TOTALDISCS, DISCOGS_MEDIATYPE & DISCOGS_RELEASETYPE
outputto "discogs_mediatype"
findline "class="head">Format:"
moveline 1 1
joinuntil ""
outputto "total disc"
sayregexp "(?<=>).+?(?=×)" "; "
outputto "mediatype"
regexpreplace "(<a href="/explore?fmt=.+?)+(.+?">)" "$1 $2"
regexpreplace "(<a href="/explore?fmt=.+?)+(.+?">)" "$1 $2"
regexpreplace "(<a href="/explore?fmt=.+?)+(.+?">)" "$1 $2"
regexpreplace "</?(i|b|u)>" ""
sayregexp "(?<=<a href="/explore?fmt=).+?(?=">)" "; "
outputto "release type"
sayregexp "(?<=,).+?(?=
)" "; "
outputto "discogs_mediatype"
replace "×" "x"
regexpreplace "
*" ""
replace "
" ";"
regexpreplace "<[^>]+>" ""
regexpreplace "^\s{0,}Format:\s+" ""
regexpreplace "\s+(,|:wink:\s{1,}" "$1 "
regexpreplace "\s+" " "
sayrest
DISCOGS_COUNTRY
outputto "country"
findline "class="head">Country:"
findline "<div" 2 1
joinuntil ""
regexpreplace "<[^>]+>" ""
sayrest
DISCOGS_YEAR
outputto "year"
findline "class="head">Released:" 1 1
findline "&year=" 1 1
findinline "&year" 1 1
if "="
joinuntil ""
findinline "=" 1 1
sayuntil """
DISCOGS_DATE
outputto "date"
unspace
regexpreplace "<[^>]+>" ""
replace "Jan" "-01-"
replace "Feb" "-02-"
replace "Mar" "-03-"
replace "Apr" "-04-"
replace "May" "-05-"
replace "Jun" "-06-"
replace "Jul" "-07-"
replace "Aug" "-08-"
replace "Sep" "-09-"
replace "Oct" "-10-"
replace "Nov" "-11-"
replace "Dec" "-12-"
regexpreplace "[^-0-9]" ""
regexpreplace "(\d\d)-(\d\d)-(\d\d\d\d)" "$3-$2-$1"
regexpreplace "-(\d\d)-(\d\d\d\d)" "$2-$1-00"
regexpreplace "(\d\d\d\d)$" "$1-00-00")
sayrest
endif
DISCOGS_STYLE
outputto "genre"
GotoLine 3
findline "Style:"
moveline 1 1
joinuntil ""
findinline "class="content">" 1 1
findinline "<"
if "a href"
killtag "*"
regexpreplace "\s+" " "
replace " , " "\\"
sayrest
say "\\"
endif
DISCOGS_GENRE
outputto "genre"
GotoLine 3
findline "Genre:"
moveline 1 1
joinuntil ""
killtag "*"
regexpreplace "\s+" " "
regexpreplace "\s+$" ""
replace " , " "\\"
sayrest
Tracklist:
gotoline 3
findline "Tracklist"
findline "class="track_pos">"
do
if " " # empty table row | I think this was for one track
releases & discogs has changed its page so this can deleted,
but I am not sure
exit
else
# DISCOGS_DISCNUMBER
outputto "discnumber"
killtag "*"
sayregexp "\d\d?(?=(\.|-))" ""
say "|"
# DISCOGS_TRACK POSITION
outputto "yes"
sayregexp "(?<=\d-)\d+" ""
sayregexp "(?<=\d\.)\d+" ""
sayregexp "[A-Z]+\d*" ""
say "|"
# DISCOGS_ARTIST
outputto "artist"
unspace
findline "<td class=\"track_artists" 1 1
joinuntil "</td>"
replace " - " ""
replace "–" ""
replace "|" "/"
replace "</a>*" "</a>"
regexpreplace " \(\d{1,2}\)</a>" "</a>"
regexpreplace "([^>]*), The</a>" "The $1</a>"
killtag "*"
regexpreplace "^ *$" "XXX-ALBUMARTIST-XXX"
if "XXX-ALBUMARTIST-XXX"
sayoutput "albumartist"
else
regexpreplace "\s{2,}" " "
sayrest
endif
findline "<td"
say "|"
# Title
outputto "Tracks"
unspace
joinuntil "</span>"
regexpreplace "<[^>]+>" ""
regexpreplace "\s\(\d?\d:\d\d\)" ""
regexpreplace "^\s+" ""
replace "|" "/"
sayuntil "</span>"
say "|"
# DISCOGS_EXTRA ARTISTS
outputto "mixartist"
findline "<"
unspace
if "<blockquote>"
joinuntil "</blockquote>"
regexpreplace "
" ";
"
regexpreplace "
" ";
"
regexpreplace "([^>]), The" "The $1"
replace "" ""
killtag "*"
regexpreplace "\s{2,}" " "
regexpreplace "\s," ","
regexpreplace "\s;" ";"
regexpreplace " (\d{1,2})" ""
replace " – " ": "
sayrest
endif
say "|"
# _Length
outputto "_LENGTH"
findline "class=\"track_duration" 1 1
joinuntil "</td>"
sayregexp "(?<=<span>).+?(?=</span>)"
say "|"
findline "class=\"track_pos\"" 1 1
findinline "class=\"track" 1 1
endif
while "_pos""
DISCOGS_TRACK INDEX (Chapter)
gotoline 3
outputto "chapter"
findline "Tracklist"
findline "<table"
joinuntil ""
regexpreplace "(<td.?class="track_index">)(.+?)()" "$1@@@@$2@@$3"
regexpreplace "(<td.?class="track_pos">)(.+?)()" "$1µ§$2$3"
regexpreplace ".?"(?:track_pos|track_index)">(.+?).?" "$1"
regexpreplace "(.@@.?) +." "$1@@"
regexpreplace "^@@(.)" "$1"
ifnot "@@"
regexpreplace "(.+)" "@@@@$1"
endif
regexpreplace "@@(.?)@@(.?)@@" "$2@@$1@@@@"
regexpreplace "\s{2,}" " "
findinline "µ" 1 1
do
sayregexp "(?<=@@)[^<]+" ", " "@@@@"
say "|"
findinline "µ" 1 1
while "§"
DISCOGS_TOTALTRACKS
outputto "total tracks"
gotoline 3
findline "Tracklist"
findline "<table"
joinuntil ""
regexpreplace "class="track_pos"" "<<
Delete Alumbartist for Single-Artist-Releases
gotoline 3
findline "Tracklist"
findline "<table"
joinuntil ""
regexpreplace ".class="track_artists">\s<a href="/artist.*" "<<>>"
ifnot "<<>>"
endif
DISCOGS~PONE MULTILINE FIELD = yes
DISCOGS_CREDITS
outputto "credits"
gotoline 3
findline "class="section major credits" 1 1
unspace
if "<div class="section major credits"
findline "section_content">"
joinuntil ""
regexpreplace "([^>]), The" "The $1" replace "" ""
replace "|" "/"
regexpreplace "\s{2,}" " "
regexpreplace "\s*<br />\s*" "\r\n"
regexpreplace "\s*\s*" "\r\n"
regexpreplace "<[^>]+>" ""
replace " – " ": "
regexpreplace " (\d{1,2})" ""
sayrest
endif
DISCOGS_NOTES
outputto "notes"
gotoline 3
findline "class="section major notes" 1 1
unspace
if "<div class="section major notes"
findline "section_content">"
joinuntil ""
regexpreplace "([^>]), The" "The $1" replace "" ""
replace "|" "/"
replace ">Notes<" ""
regexpreplace "\s{2,}" " "
regexpreplace "\s*<br ?/?>\s*" "\r\n"
regexpreplace "
" "\r\n\r\n"
regexpreplace "<[^>]+>" ""
regexpreplace " (\d{1,2})" ""
sayrest
endif
DISCOGS_BARCODES AND OTHER IDENTIFIERS
outputto "yes"
gotoline 3
findline "class="section major barcodes" 1 1
unspace
if "<div class="section major barcodes"
findline "section_content">"
joinuntil ""
outputto "yes"
sayregexp "(?<=
Barcode: ).?(?=)" "; "
regexpreplace "Barcode:.?" ""
outputto "yes"
replace "" ""
replace "|" "/"
replace ">Barcode and Other Identifiers<" ""
regexpreplace "\s{2,}" " "
regexpreplace "\s\s*" "\r\n"
regexpreplace "<[^>]+>" ""
unspace
regexpreplace "\A\Z" "<<>>"
ifnot "<<>>"
say "Other Identifiers:"
SayNewline
sayrest
SayNewline
SayNewline
endif
endif
Discogs Rating
outputto "rating"
findline "<span class="rating_value rating_value" 1 1
findinline ">" 1 1
sayuntil "<"
Copy Fields
outputto "no"
sayoutput "no"
outputto "no"
sayoutput "no"
outputto "no"
sayoutput "no"
outputto "no"
sayoutput "no"
outputto "no"
sayoutput "no"
Set "no"