CLI filename format with empty values
Posted: 04 Mar 2024, 00:42
I have been using filebot for a couple of years to rename downloaded files successfully, but there's one thing I just can't figure out. How can I build a format template that properly names things with imdb tags even if the item doesn't exist in IMDB? I'm trying to get filebot to name files the same way that Sonarr does.
For example, here are a couple of directory names for shows I download weekly from NHK World's streaming service:
The problem I'm running into is that {"{imdb-$imdbid}"} does the right thing if $imdbid is set, but if it isn't it leaves out the whole string. I've tried various assortments of braces and quoting to get it to give me {imdb-} if the value isn't set, and I just can't come up with anything that works.
Can anyone tell me the obvious thing I'm missing that will make this work the way I want it to?
Thanks!
For example, here are a couple of directory names for shows I download weekly from NHK World's streaming service:
- Dive In Tokyo (2022) {imdb-}
- Japan's Top Inventions (2018) {imdb-tt15031708}
Code: Select all
filebot -rename -non-strict --db TheTVDB --format '{ny} {"{imdb-$imdbid}"}/Season {s.pad(2)}/{ny} - {s00e00} - {t} [{vf}]{[hdr]}[{ac} {channels}]{[vc]}{-group}' --output /media/video/TV/ 'Dive in Tokyo - S03E03 Dive in Tokyo - Yotsuya - Echoes of Old Edo.mp4'
filebot -rename -non-strict --db TheTVDB --format '{ny} {"{imdb-$imdbid}"}/Season {s.pad(2)}/{ny} - {s00e00} - {t} [{vf}]{[hdr]}[{ac} {channels}]{[vc]}{-group}' --output /media/video/TV/ 'Japan'\''s Top Inventions - S07E03 Japan'\''s Top Inventions - Cultured Pearls ⧸ Casting Systems.mp4'
Can anyone tell me the obvious thing I'm missing that will make this work the way I want it to?
Thanks!