Add source tag based on url if url is present in url field

Quite a simple task, that I want to do. I want to be able to partially match a domain such as spotify, deezer or qobuz from the url field and then set the source field based on the domain name. I know it would be a partial match search and not case-sensitive, but i dont know how that works when it comes to urls. I have tried using if or option, but when there is no url field, it fills in the wrong value, rather than web. This is my complete code below.

$if($not(%source%), $if($eq_any(%media%,Compact Disc,Copy Control CD,Data CD,DTS CD,Enhanced CD,HDCD,8cm CD,Blu-spec CD,SHM-CD,HQCD,CD+G,8cm CD+G,CD),$set(source,CD)) $if($eq_any(%media%,7" Vinyl,10" Vinyl,12" Vinyl,Flexi-disc,7" Flexi-disc,Vinyl),$set(source,Vinyl)) $if($eq_any(%media%,DVD-Audio,DVD-Video),$set(source,DVD)) $if($eq_any(%media%,Hybrid SACD,Hybrid SACD \(CD layer\),Hybrid SACD \(SACD layer\),SHM-SACD),$set(source,SACD)) $if($eq_any(%media%,Digital Media),$set(source,Web)) $if($eq_any(%encodedby%,Beatport),$set(source,Beatport)) $if($or(%url%,qobuz),$set(source,Qobuz)) $if($or(%url%,deezer),$set(source,Deezer)) $if($and($not(%source%),$ne(%media%,Unknown Format)),$set(source,Unknown Web)))

Try changing your last two lines from:

$if($or(%url%,qobuz),$set(source,Qobuz)) $if($or(%url%,deezer),$set(source,Deezer))
$if($and($not(%source%),$ne(%media%,Unknown Format)),$set(source,Unknown Web)))

to:

$if($in($lower(%url%),qobuz),$set(source,Qobuz)) $if($in($lower(%url%),deezer),$set(source,Deezer)) 
$if($and($not(%source%),$ne(%media%,Unknown Format)),$set(source,Unknown Web)))

and see if that does what you want. If not, then please provide a detailed description of what you’re trying to accomplish.

1 Like