[Request] Web Source Tutorial


#1

hi all!
first, thanks for this great piece of software.
got one question though:
i tried (for several days now) to create a script for a (korean) web source on my own, using this online help: http://www.help.mp3tag.de/en/main_online.html.
but actually being a total newbie to scripting or even programming, i didnt come very far. so is there anyone willing to write a little tutorial for all those newbies (as i am) out there?
that would be much appreciated! :slight_smile:

thanks in advance!


#2

download the existing examples, enable their debug modes, look at the html pages their search
that helped me a lot to make my own script.


#3

i tried that of course, already! :slight_smile:
but i still have no clue, in fact, those examples confused me even more! (strange loops, and a bunch of unknown (at least for me) commands...
actually i just need that album cover thing...
but as said above, i'm just clueless. :slight_smile:


#4

I hope Florian or willmcelwain can write something. ATM I dont feel capable of doing that.
Do you have a specific question maybe?


#5

hi dano, thanks for splitting my request.
actually i dont have much yet... just the beginning:

[Name]=jukeon
[BasedOn]=http://music.jukeon.com/
[IndexUrl]=http://search.jukeon.com/?ks=&kk=4&kw=%s
[AlbumUrl]=http://music.jukeon.com/
[WordSeperator]=+
[IndexFormat]=%_url%|%album%|%type%|%label%
[SearchBy]=%album%

to be honest, i have no idea about this [indexFormat]. The online help says:

but unfortunately i have no idea how this could help me...


#6

If you run the query to the website, it all depends how the site gives you its results back.
If you have only one result, some sites redirect you to the album site. If you have multiple results, it presents you with a site that let's you choose which album info you want to see.
That's the first thing you must find out.
Let's assume it gives you an overview of the results. Now you need to parse the code, to get the results in Mp3tag, so you can choose what album you want to see in Mp3tag.
Therefore you need the %_url% and one or more description fields.
When I look at the site I'd use
[IndexFormat]=%artist%|%_url%|%album%

In the [ParserScriptIndex]=... part you must fill these 3 fields with values from the html site.
You need to get the Artist, the Url to the Album and the Album name from the html code.

After that comes the
[ParserScriptAlbum]=... part.
Here you parse the final album page for information like cover, tracks,...


#7

hi dano,
thanks a lot for your tips. I'm going to try it again!
(hopefully with a bit more success...) :slight_smile:


#8

hi dano,

i tried it again, and i think im slowly beginning to understand a little bit of that concept.
after finishing my script, i wanted to test it, but i get following error:

=======================================================================
=======
Mp3tag V.2.29 - 15.03.2005 - 22:53:20
--------------------------------------------------------------------------------
OS-Version: Windows XP Service Pack 2 (Build 2600)
--------------------------------------------------------------------------------
Build: Mar  7 2005 13:45:50
--------------------------------------------------------------------------------
AppPath:  1.483.374.592 Bytes frei (D:\Program Files\Mp3tag\)
DataPath: 1.671.266.304 Bytes frei (C:\Documents and Settings\yo\Application Data\Mp3tag\data\)
TempPath: 1.671.266.304 Bytes frei (C:\DOCUME~1\yo\LOCALS~1\Temp\Mp3tag V.2.29\)
FileVersion mfc42.dll: 6.2.4131.0
================================================================================

================================================================================
ERROR
--------------------------------------------------------------------------------
File:  d:\dev\projects\mp3tag\mtonlineselectdlg.cpp
Line:  88
Expression:	items.GetSize () != 0
LastError:	00000000 The operation completed successfully.

--------------------------------------------------------------------------------
CATCH
--------------------------------------------------------------------------------
File:  d:\dev\projects\mp3tag\mtonlineselectdlg.cpp
Line:  127
================================================================================

================================================================================
ERROR
--------------------------------------------------------------------------------
File:  d:\dev\projects\mp3tag\mtonlineselectdlg.cpp
Line:  88
Expression:	items.GetSize () != 0
LastError:	00000000 The operation completed successfully.

--------------------------------------------------------------------------------
CATCH
--------------------------------------------------------------------------------
File:  d:\dev\projects\mp3tag\mtonlineselectdlg.cpp
Line:  127
===============================================================================

and this is my code in jukeon.src:

[Name]=jukeon
[BasedOn]=http://music.jukeon.com
[IndexUrl]=http://search.jukeon.com/?ks=&kk=4&kw=%s
[AlbumUrl]=http://music.jukeon.com/album.nwz
[WordSeperator]=+
[IndexFormat]=%_url%|%album%|%artist%
[SearchBy]=%album%

[ParserScriptIndex]=...

# ###################################################################
# This script parses the artist's page for all releases
# by this artist.
#
# The output format is defined by IndexFormat above, which
# is used by the selection dialog
# ###################################################################

# Uncomment the following line if you want to write some debug output
debug "on" "c:\\\\debug_jukeon_index.out"

findline "http://boardr.jukeon.com"
do
  findline "http://music.jukeon.com/album.nwz"
  findinline "http://music.jukeon.com/album.nwz"
  sayuntil "">"
    say "|"
    
  findline "title=""
    findinline "title=""
    sayuntil "">"
    say "|"
    
    findline "artist"
  findline "title=""    
  findinline "title=""
    sayuntil "">"
    saynewline
while "</table></div>"

[ParserScriptAlbum]=...

# ###################################################################
# This script parses the albums page for all common information.
#
# The current output variable is set via the outputto command
# All these fields are used by the confirm online information dialog
# ###################################################################

# Uncomment the following line if you want to write some debug output
debug "on" "c:\\\\debug_jukeon_album.out"

# coverurl
outputto "coverurl"
findline "<table border=0 cellpadding=5 cellspacing=1 bgcolor="#DDD9D0">"
findinline "<img src='"
sayuntil "'"

# album
outputto "album"
findinline "title="
sayuntil ""

# artist
outputto "artist"
findline "artist_id"
findinline "title=""
sayuntil """

# year
outputto "year"
findline "¹ß¸ÅÀÏ"
findinline "<td>"
sayuntil "."

Do you have an idea, whats wrong about that? Should i send in a bug report?
Anyone else who got a tip for me? :slight_smile:

cu and thanks for reading!


#9

The error is because your web source didn't output any info. I've also noticed that there is no debug file created. This is because there are several syntax errors in your web source: please always escape quotes if you use them as parameter - instead of sayuntil "">" use sayuntil "">"
Best regards,
~ Florian


#10

hello!
i'm doing some mini steps forward. thanks to your tips, my script stopped crashing right in the beginning.
Could anyone with some higher skillz look over my little Do-While thing? I dont get it to repeat until . It stops right after 1 run. thanks in advance!

do
  findline "<td width=\"260"
  findinline "'album', "
  sayuntil ");"
  say "|"
    
  findinline "class=ser>"
  sayuntil "</a>"
  say "|"
    
  findline "<td width=\"200\""
  findinline "class=\"ser\">"
  sayuntil "</a>"
  saynewline
while "</table>"

and here is a snippet of the debug_index.out:


#11

The do...while thing is the most tricky part when building a custom web source. The while command acts like an if and therefore the text from the first parameter has to be exactly the text of the current internal cursor position.

This is not the case with your script. As you can see from the logfile, the current position is <td width="200" align=" and not so the loop ends.


#12

hi florian, thanks a lot for your quick reply.
i'm not sure what to do right now, but at least i know, where to look for. :slight_smile:
thanks again!
cu
Yo.

the do-while thing works now! thanks. but one more question: my output looks ok in the debug file, but in mp3tag, after searching when the screen pops up, where i could choose the correct album, the list remains blank. The program tells me to chose my album, but the albums arent listed there. the end of my output file looks like this:
Total output:
 output["Output"]= "15122|1Áý - Good Day And Good Bye|¸¶¾ß
17097|GOOD BYE ù¾Ñû (Single)|Matsuura Aya
10460|GOODBYE AND GOOD LUCK (Single)|The Brilliant Green
5105|ù¾ªÎéØê¦ - time to say <b>good</b>-<b>bye</b> (Single)|L'Arc-en-Ciel
3299|Good-<b>bye</b> My Loneliness (Single)|ZARD
3266|Good-<b>bye</b> My Loneliness (Album)|ZARD
21717|Good Bye, Lenin!£¯±Â¹ÙÀÌ, ·¹´Ñ!|Yann Tiersen
"
 output["Error"]= "<OK>"

anyone got another hint for me? :slight_smile:

i just noticed something strange: If i query for an album without any korean fonts, it works. Could it be, that the korean font is the problem? Is there any possibility for that to be fixed? thanx in advance best regards