-
Notifications
You must be signed in to change notification settings - Fork 200
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
RFE: Add API to override Platform #706
Comments
I don’t understand the problem. Your describing different ways to set this that does work. You have to do it in the correct order. I also fail to see how the issue you linked to is relevant. You need to fix this in your script. |
@Hellowlol those examples are all various hacks. Therefore I request a programmatic way to set the deviceId in the plex instance, not the global static module internal variable. Hence creating this issue for enchancement. Having some trickery done before importing a module trashes up project coding style. Python coding style is that you put Besides messing up style, it's very fragile, if in case somebody else loads the module before the header overwrites the code, your initialization will fail. |
I can’t speak for others but I’m not gonna do this at all. There are 3 ways to do this. Patching, environmental variables and using a config file. Your assuming that PlexServer is the main entry point. That might be true for simple scripts, but what about all the others? Should we add device_platform to all other classes that ppl might, such as the cloud classes? I assume you see my point, as this will be very had to maintain. With that being said, if you can come up with a simpler method then we are currently using that is easy to maintain I’ll happily merge that. 😄 |
The problem with patching and environment variables is that these need to be done before 'import' statement. The problem with config, is that it's global and applies to all applications, not my application, so that's out of the way for setting application-specific properties. The main problem seems to be around Perhaps move that then applications like mine, can do Ideally, (i.e in the next iteration), the config could be passed to those {client,myplex,server} constructors. |
And yes, PlexServer was an example, and was setting only |
Started something: need some kind of guidance on:
|
I found this when attempting to refactor:
seems it's somewhat[*] documented how to override a device, just need to do both assignments. plexapi.X_PLEX_PLATFORM = 'iOS'
plexapi.BASE_HEADERS['X-Plex-Platform'] = plexapi.X_PLEX_PLATFORM [*] somewhat in sense, meaning it's not in docs, but source code, i.e not official. |
Describe the issue
There's currently no programmatic way to override Platform and Client name.
Hacks like overwriting
X_PLEX_PLATFORM
/X_PLEX_DEVICE_NAME
do not work without more internal symbols hacking, because those values are copied elsewhere:python-plexapi/plexapi/__init__.py
Lines 23 to 32 in 1429867
Setting environment variables also does not work, as that needs to be done before the
import plexapi
is called.Code snippets
Expected behavior
Additional context
Trying to make changes identifiable to be able to skip own changes. I.e skip changes identified by named device:
The text was updated successfully, but these errors were encountered: