-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To do: refresh Trakt token on each run #50
Comments
at around line 216 in config_tools.py I have this
I was having problems figuring out a way to validate the credentials. If we can test right here to see if it fails somehow it should try to reauthenticate on start-up. If you have any idea how to validate it we should be good to go |
I would probably test by retrieving the user's settings? As long as that request returns a I don't know trakt.py but seems like |
Or I guess you wouldn't have to worry about the http status codes - you could just test whether that API call return an expected settings object or not. |
I was using https://github.com/fuzeman/trakt.py/blob/master/tests/oauth/test_oauth.py as a reference for this and thought the
|
this can be closed now |
Not sure this is ready to be closed? I'll take a look this week but basically the script would pass the |
ok I see what you're saying I thought you meant us telling the program to validate and refresh on startup I can look into this cause it sounds way better lol |
I've tested the token refresh and have it working in a different branch. One problem I encountered is that the refresh token can only be used once, so if multiple config files share the same tokens, the other config files break. To make it worse, if execution is automated with One workaround is for each config file to have its own trakt tokens. |
I like the format I have in this comment and think being able to run multiple config files would be beneficial |
For now, what about just creating a setting on whether to refresh the token or not? Agreed that we need to find a better way to separate auth from config. It's going to be tricky though since there are so many settings that may be different for each set of collections. For example, in your comment @meisnate12, how would I set one set of collections to sync while the other set appends? |
I was thinking of having sync_mode net setable at the global level, library level, and collection level |
config.yml
The configuration for the collections can be in a separate directory (similar to Plex-Python-Libraries' recipes). They will either have to be called out individually as arguments or the script can just iterate through everything in the collections directory. collections/movies.yml
collections/movies-4k.yml
collections/tv.yml
|
To make it easier to find the library files I was saying we have the settings all in the config file and just the collections in their own like below. This will let us not have to do so much checking in the file system of each file to see if it is a collection file. We can just check and see if the file the user specified exists vs having to check all the files around the program and it allows users to put library files wherever they want. config.yml
movie_collection.yml
4kmovie_collection.yml
show_collection.yml
|
I think the library belongs in the collection file. What if I don't want a list applied against a certain library, or if the list isn't applicable to a library type? Or what if I name a movie library and tv library the same thing? Plex allows this, but then you'd have duplicate keys in under |
im not really sure what your asking/ how its any different from now?
it wont run lists it cant same as it does now when they're in the same file
Thats a good point i guess we would have to have a show_library attribute and movie_library attribute which would also allow us to get rid of having the user specify which library_type. this is all of course if we went with my design
If you want the plex attribute in each file thats fine but we should still have a list of files in the config like this
|
You're right. I misunderstood.
That'll work. Maybe something other than
No need for this any more. |
we could probably just go with config path |
What about something like this? https://www.home-assistant.io/docs/configuration/splitting_configuration/ I'm sure there's lot of other projects that had to figure out how to nest YAML as well. Just trying to avoid reinventing the wheel if possible. |
Closing this. For config split, we can use #78 |
Trakt provides the ability to refresh the Trakt token. Seems like the script should refresh the token on each run or on some interval (maybe set the interval in the yaml with a logical default) to avoid auth silently failing? I've come across the issue myself given that Trakt tokens expire every 3 months.
Looks like #14 and #48 are probably both caused by this.
The text was updated successfully, but these errors were encountered: