# ########################################################################
# Mp3tag (v2.42 or higher) parsing for discogs.com, created by TerzOpperator on 2008-10-08
#
# Search for RELEASES only!
# This file should be in your sources directory.
# On Windows XP it's:
# C:\Documents and Settings\*username*\Application Data\Mp3tag\data\sources
#
# On Windows Vista it's:
# C:\Users\*username*\AppData\Roaming\Mp3tag\data\sources
#
#
# Uses the artist and title to find an release
#
# Modifications:
# 2008-10-08: First Release of this Script - tested with version 2.41
# 2008-10-10: Added: Tag for check if it is a Compilation (For a better Tag To File Action)
# 2008-10-10: Not an Script update, but see the Action Update below.
# 2008-14-10: Fixed: Remix Bug @ Script
# 2008-29-10: Fixed: Date if Discogs have only the Day and Month only (now we will get all Date Formats from Discogs ;))
# 2009-08-03: Script: Version 1.5.0
# Script: fully recoded and now uses the discogs API
# Script: renamed discogs.src is now: discogsapi4djs-at.src
# Added: Windows Vista description in this file
# Added: Script Version in the description
# Changed:[Name] - For the future / other scripts
# Added: [IndexURL], [WordSeperator], [SearchBy], [Encoding]
# Added: Now you can search by Artist & Album to find a release in this script
# Fixed: Now detecting remixer and mixartist correctly this was a very bad bug before
# e.g. DiscogsID:355807 = Schranz Total 9 and Mixartist now is =Boris S. (Credits)
# Added: iTunes Tags: BAND (If the there are different Track-Artists and the "Main" is not Various,
# ITUNESCOMPILATION (if its a Compilation) - i think you know what it is. ;)
# Result: Fully iTunes integration / Album / Compilation / CoverFlow
#
# ########################################################################
[Name]=Discogs Release for Deejay's - Album & Title search
[BasedOn]=http://www.discogs.com
[IndexUrl]=http://www.discogs.com/search?type=releases&q=%s&f=xml&api_key=e23cf6161b
[AlbumUrl]=http://www.discogs.com/release/
[WordSeperator]=+
[IndexFormat]=%Release%|%_url%|%_preview%|%Comment%
[SearchBy]=%artist% %album%
[Encoding]=UTF-8
[ParserScriptIndex]=...
#Debug "on" "C:\debug.txt"
# ########################################################################
# This script parses the discogs api for all releases
# by this artist and albumname.
#
# The output format is defined by IndexFormat above, which
# is used by the selection dialog
# ########################################################################
# Join Lines
JoinUntil ""
# Result
do
findinline ")[^<]+(?=)" ", " ""
say "|"
#URL-Release
sayregexp "(?<=release/)[^<]+(?=)" ", " ""
say "?f=xml&api_key=e23cf6161b"
say "|"
#URL-Preview
sayregexp "(?<=)[^<]+(?=)" ", " ""
say "|"
# Comment
sayregexp "(?<=)[^<]+(?=)" ", " ""
saynewline
findinline ""
while ""
# Format XML (Converting to UTF-8)
regexpreplace """ "\""
regexpreplace "&" "&"
regexpreplace "'" "'"
# DiscogsID
outputto "DiscogsID"
findinline ""
# Coverurl
outputto "coverurl"
if ""
findinline "uri=\""
sayuntil "\" uri"
findinline ""
endif
#Artist or BAND Tag - (first)
if ""
findinline ""
# Set to Compilation if Various
if "Various"
outputto "isCompilation"
say "yes"
outputto "ITUNESCOMPILATION"
say "1"
else
# oh my god. ok, skip to i hope it exists... ;)
findinline ""
if ""
movechar -8
if ")" # Split Artist
findinline "" -1
sayregexp "(?<=)[^<]+(?= \()" ", " ""
else
findinline "" -1
sayregexp "(?<=)[^<]+(?=)" ", " ""
endif
findinline ""
if ""
findinline ""
endif
if ""
say " "
sayregexp "(?<=)[^<]+(?=)" ", " ""
say " "
endif
findinline ""
while ""
else
# first get hack to here
findinline "" -1
findinline "" -1
findinline ""
# now set ONLY the "Main" Artist TAG (no other Artists Exists)
do
outputto "Artist"
findinline ""
movechar -8
if ")" # Split Artist
findinline "" -1
sayregexp "(?<=)[^<]+(?= \()" ", " ""
else
findinline "" -1
sayregexp "(?<=)[^<]+(?=)" ", " ""
endif
findinline ""
if ""
findinline ""
endif
if ""
say " "
sayregexp "(?<=)[^<]+(?=)" ", " ""
say " "
endif
findinline ""
while ""
endif
endif
findinline ""
endif
# Album
outputto "Album"
if ""
findinline ""
sayuntil ""
findinline ""
endif
# CatalogID and Publisher
if ""
# CatalogID
outputto "CatalogID"
findinline ""
sayregexp "(?<="
endif
# Mixartists
if ""
#outputto "Mixartist"
findinline ""
if ""
do
findinline ""
if ""
findinline ""
endif
if ""
findinline ""
endif
if ""
findinline ""
if "DJ Mix"
findinline "" -1
outputto "Mixartist"
findinline ""
movechar -8
if ")" # Split Mixartist
findinline "" -1
sayregexp "(?<=)[^<]+(?= \()" ", " ""
else
findinline "" -1
sayregexp "(?<=)[^<]+(?=)" ", " ""
endif
findinline ""
if ""
#findinline ""
say " ("
sayregexp "(?<=)[^<]+(?=)" ", " ""
say ")"
findinline ""
findinline "" -1
else
findinline "" -1
endif
say ", "
endif
findinline ""
endif
findinline ""
while ""
endif
findinline ""
endif
# Check Compilation
if ""
findinline ""
if ""
endif
if ""
# Checking Format Descriptions (is it a Compilation)
do
findinline ""
if "Compilation"
outputto "isCompilation"
set "isCompilation" "yes"
outputto "ITUNESCOMPILATION"
set "ITUNESCOMPILATION" "1"
endif
#saynewline
findinline ""
while ""
endif
findinline ""
endif
# API - (skip and use style as genre)
if ""
findinline ""
endif
# Style - Output as Genre (Default normally is Genre as Genre, but i think this is a little bit more information and it's cool 4 DJing) ;)
if ""
outputto "Genre"
do
findinline ""
#saynewline
findinline ""
if ""
endif
# Country
if ""
outputto "Country"
findinline ""
sayuntil ""
findinline ""
endif
# Outputs: Year, Date, ORIGYEAR
if ""
# Year (Recommed for mp3 Players)
outputto "Year"
sayregexp "(\d{4})" ", " ""
# Date (Recommed some library tools like rrs.at/Trakker)
# Output to: YYYY-MM-DD
outputto "Date"
findinline ""
sayuntil ""
# ORIGYEAR (Recommed for Traktor DJ Studio)
# YYYY-MM-DD
outputto "ORIGYEAR"
findinline "" -1
findinline ""
sayuntil ""
findinline ""
endif
# API - (skip)
if ""
findline ""
endif
# Tracklisting
findinline ""
do
findinline ""
# Position
outputto "position"
if ""
sayregexp "(?<=)[a-zA-Z].*(?=)" ", " ""
say "|"
findinline ""
else
say "|"
endif
# Artist (second)
# ok, now: no code trash, but Stupid codeing... can not make a nested operation....
# That is while i must repeat this script :(
if ""
outputto "Artist"
findinline ""
findinline ""
movechar -8
if ")" # Split Artists
findinline "" -1
sayregexp "(?<=)[^<]+(?= \()" ", " ""
else
findinline "" -1
sayregexp "(?<=)[^<]+(?=)" ", " ""
endif
findinline ""
if ""
findinline ""
endif
if ""
say " "
sayregexp "(?<=)[^<]+(?=)" ", " ""
say " "
endif
findinline ""
# 2
if ""
findinline ""
findinline ""
movechar -8
if ")" # Split Artists
findinline "" -1
sayregexp "(?<=)[^<]+(?= \()" ", " ""
else
findinline "" -1
sayregexp "(?<=)[^<]+(?=)" ", " ""
endif
findinline ""
if ""
findinline ""
endif
if ""
say " "
sayregexp "(?<=)[^<]+(?=)" ", " ""
say " "
endif
findinline ""
endif
# 3
if ""
findinline ""
findinline ""
movechar -8
if ")" # Split Artists
findinline "" -1
sayregexp "(?<=)[^<]+(?= \()" ", " ""
else
findinline "" -1
sayregexp "(?<=)[^<]+(?=)" ", " ""
endif
findinline ""
if ""
findinline ""
endif
if ""
say " "
sayregexp "(?<=)[^<]+(?=)" ", " ""
say " "
endif
findinline ""
endif
# End code loop... trash.... ;)
findinline ""
say "|"
endif
# Tracks and split remix
if ""
findinline ""
movechar -9
if ")" # Split Remix
outputto "tracks"
findinline "" -1
sayregexp "(?<=)[^<]+(?= \()" ", " ""
say "|"
# split remix and write it to remix
outputto "remix"
#findinline "" -1
sayregexp "(?<= \()[^<]+(?=\))" ", " ""
say "|"
else # Show title
outputto "tracks"
findinline "" -1
sayregexp "(?<=)[^<]+(?=)" ", " ""
say "|"
# write empty to remix
outputto "remix"
say ""
say "|"
endif
findinline ""
else
outputto "tracks"
say "|"
outputto "remix"
say "|"
endif
#Remixer
# ok, now: no code trash, but Stupid codeing... can not make a nested operation....
# That is while i must repeat this script :(
outputto "remixer"
if ""
findinline ""
#1
if ""
findinline ""
if ""
findinline ""
endif
if ""
findinline ""
endif
if ""
findinline ""
if "Remix"
findinline "" -1
findinline ""
movechar -8
if ")" # Split Mixartist
findinline "" -1
sayregexp "(?<=)[^<]+(?= \()" ", " ""
else
findinline "" -1
sayregexp "(?<=)[^<]+(?=)" ", " ""
endif
findinline ""
endif
endif
findinline ""
endif
#2
if ""
findinline ""
if ""
findinline ""
endif
if ""
findinline ""
endif
if ""
findinline ""
if "Remix"
findinline "" -1
findinline ""
movechar -8
say ", "
if ")" # Split Mixartist
findinline "" -1
sayregexp "(?<=)[^<]+(?= \()" ", " ""
else
findinline "" -1
sayregexp "(?<=)[^<]+(?=)" ", " ""
endif
findinline ""
endif
endif
findinline ""
endif
# End code loop... trash.... ;)
findinline ""
say "|"
#3
if ""
findinline ""
if ""
findinline ""
endif
if ""
findinline ""
endif
if ""
findinline ""
if "Remix"
findinline "" -1
findinline ""
movechar -8
say ", "
if ")" # Split Mixartist
findinline "" -1
sayregexp "(?<=)[^<]+(?= \()" ", " ""
else
findinline "" -1
sayregexp "(?<=)[^<]+(?=)" ", " ""
endif
findinline ""
endif
endif
findinline ""
endif
else
say "|"
endif
# API - (skip)
if ""
findinline ""
endif
findinline ""
while ""