Differentiate Rename patterns

Tags: #<Tag:0x00007f75683f4d48> #<Tag:0x00007f75683f4c80>

Hi all,
i’m happy Fedora user and i use massively Picard which is very useful and powerful program.
I have my preferred settings tuned up on the renaming section, plus few lines in a script.
What i would make is to have 2 possibilities for renaming files.
Example: i have full CD of my preferred band, for this files i use one rename pattern.
For sparse tracks, i would like to rename files with some like %artist% - %title% instead of full releases renamed with %artist%/%date% - %album%/%tracknumber% - %title%.

I can’t figure how can achieve this.
Sorry for my english, i hope this thread can be understood.
Regards!

1 Like

I do this sort of thing automatically in my naming script, selecting different naming formats based on different criteria. My script can be found in my repository on GitHub. If you have any questions, please don’t hesitate to ask.

You can also select the naming format manually by including the code for the different formats in separate scripts, saving the path and filename to separate variables (e.g.: %_filepath% and %_filename%), and then have a simple naming script as:

$if2(%_filepath%,%albumartist%/%album%)/$if2(%_filename%,%tracknumber% - %title%)
3 Likes

Thank you! Very helpful

1 Like

At this moment i have nothing in script section and my naming rule is:

$set(title,$replace(%title%,…,…))
$set(album,$replace(%album%,…,…))
$set(discsubtitle,$replace(%discsubtitle%,…,…))
$set(_nomeartista,$if2(%albumartist%,%artist%))
$set(_nomeartista,$replace(%_nomeartista%,…,…))
$set(_anno,$left($if2(%originalyear%,%originaldate%,%date%),4))
$set(discnumber,$if($gt(%totaldiscs%,1),$num(%discnumber%,2)))
$if($eq([non-album tracks],%album%),
%_nomeartista%/non-album_tracks/%_nomeartista% - %title%,
%_nomeartista%/
%_anno% - %album%/$if($gt(%totaldiscs%,1),$if(%discsubtitle%,CD #%discnumber%։ %discsubtitle%, CD #%discnumber%))/
$num(%tracknumber%,2). %title%)

Tryng to follow your suggestion, i think is possible to add initial line like:
set(%_SparseTrack%,sparse)
for define arbitrary variable to group songs, and after annidate another $if cycle for choose naming rule.
But it not works

Okay, let’s see if this helps make it a bit clearer…

Change your file naming script to something like:

$noop(
    This script will use the default file naming style
    unless the variable %_format_type% has been set to
    "sparse".  This would be done in a tagging script,
    either enabled when the desired tracks are loaded
    or executed manually for the desired tracks once
    they have been matched in the right-hand pane.
)

$noop( Do common processing here. )
$set(title,$replace(%title%,…,…))
$set(album,$replace(%album%,…,…))

$noop( Test to see if sparse formatting has been selected. )
$if($eq(%_format_type%,sparse),

$noop( File naming style for "sparse". )
%artist% - %title%
,

$noop( Default file naming style. )
$set(discsubtitle,$replace(%discsubtitle%,…,…))
$set(_nomeartista,$if2(%albumartist%,%artist%))
$set(_nomeartista,$replace(%_nomeartista%,…,…))
$set(_anno,$left($if2(%originalyear%,%originaldate%,%date%),4))
$set(discnumber,$if($gt(%totaldiscs%,1),$num(%discnumber%,2)))
$if($eq([non-album tracks],%album%),
%_nomeartista%/non-album_tracks/%_nomeartista% - %title%,
%_nomeartista%/
%_anno% - %album%/$if($gt(%totaldiscs%,1),$if(%discsubtitle%,CD #%discnumber%։ %discsubtitle%, CD #%discnumber%))/
$num(%tracknumber%,2). %title%)
)

Then create a tagging script like:

$set(_format_type,sparse)

Only enable or run this tagging script when you want the files to be saved using your “sparse” format.

When your naming script runs (when you save the files), it will use the full naming format by default, unless you have run the tagging script to set the variable %_format_type% to the value “sparse”, in which case it will use the “sparse” naming format.

2 Likes

Works perfectly! Thank you very much for help.

1 Like