Vinyl detection Function, how to?


#1

Hello,

I have a problem with a function, i would use %musicbrainz_tracknumber% for vinyl only and i have many functions:

$noop(################ MULTIDISC FUNCTION ################)
$noop(MultiDisc Disabled)
$set(MultiDisc0,)
$noop(MultiDisc= album/Disc 1 | disc 2/discnumber- tracks.ext)
$set(MultiDisc1,$if($gt(%totaldiscs%,1),Disc $num(%discnumber%,1)/)
$noop(MultiDisc= album/discnumber- tracks.ext)
$set(MultiDisc2,$if($gt(%totaldiscs%,1),%discnumber%-,)))
$noop(################ END OF MULTIDISC FUNCTION ################)

$noop(################ FILE NAME OPTIONS ################)
$noop(PreTitle Disabled)
$set(PreTitle0,)
$noop(PreTitle = artist - album - [title.ext])
$set(PreTitle1,$replace($rreplace(%albumartist% - %album% -,[_:*?"<>|], -),?,))

$set(Track0,)
$set(Track2,$num(%tracknumber%,2) - )
$noop( tracknumber on 1 digit)
$set(Track1,$num(%tracknumber%,1) - )
$set(Track3,$num(%discnumber%,1)-$num(%tracknumber%,2) - )
$noop( tracknumber and discnumber 2 diggits)
$set(Track4,$num(%discnumber%,2)-$num(%tracknumber%,2) - )
$set(Title,$replace($rreplace(%title%,[_:*?"<>|],),?,))
$noop(################ END OF FILE NAME OPTIONS ################)

$noop(################ CHOOSE OPTIONS ################)
%MultiDisc2%%PreTitle0%%Track1%%Title%
$noop(/2-09- Sing My Song.Flac)
$noop(################ END OF OPTIONS ################)

And i would implemented Vinyl’s detection:

$noop(Is it Vinyl?)
$if($in(%media%,Vinyl),$set(_isVinyl,1)
$noop(Vinyl Detection Disabled)
$set(VinylDetect0,)
$noop(Vinyl Detection Enabled)
$set(VinylDetect1,$if($eq(%_isVinyl%,1)%_musicbrainz_tracknumber%))
$noop(################ CHOOSE OPTIONS ################)
%VinylDetect1%%MultiDisc2%%PreTitle0%%Track1%%Title%
$noop(Vinyl/C4.2-09- Sing My Song.Flac)
$noop(################ END OF OPTIONS ################)

I try many solutions:

$if($eq(%_is,Vinyl%1),$unset(%MultiDisc2%))
$if($eq(%_is,Vinyl%1),$unset(%Track1%))
$noop(and many many manyyyyyy other, not work propely)

But i don’t know how to disable %MultiDisc2% and %Track1% functions for Vinyl disc only, I have no more ideas.


#2

How about

$if($eq(%_isVinyl%,1),do vinyl processing here, do regular processing here)

or

$if($eq(%_isVinyl%,1),$set(MultiDisc2,0)$set(Track1,0),)

or

$if($eq(%_isVinyl%,1),$unset(MultiDisc2)$unset(Track1),)

Note that you should omit the percent signs when doing the $unset() function.


#3

Thank you so much, but not fully working because my script have multiple parameters:

$set(VinylDetect1,$if($eq(%_isVinyl%,1),$unset(MultiDisc2)$unset(Track1)%_musicbrainz_tracknumber%,))

%VinylDetect1% %MultiDisc2% %PreTitle0% %Track1% %Title%

Capture%20d'%C3%A9cran%20de%202018-06-05%2020-22-17
This poses a problem, if the user changes the %multidisc2% parameter to %Multidisc1%, it will not work anymore.
BUT your answer gave me an idea, I will change my mind, rather than adding a feature, I will change the %MultiDisc*% and %Track*% choices, With and Without Vinyl detection.


#4

I admit that I didn’t go through your code in detail, but only tried to address the specific question. If I misunderstood, I apologize for the confusion. Glad that my ramblings at least sparked the idea of a possible solution for you. :slightly_smiling_face: