by ZvezdanD » Tue Apr 21, 2009 1:59 am
Crow25 wrote:I get the impression that K1LL3M wants to only have the "Disc 1" and "Disc 2" if there is 2 discs in the compilation.
This could be done with the RegExp Find & Replace script - folders with the Disc Number will be created only if some song from the album has this field >=2; if all songs from the album have disc number = 1 or undefined then this folder will not be created. Here are settings for the first mentioned example (path\<AlbumArtist>\<year> - <Album>\<Disc#> - <Album>\ Track # & name):
Find what:
Code: Select all
(.+?)\\(.+)\\([^\\]+)\.([^\.\\]+)$
Into: Path
Regular expression 1: checked
Replace with:
Code: Select all
IIf(Len(oSongData.AlbumArtistName ) > 0 And Len(oSongData.AlbumName) > 0 And Len(oSongData.Title) > 0, "$1\My Music\" & SDB.Tools.FileSystem.CorrectFilename(oSongData.AlbumArtistName & "\" & IIf(oSongData.Year > 0, oSongData.Year & " - ", "") & oSongData.AlbumName & "\" & IIf(SQLQuery("SELECT Max(CAST(DiscNumber AS integer)) FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " GROUP BY IDAlbum") > 1, oSongData.DiscNumberStr & " - " & oSongData.AlbumName & "\", "") & IIf(Len(oSongData.TrackOrderStr) > 0, oSongData.TrackOrderStr & " - ", "") & oSongData.Title & ".$4"), "$&")
VBScript expression:checked
Here are settings for the second example (path\Adele - 19 - 2008\Disc 1\09. Adele - Make You Feel My Love.mp3):
Replace with:
Code: Select all
IIf(Len(oSongData.AlbumArtistName ) > 0 And Len(oSongData.AlbumName) > 0 And Len(oSongData.Title) > 0, "$1\My Music\" & SDB.Tools.FileSystem.CorrectFilename(oSongData.AlbumArtistName & " - " & oSongData.AlbumName & IIf(oSongData.Year > 0, " - " & oSongData.Year, "") & "\" & IIf(SQLQuery("SELECT Max(CAST(DiscNumber AS integer)) FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " GROUP BY IDAlbum") > 1, "Disc " & oSongData.DiscNumberStr & "\", "") & IIf(Len(oSongData.TrackOrderStr) > 0, oSongData.TrackOrderStr & ". ", "") & oSongData.ArtistName & " - " & oSongData.Title & ".$4"), "$&")
Instead of the $1\My Music\ you should specify your path. If you want the Track Numbers with two digits, you should write Right("0" & oSongData.TrackOrderStr, 2) & instead of oSongData.TrackOrderStr & (but not inside of the Len function). Of course, all of this would work as it should only if you have numeric Disc Numbers.
[quote="Crow25"]I get the impression that K1LL3M wants to only have the "Disc 1" and "Disc 2" if there is 2 discs in the compilation.[/quote]
This could be done with the RegExp Find & Replace script - folders with the Disc Number will be created only if some song from the album has this field >=2; if all songs from the album have disc number = 1 or undefined then this folder will not be created. Here are settings for the first mentioned example (path\<AlbumArtist>\<year> - <Album>\<Disc#> - <Album>\ Track # & name):
Find what: [code](.+?)\\(.+)\\([^\\]+)\.([^\.\\]+)$[/code]
Into: Path
Regular expression 1: checked
Replace with: [code]IIf(Len(oSongData.AlbumArtistName ) > 0 And Len(oSongData.AlbumName) > 0 And Len(oSongData.Title) > 0, "$1\My Music\" & SDB.Tools.FileSystem.CorrectFilename(oSongData.AlbumArtistName & "\" & IIf(oSongData.Year > 0, oSongData.Year & " - ", "") & oSongData.AlbumName & "\" & IIf(SQLQuery("SELECT Max(CAST(DiscNumber AS integer)) FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " GROUP BY IDAlbum") > 1, oSongData.DiscNumberStr & " - " & oSongData.AlbumName & "\", "") & IIf(Len(oSongData.TrackOrderStr) > 0, oSongData.TrackOrderStr & " - ", "") & oSongData.Title & ".$4"), "$&")[/code]
VBScript expression:checked
Here are settings for the second example (path\Adele - 19 - 2008\Disc 1\09. Adele - Make You Feel My Love.mp3):
Replace with: [code]IIf(Len(oSongData.AlbumArtistName ) > 0 And Len(oSongData.AlbumName) > 0 And Len(oSongData.Title) > 0, "$1\My Music\" & SDB.Tools.FileSystem.CorrectFilename(oSongData.AlbumArtistName & " - " & oSongData.AlbumName & IIf(oSongData.Year > 0, " - " & oSongData.Year, "") & "\" & IIf(SQLQuery("SELECT Max(CAST(DiscNumber AS integer)) FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " GROUP BY IDAlbum") > 1, "Disc " & oSongData.DiscNumberStr & "\", "") & IIf(Len(oSongData.TrackOrderStr) > 0, oSongData.TrackOrderStr & ". ", "") & oSongData.ArtistName & " - " & oSongData.Title & ".$4"), "$&")[/code]
Instead of the $1\My Music\ you should specify your path. If you want the Track Numbers with two digits, you should write Right("0" & oSongData.TrackOrderStr, 2) & instead of oSongData.TrackOrderStr & (but not inside of the Len function). Of course, all of this would work as it should only if you have numeric Disc Numbers.