Series with more than 1000 episodes error

204 views
Skip to first unread message

Claus Pedersen

unread,
Jun 6, 2023, 11:18:24 AM6/6/23
to TV Rename
So I've been trying to rename all my One Piece episodes and it works fine until you start hitting sequential episode 1001 and upwards.
TV Rename truncate the first of the 4 digets so episode 1001 becomes episode 001 instead and then it start complaining that there is 2 files with the same episode number and then ignores it and I have episode 001 and episode 1001 and it thinks they are the same.

Could we get an update to TV Rename so it will be compatible with 4 diget sequential numbers so it dont start counting again from start at episode 1001.

Kind Regards
Satis

Tom Snyder

unread,
Jun 6, 2023, 11:47:06 AM6/6/23
to TV Rename
Is there any reason why you are choosing to use Absolute Order rather than Aired Seasons?

TV Rename

unread,
Jun 6, 2023, 9:02:48 PM6/6/23
to TV Rename
Can you share some pictures of the issue you see? 1109 episodes seem to load OK for me.

Claus Pedersen

unread,
Jun 7, 2023, 10:12:56 AM6/7/23
to TV Rename
Here is the error list I'm getting.
TVRename_2023-06-07_15-56-00.png

I had an extra look at it today and I think I found out what's wrong as I was wrong regarding truncating the first diget in a 4 diget number.
So on each error I noticed that one of the files had a random short Hash added to it like: [20D0249E] on the first line.
that one starts with 20 in the short hash and the file it's conflicting with is is: One Piece - 020 [1080p].mkv

So if that's the reason it's doing that, then I have some options to fix it myself like:
1. Rename the files with the short hash by removing the short hash.
2. Try and see if I can make an regex string that takes the short Hash code into account as well and don't check that for number comparison.

One other option would be if you had an easy idea to make the search skip the short hash and have that in the program by default as well.

TV Rename

unread,
Jun 7, 2023, 9:32:13 PM6/7/23
to TV Rename
This is an issue with your 'filename processors' not being aligned to the shows in your folder. The default ones work pretty well with most filenames, but clearly not the ones in your folder.

You can either match them up manually, or,

Try going to the 'filename processor' screen and pointing to the folder with your files in it. from there you can enable/disable/modify/create processors until it recognises the files correctly. You may need to read up on 'regular expressions' as it a bit complex

Looks like you might need to use absolute sequence numbers for them as I can't see a SxxExx style text in the filenames

Filename processors control how TVR works out which episode the file is for.

Sequential Matching may help:


Claus Pedersen

unread,
Jun 8, 2023, 3:36:40 AM6/8/23
to TV Rename
yeah I'm starting to get quite used to Regex as I have used it before in works.
From the filename processor, I see you use the "(?<s>)" and "(?<e>)" as represent season and episode. do you have a letter for the sequential number or does that not matter?

Oh and yes, I have already turned on the use sequential numbers for the series ;)

Sparky53

unread,
Jun 8, 2023, 10:03:10 AM6/8/23
to TV Rename
Unfortunately the sequential check is hardcoded in https://github.com/TV-Rename/tvrename/blob/3c85c9b632f5c58adb7cc76b4c85ebb3710f3a76/TVRename/ScanActivity/Finders/FinderHelper.cs#L80

"(E|e|Ep|ep|episode|Episode) ?0*(?<sequencenumber>\d+)\D"
or
"\D0*(?<sequencenumber>\d+)\D"

Let us know if you have a decent regex to add

No, S, E and F are the only 'magic' tag names for regex (F being the max episode number in multiepisode files - eg S02 E01-03 => S=2, e=1, f=3)

TV Rename

unread,
Jun 9, 2023, 6:05:40 PM6/9/23
to TV Rename
try 4.9.9

Claus Pedersen

unread,
Jun 10, 2023, 12:50:41 PM6/10/23
to TV Rename
Definitely less errors now and matching up more than before ;)
There are still 4 errors left but I have been testing with different regex

