How I got around American Dad showing S09 instead of S10

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Tweak_four17
Donor
Posts: 53
Joined: 24 Apr 2014, 19:30

How I got around American Dad showing S09 instead of S10

Post by Tweak_four17 »

As some of you who deal with this show (American Dad!) know the file name typically is a season behind what it should actually be compared to TheTVDB for whatever reason and this can be really annoying especially if you run automated scripts to process your files. Here is how I got around it, hopefully it helps someone else out..

In Utorrent I call a batch file when torrent state changes

Code: Select all

"C:\downloads\utorrent.bat" "%S" "%N"
Then in the batch file

Code: Select all

if %1 == "11" goto process
exit

:process
filebot -script fn:amc --output "c:\downloads\Complete torrents\downloads" --log-file amc.log --def "seriesFormat={(n == 'American Dad!' ? (n)+' - S'+(s+1)+'E'+(e.pad(2)) : (folder.name == 'Complete torrents' ? fn : (folder.name == 'downloads' ? fn : folder.name)))}" "movieFormat={folder.name == 'Complete torrents' ? fn : folder.name}" --action move -non-strict "C:\downloads\Complete torrents" --conflict override --def clean=y --def excludelist=amc.txt

filebot -script fn:amc --log-file amc.log --def unsorted=y --def "seriesFormat={new File('H:/videos/Kids TV Shows/', n.replace(':',' -').replace('?','')).exists() ? 'H:/videos/Kids TV Shows/'+n.replace(':',' -').replace('?','') : 'G:/videos/TV Shows/'+n.replace(':',' -').replace('?','')}/{episode.special ? 'Special' : 'Season '+s}{new File('H:/videos/Kids TV Shows/', n.replace(':',' -').replace('?','')).exists() ? '' : (' (')+vf.match(/720[pP]|1080[pP]/)+(')')}/{n.replaceTrailingBrackets().replace(':',' -').replace('?','')} - S{episode.special ? '00' : s.pad(2)}E{es*.pad(2).join('-E').replaceAll('null',{episode.special ? special.pad(2):''})} - {t.replace(':',' -').replace('?','').replacePart (' (Part $1)')}{new File('H:/videos/Kids TV Shows/', n.replace(':',' -').replace('?','')).exists() ? '' : (' (')+vf.match(/720[pP]|1080[pP]/)+(')')}" "movieFormat=H:\videos\Movies\{n.replace(':',' -').replace('?','')} ({y}){\" CD$pi\"}{(' (')+vf.match(/720[pP]|1080[pP]/)+(')')}" --action copy -non-strict "C:\downloads\Complete torrents\downloads" --conflict skip  --def storeReport=y  --def excludelist=amc.txt

exit
The first part simply checks if the torrent state is finished and if so the processing begins, otherwise the batch file exits
Basically it looks at the name of the files and if it determines that it is American Dad! it adds 1 to the season number and puts it into another folder within my completed torrents folder naming it American Dad! - S##E##, if it detects it is not American Dad it copies the video files into this other folder either by folder name or if it is a loose file it just copies it w/o renaming it. Then the 2nd call renames everything properly and sorts it onto my network drives as needed.

The specific format for the first call is

Code: Select all

"seriesFormat={(n == 'American Dad!' ? (n)+' - S'+(s+1)+'E'+(e.pad(2)) : (folder.name == 'Complete torrents' ? fn : (folder.name == 'downloads' ? fn : folder.name)))}" 
Then the 2nd call can be whatever you want it to be for your needs.

Hopefully this is helpful, its an extra step but it also saves me having to manually rename American Dad so now my media center is 100% automatic.
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How I got around American Dad showing S09 instead of S10

Post by rednoah »

Won't this cause issues if your Media Center is also using TheTVDB to make sense of the filenames?
:idea: Please read the FAQ and How to Request Help.
Tweak_four17
Donor
Posts: 53
Joined: 24 Apr 2014, 19:30

Re: How I got around American Dad showing S09 instead of S10

Post by Tweak_four17 »

I'm not sure what you mean? The scene released the file as S09E## but TVDB thinks it should be S10E## for the correct airdate/ episode title, so this bumps the season number up so it identifies as the correct file. Plex also uses theTVDB so if I didn't do this it would htink it was an episode that aired last year.
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How I got around American Dad showing S09 instead of S10

Post by rednoah »

oh, so it actually matches the wrong episode data, but you just fix it in the format... in that case make sure to use -no-xattr so at least the files don't get tagged with the wrong data.

I would solve the issue something like this:

Code: Select all

filebot -rename . --filter "(n != 'American Dad!' || s == 10)"

Code: Select all

[TEST] Rename [D:\workspace\testdata\AMC-TEST\American.Dad.9x01.avi] to [America
n Dad! - 10x01 - Steve and Snot's Test-Tubular Adventure.avi]
You could be even more fancy and tell filebot to only consider episode data that has been aired within this week:

Code: Select all

filebot -rename . --filter "n != 'American Dad!' || now - airdate.timeStamp < 604800000"
:idea: Please read the FAQ and How to Request Help.
Tweak_four17
Donor
Posts: 53
Joined: 24 Apr 2014, 19:30

Re: How I got around American Dad showing S09 instead of S10

Post by Tweak_four17 »

Correct me if I'm wrong but wouldn't the first formula need to be updated every season? Otherwise once season 11 starts it would still force season 10? My solution gets around that. I realize its more work, but it also works for me in my setup as the frist call dumps all the video files into a single folder and between that and the 2nd call I run a conversion script to convert .mkv to .mp4. I like the idea of the airdate, that might be something a bit more foolproof for new files. If I were to add that to my AMC script I assume it would look something like:

Code: Select all

"seriesFormat={(n != 'American Dad!' || now - airdate.timeStamp < 604800000") : (folder.name == 'Complete torrents' ? fn : (folder.name == 'downloads' ? fn : folder.name)))}"
?
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How I got around American Dad showing S09 instead of S10

Post by rednoah »

Your solution only works because you only use {sxe} numbering. Your logic doesn't work if you want to use other bindings like {t} or {airdate} since the match is wrong. Also FileBot will tag your files, so while the name is 10x01 it's still tagged with the data from 9x01.

So the real solution must be --filter and not any format since that makes filebot find the correct match, rather then just fix/fake the name for wrong matches.
:idea: Please read the FAQ and How to Request Help.
Tweak_four17
Donor
Posts: 53
Joined: 24 Apr 2014, 19:30

Re: How I got around American Dad showing S09 instead of S10

Post by Tweak_four17 »

All my logs show a failed to set xattr, so does that mean the tags in filebot are still wrong? and on the 2nd call wouldn't it over write the previous tags anyways as it correctly identifies the episode title on the 2nd call so it is determining it to be from season 10..?
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How I got around American Dad showing S09 instead of S10

Post by rednoah »

If it says it can't set xattr then xattr are not set. So nothing is tagged. If you wanna avoid those issue just add -no-xattr in the call.

If xattr where to be set, it'll always be overridden with the latest rename call. So a second rename call would actually solve the xattr issue as well since filebot puts priority on the actual filename rather than xattr tags during matching.
:idea: Please read the FAQ and How to Request Help.
Post Reply