Action Item #470

Refactor to better support Movies vs TV episodes

Added by Hammel about 2 years ago. Updated over 1 year ago.

Status:ClosedStart date:30 Oct 2015
Priority:ImmediateDue date:
Assignee:Hammel% Done:

100%

Category:TMDB API
Target version:PiBox - 0.12.0
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.

Associated revisions

Revision 24e5d278
Added by Hammel over 1 year ago

RM #470: Added TVDB class and extended UI class to support TV episode data from TVDB.com. This basically works but
load/save and alternatives are not yet implemented.

Revision 24e5d278
Added by Hammel over 1 year ago

RM #470: Added TVDB class and extended UI class to support TV episode data from TVDB.com. This basically works but
load/save and alternatives are not yet implemented.

Revision 9b855244
Added by Hammel over 1 year ago

RM #470: Add TVDB.com logo at the bottom of the details frame. If the episode name is provided in the JSON, use it as the "TMDB name". Change "TMDB Name" label to "Video Title" Use the episode overview if available, otherwise use the series overview.

Revision 9b855244
Added by Hammel over 1 year ago

RM #470: Add TVDB.com logo at the bottom of the details frame. If the episode name is provided in the JSON, use it as the "TMDB name". Change "TMDB Name" label to "Video Title" Use the episode overview if available, otherwise use the series overview.

Revision 7640bd6a
Added by Hammel over 1 year ago

RM #470: Moved common code to updateEntry and let queryDB and setID call it as appropriate.

Revision 7640bd6a
Added by Hammel over 1 year ago

RM #470: Moved common code to updateEntry and let queryDB and setID call it as appropriate.

Revision 94b4b1b2
Added by Hammel over 1 year ago

RM #470: Provide separate fields for file title and real title for use with TV episodes. Scan the correct DB type when
clicking on alternatives.

Revision 94b4b1b2
Added by Hammel over 1 year ago

RM #470: Provide separate fields for file title and real title for use with TV episodes. Scan the correct DB type when
clicking on alternatives.

Revision 003521bc
Added by Hammel over 1 year ago

RM #470: Fix setting alternative to actually update the entry to the alternative series and matching season/episode numbers.

Revision 003521bc
Added by Hammel over 1 year ago

RM #470: Fix setting alternative to actually update the entry to the alternative series and matching season/episode numbers.

Revision e30c820a
Added by Hammel over 1 year ago

RM #470: Implemented load/save for tv episodes.

Revision e30c820a
Added by Hammel over 1 year ago

RM #470: Implemented load/save for tv episodes.

Revision 69b02b2c
Added by Hammel over 1 year ago

RM #470: Add title bar text to shell.

Revision 69b02b2c
Added by Hammel over 1 year ago

RM #470: Add title bar text to shell.

Revision 8890456c
Added by Hammel over 1 year ago

RM #470: Added simple about dialog.

Revision 8890456c
Added by Hammel over 1 year ago

RM #470: Added simple about dialog.

Revision 7d5de87c
Added by Hammel over 1 year ago

RM #470: Clean up old db files before saving. Add some missing fields that make it easier for the front end to
know what to display. Clean up properly when rescanning all video entries.

Revision 7d5de87c
Added by Hammel over 1 year ago

RM #470: Clean up old db files before saving. Add some missing fields that make it easier for the front end to
know what to display. Clean up properly when rescanning all video entries.

Revision 3e6b55e2
Added by Hammel over 1 year ago

RM #470: Add overview to top level JSON output so front ends can get to it easily.

Revision 3e6b55e2
Added by Hammel over 1 year ago

RM #470: Add overview to top level JSON output so front ends can get to it easily.

History

#1 Updated by Hammel over 1 year 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.

#2 Updated by Hammel over 1 year 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.

#3 Updated by Hammel over 1 year 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.

#4 Updated by Hammel over 1 year 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.

#5 Updated by Hammel over 1 year 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.

#6 Updated by Hammel over 1 year 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.

#7 Updated by Hammel over 1 year 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.

Also available in: Atom PDF