home *** CD-ROM | disk | FTP | other *** search
- {!%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
- }
- program Advanced_folder_rules;
-
- const
- _MiscFolder = '0-9 & Misc'; // mine is '0-9 & Misc'
-
- var
- sTmp: string;
- begin
-
- // phase 1 loop trough entries and adjust values as needed
- re_Init( false );
- repeat
- sTmp := re_getLevel( 2 );
- if UpperCase( Copy( sTmp, 1, 4 ) ) = 'THE ' then begin // remove 'the'
- re_setLevel( 1, Copy( sTmp, 5, 1 ) );
- re_setLevel( 2, Copy( sTmp, 5, 9999 ) );
- end;
-
- if Pos( Copy( sTmp, 1, 1 ), '1234567890.''' ) > 0 then begin // move all those artists to custom folder
- re_setLevel( 1, _MiscFolder );
- end;
-
- sTmp := re_getLevel( 4 );
- if UpperCase( sTmp ) = 'SOUNDTRACK' then begin // special genre
- re_setLevel( 1, _MiscFolder );
- re_setLevel( 2, 'Soundtracks' );
- end;
- re_removeLevel( 4 ); // remove the level, it used only to check genre
-
- sTmp := Trim( re_getLevel( 3 ) );
- if sTmp = '-' then begin // missing year AND album tags
- re_removeLevel( 3 );
- end;
- until not re_Skip;
-
- // we have to do the count of files per folder here because the structure may have been altered above
- // phase 2 get count and loop trough entries and remove level if we must
- re_Init( true );
- repeat
- if re_getCount = 1 then begin // no year - album structure for just one song
- re_removeLevel( 3 ); // if level 3 was removed before it will not do anything
- end;
- until not re_Skip;
-
- // we have to do the re-count of files per folder here because the structure may have been altered above
- // phase 3 get count and loop trough entries and remove level if we must
- re_Init( true );
- repeat
- if re_getCount = 1 then begin // no Artist folder for just one song put it in the root letter folder ( A B C ... )
- re_removeLevel( 2 );
- end;
- until not re_Skip;
-
- end.
-