Organize & Multi Disc Scripts

Use this forum for everything concerning script usage
Post Reply
jhedlun
Newbie
Newbie
Posts: 7
Joined: Fri Feb 04, 2011 10:28 pm

Organize & Multi Disc Scripts

Post by jhedlun »

Also I am pretty proud of my Organize script I made! and I will put it up for people to copy if they like.
It will reorg by genre then artist, year and album , then the file ( wich I have just as track - Song title. I adapted %E to be where I got it from - ie CD, itunes, friend, other, library
If you place "_Artist name" in the URL tag it will also move that set of mp3s to be with that artist - like a tribute album to that band under "User Appended"
It will also reorder soundtracks differently - by putting in the album first and then the year. Place "Soundtrack" in the type field or name the genre "soundtrack"
and singles it changes the format too for order. Place "Singles" in the "type" field
Last it will create any various artist albums under a VA folder. Place "VA" in the "type" field
Anyway it can be adapted pretty easily to other setup orders. Shows how to bring different sets of genres to one folder to.
Enjoy:

Code: Select all

{!%G%|%A%|%Y% - %L% - %E%|%XY%|%Y%|%L%|%W%|%E%}

//   {!%A:1|%A|%Y - %L|%G}
// the first line contains the folder structure and is dynamically used upon script execution, it is optional

{
  sample script to force special folder rules
  the folder structure defined is the following :
  %A , 1   - artist first letter
  %A       - artist
  %Y - %L  - year album
  %G       - dummy genre level, The %G variable is only used as an example of how to check for other values
  %XY      - type
  %W       - URL
}
program Advanced_folder_rules;

const
  _MiscFolder = 'VA'; // mine is '0-9 & Misc'

var
  sTmp: string;
  sTmp2: string;
  sTmp3: string;
begin

  // phase 1 loop through entries and adjust values as needed
  re_Init( false );
  repeat
    sTmp3 := re_getLevel(8 );
    if sTmp3 + '-' =  '-' then begin // see if genre is missing
       re_setLevel(3,re_getLevel( 5 ) + ' - ' + re_getLevel( 6 ));
       stmp3 := ''
    end else begin
       stmp3 := ' - ' + stmp3
    end;

    sTmp := re_getLevel(1 );
    if sTmp + '-' =  '-' then begin // see if genre is missing
       re_setLevel( 1, 'MISSING' );
    end;
    // check for Various Artists in 'Type' field  use VA   Don't use on Soundtrack genre files - assumed to be VA
    sTmp := re_getLevel(4);
    sTmp2 := '0';
    if UpperCase( sTmp ) = 'VA' then begin // VA type
       re_setLevel(3,re_getLevel( 6 ) + ' - ' + re_getLevel( 5 ) + stmp3)
       re_setLevel( 2, '+Various Artists' );
    end;
    if UpperCase( sTmp ) = 'VARIOUS ARTISTS' then begin // VA type
       re_setLevel(3,re_getLevel( 6 ) + ' - ' + re_getLevel( 5 ) + stmp3)
       re_setLevel( 2, '+Various Artists' );
    end;
    sTmp := re_getLevel(4);
    if UpperCase( sTmp ) = 'SINGLES' then begin // singles
       re_setLevel( 2,re_getLevel (1) );
       re_setLevel(1, 'Singles')
       re_removeLevel( 3 );
       re_removeLevel( 3 );
       re_removeLevel( 3 );  re_removeLevel( 3 );
    end;

    sTmp := re_getLevel(1);
    if UpperCase( sTmp ) <> 'SOUNDTRACK' then begin // keep soundtrack related out of loop
       sTmp := re_getLevel(7);
       if sTmp <> '' then begin //get special directory and create first ' say you want CD Y by artist J in with artist K - put the artist name with a underscore in front of it
                                // in the tagging type field to get it moved
          if UpperCase( Copy( sTmp, 1, 1 ) ) = '_' then begin // remove 'the'
             re_setLevel(4,re_getLevel(2));
             re_setLevel( 2, Copy( sTmp, 2, 9999 ) );
             If sTmp = '_Singles' then begin
                re_setLevel( 2,re_getLevel (1) );
                re_setLevel(1, 'Singles')             // dont use URL for singles use TYPE
                re_removeLevel( 3 );
                re_removeLevel( 3 );
                re_removeLevel( 3 );  re_removeLevel( 3 );
             end else begin;
                re_addLevel( re_getLevel (3));
                re_setLevel( 3,'+User Appended' );
                sTmp2 := '1';
             end;
          end;
       end;
    end;
    
    sTmp := re_getLevel(1)
    if UpperCase( sTmp ) = 'EASY LISTENING' then begin // special genre
       re_setLevel( 1, 'Light' );
    end;
    if UpperCase( sTmp ) = 'INDUSTRIAL' then begin // special genre
       re_setLevel( 1, 'Industrial and Punk' );
    end;
    if UpperCase( sTmp ) = 'METAL' then begin // special genre
       re_setLevel( 1, 'Industrial and Punk' );
    end;
    if UpperCase( sTmp ) = 'PUNK' then begin // special genre
       re_setLevel( 1, 'Industrial and Punk' );
    end;
    if UpperCase( sTmp ) = '70S' then begin // special genre
        re_setLevel( 1, '60s and 70s' );
    end;
    if UpperCase( sTmp ) = '60S' then begin // special genre
       re_setLevel( 1, '60s and 70s' );
    end;
    if UpperCase( sTmp ) = 'TECHNO' then begin // special genre
       re_setLevel( 1, 'Dance' );
    end;
    if UpperCase( sTmp ) = 'ALTERNATIVE' then begin // special genre
       re_setLevel( 1, 'Alternative & Rock' );
    end;
    if UpperCase( sTmp ) = 'ROCK' then begin // special genre
       re_setLevel( 1, 'Alternative & Rock' );
    end;
    if UpperCase( sTmp ) = 'ACID JAZZ' then begin // special genre
       re_setLevel( 1, 'Swing Blues Jazz' );
    end;
    if UpperCase( sTmp ) = 'SWING' then begin // special genre
       re_setLevel( 1, 'Swing Blues Jazz' );
    end;
    if UpperCase( sTmp ) = 'BLUES' then begin // special genre
       re_setLevel( 1, 'Swing Blues Jazz' );
    end;
    if UpperCase( sTmp ) = 'JAZZ' then begin // special genre
       re_setLevel( 1, 'Swing Blues Jazz' );
    end;

    //   1  2    3      4   5   6   7
    //{!%G|%A|%Y - %L|%XY |%Y |%L |%W}
    if UpperCase( sTmp ) = 'SOUNDTRACK' then begin // special genre
       sTmp := re_getLevel(7 );
       if UpperCase( Copy( sTmp, 1, 1 ) ) = '_' then begin // remove 'the'
          re_setLevel( 2, Copy( sTmp, 2, 9999 ) );
          re_removeLevel( 4 );
          re_removeLevel( 4 );
          re_removeLevel( 4 );
          re_removeLevel( 4 );
       end else begin
          re_removeLevel( 4 );
          re_setLevel(2,re_getLevel( 5 ) + ' - ' + re_getLevel( 4 ) + stmp3)
          re_removeLevel( 3 );
          re_removeLevel( 3 );
          re_removeLevel( 3 );
          re_removeLevel( 3 );
       end;
       re_setLevel(1, 'Soundtracks')
    end;

    if sTmp2 <> '1' then begin
       re_removeLevel( 4 ); // remove the level, it used only to check genre
       re_removeLevel( 4 ); // remove the level, it used for year get
       re_removeLevel( 4 ); // remove the level, it used for album get
       re_removeLevel( 4 ); // remove the level, it used for URL get
    end else begin
       re_removeLevel( 5 );
       re_removeLevel( 5 );
       re_removeLevel( 5 );
       re_removeLevel( 5 );
    end;
    sTmp := Trim( re_getLevel( 3 ) );
    if sTmp = '-' then begin // missing year AND album tags
       re_removeLevel( 3 );
    end;
  until not re_Skip;

end.

jhedlun
Newbie
Newbie
Posts: 7
Joined: Fri Feb 04, 2011 10:28 pm

Re: Disc

Post by jhedlun »

This one quick formats the Cds track number from 01 with Disk 1&2,2&2 sets tracks from 01,02 to 101,102,201,301, etc format according to the Disk - works great when burning CDs from EAC as it puts it in when it sees a set.
Simple appending script but I saw a lot of people asking for it or similar. Makes it so easy on a 7 disc set to hit one macro and bamm all your CDs are sorted out again.
Format = Disc # + track #

Code: Select all

program FixDisc_number_for_multidisc;

var
  sTmp: string;
  bUpdated: boolean;

begin

  if not tg_Init then exit; // no rows get out

  repeat
   bUpdated := false;
   sTmp := tg_GetField( 'Disk' );


     sTmp:= Trim( Copy( sTmp, 1, 1 ) )
     if Length( sTmp + tg_GetField( 'Track' ) ) = 3 then begin
        tg_setField( 'Track', sTmp + tg_GetField( 'Track' ) );
        tg_setField( 'Title',tg_GetField( 'disk' )  );
        bUpdated := true;
     end;
 
    if bUpdated then begin
       tg_setSkip( false );
       tg_SetResult( 'OK' );
    end else begin
       tg_setSkip( true );
    end;

  until not tg_Skip;

end.
And this one does the renaming scripting for soundtrack singles and normal automatically.

Code: Select all

program Fixname;

var
  sTmp: string;
  sExt: string;
  bUpdated: boolean;
//soundtrack settting

begin

  if not tg_Init then exit; // no rows get out

  repeat

    bUpdated := false;
    sTmp := tg_getfield( 'RENAME' );

    begin
      tg_Loadfile;
      sExt := '.' + gtag.FileExt
      If ((gTag.Type_ = 'Soundtrack') or (gTag.Type_ = 'VA')  or (gTag.Genre = 'Soundtrack') or (gTag.Type_ = 'Various Artists')) then begin
         sTmp := gTag.TrackF  + ' - ' + gTag.Artist2 + ' - ' + gTag.Title2;
      end;
  
      If ((gTag.Type_ = 'Soundtrack') or (gTag.Type_ = 'VA')  or (gTag.Genre = 'Soundtrack') or (gTag.Type_ = 'Various Artists')) then begin
         sTmp := gTag.TrackF  + ' - ' + gTag.Artist2 + ' - ' + gTag.Title2;
      end else if (gTag.Type_ = 'Singles')   then begin
         sTmp := gTag.Artist2 + ' - ' + gTag.Title2
      end else if (gTag.Genre = 'Audio Book')   then begin
         sTmp := gTag.Artist2 + ' - ' + gTag.Album2 + ' - ' + gTag.TrackF
      end else begin;
         sTmp := gTag.TrackF  + ' - ' + gTag.Title2
      end;
    
      sTmp := sys_RemoveIllegalChars( sTmp );
      sTmp := sys_ApplyCase(sTmp,3 );
      sTmp := sys_ApplyMatrix(sTmp,0 );
      sTmp := sTmp + sys_ApplyCase(sExt,2 );//+ sExt ;
      tg_setfield( 'Rename' , sTmp );
      bUpdated := true;
    end;
  
    if bUpdated then begin
       tg_setSkip( false );
       tg_SetResult( 'OK' );
    end else begin
       tg_setSkip( true );
    end;
    sTmp := ''
  until not tg_Skip;

end.

Post Reply