clara-j / media_cleaner

Python script to delete watched content on Emby
31 stars 17 forks source link

Update media_cleaner.py #4

Closed terrelsa13 closed 4 years ago

terrelsa13 commented 4 years ago

-Use plain text password one time to get the access token. -Access token is now stored. -Password is no longer stored. -Add not_playedage configs for movies, episodes, videos, and trailers to allow different days for each media type. -Remove '_action' configs -(-1) in not_playedage* will disable deleting each media type. -Attempt at updating output and putting into sections. -Showing 'days since watched' for each watched movie, episode, video, and trailer. -Add series name to episode output.

clara-j commented 4 years ago

Great work on this, I had been slowly working on cleaning up the code, but haven't had too much time. So this is very helpful.

One thing I just want to look up before I accept the pull is the access token vs storing the hashed password. The reason I went with the hashed password vs the token was that I was under the impression that the token would expire. So that is why I stored the hashed password and then get a new token each time.

terrelsa13 commented 4 years ago

No problem.

This is a recent post on the emby forum I found that lead me to believe the tokens do not expire. But I could be wrong. If it turns out tokens do expire we can add storing and using the hashed password back into the script.

terrelsa13 commented 4 years ago

Another possible option: If it turns out the API generated access token does expire; a token can be manually created via the emby server API GUI. The script would then prompt the user to copy/paste the manual created token. This token would never expire (unless revoked) and a password would not have to be input or stored.

I know this might be less ideal as it requires a few extra clicks to manually create a token.

clara-j commented 4 years ago

I had tried with the generated API key, but for some reason I couldn't get it to have permissions to delete.

I can't find anything showing the token expires so I will merge and revert back if it causes any problems.

Thanks again for the work on this.