-
Notifications
You must be signed in to change notification settings - Fork 41
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
Support base64 encoding #93
Conversation
f5f6cfc
to
42c76f5
Compare
This doesn't work with Python 3 (Kodi 19). Hexlify was used for a good reason.
|
We'll probably move to base64 instead? |
I think that's a good option now that Addon Signals has moved to |
That won't work as we have to communicate back. We need to effectively track what encoding was used by which sender and reply accordingly. |
Just base64 then. |
I think the only way forward is to do it like this. Store the encoding-type per sender, so we support both base64 and hex encoding. @im85288 Do you agree with this implementation? We should work towards releasing this as soon as possible. |
Next to this, I think we need fix the Wiki and provide sensible instructions for add-on writers on how to integrate with Up Next. @im85288 Can you give @mediaminister and me access to the Wiki? |
@dagwieers - I guess so as it seems to be the only way to have things generic. I have not been keeping up but if the problem comes down to only Addon Signals...maybe we should just go back to having this addon use it as it used to so that all of that sort of logic belongs in that addon rather than here? |
Sure - Not sure I know how to do it though..but will take a look |
@dagwieers You should now have access to the wiki, let me know if there are any issues |
Ok, this PR is not ready until it has been reviewed and confirmed to work. |
Tested with VRT NU add-on (hex) and Netflix (base64). |
Doesn't work yet.
|
@mediaminister Kodi version ? Python version ? I am testing a newer version using the base64 class for Python 3, and have a separate function for encoding the data. And I added some unit tests (#95) for this to ensure it works as expected on all Python versions as we have had some complaints I cannot reproduce. |
Kodi 18.5 Git:20191117-37f51f6e63 Platform: Linux x86 64-bit, Python 2 with VRT NU add-on master branch |
@mediaminister Dat heb ik nochtans getest. |
Watching two episodes works sometimes. But I can't watch three or more episodes in a row. (I don't use the "Watch Now" button.) |
I am planning to write integration tests as well where we can perform successive calls and fake playing media. But there will always be some gray area when Kodi is involved. (e.g. Unicode and behaviour) I did not test multiple successive calls myself yet at this stage. I first want to finish the unit tests in this PR to work fine. Hopefully tonight. |
7f35eea
to
4dae549
Compare
ff74360
to
01249b8
Compare
The unit tests work, despite Travis CI not working in GitHub today (?). This time I tested successive continuation, and it works. |
4661544
to
1e9eb7b
Compare
That is the problem, since v0.0.9 the implementation was not using Addon Signals and other projects may have implemented support in their add-on (like we did with VRT NU). See also: #29 So I am afraid we have to support both hex and base64-encoded payloads for some time. I don't mind if we add a warning so over time people move to base64 encoded payloads, but we cannot just move to using Addon Signals at this time. |
Tested py3.7 hex and base64, and py3.5 hex, seems to be working fine |
@dagwieers - Thanks for the explanation and getting this resolved. When your ready for me to merge and build a release candidate just let me know. |
Let's get the approval of @mediaminister. His Kodi testing skills have been unmatched. |
I tested with VRT NU add-on on Kodi 18/Python 2 and Kodi 19/Python3 and I can confirm it works. I didn't manage yet to get Netflix add-on working on Kodi 19/Python3 (Windows) because of a missing Cryptodome dependency. So, we should wait for a confirmation of base64 working on Python 3 before merging. |
Let me also add unit tests for Addon Signals. |
6f2fc42
to
ac246b3
Compare
With the recent change from Addon Signals to **base64** encoding, we need to support both **hex** and **base64** encoding. This PR includes: - support for base64 encoding when the original sender uses base64 encoding - communicate with trakt using base64 encoding - add unit tests for encoding/decoding hex and base64 encoding - add testing using AddonSignals - add testing for Python 3.5
Personally, I would merge this and release this as soon as possible. Since friday Up Next is broken for all add-ons using Addon Signals. In the unlikely case we broken Python 3 using base64 we can fix that afterwards. The number of users running a Kodi v19 is limited (according to inputstreamhelper and Up Next download stats it is less than 1%) and typically users that chose to live on the edge. |
@dagwieers Cool merging now, we can create new issues etc as needed in the future |
I tested |
@mediaminister Great to hear! It is not the same as an Addon Signals test, and our encode/decode tests has its limitations too. But at least we know it does not have any obvious Python 3 issues. Thanks! |
I do have to note that we are still trying hex-encoding first, and then fall back on base64. And the main reason for this is that an hex-encoded string can be decoded as base64 without any issues (it could be a valid base64 string too) whereas the hex-encoding has various type checks that do raise an exception. We may want to improve our code by validating that the decoded content is proper JSON, and if not try base64. But it is probably better to get rid of hex-encoding in the not too distant future. It would be good to know our customers better and have a complete list of add-ons using Up Next. |
With the recent change from Addon Signals to base64 encoding, we need to support both hex and base64 encoding.
This PR includes:
This fixes #91