Action Item #470
closedRefactor to better support Movies vs TV episodes
100%
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.
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.
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:- Add a configuration dialog for setting
- TheMovieDB.org API key
- TheTVDB.com API key
- File extensions to scan
- Poster sizes
- New class: TVDB.java
- Migrate TV specifics to TVDB.java from MovieDB.java
- 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.
Updated by Hammel over 8 years ago
MovieDB is refactored. Now I need to write TVDB.java. Here are some notes:
- 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'
- 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.
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.Load/Save of json dataSeparate TV from Movie json data when saving. VideoFE will eventually offer browsing of either at the start.Add support for alternatives for TV episodesAdd TVDB.com logo at the bottom of videolib, like TheMovieDB.org. Not sure if it's required but give credit where due.If the episode name is provided in the JSON, use it as the TMDB name.Change "TMDB Name" lable to "Video Title"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.
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.
Updated by Hammel about 8 years ago
- 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.
- VideoLib had problems with rescan all where it didn't actually get new instances of the video classes.
- 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.
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.