Project

General

Profile

Actions

Action Item #470

closed

Refactor to better support Movies vs TV episodes

Added by Hammel about 9 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
Category:
TMDB API
Target version:
Start date:
30 Oct 2015
Due date:
% Done:

100%

Estimated time:
Severity:
01 - Critical

Description

Adding TV episodes worked fairly well but the code is ugly and is not bug free (alternatives doesn't work right, for example).

I need to refactor this code to separate the movie vs tv code, including allowing better TV support in UI.

Actions #1

Updated by Hammel over 8 years ago

This work should include requiring a directory and file naming structure that matches the Plex requirements (title/season/title - s01e01 - episode name.mkv for tv episodies). And use the TheTVDB.com.

Actions #2

Updated by Hammel over 8 years ago

  • Status changed from New to In Progress
  • Priority changed from High to Immediate
  • % Done changed from 0 to 10
  • Severity changed from 02 - High to 01 - Critical

Refactoring should use TheTVDB.com for TV episode lookups instead of TheMovieDB.org. This is what Plex uses and I will enforce a file structure of the same format as Plex, so it should work must better than the old way.

This requires:
  1. Add a configuration dialog for setting
    1. TheMovieDB.org API key
    2. TheTVDB.com API key
    3. File extensions to scan
    4. Poster sizes
  2. New class: TVDB.java
  3. Migrate TV specifics to TVDB.java from MovieDB.java
  4. Refactor directory scans to require Plex directory layout depending on which type is selected (Movie or TV).

The Database UI box sets which base URL to use and which class (MovieDB or TVDB) to use for scans.

Actions #3

Updated by Hammel over 8 years ago

MovieDB is refactored. Now I need to write TVDB.java. Here are some notes:

  1. To get a TOKEN, required to make additional queries:
    curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"apikey":"xxx"}' 'https://api.thetvdb.com/login'
    
  2. This returns a token that is then used in subsequent queries:
    curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <token>' 'https://api.thetvdb.com/search/series?name=The%20West%20Wing'
    

This java API shows how series episodes can be queries given you have the token.

It is also possible to reset the token within 24 hours. So the time stamp for the token should be saved in configuration data and a new token requested only if the old one has expired.

Actions #4

Updated by Hammel over 8 years ago

  • % Done changed from 10 to 60

Support for both Movies (TheMovieDB.org) and TV Episodes (TVDB.com) is now implemented. I can scan a directory of episodes that use the following naming scheme:

    Series-Name - s<xx>e<yy> - Episode-Name

As long as the series name and season (xx) and episode (yy) numbers are provided then it works perfectly. I can also show both series and episode images.

There is still a bit of work to do for TV episodes.
  1. Load/Save of json data
  2. Separate TV from Movie json data when saving. VideoFE will eventually offer browsing of either at the start.
  3. Add support for alternatives for TV episodes
  4. Add TVDB.com logo at the bottom of videolib, like TheMovieDB.org. Not sure if it's required but give credit where due.
  5. If the episode name is provided in the JSON, use it as the TMDB name.
  6. Change "TMDB Name" lable to "Video Title"
  7. Use the episode overview if available, otherwise use the series overview.

I also noticed that VideoLib doesn't display it's program name in the window manager title bar. I should fix that too.

Actions #5

Updated by Hammel about 8 years ago

  • % Done changed from 60 to 90

Everything's working now. All fixes are applied, tested, committed and pushed.

The changes are in the mjhammel/tvdbcom branch for now. I'll merge with master when videofe is updated to support the new db formats.

Issue will be closed when the merge with master occurs.

Actions #6

Updated by Hammel about 8 years ago

Videofe has been ported. It exposed some issues with the VideoLib port.
  1. I needed more data stored as videolib_ names in the main JSON entry to make it easier for the front end to find what it needs quickly.
  2. VideoLib had problems with rescan all where it didn't actually get new instances of the video classes.
  3. VideoLib generated new file IDs but didn't clean out old entries, leaving cruft behind. The cruft had to be deleted before saves were performed.

These are all fixed and both videolib and videofe appear to be working fine now.

Now videofe needs to be tested on hardware. Once that's shown to be working with the new db I can close both issues.

Actions #7

Updated by Hammel about 8 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

Videofe tested on hardware. Fixed a few minor bugs and added support for overviews and series posters that were missing.

Everything is working fine now. In fact, much better than before refactoring.

Committed and pushed.

Merged with master.

Closing issue.

Actions

Also available in: Atom PDF