Getting ranking/tracknumbers from webpage to local tracks

Use this forum for everything concerning script usage
Post Reply
deep
Newbie
Newbie
Posts: 5
Joined: Fri Apr 11, 2014 4:06 pm

Getting ranking/tracknumbers from webpage to local tracks

Post by deep »

I have invidivual tracks (not full albums) and i want to sort them automatically in the order (ranking) like on a webpage (e.g. http://www.mix1.de/charts/singlecharts.htm)

I already have all those tracks in a local folder but the ranking / trackumbers are missing or are not identical.

So the 'track no' is the tag field that needs to be filled.

My tracks / filenames already have an identical or at least very similar "artist - title tag" like the website rankings...


Would be glad for help... Greets

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Getting ranking/tracknumbers from webpage to local track

Post by jtclipper »

Will check out the HTML and get back to you in the next few days

deep
Newbie
Newbie
Posts: 5
Joined: Fri Apr 11, 2014 4:06 pm

Re: Getting ranking/tracknumbers from webpage to local track

Post by deep »

Thx! I'm familiar with html, the Problem is the Pascal/Delphi...maybe i can help to adopt it to Website when you provide the scripting.

Greets

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Getting ranking/tracknumbers from webpage to local track

Post by jtclipper »

Here is a sample script that will capture the ranking and title from that webpage :

Code: Select all

{http://www.mix1.de/charts/singlecharts.htm}

{?
 ARTIST=FORM;search_text=%:str|btn=#:click
 ALBUM=FORM;search_text=%:str|btn=#:click
 TITLE=FORM;search_text=%:str|btn=#:click
/?}

Program Mix;
var
  slMain: TStringList;
  iRow: integer;

  //------
  procedure GetTracks;
  var
    sTitle, sTrack, sTmp: string;
  begin

    while on_FindRow( iRow, 0, '"Rank', slMain ) do begin

       sTmp := Copy( slMain[ iRow ], Pos( '"Rank', slMain[ iRow ] )+5, 999 );
       sTrack := Trim( Copy( sTmp, 1, Pos( '"', sTmp ) - 1 ) );

       sTmp := slMain.Strings[ iRow+9 ];
       sTitle := on_cleanHTMLLine( Copy( sTmp, 1, Pos( '</A>', sTmp )-1 ) );

       on_addTrack( sTrack+'r', sTitle, '', '' );
       Inc( iRow );

    end;
  end;

begin

  on_Init(1); // clear values

  slMain := TStringList.Create;
  try

    iRow := 0;
    on_loadHTML( slMain ); // load page to stringlist

    //slMain.SaveToFile( 'c:\1.htm' ); // save to a file to see what we have to deal with

    GetTracks;

  finally
    slMain.Free;
  end;
end.
In order to make this work you have to set a few things :

In the Online right panel click the 'use' button and select only 'Track'
I place an 'r' after each track, this is needed because if you use disjunctive numeric tracks the grid will correct them and place them in order, If you don't want the 'r' in the track field create a replacement matrix to replace it with an empty string and add it to the work flow selecting only the track field.
In the main grid, you will have to use the right click menu and the 'Auto apply matching tracks', so that the program searches for a title field match and then proceed to apply the values.

deep
Newbie
Newbie
Posts: 5
Joined: Fri Apr 11, 2014 4:06 pm

Re: Getting ranking/tracknumbers from webpage to local track

Post by deep »

Hey,

this is great and working! Many thanks dude!

Three more questions:

1. Is it possible to rename the local tracks directly with the rank-number in front of the filename? Currently the tracknr is just added to the id-tag...

2. Is is possible to turn the question if the found track matches with the local one off after selecting "Auto apply matchin tracks"? (Easier for multiple tracks)

3. If the page uses a code like the following:

Code: Select all

<table border="0" cellspacing="2" cellpadding="0" width="940">
<tr><td>
<table border="0" cellspacing="3" cellpadding="3" width="940">

<tr>
<td width="35" align="center" height="21"><b>Platz</b></td>
<td width="50" align="center" height="21"><b>VW</b></td>
<td width="105" align="center" height="21"><b>Woche</b></td>
<td width="750" align="left" height="21" colspan="3"><b>Artist - Titel</b></td>
</tr>




<tr>
<td width="35" align="center" height="25"><b>1</b></td>
<td width="50" align="center" height="25"><b>1</b></td>
<td width="105" align="center" height="25"><b>17.02.2014</b></td>
<td width="655" align="left" height="25">
Mr Probz - Waves (Robin Schulz Remix)</td>
</tr>


<tr>
<td width="35" align="center" height="25"><b>2</b></td>
<td width="50" align="center" height="25"><b>3</b></td>
<td width="105" align="center" height="25"><b>11.11.2013</b></td>
<td width="655" align="left" height="25">
Faul & Wad Ad Vs Pnau - Changes</td>
</tr>

What do i have to change in your script (apart from the url of course) to adopt it?

The Rank position is always after the html-code:

Code: Select all

<td width="35" align="center" height="25"><b>


and the Track - Title is always after the html-code:

Code: Select all

<td width="655" align="left" height="25">



Thanks again, greets

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Getting ranking/tracknumbers from webpage to local track

Post by jtclipper »

You cannot turn off the question but an online album panel script can be made.
You have to load and save the webpage from inside the script because the HTML might differ, post a link and I'll have a look.

yes you can rename the filenames just use %R% %F% as your rename format (it is located at the right bottom of the screen), this should appear in the 'if renamed column' , also make sure that you click the down arrow next to update and select both ( main grid toolbar ).

deep
Newbie
Newbie
Posts: 5
Joined: Fri Apr 11, 2014 4:06 pm

Re: Getting ranking/tracknumbers from webpage to local track

Post by deep »

jtclipper wrote: You have to load and save the webpage from inside the script because the HTML might differ, post a link and I'll have a look.
http://goo.gl/qdrtma


I will check the renaming :) Another panel script is too complicated just to turn the question off, but thanks :)

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Getting ranking/tracknumbers from webpage to local track

Post by jtclipper »

Here is the chart script

Code: Select all

{http://home.arcor.de/jay_dee/Charts.htm}

Program Chart;

var
  slMain: TStringList;
  iRow: integer;

  //------
  procedure GetTracks;
  var
    sTitle, sTrack, sTmp: string;
  begin

    while on_FindRow( iRow, 0, 'center><B>', slMain ) do begin

       sTmp := on_cleanHTMLLine( slMain[ iRow ] );
       if StrToIntDef( sTmp, -1 ) <> -1 then begin
          sTrack := sTmp + 'r';
          sTitle := on_cleanHTMLLine( slMain.Strings[ iRow+2 ] );
          sTitle := Trim( Copy( sTitle, Pos( '-', sTitle ) + 1, 999 ) );

          on_addTrack( sTrack, sTitle, '', '' );
       end;
       iRow := iRow + 3;
    end;
  end;

begin

  on_Init(1); // clear values

  slMain := TStringList.Create;
  try

    iRow := 0;
    on_loadHTML( slMain ); // load page to stringlist

    //slMain.SaveToFile( 'c:\1.htm' ); // save to a file to see what we have to deal with

    GetTracks;

  finally
    slMain.Free;
  end;

end.

deep
Newbie
Newbie
Posts: 5
Joined: Fri Apr 11, 2014 4:06 pm

Re: Getting ranking/tracknumbers from webpage to local track

Post by deep »

I didn't recognize the "update" button :) That was my mistake to rename it properly. Thanks!

This Script is working as well! You helped me a lot...

Post Reply