Script for ripping genre, year & record label from beatport.com

About the Genre replacement problem:

I've found your mistake in the script you attached in the forum post. You have repeated the last three lines of the #genre section in the #trackname section which comes afterwards.

this is your code, the red lines are wrong:

# GENRE

debug "on" "C:\Users\Sir Seppone\AppData\Roaming\Mp3tag\data\sources\debug.txt"
outputto "genre"
findline "<genre"
joinuntil ""
replace "Progressive House" "House Prog"
replace "Electro House" "House Electro"
findinline ""
sayuntil "</"
say "|"

TRACK NAME

findinline ""
sayuntil "</"
say "|"<!--colorc--></span><!--/colorc--><!--fontc--></span><!--/fontc--><!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->
findline "<performer"<!--fontc--></span><!--/fontc-->

btw.: the debug file shows you in which line the error is happening. this showed pointed me directly to the wrong line. so it's good to use a text editor which shows the numbers of the line.

About the Cover Art problem:

QUOTE (stevehero)
In the beatport script concerning the cover art. I want it to gotoline 8 where the 500px images are mostly always stored therefore I want to findinline "width="500" height="500"" and if it cant find it I want it to jump to line 7 where the 60px image of the release will always be. I've checked a lot of various release API's and they ALL hold these values with line 8 being either a 500px of the release or a different sized .jpg of the label but always line 7 is the 60px version of the release. Thats why I want it to default to line 7 if findinline 8 fails.

I have a feeling where I'm goin wrong is the ifnot line? But I'm not sure.

My attempt.

COVERURL

outputto "coverurl"
gotoline 8
findinline "width="500" height="500"" 1 1
ifnot "<image url="
gotoline 7
endif
findinline "url=\""
sayuntil "\" "

I'm still not 100% sure what the "1 1" after findinline does. I read the link you gave me but still not getting it.

Yes, ifnot is part of the problem. And you also deleted the unspace command. And you replaced findline with findinline. And you didn't escape the qutoationmarks. All these things lead to different results.

findline "text" 1 1
Finds the first next line which contains "text". If "text" can't be found in any of the next lines, the parser stops at the last line. Without the second 1 in the command, the script would stop and show if text can't be found.
After a findline command, the parser is always at the first character of a line.

findinline "text" 1 1
Finds the first next occurence of "text" in the line. If "text" can't be found in the line, the parser stops at the end of the line. Without the second 1 in the command, the script would stop and show if text can't be found.
After a findinline "text" command, the parser is at the first character which follows after "text" in the line.

unspace
This removes leading and trailing spaces of lines. And it sets the parser back to the first character of the line.

You can check the position of the parser after every line in the debug file. It is show line at "Line and position:" by this symbol: ^

This was all essential in my fix:

findline "width="500" height="500"" 1 1

unspace
ifnot "<image url="

The first line here looked for a line with width="500" height="500" in it.

If width="500" height="500" can't be found, the parser stops at the last line. Unspace doesn't change anything. And the ifnot command has a positive result (positive = the last line does not start with "<image url=" so the ifnot condition is positive, the lines until endif are executed).
If width="500" height="500" can be found, the parser stops at this line. Unspace removes the leading spaces. And the ifnot command has a negative result (negative = the line does start with "<image url=" so the ifnot condition is negative, the lines until endif are ignored).

The only thing I wonder: I don't know if my fix as I presented it in the forum worked at all. I forgot to escpape the parenthesis. The first line must be written as wollowing:
findline "width=</b>"500</b>" height=</b>"500</b>"" 1 1

So, for what you want to do now:

outputto "coverurl"

gotoline 8
findinline "width="500" height="500"" 1 1
movechar -24
ifnot "width="500" height="500""

gotoline 7

else

gotochar 1

endif
findinline "url=""
sayuntil "" "

After findinline "width="500" height="500"" 1 1 this script goes back 24 characters (the exact length of "width="500" height="500", this time without escaping the quotationmarks) and checks with ifnot, if the seached text has (not) be found. If it has not been found, it moves to line 7, if found it moves to the first character of the line (because otherwise, the following findinline "url="" would find nothing).

