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
Improve offline capabilities, "fix" subscription import & error messages #1083
Conversation
JamesCullum
commented
Jun 19, 2022
•
edited
edited
- Refactored Sponsorblock, so that when videos are downloaded, segments are displayed and skipped offline as well
- Removed unused imports (CTRL+SHIFT+O) and auto-indented (CTRL+SHIFT+L) some files I worked with
- Reworded the "subscription.json" hint to correctly call it "subscription.csv". There were some reports of this not working (Not able to import my subscriptions from Youtube #1046 & Importing subscriptions not working #1041), but I tested it with the current build and it works. I assume it either was fixed upstream or through a different contribution. Hence we only really need to change the instructions, rebuild and publish to fix this.
- Fixed error toasts during offline mode - simply saying that the internet connection is unavailable is better than using the technical error. Also an error with "Javascript player" is not useful and the toast is suppressed.
…g updated gradle build, the bug of failed importing has been fixed upstream.
…nloading and using it offline
… (saving RAM). Improve errors for offline mode.
About the imports - there are a couple of file formats which is supported by NewPipeExtractor, json, csv and even zip, and I've fixed a couple of bugs in my latest commit, but I still received exceptions with the zip format, so I haven't closed the tickets yet. |
I see - thanks for the clarification! With CSV it works fine for me, and with the updated phrasing this is what most users would expect to select (before looking into the code, I didn't know ZIP was even supported). Ready to merge then? |
Sorry for not replying earlier, I have a couple of concerns:
|
So this means we should change only english, or modify english as well only via weblate?
Agreed - done already
Agreed, this method for the current approach might make sense to change going forward. Not sure if this needs to happen as part of this PR, as this is an already existing implementation.
It actually isnt - the download does not set SBVideoInfo for the youtube object itself, only for the new column.
The information is only retrieved in two scenarios - once when the video is downloaded (then its cached), or everytime the video is played. As the request is only executed once, there is not really a need for advanced data handling - if the file is cached, we expect the data to be embedded (or null, if download failed), otherwise we request it and if the data is valid, we load it.
You are right that theoretically this would be a concern. However as mentioned above - this would only happen for downloaded videos, for which I assume users expect to load data offline and save data as much as possible (if an internet connection is available at all). If someone wants to refresh the download video, they can delete and re-download the video. We could try to pull updated data for downloaded videos as well, if we want that.
I think as I don't store the blob as video anymore (first draft I did), I can just remove it from the YoutubeVideo and deal with it directly in the player.
Sure, will do |
… version, move SBVideInfo back to Player instead of YoutubeVideo Revert formatting changes for files without changes, for less confusion
If you opened up the YoutubePlayerActivityV2, then the code retrieved that sponsorblock segment, and set it on the YoutubeVideo object. If you later clicked on the download menu item, that YoutubeVideo object was added to the download database. But maybe, I've screwed up something during my debugging. |
Thanks for merging! I suspected that it would do that, but during my tests this wasnt the case. Maybe you waited for the video to finish completely loading? Anyways, now the issue is fixed either way and the code is more clean this way anyways, thanks for the discussion 👍 |