INTERACT FORUM
More => Old Versions => JRiver Media Center 30 for Windows => Topic started by: wraith on September 18, 2024, 09:04:18 pm
-
Hi
I'm trying to create an expression that will rename my files in the format:
[Album] - [Track #] - [Artist] - [Name]
with any empty fields being excluded from the name [including the " - " between].
The expression I've created so far is:
listbuild(1, / -/ ,
[Album,0],
[Track #, 0],
[Artist,0],
[Name,0]
)
The above is, so far, working with the string fields but I'm getting stuck with the [Track #] field. The [Track #] field replaces an empty field with "00", and I would prefer it excluded. I understand, from my web, expression wiki and forum searches, this behaviour is by design. As such, I've played around with FormatNumber, Delimit etc. and can't get it to be excluded.
Would appreciate feedback on how to exclude the [Track #] field [and, I'm presuming, any other numeric fields].
Thanks in advance
-
Hi wraith, there are several ways. Try this one:
listbuild(1, / -/ ,
[Album],
if([Track #], [Track #],),
[Artist],
[Name]
)
This works by checking if [track #] is "false" (a zero value is false in the Expression Language).
-
Hi zybex.
Thanks for helping out.
Tried your suggestion and still outputting "00". I'm still hunting. Any other ideas?
-
Strange. The renaming tool does some weird things. Try:
listbuild(1, / -/ ,
[Album],
if(isempty([Track #]),,[Track #]),
[Artist],
[Name]
)
Or:
listbuild(1, / -/ ,
[Album],
if([Track #, 0], [Track #],),
[Artist],
[Name]
)
-
No luck. Both those options still output "00" :(
-
Well, let's try another way:
replace(listbuild(1, / -/ ,
[Album],
[Track #,0],
[Artist],
[Name]),- 00 -,-)
-
This should work also with RMC tool
listbuild(1, / -/ ,
[Album,0],
If(Compare([Track #],>,0),[Track #],),
[Artist,0],
[Name,0])
you can also add padding to track# make it look more clean in explorer
listbuild(1, / -/ ,
[Album,0],
If(Compare([Track #],>,0),PadNumber([Track #],2),),
[Artist,0],
[Name,0])
-
Hi Lepa,
The Compare function did the trick, thank you! :)
Hi Zybex,
Thanks for helping out, as well :)