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

Migrate to api v2 #134

Closed
wants to merge 7 commits into from
Closed

Migrate to api v2 #134

wants to merge 7 commits into from

Conversation

nalch
Copy link
Contributor

@nalch nalch commented Mar 21, 2020

  1. Move base url and api base into own module
  2. Use new api base where applicable
  3. Add login settings
  4. Add login/logout functions
  5. Add automatic (re)login after forbidden responses
  6. Minor pycodestyle fixes

fixes #127, fixes #128, fixes #131, fixes #132, fixes #133

1. Move base url and api base into own module
2. Use new api base where applicable
1. Add login settings
2. Add login/logout functions
3. Add automatic (re)login after forbidden responses
This was referenced Mar 21, 2020
@doko-desuka
Copy link
Contributor

Wow, this looks like a lot of work! Thanks for all this @nalch.

I think this official WS add-on could use a cleanup in some places.
The /resources/lib/ui/embed_extractor.py script for example, it has some extractors for sites that don't exist anymore like RapidVideo. Another point is the fact that it requests series data multiple times when it could cache it to memory (see usages of the _get_anime_info function).
I mean, if you already have the data, put it in a Kodi memory property and keep it there (like it's done in here).

@doko-desuka
Copy link
Contributor

doko-desuka commented Mar 22, 2020

For everyone coming in, you can download this zip here to install this updated WonderfulSubs version by Nalch: plugin.video.wonderfulsubs.zip *
If any more commits are made after this comment, this zip will become obsolete and should be ignored.

* That zip is just the archive of his fork but with the folder inside it renamed to plugin.video.wonderfulsubs.

@Ichijoe2112
Copy link

Ichijoe2112 commented Mar 22, 2020

Just tried this, and it's not working. This said. It would seem like the entire WonderfulSubs site is um dead. Going there points you to use the 'beta.WonderfulSubs.com' location. That on first inspection looks more promising. But, nothing seems to be quite baked there as well. Hopefully these issues will be resolved soon. But, I got a feeling things are staying down again for a while T_T

But, I thank the Developers use of their time. And, having no intentions of disrespecting it either. Even if nothing much has changed. But, as stated, I believe these troubles are all on the other side of the ether right now.

@nalch
Copy link
Contributor Author

nalch commented Mar 22, 2020

Just tried this, and it's not working. This said. It would seem like the entire WonderfulSubs site is um dead. Going there points you to use the 'beta.WonderfulSubs.com' location. That on first inspection looks more promising. But, nothing seems to be quite baked there as well. Hopefully these issues will be resolved soon. But, I got a feeling things are staying down again for a while T_T

But, I thank the Developers use of their time. And, having no intentions of disrespecting it either. Even if nothing much has changed. But, as stated, I believe these troubles are all on the other side of the ether right now.

That is weird. Just watched a bit with the new version.
The pull request version uses the beta version of the site (or more precisely api version v2), so that shouldn't be a problem. If you can upload the kodi log, I'll have a look, what could have gone wrong.

@DxCx
Copy link
Owner

DxCx commented Mar 23, 2020

Awsome work @nalch thanks alot for your hard work!
Ill review it ASAP :)

@NerdNational
Copy link

is there away of getting the plugin to work on the firestick?

@Ichijoe2112
Copy link

I haven't used a Fire Device in some time. So I might be out of touch. But, assuming things haven't changed much. You should be a side / down load(er), from the Amazon Appstore. That you will endup pluging the URL to Kodi into. Which will allow you to download, and install it. Its a shame this still has to be said in 2020. But, Google really is your best Friend in such matters, use him.

@NerdNational
Copy link

NerdNational commented Mar 23, 2020 via email

@doko-desuka
Copy link
Contributor

@NerdNational are you able to watch it on the website? because some old / obscure shows simply don't have any working sources anymore.
They still reference Mangostream / RapidVideo, video hosters that don't exist anymore.

If what you're trying to watch doesn't have the CR server then I wouldn't put much hope into it.

@doko-desuka
Copy link
Contributor

  • Streamango, not Mangostream lol

@NerdNational
Copy link

NerdNational commented Mar 23, 2020 via email

@Ichijoe2112
Copy link

Just tried this, and it's not working. This said. It would seem like the entire WonderfulSubs site is um dead. Going there points you to use the 'beta.WonderfulSubs.com' location. That on first inspection looks more promising. But, nothing seems to be quite baked there as well. Hopefully these issues will be resolved soon. But, I got a feeling things are staying down again for a while T_T
But, I thank the Developers use of their time. And, having no intentions of disrespecting it either. Even if nothing much has changed. But, as stated, I believe these troubles are all on the other side of the ether right now.

That is weird. Just watched a bit with the new version.
The pull request version uses the beta version of the site (or more precisely api version v2), so that shouldn't be a problem. If you can upload the kodi log, I'll have a look, what could have gone wrong.

Ok I like to think I'm on top of things. But, I'm willing to admit stupidity on my part. The Zip Files as given... Do I need to treat these is any other special way, other then the usual method of 'installing as zip file' (i.e. System -> Settings -> Add-ons -> Install from zip file)?
Because this is how I did it, on my Shield TV running Kodi v18.6.2

I was also trying to access the Site from my Tablet, as I was requested to log back into my old account. Which was Not workong for me. Henne the Beta Website which did allow me to create a working account. Which this Add-on seems to also accept. No more nagging about needing to log in. But, (and, it may be a tablet thing), but, nothing was apparently working on the actual website over Crome either.

@NerdNational
Copy link

