Skip to content
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

Direct device access for myjdapi #58

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

Direct device access for myjdapi #58

wants to merge 5 commits into from

Conversation

hfr
Copy link

@hfr hfr commented Feb 27, 2024

This modifications allows myjdapi to be used for a direct local connection to a JDownloader device without any interaction with the My.Downloader service.

@mmarquezs
Copy link
Owner

Thanks for your contribution. Will try to take a look at it at some point, probably this weekend.

@hfr
Copy link
Author

hfr commented Feb 28, 2024

Thanks for your contribution. Will try to take a look at it at some point, probably this weekend.

I could test the direct device access with my configuration but I do not use My.Downloader at all. So it is necessary that some else is checking if my monkey-patches are conflicting with the normal operation via My.Downloader.

There is one other point which might need some research. My JD device was not happy with the parameter packaging of the original request_api() method. It especially did not like that the dict of the parameter was packaged as a string. Therefore I introduced a flag to allow for a transport as dict. I wonder why the local packaging might be different from the packaging via My.Downloader. Could it be that this might prevent the the usage of the direct communication even if it is available?

Here is the code I have modified:

            if params is not None:
                for param in params:
                    if (isinstance(param, dict) and not self.__dict_as_str) or isinstance(param, str) or isinstance(param, list):
                        params_request += [param]
                    elif (isinstance(param, dict) and self.__dict_as_str) or isinstance(param, bool):
                        params_request += [json.dumps(param)]
                    else:
                        params_request += [str(param)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants