Code: Select all
--format "/rootpath/{plex.tail} - part{di}"
Code: Select all
--format "/rootpath/{plex.tail} - part{di}"
Code: Select all
model.episode.count(episode)
Code: Select all
model.episode.count(episode) > 1 ? " - part$di" : null
Code: Select all
{plex.tail.derive{model.episode.count(episode) > 1 ? " - part$di" : null}}
Code: Select all
{plex.tail.derive{dc > 1 ? " - part$di" : null}}
Code: Select all
xxx/Season 02/xxx - S02E07 - Deutschland 93 - part.mkv
xxx/Season 02/xxx - S02E07 - Deutschland 93 - part.eng.srt
Code: Select all
{
plex.tail.derive{
def x = model.count{ [it.ext, it.episode] == [ext, episode] }
return x > 1 ? " - part$x" : null
}
}
I don't really understand this part.nls wrote: ↑23 Dec 2018, 18:05
- It detects duplicates on a global level, ignoring lower level data: series episodes in the same season are obvious candidates, while ones across different seasons/series are not. The issue is probably that duplicate detection data is not reset between such groups, so I end up with file names for all files in a large set such as these (note the " - part" at the end):
Thanks, I'll try this tomorrow.rednoah wrote: ↑23 Dec 2018, 20:28 1.
You can do a per-file extension duplicate index like so:Code: Select all
{ plex.tail.derive{ def x = model.count{ [it.ext, it.episode] == [ext, episode] } return x > 1 ? " - part$x" : null } }
Code: Select all
dc > 1 ? " - part$di" : null
Code: Select all
filename.eng.srt -> seriesname - SXEXX - title - part1.eng.srt
filename.ger.srt -> seriesname - SXEXX - title - part2.ger.srt
Code: Select all
filename.eng.srt -> seriesname - SXEXX - title.eng.srt
filename.ger.srt -> seriesname - SXEXX - title.ger.srt
Code: Select all
def x = model.count{ [it.ext, it.episode, it.lang] == [ext, episode, lang] }
Code: Select all
{
plex.tail.derive{
def key = { m -> [m.ext, m.episode, any{m.lang.ISO2}{null}] }
def keyEquals = { m -> key(m) == key(self) }
def dc = model.count(keyEquals)
def di = model.findIndexOf(keyEquals)
return dc > 1 ? " - part$di" : null
}
}
Code: Select all
{
plex.tail.derive{
def x = model.count{ [it.ext, it.episode, it.lang] == [ext, episode, any{m.lang.ISO2}{null}] }
return x > 1 ? \" - part\$di\" : null
}
}
Code: Select all
filebot --encoding UTF-8 -rename --db xattr --action symlink -non-strict --file-filter "f.xattr['net.filebot.metadata'] != null" --format "/targetdir/
{
plex.tail.derive{
def x = model.count{ [it.ext, it.episode, it.lang] == [ext, episode, any{m.lang.ISO2}{null}] }
return x > 1 ? \" - part\$di\" : null
}
}
" -r -script fn:renall "path1" "path2" ...
Code: Select all
--action /path/to/plex-link.sh
Code: Select all
#!/bin/sh -xu
ln -l "$1" "$2"
-non-strict is a leftover from copy-pasting my 1st pass command line. It might not do anything for the renaming pass generally, but as a coincidence it makes my filter work as intended. But I can change the command line by removing both options and according to your post it should just rename files having proper xattr attributes.The good news here is that your --file-filter doesn't do anything, and can be removed from the command, since --db xattr ignores non-xattr tagged files by default (unless -non-strict is set).
Very understandable.nls wrote: ↑26 Dec 2018, 11:15 So, I'll run the 2nd pass according to your hints and report back later. I was already thinking of coding a small script to do the 2nd pass renaming but I guess this is still manageable using filebot. This problem might be a corner case but I absolutely want to avoid manual renaming even for a few files and want to make an idempotent, repeatable process that needs no human intervention.
Code: Select all
#!/usr/bin/env filebot -script
args.eachMediaFolder{
rename(folder: it)
}
Code: Select all
sudo -u media filebot --encoding UTF-8 -rename --db xattr --action symlink --format "/target_root/
{
plex.tail.derive{
def x = model.count{ [it.ext, it.episode, it.lang] == [ext, episode, any{m.lang.ISO2}{null}] }
return x > 1 ? \" - part\$di\" : null
}
}
" -script fn:renall "source_root"