Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Improved FetchMetadata, Adding Pause state, Fixed "(year)" in title #23

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

TheGeeKing
Copy link

@TheGeeKing TheGeeKing commented Aug 14, 2023

Added:

  • You can use Trakt to more accurately find the media, get season poster (could add an option in config to choose between show, season, episode poster)
  • Displays "Paused ⏸︎ | X%/Y min" when session is paused and shows progress (%) and duration of the media. Close Enhancement: Paused status #22

Changed:

Added:
- Use trakt if tmdb isn't find

Changed:
- Now connects to PMS with `ConnectPlexMediaServer()` method.
- While searching through tmdb results, if we have tmdb id and it is same as `entry["id"]` we correctly found matching content.

Currently for a show It wasn't giving the correct Metadata. Also id should be preferred to identify content than string title or year (those can vary).

Now, we get the guids of the media, if trakt is setup. We get the first database id in the session guids list and do a simple request to trakt, we later use the data returned for the button link. For the poster, trakt documentation says that they use tmdb, so we have to use it. Otherwise, we use the default search method.

**Why don't I have only used TMDB API?**
TMDB uses id depending of the media type, this makes things a bit harder but not much. True issue is that getting details for TV episode is a pure nightmare. Every database has a way of sorting episodes and seasons. Using id is made to bypass that and directly know which content it is. TMDB however, ask for the tmdb id, but also the season and episode number. Issue is that if you use another database than tmdb on plex you might get an index (episode) and parentIndex (season) that point to a non existing episode for tmdb and so no episode details. Here we at least use trakt to get link to the show.

I have tried to follow the file naming and type hinting convention as closely as possible, even if it doesn't conform to the PEP8 standard.
Added:
- Displays "Paused ⏸︎ | X%/Y min" when session is paused and shows progress (%) and duration of the media -> EthanC#22
- Added `IsInPause()` and `BuildPausePresence()` methods
- Logging case clearing status raise an Exception

Changed:
- trakt apiKey to clientId, forgot to save file

Fixed:
- `res = res.json()` was at the wrong place causing an error
- media type was hard coded, changed it to use media_type variable

Removed:
- Unused function
- Unused import
Added:
- Use regex to remove any "(XXXX)" in a title -> EthanC#21
Added:
- If using, Trakt, it will use poster of the season (could add a way in the config file to choose between show, season or episode)

Changed:
- If Trakt is enabled, it will now get the data from TMDB API using Trakt season and episode numbering
- If trakt is not enabled or it fallbacks to default search, it now use ratingkey to find show tmdb and get accurate data and not title query.
Added:
- Trakt setup and configurable values to README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't fetch data if title already contains the year Enhancement: Paused status
1 participant