sharinganthief / tvrename

Automatically exported from code.google.com/p/tvrename
Other
0 stars 0 forks source link

Sequential show numbering style #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Sequential show numbering, rather than SxxEyy

http://tvrename.com/bb/viewtopic.php?f=7&t=325&p=1213#p1213

This means that the "FindSeasEp" function will need to be enhanced to still
detect it after the renaming.

Sequential number matching currently only applies when finding missing
episodes, from the "download" folders.

Original issue reported on code.google.com by tvren...@tvrename.com on 10 Sep 2009 at 12:21

GoogleCodeExporter commented 9 years ago
I'm interested in implementing this feature.  Where are the related methods?

Original comment by YeOldeSt...@gmail.com on 9 Apr 2011 at 9:51

GoogleCodeExporter commented 9 years ago
Apologies for the slow response.. I've been a bit busy recently.

First a bit of background how-it-works.  Please bear with me if you already 
know this, but it is important to know.

(1) TVRename has a list of shows (each is a "ShowItem").  Each show has a 
number of seasons, and each season has a number of episodes (episodes are 
downloaded from thetvdb, as "Episode" items.  Once the merge/rename/etc. rules 
are applied, they are turned into "ProcessedEpisode" classes).
(2) When you do a "Scan", for each of your shows, for each of the seasons, it 
determines the name of the folder(s) in your media library for that season 
(function RenameAndMissingCheck).  Automatic and manual folders feature here.  
(ShowItem.AllFolderLocations)
(3) For each file in that folder, it determines the season and episode number 
of the file.  
(3b) If the filename doesn't match the official filename template, create a new 
"action" to rename it.
(4) For each episode that has aired so far in the season, mark each one off as 
"found" as they are found in (3). (variable "localEps").
(5) After processing all files in the folder, anything not marked off in 
"localEps" is added as a "missing" action.

The checking of .NFO, .TBN, and folder.jpg files is mixed into the above, too, 
since its most convenient/efficient to do it at the same time.

At this point we have a list of episodes missing from the media library.  Next 
step is to figure out where they are:

(6) For each missing episode (function LookForMissingEps)
(7) For each file in the folder in the user's "Search Folders", see if it's 
name contains the show's name.  If so, determine the season and episode number. 
(functions FindMissingEp and FindSeasEp).
(7b) If the show has "use sequential number matching" turned on, then also look 
for the overall number of the episode (function MatchesSequentialNumber).
(8) If found, set up an "action" (i.e. thing to do pending the user's approval 
in the Scan tab) to rename/move/copy the file as appropriate, with the name as 
per the global "Filename template".

The problem is that if a show is renamed to "My Show Episode 123", the "S02E04" 
part is missing, so always shows as missing, maybe later being found again 
(already there) in (7b). 

So, the things I suggest doing are:
(A) Rather than using a global filename template in (9), add a per-show 
advanced setting to have a custom filename template, as I expect it may only be 
a small number of shows you want this feature for.
(B) At the moment, the "sequential number match' is only used in (7b).  Needs 
to be added for what happens in step (3).

For (A), you need to add to the dialog "AddEditShow", and add to the code that 
saves/loads the show's settings (the class "ShowItem").  Have a look at the 
setting "UseCustomShowName" and "CustomShowName" are done, if you want 
something to copy as a basis for this.

For (B), a call to MatchesSequentialNumber needs to be added to the function 
"RenameAndMissingCheck", around line 2574 (where FindSeasEp is called).  Have a 
look at the other call to "MatchesSequentialNumber" on line 474, to get the 
idea of what to do.

Also..  Shows named by date, e.g. "Colbert Report 2011-05-07" is also something 
there is a demand for, and is a similar problem to this one.  The added 
complication for this is the different date formats (Y-M-D, M-D-Y, D-M-Y, 
etc.).  It may be easy to add support for this at the same time, as its a 
similar thing to sequential numbering - but some consideration might be needed 
of problems related to variation of date formats.  Even though you could assume 
that the user wants things renamed to their format as specified by their OS's 
settings, searching for missing episodes in (7) might have to cope with other 
formats, or let the user specify (per show) what it should be.

Let me know if you have any more questions, or anything I've said above appears 
to be contradicted by the code.  It's been a while since I wrote and worked on 
it, particularly this side of things, so I might be wrong on one or two minor 
details.

Original comment by tvren...@tvrename.com on 7 May 2011 at 8:01