RemiRigal / Plex-Auto-Languages

Automated language selection for Plex TV Shows !
MIT License
428 stars 16 forks source link

[Feature Request] Update new files as they are added #26

Closed rg9400 closed 2 years ago

rg9400 commented 2 years ago

I am not sure if this increases the scope or complexity of the app, but I noticed PlexAutoLanguages works super well when I have a full season/show available on Plex. However, for currently airing items, it doesn't track new files as they are added to Plex. There are two scenarios

  1. A completely new episode is added
  2. An existing episode file is upgraded. Let's take a scenario where I am watching an anime. I have subbed releases, but they are being replaced by dual audio files as those are released, which usually lag behind by a few weeks. If I play the first dual audio release using the dub tracks, it won't find those dubbed tracks for the rest of the season, but as a new dual audio file is added, those tracks could now theoretically be selected.

I realize this may not be easy to do. Currently, it seems you are just updating the languages given a trigger, so you don't need to keep track of the sub/language selection beyond the update. But in this scenario, if a new file is added, you would need to A) know the file is added which includes both as new episodes as well as replacements of existing files and B) know which tracks to select

However, I figured I would create a GHI to at least initiate the discussion

RemiRigal commented 2 years ago

Thank you for opening an issue !

I have added support for completely new episodes in version v1.0.11. Whenever a new episode is added, PlexAutoLanguages will perform a language update for all users based on:

If you are already running this version and experience issues with this please let me know.

However the upgrade of an existing episode (file upgrade or new additional file) is not yet supported. I will work on it !

rg9400 commented 2 years ago

This seems to be working, will test further. One question is if it is possible to maybe exclude this case from notifications? If not, I will need to turn them off as each new episode added generates multiple notifications now, one per user 😅

BEisem commented 2 years ago

I was just coming to post an error, but it seems that it is related to this new feature. When a new episode is added, I get the following error:

2022-04-29 12:16:14,350 [INFO] Processing newly added episode 'Nick Knowles' Big House Clearout' (S01E06)
2022-04-29 12:16:26,891 [ERROR] Unable to process timeline
Traceback (most recent call last):
  File "main.py", line 176, in process_timeline_message
    self.process_timeline(timeline)
  File "main.py", line 213, in process_timeline
    user_item = user_plex.fetchItem(item_id)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 173, in fetchItem
    data = self._server.query(ekey)
  File "/usr/local/lib/python3.8/site-packages/plexapi/server.py", line 680, in query
    raise NotFound(message)
plexapi.exceptions.NotFound: (404) not_found; http://localhost:32400/library/metadata/644158 <html><head><title>Not Found</title></head><body><h1>404 Not Found</h1></body></html>
RemiRigal commented 2 years ago

This seems to be working, will test further. One question is if it is possible to maybe exclude this case from notifications? If not, I will need to turn them off as each new episode added generates multiple notifications now, one per user 😅

@rg9400 If you want to get more information on what's going on I have added a debug mode that you can enable by setting the parameter debug to true as mentioned here. The feature is only available in the master branch for now though.

About notifications, you are raising a good point, this will be extremely annoying for people having a lot of users. I will think about a good way to tackle this. Thank you for the suggestion 👍


I was just coming to post an error, but it seems that it is related to this new feature. When a new episode is added, I get the following error

@BEisem Can you try the latest version ?

BEisem commented 2 years ago

@RemiRigal I'm already on the latest version, is there a new docker build that is still pending? I've tried pulling but nothing new is showing up.

RemiRigal commented 2 years ago

@RemiRigal I'm already on the latest version, is there a new docker build that is still pending? I've tried pulling but nothing new is showing up.

Apologies, I forgot to change something earlier, should be better with version v1.0.14. Thank you for your patience !

RemiRigal commented 2 years ago

@rg9400 Version v1.0.15 comes with an improved notification system. There will only be one notification per newly added episode, and you can now choose to receive notifications only for specific users. See the documentation for more details.

BEisem commented 2 years ago

This is a great update, thank you for addressing this!

RemiRigal commented 2 years ago

Good news, I've merged PR #34 that adds support for updated episodes ! The feature has been released with version v1.1.0.

A language update is triggered whenever the files of an episode change, so:

You should then see something like this in the logs: 2022-05-02 17:50:49,221 [INFO] [Status] Processing updated episode 'Mindhunter' (S02E04)

rg9400 commented 2 years ago

This seems to be working based on some initial testing. One additional request I had (let me know if you want to open up a GHI) is to still give a bit more flexibility with the notifications. I appreciate being able to condense it to All Users for new episodes and to also suppress specific users. But if I want notifications on, the new files are basically creating notifications for every new file and upgrade, which creates a lot of noise. These aren't super useful and serve as more passive updates based on selections the user may have made in the past. So ideally, being able to only see notifications based on active triggers would be ideal.

RemiRigal commented 2 years ago

Sure ! I can add more settings for the notifications. A separate GHI would be better in my opinion, could you open one please ?

I think we can close this issue. Feel free to reopen it if you experience any issues with the processing of new/updated episodes !