I took the remaining files names from the error list and added it into an online regex editor as values to search against +(I also added 1 filename where the sequential number has a v2 added to it as it didn't process that one either)
I then looked in the regex you are using to compare  sequence number with and checked the results from it.

First one is: "(E|e|Ep|ep|episode|Episode) ?0*(?<sequencenumber>\d+)\D"
Now for me personally, I have never seen any files with those tags right in front of a sequence number,
but with your years of experience in developing TVR I'm sure you have seen it some times so let's check it in the online regex editor.
firefox_2023-06-10_16-53-37.png
In my case it should not match any of those files as they don't use any of the tags in the sequence number,
and that part it does correctly... well at least for the first 5 filenames.
The problem comes when filenames has a hash number in them like this: [1E6E13DB]
The quick and easy fix I saw at first was just to make sure it checked if there were a space before the episode tags like this:
firefox_2023-06-10_17-56-23.png
That fixed my problem... But Wait!!! then I thought what about filenames that started with one of the episode tags as they would then not be recognized anymore.
We would have to add another check if the episode tags are searched in the start of a filename as well.
So I cooked up this one instead: "(^(E|e|Ep|ep|episode|Episode)| (E|e|Ep|ep|episode|Episode)) ?0*(?<sequencenumber>\d+)\D"
firefox_2023-06-10_18-37-05.png
Changed the "\s" to an space character as well as it was checking new lines as well, though it would not matter as in your case, you are checking a 1 line string without newline character in it ;)
But as you can see, that should work nicely :)

Next is regex: "\D 0*(?<sequencenumber>\d+) \D"
This one is the one that should match all the correct episode numbers for me so let's take a look at it:
firefox_2023-06-10_15-37-48.png
It Matches all the filenames with the correct number except the 082v2 as it got the v2 in it
Now the easiest way to fix this in my case would be to remove the space right before the last "\D" but there is probably a reason you had it there so I didn't want to compromise that solution as it could break something else.
So instead I adding this "(?:v[0-9]+)?" right after the" (?<sequencenumber>\d+)"
It checks if there is a v followed by at least 1 number in a non-capturing group (Just so it doesn't return a unusable value) and make sure there is only one or none attached to the sequence number.
The full regex is like this then: "\D 0*(?<sequencenumber>\d+)(?:v[0-9]+)? \D"
firefox_2023-06-10_16-21-41.png

With the changes I have mentioned, it should in theory fix all my problems without changing the way they are already working and not break it for others.

Hope you would consider these changes :)

Here is a link for each of the regex tests I did on the online regex editor:
First one: https://regex101.com/r/GfR1he/3
Second one: https://regex101.com/r/La1nV7/1

TV Rename

unread,
Jun 10, 2023, 7:41:01 PM6/10/23
to TV Rename
No problem at all - you did all the hard work! The code handles start (and end) of the filename in a different way, so we don't need the ^ trick. Good thinking though

Went with 
            \D\s(E|e|Ep|ep|episode|Episode)\s?0*(?<sequencenumber>\d+)\s\D
            \D\s0*(?<sequencenumber>\d+)\s\D
            \D\s0*(?<sequencenumber>\d+)v\d+\s\D

in the end

Claus Pedersen

unread,
Jun 11, 2023, 6:09:10 AM6/11/23
to TV Rename
Sounds good :) can't wait for the new update ;)

Claus Pedersen

unread,
Jun 25, 2023, 7:43:47 AM6/25/23
to TV Rename
Still got some stuff to do before a new version release ?

TV Rename

unread,
Jul 6, 2023, 10:25:37 AM7/6/23
to TV Rename
It's out

Claus Pedersen

unread,
Jul 14, 2023, 7:25:05 AM7/14/23
to TV Rename
I saw :)
Now I just have the issue that in 5.0.6 it won't download from tvdb.

Going to try again later on
Reply all
Reply to author
Forward
0 new messages