By the way:

ifnot "width=\"500\" height=\"500\""
 gotoline 7

else

 gotochar 1

endif

is exactly the same as: if "width=\"500\" height=\"500\"" gotochar 1 else gotoline 7 endif

e.g. changing "Progressive House" to "House Prog" Thanks for this, works.

To fix missing 500px artwork and get the 60px version. Thanks for this. And I fully understand the "1 1" function now. Thank you.

The helpfile only states that it "Removes leading and trailing spaces from the current line." Thanks.

I was wondering why there was a difference in the two. So anything before """ has to escaped like "/""?

NOTE: I'm in the process of finishing of the script along with those below and will post them later in a new thread for you all to use. All of which will output (see attached pic).
Search by release.
Search by ID.
Search by track (give specific track values)

This is where I need a little info, I cant find whether there is an API for single tracks. The album one is http://api.beatport.com/catalog/releases/d...mat=xml&id= and you add the release id to the end to find the release.

However, the track url is e.g. http://www.beatport.com/track/banger-origi...lub-mix/1686845. I was wondering if there was an api search to search this track e.g. http://www.beatport.com/track/detail?v=1.0...#0066cc]1686845[/color][/u]


use " not /"
you have to use " whenever you refer to a " in the beatport xml file.
you have to use " when it is part of the script language syntax.

Have you read my discussion with Irvin Cee in this topic.
I misunderstood him at first and wrote a search by release ID script for him:
Script for ripping genre, year & record label from beatport.com

But what he really wanted to do was a search and script for single tracks, not release pages. And he says he had success with it.
Here is the API page for the single track:
http://api.beatport.com/catalog/tracks?v=1...&id=1686845

He presented his first script here:
Script for ripping genre, year & record label from beatport.com
and I think this is his final version:
support for Beatport API single tracks based on Beatport Track ID in filename

Be aware that the single track search must be done for every track seperatly.

Good to see that you now renamed the tag-field for the release-id to BEATPORT_RELEASE_ID. It was really a pain for me to see you writing this ID to DISCOGS_RELEASE_ID. There the information would have been absolutly useless. Anybody who wanted to have a look at the release page would have been directed to a completly discogs page.

hi guys.
i really tried dont know how many times but i'm not be able to work the script.
please can you explain this procedure?
i placed the script in this folder but nothing

C:\Program File\Mp3tag\data\sources

i'm on windows xp, mp3tag v2.49, beatport 1.5 script.

thanks

see post here

ok now it works thanks!
the problem now is that i receive an error message:

error connecting to server: http://api.beatport.com

user abort

any advice?
thanks!

wow, this is pretty cool!! thanks stevehereo & pone and everyone involved for this plugin! this is gonna save me alot of time.

For anyone interested, I've finally gotten round to uploading the final scripts I've been working on with help from pone of course :slight_smile:

Please see THIS POST

It allows search and direct parsing of beatport.com by:
- Direct by BEATPORT_RELEASE_ID

  • Direct by WWW(URL)
  • Search by Release
  • Search by (Album)Artist + Release
  • Search by (Album)Artist + Title
QUOTE (pone @ Sep 6 2011, 12:40) <{POST_SNAPBACK}>
Well, I quickly adapted my script from discogs and it seems to be working. Add this at the end of the script:
#TOTALTRACKS    
outputto "TOTALTRACKS"
gotoline 1
joinuntil "<name>Users Also Bought</name>"
regexpreplace "</track>" "<<<Track>>>I<<<Track>>>"
regexpreplace ".*?(<<<Track>>>.*<<<Track>>>).*" "$1"
regexpreplace "<<<Track>>>[^I].*?<<<Track>>>" "<<<Track>>>"
replace "<<<Track>>>" ""
replace "IIIIIIIIII" "X"
replace "XXXXXXXXXX" "C"
replace "CI" "C0I"
regexpreplace "X$" "X0"
regexpreplace "C$" "C00"
replace "CCCCCCCCC" "9"
replace "CCCCCCCC" "8"
replace "CCCCCCC" "7"
replace "CCCCCC" "6"
replace "CCCCC" "5"
replace "CCCC" "4"
replace "CCC" "3"
replace "CC" "2"
replace "C" "1"
replace "XXXXXXXXX" "9"
replace "XXXXXXXX" "8"
replace "XXXXXXX" "7"
replace "XXXXXX" "6"
replace "XXXXX" "5"
replace "XXXX" "4"
replace "XXX" "3"
replace "XX" "2"
replace "X" "1"
replace "IIIIIIIII" "9"
replace "IIIIIIII" "8"
replace "IIIIIII" "7"
replace "IIIIII" "6"
replace "IIIII" "5"
replace "IIII" "4"
replace "III" "3"
replace "II" "2"
replace "I" "1"
sayrest<!--QuoteEnd--></div><!--QuoteEEnd-->

I was looking at your mod on your 3.11 version. I was trying to figure out how you implemented the TRACK/TOTALTRACK output. It seems that you have outputted the TRACK and TOTALTRACKS to temp tags then outputted them to the actual tag. Could you help me understand how I would go about implementing this in my scripts?

Thanks.

the TRACK/TOTALTRACK output has quite a few tricky compontents:

1st:
It took me a while to get the numbers in a format which allowed me to repeat the same number for totaltrack after every track number. I solved this with a lot of regexpreplace commands and a do ... while loop.

2nd:
As you know, it is not so easy to write something into the TRACK tag field with mp3tag web sources.
I have described the problem and also the steps to my solution here:
/t/11831/1

Basically it only works when you write rewrite the TITLE and TRACK at the very end of the script. When you do write any other tag-fields after that, the output of the different fields will be mixed up. I have no idea why.

I have used the temp outputs mainly to make the export with different settings easier. With my script you have six different ways (+ three optional changes for scpecial media formats) to write the TRACK field. And you can also write more than one of them into the different fields. So i write them all as normal tag fields in the middle part of the script. They are written direcly in the fields you choose in the settings file. Only if you choose TRACK there, they will be written in TEMP field and copied into TRACK at the end of the script.
There I have:

outputto "title"
sayoutput "tracks"
outputto "track"
sayoutput "discogs pone track / totaltracks temp"
set "discogs pone track / totaltracks temp"

I guess instead of the last two lines you can have every other way to get output. It should also be possilbe to parse the web page here. Only do not send output to a different field than TRACK after that.

Here is the code I have put below the code in your post here. # TRACK/TOTALTRACKS

outputto "title"
sayoutput "tracks"
outputto "track"
say "01|02|03|04|05|06|07|08|09|"
say "/"
sayoutput "totaltracks"

It puts leading zeros in okay but when I do the last two lines above they don't work. You said as long as I dont output to any other field than TRACK it will be okay. I've also tried parsing the website as you mentioned by adding this code but no joy. outputto "title"

sayoutput "tracks"
outputto "track"
say "01|02|03|04|05|06|07|08|09|"
say "/"
gotoline 1
joinuntil "<name>Users Also Bought</name>"
regexpreplace "</track>" "<<<Track>>>I<<<Track>>>"
regexpreplace ".*?(<<<Track>>>.*<<<Track>>>).*" "$1"
regexpreplace "<<<Track>>>[^I].*?<<<Track>>>" "<<<Track>>>"
replace "<<<Track>>>" ""
replace "IIIIIIIIII" "X"
replace "XXXXXXXXXX" "C"
replace "CI" "C0I"
regexpreplace "X$" "X0"
regexpreplace "C$" "C00"
replace "CCCCCCCCC" "9"
replace "CCCCCCCC" "8"
replace "CCCCCCC" "7"
replace "CCCCCC" "6"
replace "CCCCC" "5"
replace "CCCC" "4"
replace "CCC" "3"
replace "CC" "2"
replace "C" "1"
replace "XXXXXXXXX" "9"
replace "XXXXXXXX" "8"
replace "XXXXXXX" "7"
replace "XXXXXX" "6"
replace "XXXXX" "5"
replace "XXXX" "4"
replace "XXX" "3"
replace "XX" "2"
replace "X" "1"
replace "IIIIIIIII" "9"
replace "IIIIIIII" "8"
replace "IIIIIII" "7"
replace "IIIIII" "6"
replace "IIIII" "5"
replace "IIII" "4"
replace "III" "3"
replace "II" "2"
replace "I" "1"
sayrest
QUOTE (stevehero @ Nov 8 2011, 14:36) <{POST_SNAPBACK}>
. # TRACK/TOTALTRACKS
 outputto "title"
 sayoutput "tracks"
 outputto "track"
 say "01|02|03|04|05|06|07|08|09|"
 say "/"
 sayoutput "totaltracks"<!--QuoteEnd--></div><!--QuoteEEnd-->

have a look a the debug file. this can't work it will give you the output:
"01|02|03|04|05|06|07|08|09|/15" (15 as example for totaltracks)

but you need:
"01/15|02/15|03/15|04/15|05/15|06/15|07/15|08/15|09/15|10/15|11/15|12/15..."

this has nothing to do with the TRACK vs TRACKS problem. it's the the tricky thing I refered above under 1st.
pleas note that i have done some changes that total-tracks-counter with the roman numbers.
this is the core element of what I have changed.

do                                                    # get seperated tracknumbers
    regexpreplace "^(I)(I+)" "$2|$1$2"
    findinline "I"
while "I"

gives me something like
15|14|13|12|11|10...
or was it
1|2|3|4|5|6...

don't know now. more tonight. I don't have the time now

To be honest I'm completely baffled how to get this to work. So any further help would be appreciated.

You still don't use the debug file, do you? You can see there every step the script does.

Well,
here is what I used in 3.9 for TRACK/TOTALTRACK.

outputto "title"
sayoutput "tracks"
outputto "track"
say "01/"
sayoutput "discogs pone totaltracks temp"
say "|02/"
sayoutput "discogs pone totaltracks temp"
say "|03/"
sayoutput "discogs pone totaltracks temp"
say "|04/"
sayoutput "discogs pone totaltracks temp"
say "|05/"
sayoutput "discogs pone totaltracks temp"
say "|06/"
sayoutput "discogs pone totaltracks temp"
say "|07/"
sayoutput "discogs pone totaltracks temp"
say "|08/"
sayoutput "discogs pone totaltracks temp"
say "|09/"
sayoutput "discogs pone totaltracks temp"
say "|10/"
sayoutput "discogs pone totaltracks temp"
say "|11/"
sayoutput "discogs pone totaltracks temp"
say "|12/"
sayoutput "discogs pone totaltracks temp"
say "|13/"
sayoutput "discogs pone totaltracks temp"
say "|14/"
sayoutput "discogs pone totaltracks temp"
say "|15/"
sayoutput "discogs pone totaltracks temp"
say "|16/"
sayoutput "discogs pone totaltracks temp"
say "|17/"
sayoutput "discogs pone totaltracks temp"
say "|18/"
sayoutput "discogs pone totaltracks temp"
say "|19/"
sayoutput "discogs pone totaltracks temp"
say "|20/"
sayoutput "discogs pone totaltracks temp"
say "|21/"
sayoutput "discogs pone totaltracks temp"
say "|22/"
sayoutput "discogs pone totaltracks temp"
say "|23/"
sayoutput "discogs pone totaltracks temp"
say "|24/"
sayoutput "discogs pone totaltracks temp"
say "|25/"
sayoutput "discogs pone totaltracks temp"
say "|26/"
sayoutput "discogs pone totaltracks temp"
say "|27/"
sayoutput "discogs pone totaltracks temp"
say "|28/"
sayoutput "discogs pone totaltracks temp"
say "|29/"
sayoutput "discogs pone totaltracks temp"
say "|30/"
sayoutput "discogs pone totaltracks temp"
say "|31/"
sayoutput "discogs pone totaltracks temp"
say "|32/"
sayoutput "discogs pone totaltracks temp"
say "|33/"
sayoutput "discogs pone totaltracks temp"
say "|34/"
sayoutput "discogs pone totaltracks temp"
say "|35/"
sayoutput "discogs pone totaltracks temp"
say "|36/"
sayoutput "discogs pone totaltracks temp"
say "|37/"
sayoutput "discogs pone totaltracks temp"
say "|38/"
sayoutput "discogs pone totaltracks temp"
say "|39/"
sayoutput "discogs pone totaltracks temp"
say "|40/"
sayoutput "discogs pone totaltracks temp"
say "|41/"
sayoutput "discogs pone totaltracks temp"
say "|42/"
sayoutput "discogs pone totaltracks temp"
say "|43/"
sayoutput "discogs pone totaltracks temp"
say "|44/"
sayoutput "discogs pone totaltracks temp"
say "|45/"
sayoutput "discogs pone totaltracks temp"
say "|46/"
sayoutput "discogs pone totaltracks temp"
say "|47/"
sayoutput "discogs pone totaltracks temp"
say "|48/"
sayoutput "discogs pone totaltracks temp"
say "|49/"
sayoutput "discogs pone totaltracks temp"
say "|40/"
sayoutput "discogs pone totaltracks temp"
say "|41/"
sayoutput "discogs pone totaltracks temp"
say "|42/"
sayoutput "discogs pone totaltracks temp"
say "|43/"
sayoutput "discogs pone totaltracks temp"
say "|44/"
sayoutput "discogs pone totaltracks temp"
say "|45/"
sayoutput "discogs pone totaltracks temp"
say "|46/"
sayoutput "discogs pone totaltracks temp"
say "|47/"
sayoutput "discogs pone totaltracks temp"
say "|48/"
sayoutput "discogs pone totaltracks temp"
say "|49/"
sayoutput "discogs pone totaltracks temp"
say "|60/"
sayoutput "discogs pone totaltracks temp"
say "|61/"
sayoutput "discogs pone totaltracks temp"
say "|62/"
sayoutput "discogs pone totaltracks temp"
say "|63/"
sayoutput "discogs pone totaltracks temp"
say "|64/"
sayoutput "discogs pone totaltracks temp"
say "|65/"
sayoutput "discogs pone totaltracks temp"
say "|66/"
sayoutput "discogs pone totaltracks temp"
say "|67/"
sayoutput "discogs pone totaltracks temp"
say "|68/"
sayoutput "discogs pone totaltracks temp"
say "|69/"
sayoutput "discogs pone totaltracks temp"
say "|70/"
sayoutput "discogs pone totaltracks temp"
say "|71/"
sayoutput "discogs pone totaltracks temp"
say "|72/"
sayoutput "discogs pone totaltracks temp"
say "|73/"
sayoutput "discogs pone totaltracks temp"
say "|74/"
sayoutput "discogs pone totaltracks temp"
say "|75/"
sayoutput "discogs pone totaltracks temp"
say "|76/"
sayoutput "discogs pone totaltracks temp"
say "|77/"
sayoutput "discogs pone totaltracks temp"
say "|78/"
sayoutput "discogs pone totaltracks temp"
say "|79/"
sayoutput "discogs pone totaltracks temp"
say "|80/"
sayoutput "discogs pone totaltracks temp"
say "|81/"
sayoutput "discogs pone totaltracks temp"
say "|82/"
sayoutput "discogs pone totaltracks temp"
say "|83/"
sayoutput "discogs pone totaltracks temp"
say "|84/"
sayoutput "discogs pone totaltracks temp"
say "|85/"
sayoutput "discogs pone totaltracks temp"
say "|86/"
sayoutput "discogs pone totaltracks temp"
say "|87/"
sayoutput "discogs pone totaltracks temp"
say "|88/"
sayoutput "discogs pone totaltracks temp"
say "|89/"
sayoutput "discogs pone totaltracks temp"
say "|90/"
sayoutput "discogs pone totaltracks temp"
say "|91/"
sayoutput "discogs pone totaltracks temp"
say "|92/"
sayoutput "discogs pone totaltracks temp"
say "|93/"
sayoutput "discogs pone totaltracks temp"
say "|94/"
sayoutput "discogs pone totaltracks temp"
say "|95/"
sayoutput "discogs pone totaltracks temp"
say "|96/"
sayoutput "discogs pone totaltracks temp"
say "|97/"
sayoutput "discogs pone totaltracks temp"
say "|98/"
sayoutput "discogs pone totaltracks temp"
say "|99/"
sayoutput "discogs pone totaltracks temp"
say "|"
set "discogs pone totaltracks temp"

As you can see, it works only for a maximum of 99 tracks, but you can extend it as long as you like. It works with the same logic as the say "01|02|03|04|05|06|07|08|09|" solution in the other topic.

For the more complicated way I'm using now, here is the code:

# TRACK COUNTER
gotoline 3
findline "Tracklist</span>"
findline "<table"
joinuntil "</table>"
regexpreplace "class=\"track_pos\"" " <<<Track>>>I<<<Track>>> "
regexpreplace ".*?(<<<Track>>>.*<<<Track>>>).*" "$1"
regexpreplace "<<<Track>>>[^I].*?<<<Track>>>" "<<<Track>>>"
replace "<<<Track>>>" ""
do                                                    # get seperated tracknumbers
    regexpreplace "^(I)(I+)" "$2|$1$2"
    findinline "I"
while "I"
unspace
replace "IIIIIIIIII" "X"
replace "XXXXXXXXXX" "C"
replace "CI" "C0I"
regexpreplace "X($|\|)" "X0$1"
regexpreplace "C($|\|)" "C00$1"
replace "CCCCCCCCC" "9"
replace "CCCCCCCC" "8"
replace "CCCCCCC" "7"
replace "CCCCCC" "6"
replace "CCCCC" "5"
replace "CCCC" "4"
replace "CCC" "3"
replace "CC" "2"
replace "C" "1"
replace "XXXXXXXXX" "9"
replace "XXXXXXXX" "8"
replace "XXXXXXX" "7"
replace "XXXXXX" "6"
replace "XXXXX" "5"
replace "XXXX" "4"
replace "XXX" "3"
replace "XX" "2"
replace "X" "1"
replace "IIIIIIIII" "9"
replace "IIIIIIII" "8"
replace "IIIIIII" "7"
replace "IIIIII" "6"
replace "IIIII" "5"
replace "IIII" "4"
replace "III" "3"
replace "II" "2"
replace "I" "1"

# DISCOGS~TRACK NUMBER / TOTALTRACKS
outputto "discogs pone track / totaltracks temp"
sayuntil "|"
say "/"
sayregexp "(\d+)$"
do
    say "|"
    movechar 1
    sayuntil "|"
    say "/"
    sayregexp "(\d+)$"
while "|" 30
unspace
sayregexp "(\d+)$"

...

# TRACK FIX: DISCOGS~TRACK NUMBER / TOTALTRACKS
outputto "title"
sayoutput "tracks"
outputto "track"
sayoutput "discogs pone track / totaltracks temp"
set "discogs pone track / totaltracks temp"

The first stands in the middle of my scripts, the second at the end.
I think you you can use it for your beatport script, if you just replace the first nine lines with this:

# TRACK COUNTER
gotoline 1
joinuntil "<name>Users Also Bought</name>"
regexpreplace "</track>" "<<<Track>>>I<<<Track>>>"
regexpreplace ".*?(<<<Track>>>.*<<<Track>>>).*" "$1"
regexpreplace "<<<Track>>>[^I].*?<<<Track>>>" "<<<Track>>>"
replace "<<<Track>>>" ""

And here is the protocol of these parts from the debug file. It's for a release with 12 tracks.
debug_track_totaltrack.txt (62.3 KB)

Please tell me the exact script-lines you don't understand, if you have further questions. I'm always willing to help if I find the time.

The new core elements are

do                                                    # get seperated tracknumbers
    regexpreplace "^(I)(I+)" "$2|$1$2"
    findinline "I"
while "I"

this transforms
IIIIIIIIIIII
(was later transformed to 12 = totaltrack)
to
I|II|III|IIII|IIIII|IIIIII|IIIIIII|IIIIIIII|IIIIIIIII|IIIIIIIIII|IIIIIIIIIII|III
IIIIIIIII
(is later transformed to 1|2|3|4|5|6|7|8|9|10|11|12 = all tracknumbers, the last one representing also totaltracks)
So I have now at this point my own track counter and are not longer dependend on the one built into Mp3tag. This also enables me to write exact as many tracknumbers as I need and drop the long list or 99 say ... sayoutput ... seqeuences of my first solution.

the second new element is this:

do
    say "|"
    movechar 1
    sayuntil "|"
    say "/"
    sayregexp "(\d+)$"
while "|" 30

it parses the web site at the line 1|2|3|4|5|6|7|8|9|10|11|12
always saying moving to the next number (movechar 1) saying that number (sayuntil "|") and then saying the the last number (sayregexp "(\d+)$")

EDIT:
I have now idea why i limited the do ... while loop to 30. Also it seems to have no effect as tracknumbers higher than 30 are also written without problem. I think I just left it there from the process of finding the right code for this loop where i had some proplems with infinite loops which let Mp3tag crash. I will delete this in the next update.

debug_track_totaltrack.txt (62.3 KB)

Yes, I do but it confuses me sometimes, especially with something as complex as this. And its also a matter of knowing exactly what to do with the information it outputs. So I have attached my debug file to show you a problem I have. If you take a look at line 16 it says:

Output         : >http://www.beatport.com/release/dark-beat/381430<

Should this be the case? After all the command is 'gotoline 1'
debug_totaltrack.txt (190 KB)
I have managed to get the track/total track and totaltrack outputs to work. So thank you very much. Code below is what I used. And you are right it is a more complicated method.

# TRACK COUNTER
debug "on" "F:\PROGRAMS\music\Mp3tag\debug totaltrack.txt"
gotoline 1
joinuntil "<name>Users Also Bought</name>"
regexpreplace "</track>" "<<<Track>>>I<<<Track>>>"
regexpreplace ".*?(<<<Track>>>.*<<<Track>>>).*" "$1"
regexpreplace "<<<Track>>>[^I].*?<<<Track>>>" "<<<Track>>>"
replace "<<<Track>>>" ""
do                                                    # GET SEPERATED TRACKNUMBERS
    regexpreplace "^(I)(I+)" "$2|$1$2"
    findinline "I"
while "I"
unspace
replace "IIIIIIIIII" "X"
replace "XXXXXXXXXX" "C"
replace "CI" "C0I"
regexpreplace "X($|\|)" "X0$1"
regexpreplace "C($|\|)" "C00$1"
replace "CCCCCCCCC" "9"
replace "CCCCCCCC" "8"
replace "CCCCCCC" "7"
replace "CCCCCC" "6"
replace "CCCCC" "5"
replace "CCCC" "4"
replace "CCC" "3"
replace "CC" "2"
replace "C" "1"
replace "XXXXXXXXX" "9"
replace "XXXXXXXX" "8"
replace "XXXXXXX" "7"
replace "XXXXXX" "6"
replace "XXXXX" "5"
replace "XXXX" "4"
replace "XXX" "3"
replace "XX" "2"
replace "X" "1"
replace "IIIIIIIII" "9"
replace "IIIIIIII" "8"
replace "IIIIIII" "7"
replace "IIIIII" "6"
replace "IIIII" "5"
replace "IIII" "4"
replace "III" "3"
replace "II" "2"
replace "I" "1"
# TOTALTRACKS
outputto "totaltracks"
sayregexp "(\d+)$"
# TRACK / TOTALTRACKS
outputto "beatport stevehero track / totaltracks temp"
sayuntil "|"
say "/"
sayregexp "(\d+)$"
do
    say "|"
    movechar 1
    sayuntil "|"
    say "/"
    sayregexp "(\d+)$"
while "|"
unspace
sayregexp "(\d+)$"
# TRACK FIX: TRACK / TOTALTRACKS
outputto "title"
sayoutput "tracks"
outputto "track"
sayoutput "beatport stevehero track / totaltracks temp"
set "beatport stevehero track / totaltracks temp"

So the only thing left to get working is the leading zeros on the tracks. Im not to fused about it but I'm just curious to know how to implement it. I can handle looking at the debug.txt file on more simple matters but this is beyond me for the time being. I hope you understand.

I suppose you wouldn't be up to maybe use skype some time to go over some things. Its quite difficult to get a grasp sometimes through this.

I have deleted the 30 in the loop and it works without a problem.

debug_totaltrack.txt (190 KB)

The Output line always shwos the output of the field of the last outputto command. I this was WWW at you example. Gotoline 1 doesn't change anything for the output. When you use outputto "totaltracks" in line 337, the output is set to zero at the debug file..

You should be able to take it from my script without modifications. It uses the tracknumber as they are after the # TRACK COUNTER part of the script, before the # TRACK / TOTALTRACKS part.
So for a release with 12 tracks, it parses the text:
1|2|3|4|5|6|7|8|9|10|11|12

The code is this:

replace "|" "-|-"
 regexpreplace "(^|$)" "-"
 findinline "@@@" 1 1                                 #move to end of line
 movechar -1
 findinline "|" -1 1
 if "-|"
     movechar 4
 endif
 if "-"                                                #one digit
     regexpreplace "-(\d)-" "-0$1-"
 else
     movechar 1
     if "-"                                            #two digits
         regexpreplace "-(\d)-" "-0$1-"
     else
         movechar 1
         if "-"                                        #three digits
             regexpreplace "-(\d)-" "-0$1-"
             regexpreplace "-(\d\d)-" "-0$1-"
         else                                        #four digits
             regexpreplace "-(\d)-" "-0$1-"
             regexpreplace "-(\d\d)-" "-0$1-"
             regexpreplace "-(\d\d\d)-" "-0$1-"
         endif
     endif
 endif
 replace "-" ""

this is what it does:
line 1-2: put dashes around every number, so the parsed text is now -1-|-2-|-3-|-4-|-5-|-6-|-7-|-8-|-9-|-10-|-11-|-12-
line 3-5: move the parser in front of the last number
line 6-8: check if the follows another number (i had to put this in to avoid an error if there is only one track. the version of my script you can download doesn't have that yet)
line 9-26: these lines check the postion of the dash after the last track number. the parser jumps to the next character with movechar 1 until it finds the dash. when it is direct after the first digit of last tracknumber, the last tracknumber must be 1-9, so the script adds no leading zero.
when the dash is after the scecond digit of last tracknumber, the last tracknumber must be 10-99, so the script adds one leading zero to every track with only one digit. And so on... I stopped at four digits, which means it works to a maximum of 9999 totaltracks. Should be enough :wink:
line 27: deletes the dashes from the parsed text again, so you have the same text what you had before, only with leading zeros, in our 12 tracks example, it's:
01|02|03|04|05|06|07|08|09|10|11|12

i've deinstalled skype as it seems to crash my computer from time to time. you can add me on facebook if you are there, so we would be able to clear things via chat. send me a pm.

The problem is this for more than just one line. If you take a look, over 20 lines are the same output?

"Output         : >http://www.beatport.com/release/dark-beat/381430<"

I've tried it and it works like a charm.

Thank you and lol :]

Cool, I'll send you a PM now.

I have noticed a problem when it comes to this part of the script.

# TRACK / TOTALTRACKS
outputto "beatport stevehero track / totaltracks temp"
sayuntil "|"
say "/"
sayregexp "(\d+)$"
do
    say "|"
    movechar 1
.....

The debug.txt file lists the problem as this:

Script-Line    : 381
Command        : movechar
Parameter 1    : >1<

Aborted: ERROR(L381/movechar): position not found

So the problem lies with movechar 1. I have checked your v3.11 script to see if the problem existed there also. I tried this release http://www.discogs.com/Axwell-Axwell-Subma...release/1086081. And I'm sorry to say that it does. :confused:

because the output doesn't change for over 20 line. no say or sayout command. the output line of the debug file shows the output a field until the given line of the script.

tanks for reporting. i'll fix it. that's a problem i have at my script with all the different possible settings. with my personal settings there is no problem, but with TRACK/TOTALTRACKS there is. so i just didn't notice and did not enough tests with different settings.