Page 1 of 1

add the release year of the latest episode at the tv show folder name

Posted: 22 Jul 2016, 13:13
by boe
Hello,

I would like help renaming just the folders for TV episodes.
My exiting folder & files look like this:

Code: Select all

G:\TVCurrent\Archer\Season 1\Archer (2009) - S01E01 - Mole Hunt 720p.mkv
G:\TVCurrent\Archer\Season 1\Archer (2009) - S01E02 - Training Day 720p.mkv
etc.
G:\TVCurrent\Archer\Season 2\Archer (2009) - S02E01 - Swiss Miss 720p.mkv
etc.
Filebot has done a really good job of renaming my files.

I'd like to include the first airdate in the top topfolder of a series. I'm curious if it could change the folders from above to:

Code: Select all

G:\TVCurrent\Archer (2009)\Season 1\Archer (2009) - S01E01 - Mole Hunt 720p.mkv
G:\TVCurrent\Archer (2009)\Season 1\Archer (2009) - S01E02 - Training Day 720p.mkv
etc.
G:\TVCurrent\Archer (2009)\Season 2\Archer (2009) - S02E01 - Swiss Miss 720p.mkv
etc.
Or even better if it could include the season airdate (at that point i'd take the date out of the filename)

Code: Select all

G:\TVCurrent\Archer (2009)\Season 1 (2009)\Archer- S01E01 - Mole Hunt 720p.mkv
G:\TVCurrent\Archer (2009)\Season 1 (2009)\Archer - S01E02 - Training Day 720p.mkv
etc.
G:\TVCurrent\Archer (2009)\Season 2 (2010)\Archer - S02E01 - Swiss Miss 720p.mkv
etc.

Re: Please help with renaming folder for TV episodes

Posted: 22 Jul 2016, 13:40
by rednoah
1.
Forget the notion of renaming folders. What you really want is reorganize files (move, rename, etc it's all the same) into a specific path scheme (i.e. you always deal with files, you never deal with folders, because folder don't exist without files).

2.
You decide what path scheme you want:

Code: Select all

G:\TVCurrent\Archer (2009)\Season 1\Archer (2009) - S01E01 - Mole Hunt 720p.mkv
3.
You express your path scheme as FileBot Format:

Code: Select all

G:/TV Shows/{ny}/Season {s}/{ny} - {s00e00} - {t} {vf}
4.
You process all your files. Notice that "renaming files" is the same as "renaming folders" and that FileBot will get it done in a single operation.


BONUS: Season Year

Simple Solution:

Code: Select all

G:/TV Shows/{ny}/Season {s} ({d.year})/{n} - {s00e00} - {t} {vf}
Complex Solution (once you realize that an episode aired in 2016 can belong to a season started in 2015):

Code: Select all

G:/TV Shows/{ny}/Season {s} ({episodelist.findAll{it.season == s}.airdate.year.min()})/{n} - {s00e00} - {t} {vf}
@see viewtopic.php?f=5&t=165

Re: Please help with renaming folder for TV episodes

Posted: 22 Jul 2016, 15:06
by boe
WOw - thanks for the detailed solution! I'll give it a try.

Re: Please help with renaming folder for TV episodes

Posted: 22 Jul 2016, 15:13
by boe
Worked like a charm! Thanks again!

Re: Please help with renaming folder for TV episodes

Posted: 17 Apr 2020, 23:40
by GeorgeAl
Can you add the release year of the latest episode at the tv show folder name?

e.g. G:\TVCurrent\Archer (2009)\Season 2\Archer (2009) - S02E01 - Swiss Miss to G:\TVCurrent\Archer (2009-2020)\Season 2\Archer (2009) - S02E01 - Swiss Miss

Re: Please help with renaming folder for TV episodes

Posted: 18 Apr 2020, 06:18
by rednoah
Yes, conceptually, same as the above, except with max() instead of min().


e.g. latest episode airdate year:

Code: Select all

{episodelist.airdate.year.max()}
e.g. episode airdate min-max values:

Code: Select all

{episodelist.airdate.year.bounds().join('-')}

:idea: Keep in mind that the destination folder structure now varies depending on when you process a given file. This may not be what you want.