skorokithakis / episode-renamer

Episode renamer is a simple python script that renames folders of TV episode video files to their proper names.
http://pypi.python.org/pypi/episode-renamer/
41 stars 8 forks source link

TV Shows renaming with "Episode #1" rather than with the proper title #11

Open benjaminch opened 7 years ago

benjaminch commented 7 years ago

Hello,

I noticed since couple weeks, I had troubles renaming TV shows episodes because it seems that the API is returning "Episode #1" rather than the proper title.

At first, I though that the title wasn't available on IMDB but once double checked, the title was available. I guess the backend API might have troubles retrieving episodes names, did IMDB changed its API ?

Cheers, Benjamin

skorokithakis commented 7 years ago

Hello!

I'm not seeing this, I'm afraid. Could you give me a sample filename and commandline that exhibit the issue?

benjaminch commented 7 years ago

Sure !

python2.7 episoderenamer.py -g "Modern Family" -y 2009 . -m "%(show)s - %(series_num)02dx%(episode_num)02d - %(title)s.%(extension)s"

http://imdbapi.poromenos.org/js/?name=Modern%20Family

screen shot 2016-10-17 at 13 34 31

screen shot 2016-10-17 at 13 35 17

skorokithakis commented 7 years ago

Hmm, I think this is because, when the API process first retrieves the episodes, they don't have a name from IMDB (they just have "Episode 8.1", for example). Afterwards, when IMDB updates the name, this isn't changed in the database, because only new shows are updated. I'm afraid there's not much that can be done, short of nuking the db manually and recreating :/

benjaminch commented 7 years ago

Hum, is that your DB ?

skorokithakis commented 7 years ago

Yes: https://github.com/skorokithakis/imdbapi

benjaminch commented 7 years ago

Can we think trying to get the title name at least 1 time updating your DB when we encounter a "Episode 1" title with a min retry period (24 hours or so) ? It will allow your DB to be fully up to date with 24 hours delay. Because I have the feeling than more and more shows are experiencing this name issue.

skorokithakis commented 7 years ago

Sorry, I just saw this. Unfortunately, for performance reasons, the script diffs each day's shows so I only import the new names each day. Maybe I could have the script sed "Episode #" out of the file, though.

benjaminch commented 7 years ago

Hey thanks ! Maybe we can think about something like :

  1. The user runs the command to rename the files
  2. If any titles comes with Episode # then just try to scrap again information for this show only
  3. If the second pull comes with proper names, then replace it in the DB, otherwise let it as it is

What do you think ?

skorokithakis commented 7 years ago

What do you mean? Episode-renamer doesn't have anything to do with the server. The server can't retrieve information if it sees that the episode names are generic, because of the problem in my previous comment.

benjaminch commented 7 years ago

Yes, sorry I meant on your server side app. The performances trouble you describe, is it in case you redo a diff on everything ? I was more thinking about triggering the re-pull after the get names fonction. Meaning :

  1. I run the episode renamer command
  2. the script asks to your backend the episode names
  3. the backends doesn't find anything so is likely to return the Episode#XX
  4. Before to return this result, can it run another test (maybe capped to once a day for a given show if you want to preserve performances) pulling the episodes titles from your initial source (not your DB source but what is feeding it upfront). Asking a standalone feed for the given show / season
  5. If still nothing, then return the Episode#XX format, otherwise, take the chance to update the name in your DB with the new name you just get;

Does it make sense ? What do you use to feed your database upfront ?

skorokithakis commented 7 years ago

No, the problem isn't that the server returns "Episode 1" because it found nothing, it's that IMDB actually names their episodes "Episode 1" if they didn't have the name. So the script looks at IMDB, sees that an episode is called "Episode 1", adds that name and then never looks again, since, as far as it knows, that episode already has a name.

To import episodes to the database, I download the IMDB feed every day and diff it with the previous day's feed. New episodes are inserted and then the cycle repeats the next day. That's why it's a problem to change names, because the episodes have already been named with the wrong names...