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

Resuming videos from the progress saved in YouTube #505

Open
chidniu opened this issue Dec 18, 2018 · 14 comments
Open

Resuming videos from the progress saved in YouTube #505

chidniu opened this issue Dec 18, 2018 · 14 comments

Comments

@chidniu
Copy link

chidniu commented Dec 18, 2018

It would be awesome if this add-on could use the video-progress saved in Youtube. This would enable cross-device resuming of videos which is a really cool feature, especially for the "Watch Later" playlist.

@tadly
Copy link

tadly commented Jan 15, 2019

As far as I know this is impossible as there's no way to retrieve the progress information.

Further, if you watch a youtube video in kodi, progress is not being tracked on youtube.
Hence you're still left with a half-baked solution.

On this note...
I'm curious if the add-on could at least mark videos as watch (in kodi) if they exist in the history playlist (completely ignoring progress of course).
Have had that myself a few times where I already watched a video on my phone/tab/notebook to then browse my subscriptions in kodi not remembering what I've already seen.

@chidniu
Copy link
Author

chidniu commented Jan 15, 2019

Thanks for your reply! The official webapp (www.youtube.com/tv) supports both writing and reading progress information, so I assumed it might technically be possible. Real shame, because syncing both ways would be a huge improvement in usability imho!

@tadly
Copy link

tadly commented Jan 15, 2019

I was actually thinking of /tv as well but have never used it nor "debugged" it so I didn't reference it in my initial response.

If it actually does allow to read/write you are very welcome to share more details!

!!! THAT SAID !!!

Setting the progress (which would affect history and play-count) on youtube is prohibited.
Googles stance for this add-on is:

As long as it does not manipulate history and/or play-count we'll close both eyes

* Not word by word what they said but you get the idea and I think it's only play-count but I'm not 100%

There are many valid reasons for google to hold this position (most notable one being -> no ads in kodi)


Anyways, pulling progress information might still be an interesting aspect.

@anxdpanic Hope you don't mind me pulling you in on this.
Could be a real nice feature for the addon even if one-way.

@anxdpanic
Copy link
Collaborator

@tadly
I'm not sure regarding pulling the progress, will be something to look into though.

I was not aware of that stance, and currently the add-on does add to history and as of this version would track play time. I will have to remove this for the next beta.

@tadly
Copy link

tadly commented Jan 15, 2019

@anxdpanic you mean it does track it on youtube or tracks it within kodi?

Within kodi is fine!!
On youtube I've never seen working with the add-on

@anxdpanic
Copy link
Collaborator

anxdpanic commented Jan 15, 2019

It tracks on YouTube

See:

f80bc17
d49aa3e

@tadly
Copy link

tadly commented Jan 15, 2019

Testing this right the heck now and I can confirm this seems to be working.

Don't get me wrong, I'd love for this to work and be part of the add-on as I myself wrote a (private) add-on which spawns a browser in the background playing the video in low quality just to achieve this (without google being able to say anything about it).

Before you start removing stuff I'll actually talk about this in the team real quick.

@anxdpanic
Copy link
Collaborator

hah, I'd love to keep this as part of the add-on as well. I understand the stance though, and the feature is of no use without the add-on :)

Thanks for checking, will hold off on removing until you've had a chance to confirm.

@tadly
Copy link

tadly commented Jan 15, 2019

Just out of curiosity, how stable do you think this is gonna be?

Back when I tried to find a way to track progress I found that google does a lot to validate whether or not it's a real watch or not by, even after the video has been watched, validating stuff server side, retroactively removing the watched state if deemed invalid.

Either way, 👏 for managing to get this working in the first place!

@anxdpanic
Copy link
Collaborator

Adding it to history was working for a few versions, only recently they changed where the url was. As it was, it always marked the history at the start of the video but there were never any reports of history items going missing.
The new part for this version was reporting playback state and time, I would think this should be relatively stable as well but could probably be improved.

@tadly
Copy link

tadly commented Jan 15, 2019

Alright, good news!
I talked to one of the team members who has talked to Google and to the best of our knowledge this would be fine to have, so let's continue unless we hear otherwise.

Now if you manage to get polling in as well (so it's both ways) we are beyond golden! :D

Edit: Sorry for me saying google prohibited this. I was certain this was their stance at some point but I must misremember things

@anxdpanic
Copy link
Collaborator

Sounds good! Thank you again for confirming.
Regarding your edit, absolutely no worries about your assertion. I'd rather it be brought up and have a conversation about it, than adding a feature unchecked that could cause issues.

Haven't looked yet, but the things I'm worried about with pulling are;

  1. It will be 1 video per request, which for a list of 50 videos would be ~52 requests
  2. If number 1. is the case, pulling the info after user chooses to play will cause conflicts with Kodi's bookmarking

@tadly
Copy link

tadly commented Jan 15, 2019

In regards to polling.

I agree that polling the exact progress will cause a lot of requests which is undesirable.
If at all possible it could be a "Maintenance option" which the user could trigger manually (or maybe at startup or on big intervals).

A more simplistic approach, without progress, could be to just mark videos watch based on them existing in the history playlist.
This should limit the amount of request (depending on how precisely you can fetch the history).
Say you pull all videos watched within the last hour or so and have this run every hour in the background.
That'd be good enough IMO. You'd obviously track when it was last run and if last_run + interval <= time.time() run it again.

@anxdpanic anxdpanic changed the title Resuming videos from the progress saved in Youtube (enhancement) Resuming videos from the progress saved in YouTube Mar 12, 2019
@tadly
Copy link

tadly commented Apr 23, 2019

Now that I'm more often watching videos on youtube outside of kodi, I wanna bump this again :)

As mentioned in my previous comment, not setting the progress itself but at least the watched state within kodi would already be huge.

The "how to implement this" should probably be discussed again.
My previous suggestion of "once an hour" is quite error prone for systems which are turned off for a longer period of time.

Instead pulling...

  • The last ~24 hours or
  • The last ~100 videos

...would make more sense and be less likely to miss videos.

A service could then trigger this once an hour (I think that's reasonable).
Additionally, being ability to manually trigger it from the settings / through RunPlugin would be nice.

Do you think this would be difficult to add?
Maybe I'd find the time to do so with a little guidance on where to start.

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

No branches or pull requests

3 participants