NerdNational commented Mar 23, 2020 via email

@NerdNational
Copy link

NerdNational commented Mar 23, 2020 via email

@NerdNational
Copy link

NerdNational commented Mar 23, 2020 via email

@Ichijoe2112
Copy link

Ok Tried somethings differently, and have since found some success. My main point of failure is in using 'Latest'. As per my want, if I instead look into the 'Airing' channel. Things begin to work. But, I'm to lasy to read subs, and want to watch the dubbed stuff. And, that may well be all still hit, and miss at this point. As I was trying to start a dubbed ep of new LotGH on my Samsung Tablet last night, and the Site was clearly not having any of it.

@doko-desuka
Copy link
Contributor

Can you test it with this add-on? https://github.com/doko-desuka/plugin.video.wsbeta

Copy link
Owner

@DxCx DxCx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, Thanks alot!
I havnt tried it yet but ill defently do after next CR cycle

resources/lib/WonderfulSubsBrowser.py Outdated Show resolved Hide resolved
@@ -155,6 +157,10 @@ def __send_request(session, url, data=None, set_request=None, head=False):
'allow_redirects': True,
}

token = control.getSetting('login.token')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the seperation between http and control (you may add token throught api/self instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure, where to put it. Do you mean to pass it from WonderfulSubsBrowser into the function?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, token is generic to http, control isnt

resources/lib/ui/embed_extractor.py Outdated Show resolved Hide resolved
resources/lib/ui/BrowserBase.py Outdated Show resolved Hide resolved
resources/lib/WonderfulSubsBrowser.py Show resolved Hide resolved
return response["json"]
if self._response_forbidden(response) and reauth:
login()
return self._json_request(url, data, reauth=False)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont you need to just tell xbmc to referesh?
Also, i think there was another place which tried to handle relogin..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My knowledge about xmbc is not sufficient for that :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ill need to referesh my memory but i think there is a function to halt render and just referesh the same addon url

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

II was exploring today, on another issue, and came across: Kodi Documentation website [ https://codedocs.xyz/AlwinEsch/kodi/index.html ]. It appears to be for v19.0, so I do not know if you can find something useful here. nalch, I thought this might help.

Also I
tried your version yesterday and watched 22/7 sub [from Currently Airing]. I did not get any subs, on screen. I reviewed the log, and found WS could not find sub. I apologize, but I did not copy the segment of the log referencing this issue... Sorry, just thought I would mention this.

I really appreciate all you are doing!

resources/lib/__init__.py Outdated Show resolved Hide resolved
@@ -5,6 +5,13 @@
<setting id="reverseorder" label="40002" type="labelenum" values="Ascending|Descending" default="Descending"/>
<setting id="searchhistory" label="40003" type="labelenum" values="Yes|No" default="Yes"/>

<setting type="lsep" label="Login"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So looks like we need to remove wonderful subs from the playlist flavor (as everone is logged in by default) and handle different flavor only if set..

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note that some changes leaked from this commit into previous one, like strings and forbiden/use token

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you can browse some lists without being logged in, so not sure, if we want to remove the watchlist flavor. Probably a good idea.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need it to play? What gives browse without play?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I usually just log in when I have to, but I'll try to put it on load.

@@ -1,11 +1,11 @@
import itertools
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor pycodestyle fixes - while i am in favor of using tooling i think that commit alone deserves its own PR.
Also, if using such tool, the configuration file should be shared in the repo (to make sure everyone is aligned), so please add such file to git (tox.ini?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, was conflicted myself, but those are just a subset of the pycodestyle rules my IDE showed :/ The inner monk wanted the empty lines.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im perfectly fine with your inner monk, it just make sense, i just want the config to be shared so other monks woth get nuts ;)

Copy link
Owner

@DxCx DxCx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if you please can rebase and squash properly so i can use the commits as is and not squash all togather

resources/lib/__init__.py Outdated Show resolved Hide resolved
1. Move _response_forbidden into subs browser
2. Remove constants import from embed_extractor
@nalch
Copy link
Contributor Author

nalch commented Mar 24, 2020

Also, if you please can rebase and squash properly so i can use the commits as is and not squash all togather

Not sure, what you mean with that. I usually have the commits separate for easier reviewing and then squash them when merging. What do you prefer to do?

@DxCx
Copy link
Owner

DxCx commented Mar 24, 2020

Everything is reviewed and can be prepared for a merge ;)

@Serg86
Copy link

Serg86 commented Mar 26, 2020

Is the upcoming new version still compatible with Kodi 17.6? I am using RecalBox 6.1.1 and unfortunately, their Kodi version is always way older than the current Kodi release.

I much prefer RecalBox to RetroPie and even though Kodi introduced RetroPlayer in version 18, it's far from great, the input lag alone is horrendous. Maybe Kodi 19 or 20 will be better but so far, RecalBox it is, which unfortunately means Kodi 17.6 for the foreseeable future.

@DxCx
Copy link
Owner

DxCx commented Mar 29, 2020

@nalch should i expect another drop soon? Or do you want me to take it from this point to merge? I think that espeically now (covid-19) people would need this plugin even more

@nalch
Copy link
Contributor Author

nalch commented Mar 29, 2020

@nalch should i expect another drop soon? Or do you want me to take it from this point to merge? I think that espeically now (covid-19) people would need this plugin even more

Hey, I'm probably not able to add something until late next week so feel free to chime in :)

@DxCx
Copy link
Owner

DxCx commented Apr 3, 2020

please open a PR with pycodestyle fixes (including its config)

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