# ###################################################################
#
# Mp3 Tag configuration to interact with
# vrporn-database.com
#
# Version 0.2
#
# ###################################################################
[Name]=Local VRP dB
[BasedOn]=vrporn-database.com
[IndexUrl]=https://vrporn-database.com/tag/search?
[AlbumUrl]=https://vrporn-database.com/tag/item/
[WordSeparator]=+
[IndexFormat]=%Artist%|%Title%|%_url%|%Label%|%_preview%
[SearchBy]=Filename||$replace(%_filename%,_edt_ffmeg, )||release_title=%s
[UserAgent]=1
[Encoding]=url-utf-8

Debug "ON" "R:\out.txt"
#DebugWriteInput "R:\in.txt"

[ParserScriptIndex]=...
# ###################################################################
#					I  N  D  E  X
# ###################################################################
replace "|" "$verticalBar()"
json "ON" "current"

# First, check if we've found anything
json_select_object "pagination"
json_select "items"

# Then iterate over all releases
ifnot "0"
	json_unselect_object
	json_foreach "results"

		# Artist
		json_select "artist"
		sayrest
		say "|"

		# Title
		json_select "title"
		sayrest
		say "|"

		# URL
		json_select "resource_url"
		sayrest
		say "|"

		# Label
		json_select "label"
		sayrest
		say "|"

		# Preview
		say "https://vrporn-database.com/video/"
		json_select "id"
		sayrest

		saynewline

	json_foreach_end
endif

[ParserScriptAlbum]=...
# ###################################################################
#					A  L  B  U  M
# ###################################################################
replace "|" "$verticalBar()"
json "ON" "current"

# Album
outputto "ALBUM"
json_select "title"
sayrest

# Discogs_Release_ID
outputto "VRPORN_DATABASE_ID"
json_select "id"
sayrest

# Coverurl
outputto "coverurl"
json_select "cover"
sayrest

# Catalog Number
outputto "PRODUCERNUMBER"
json_select_many "labels" "catno" ", "
sayrest

# Publisher
outputto "PUBLISHER"
json_select_many "labels" "name" ", "
sayrest

# Media Type
outputto "FORMAT"
json_select "format"
sayrest

# Genre
outputto "GENRE"
json_select_array "genres" -1 ","
sayrest

# Style
outputto "STYLE"
json_select_array "styles" -1 ","
sayrest

# Country
outputto "COUNTRY"
json_select "country"
sayrest

# Year
outputto "YEAR"
json_select "year"
ifnot "0"
	sayrest
endif

# Www
outputto "WWW"
json_select "uri"
sayrest

# Artist
outputto "ARTIST"
json_select_array "artists" -1 ","
sayrest
