Page 1 of 1

Add .partN to episode duplicates

Posted: 03 Jan 2020, 14:13
by Silke79
Have a little problem with my TV-series script when it come to naming episodes that there are more then one part of.

For example how it may look like before:
TV-Serier/TV-series Name/Season XX/TV-series name.s01e01.part1.mkv
TV-Serier/TV-series Name/Season XX/TV-series name.s01e01.part2.mkv


So it would look like this after:
TV-Serier/TV-series Name/Season XX/TV-series name - S01E01 - #0001 - Episode name - [1920x1080] [1080p - x264] [AC3 - 6ch] [2020-01-01] part1.mkv
TV-Serier/TV-series Name/Season XX/TV-series name - S01E01 - #0001 - Episode name - [1920x1080] [1080p - x264] [AC3 - 6ch] [2020-01-01] part2.mkv


And so it works with plex too.

This is the script I use now and would like to work when a episode are more then one part too.

Code: Select all

/TV-Serier/{az}/{(n == primaryTitle ? ny : ny + ' (' + primaryTitle + ')').colon(' - ')}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n.colon(' - ').lowerTrail()} - {s00e00} {'- #' + absolute.pad(4)} - {t.colon(' - ').lowerTrail()} - [{resolution}] [{vf} - {vc}] [{ac} - {af}] [{airdate}]{'.'+lang}

Re: Plex Naming Schemes

Posted: 03 Jan 2020, 14:24
by rednoah
I recommend using {plex} which adheres to the Plex Naming Standard:
https://support.plex.tv/articles/naming ... how-files/

:!: All the customizations you have, make files less compatible with Plex. Might work. Might not. But it's certainly not what the documentation says. Please join the Plex forums for details on what naming works best for Plex, and what kind of customizations are within reason without tripping Plex.

Re: Plex Naming Schemes

Posted: 03 Jan 2020, 14:58
by Silke79
It works in my Plex if the file looks like this and it will put it together as one episode in Plex.

TV-Serier/TV-series Name/Season XX/TV-series name - S01E01 - #0001 - Episode name - [1920x1080] [1080p - x264] [AC3 - 6ch] [2020-01-01] part1.mkv

TV-Serier/TV-series Name/Season XX/TV-series name - S01E01 - #0001 - Episode name - [1920x1080] [1080p - x264] [AC3 - 6ch] [2020-01-01] part2.mkv


But as my script works now I need to do the first part and then go to the folder and file and add on the end partX and then rename the next part after that.

So my question is if one can add to the script when it shows this typs of files of episodes so it will do the works, but then it is not that often I have seen a episode that are two or more files for one episode and are not often one has to fix it manually.

Re: Plex Naming Schemes

Posted: 03 Jan 2020, 15:09
by rednoah
Can you provide sample files for testing? And example destination paths you would like for these files?

Re: Plex Naming Schemes

Posted: 03 Jan 2020, 15:11
by Silke79
How do you mean more then what I have posted here?

Re: Plex Naming Schemes

Posted: 03 Jan 2020, 15:13
by rednoah
:?: Presumably, the problem is that both "parts" get matched to the same episode, and formatted to the same destination path, meaning you can't have both files? Correct?

:arrow: You could use fn.match() to match arbitrary bits and pieces from the current file name, and preserve that in the destination file path:

Code: Select all

fn.match(/part[1-9]/)


:idea: Well, generally speaking, without sample files, or at least file names, I can't try it myself, so I can't run tests to reliably figure out what is and isn't working correctly. While the problem may be clear and obvious to you, there is plenty of room for ambiguity on my end when I read your post: viewtopic.php?t=1868

Re: Plex Naming Schemes

Posted: 03 Jan 2020, 15:21
by Silke79
You mean like this and were I after manually add partX at the end of the media file?

Image
Image

Re: Plex Naming Schemes

Posted: 03 Jan 2020, 15:22
by Silke79

Code: Select all

TV-Serier\L\The Lady Musketeer (2006)\Season 01\The Lady Musketeer - S01E01 - Episode 1 - [704x512] [480p - XviD] [MP3 - 2ch] [2006-04-14] part1.avi
TV-Serier\L\The Lady Musketeer (2006)\Season 01\The Lady Musketeer - S01E01 - Episode 1 - [704x512] [480p - XviD] [MP3 - 2ch] [2006-04-14] part2.avi

