New mask functions

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: New mask functions

Re: Re:

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.

Re: New mask functions

by chrisjj » Mon Apr 20, 2009 11:54 pm

Auto-organize uses the music tag to produce the eventual file path and name.

Auto-organize doesn't use the music tag to mask the eventual file path and name.

Re:

by Crow25 » Mon Apr 20, 2009 9:25 pm

Seeker wrote:
K1LL3M wrote:Is there a way for these new mask to allow a variation in the tags such as an additional folder, with the disc number, to be added to the mask only if there is multiple discs

E.g.

If album has multiple disks, tag = path\<AlbumArtist>\<year> - <Album>\<Disc#> - <Album>\ Track # & name

Album is single disc - tag = path\<AlbumArtist>\<year> - <Album>\ Track # & name

If this is already available; could someone tell be how please :)
Does this work for you?

path\<AlbumArtist>\<year> - <Album>\$IF(<Disc#>,<Disc#> - <Album>$\,)Track # & name

note - I followed your convention - these won't work exactly correctly with mediamonkey rules.
I get the impression that K1LL3M wants to only have the "Disc 1" and "Disc 2" if there is 2 discs in the compilation. Many albums put a 1 in the disc metadata, even if there is only 1 disc producing...
Eg.
path\Adele - 19 - 2008\Disc 1\09. Adele - Make You Feel My Love.mp3
for that particular album it only contains 1 disc in total

However its tough because there is no metadata (that i know of) that describes the "total number of discs".
The closest i've got is

$If(<Disc#>>=2,Disc <Disc#>,)
Which only uses "disc 2" if there is second disc... however disc 1 is in the previous directory.

Re: New mask functions

by Crow25 » Mon Apr 20, 2009 9:16 pm

chrisjj wrote:As an aside, could someone explan why these are called 'mask' functions? I can see no masking! :)
Auto-organize uses the music tag to mask (produce) the eventual file path and name.

Re: New mask functions

by chrisjj » Sun Mar 30, 2008 8:27 pm

As an aside, could someone explan why these are called 'mask' functions? I can see no masking! :)

by spacefish » Sun Mar 30, 2008 1:25 pm

Teknojnky wrote:Its like math, the innermost parenthesis evaluate first.
I suck at math! :)

by Teknojnky » Sun Mar 30, 2008 12:05 pm

Its like math, the innermost parenthesis evaluate first.

by spacefish » Sun Mar 30, 2008 8:10 am

Lovely! Thank you. I feel pretty dense for not trying that. :P

I guess after looking at it, I do see a logic to the order. I want to move the prefix (#1) for the first (#2) item. Well, some sort of logic anyway. Thanks for the help! :)

by MoDementia » Sun Mar 30, 2008 7:21 am

Try it the other way round

Code: Select all

E:\Music\($MovePrefix($First(<Album Artist>))\<Album>\

by spacefish » Sun Mar 30, 2008 5:52 am

I was trying to make a mask that would use the first album artist and move the prefix but it doesn't seem to work properly. I'm probably doing it wrong but perhaps it's not possible?

Album Artist = DJ Vadim; Prime Cuts

using the mask

Code: Select all

E:\Music\$First($MovePrefix(<Album Artist>))\<Album>\
just removes the prefix, it doesn't move it:

Code: Select all

E:\Music\Vadim\Architects of the Great\
It should look like this:

Code: Select all

E:\Music\Vadim, DJ\Architects of the Great\
$MovePrefix works properly otherwise, just not with $First.

by benzo8 » Tue Mar 25, 2008 10:16 am

OK, using Petr's fixed .1147 binary, the following now works as expected:

Code: Select all

d:\albums\$Group($RemovePrefix(<Album Artist>),1)\<Album Artist>\<Album>\$if(<Track#>,<Track#>. ,)<Title> - <Artist>
Thanks for the help guys...

by benzo8 » Tue Mar 25, 2008 4:12 am

Thanks - I thought I'd tried $First, but maybe I did it wrong. Anyhow, I've gone back to .1140 for the time being - too many showstopper crashes in .1147 for my liking at the moment. I'll play with the new mask functions again when a more stable build is released.

by jiri » Tue Mar 25, 2008 3:53 am

$Group() or $Left(,1) functions should help you (for one letter they do actually the same).

Jiri

by benzo8 » Tue Mar 25, 2008 3:43 am

The $RemovePrefix and $MovePrefix don't appear to handle <Field:x> format:

ie: (where <Album Artist> = "The Fratellis")

$MovePrefix(<Album Artist>) returns "Fratellis, The" as expected
$MovePrefix(<Album Artist:1>) returns "T".

Obviously, the $MovePrefix is being applied after the string reduction, so, in effect, there's no prefix to move. So, how can I finesse this to return "F", as required?

I've tried using $First, as in:

$First($MovePrefix(<Album Artist>),1) returns "Fratellis, The"

Any ideas?

Re: New mask functions

by drjboulder » Tue Mar 25, 2008 2:34 am

MoDementia wrote:I'm Guessing this should work

Code: Select all

C:\Users\Drock\Music\MP3s\$MovePrefix(<Artist>)\<Year> - <Album>\<Artist> - <Album> - <Track#> - <Title>
Yeah, thanks Mode, that was it.
:oops: Do not know why I have so much trouble with masks!

Top