Re: Plex Naming Schemes

Posted: 03 Jan 2020, 18:00
by kim
looks like your files are named wrong, so rename the "part 2" file to S01E02

Code: Select all

The Lady Musketeer - S01E02 - Episode 2 - [704x512] [480p - XviD] [MP3 - 2ch] [2006-04-14] part2.avi
... and Filebot does not know your files are multipart
S01E01 Episode 1 April 14, 2006 85
S01E02 Episode 2 April 14, 2006 85
https://thetvdb.com/series/the-lady-mus ... official/1

@rednoah

Code: Select all

{pi}
does not work in episode mode and I don't see an alternative ?

Re: Plex Naming Schemes

Posted: 03 Jan 2020, 19:00
by kim
I made an alternative:

Code: Select all

{' - Part ' + folder.listFiles{ it.isVideo() }.withIndex(1).find{ it[1] == fn.match(/(?:cd|part)\s?(\d+)$/).toInteger() }[1] }
but it's almost useless... it's a lot like

Code: Select all

{i}

Re: Add .partN to episode duplicates

Posted: 03 Jan 2020, 19:34
by rednoah
The {di} duplicate index and {dc} duplicate count should do the job:

Code: Select all

{if (dc > 1) ".part$di"}
Image

Re: Plex Naming Schemes

Posted: 03 Jan 2020, 20:56
by Silke79
kim wrote: 03 Jan 2020, 18:00 looks like your files are named wrong, so rename the "part 2" file to S01E02

Code: Select all

The Lady Musketeer - S01E02 - Episode 2 - [704x512] [480p - XviD] [MP3 - 2ch] [2006-04-14] part2.avi
... and Filebot does not know your files are multipart
S01E01 Episode 1 April 14, 2006 85
S01E02 Episode 2 April 14, 2006 85
https://thetvdb.com/series/the-lady-mus ... official/1

@rednoah

Code: Select all

{pi}
does not work in episode mode and I don't see an alternative ?
Thanks Kim for the input, but I only posted the two part of the first episode and I got in total 4 parts. ;)

Re: Add .partN to episode duplicates

Posted: 03 Jan 2020, 20:58
by Silke79
rednoah wrote: 03 Jan 2020, 19:34 The {di} duplicate index and {dc} duplicate count should do the job:

Code: Select all

{if (dc > 1) ".part$di"}
Image
Thanks Rednoah
It works great now when there are parts of an episode.

Re: Add .partN to episode duplicates

Posted: 18 Feb 2020, 10:53
by Silke79
I noticed a problem with the new part script where it will think that subtiltes also is a part and will then try to name the episode and the subtiltes with Part 1 and Part 2 at the end, so if possible to fix that so it will not see the subtiltes as a part?

Code: Select all

/TV-Serier/{az}/{(n == primaryTitle ? ny : ny + ' (' + primaryTitle + ')').colon(' - ')}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n.colon(' - ').lowerTrail()} - {s00e00} {'- #' + absolute.pad(4)} - {t.colon(' - ').lowerTrail()} - [{resolution}] [{vf} - {vc}] [{ac} - {af}] [{airdate}]{'.'+lang}{if (dc > 1) ".part$di"}
My old script for no parts.

Code: Select all

/TV-Serier/{az}/{(n == primaryTitle ? ny : ny + ' (' + primaryTitle + ')').colon(' - ')}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n.colon(' - ').lowerTrail()} - {s00e00} {'- #' + absolute.pad(4)} - {t.colon(' - ').lowerTrail()} - [{resolution}] [{vf} - {vc}] [{ac} - {af}] [{airdate}]{'.'+lang}

Re: Add .partN to episode duplicates

Posted: 18 Feb 2020, 13:08
by rednoah
Yes, but it'll get more difficult exponentially, because now you'll have to count "duplicates per file type" yourself via the {model} binding:
viewtopic.php?t=9814

Alternatively, you could process video files and subtitle files separately.


EDIT:

FileBot r7109 will consider the duplicate context per file type.

Re: Add .partN to episode duplicates

Posted: 18 Feb 2020, 15:49
by Silke79
So far I have done the easy part of having separat scripts in Presets and in Fetch Data the one without parts, but I was just hoping there was a way to work around that and to have one script for all.

Thanks for the help and quick respons rednoah.