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

refactor download manager #962

Open
theScrabi opened this issue Jan 5, 2018 · 72 comments
Open

refactor download manager #962

theScrabi opened this issue Jan 5, 2018 · 72 comments
Labels
bounty Whoever solves this gets a bounty: https://app.bountysource.com/teams/newpipe downloader Issue is related to the downloader feature request Issue is related to a feature in the app help wanted Help is wanted in fixing this issue

Comments

@theScrabi
Copy link
Member

theScrabi commented Jan 5, 2018

bounty

  • [5] I carefully read the contribution guidelines and agree to them.
  • [no] I checked if the issue/feature exists in the latest version.

Gigaget wase once a downloader distributed on fdroid. However it is discontinued, tho we copypasted their code into NewPipe, and made gigaget our downloader.
Now we have to get rid of it, since its causing a lot of trouble.
Related issues:
#961
#779
#355
#345
#315

Maybe we could replace it with a Download Manager available on Android Arsenal. Feel free to browse a little and find a downloader you think fits to NewPipe.

A new download manager must have these abilities:

  • using SAF (for downloading to sdcard)
  • Be singe threaded (one thread per download)

Nice to have:

@theScrabi theScrabi added the feature request Issue is related to a feature in the app label Jan 5, 2018
@theScrabi theScrabi added the bounty Whoever solves this gets a bounty: https://app.bountysource.com/teams/newpipe label Jan 5, 2018
@ghost
Copy link

ghost commented Jan 11, 2018

@theScrabi From your link, Fetch looks like the most active and up to date project.

@theScrabi
Copy link
Member Author

theScrabi commented Jan 11, 2018

Uuuh fetch also has a wifi only switch :)

Does it also support notification?

@ghost
Copy link

ghost commented Jan 11, 2018

@theScrabi No idea. There's not a lot of open source download managers for Android out there. Gigaget and uGet are pretty much the most well known ones. The ones you listed are more like side projects that aren't ready to be posted on the Play Store or even F-Droid.

You may have to stick with Gigaget for a while longer or even find somebody to fork Gigaget and fix the issues you mentioned. Or perhaps uGet can be ported to Newpipe? Not sure how easy that would be compared to porting Gigaget.

@miloslavnosek
Copy link

uGet is just frontend for CLI downloader aria2. Perhaps aria2 can be used in newpipe?

@ghost
Copy link

ghost commented Feb 26, 2018

@LosEagle Actually, its a frontend for curl and aria2, and only curl is supported by default. aria2 support is included in uGet but you have to enable it in the settings before you are able to use it.

However, aria2 on it's own might be a good option but I'm not sure how easy it will be to add to Newpipe.

@ghost
Copy link

ghost commented Feb 26, 2018 via email

@theScrabi
Copy link
Member Author

Well, using a native library would add another level of hell to NewPipe.

Oh yes. Well it was nice if there is already some external downloader available.
@wb9688 could you please write the downloader as a module for for gradle, like the NewPipeExtractor.

@ghost
Copy link

ghost commented Feb 26, 2018

could you please write the downloader as a module for for gradle, like the NewPipeExtractor.

@theScrabi: I don't think we should do that, since we'll need to have things specific for NewPipe (for example getting a new stream URL from NewPipeExtractor when the URL it's using to download expires). I'll write a new downloader for NewPipe though.

@karyogamy
Copy link
Contributor

Has anyone looked at this? It looks quite mature and modular.

@ghost
Copy link

ghost commented Feb 28, 2018

@wb9688 Thanks for your efforts and be sure to take your time on this downloader project. Please make sure the downloader makes multiple simultaneous connections while downloading like Gigaget does, though, or I predict many people will complain.

@theScrabi theScrabi changed the title Get rid of gigaget refactor download manager Apr 4, 2018
@theScrabi
Copy link
Member Author

So I worked myself into this a bit further, and what i found out is, that accessing files via Unix file system (File class) is not possible any more. Instead you would want to use the Android Storrage Access Framework, which comes with its on classes and methods to handle files.

Uri instead of file names

So instead of filenames SAF uses Uri, to access files. What we would want to do in order to access SD card files is getting the Uri for the root directory, and cooncan the path to our file onto the end of it.

InputStream/OutputStream

Files can not be handled with File class anymore, however from android we can request InputStream/OutputStreams and create/delete fiels.

gigaget

Our current download manager is bad rubbish, it's old code someone wrote to test his andorid skills, and therefore its not quite reliable and up to date. Also it is based ontop of the idea that you can download one file with parallel threads.

What I've seen so far is that there is no real replacement for a download manager that uses SAF on android arsenal (notify me if you find something different).

So we have two options here:

  1. Refactor gigaget, so it does not use threads, and supports SAF
  2. Write a downloadmanager from scratch

File picker

Our filepicker is cool, but it does also not use SAF, and on top of that its sometimes a big buggy, here it would be cool to use the android SAF file picker, but that is not relay usable until android 6.0 ... so meh, we need to stick to it, and try to translate from filepath to uri.

@ghost
Copy link

ghost commented Apr 5, 2018

Didn't @wb9688 already say he was writing a new downloader? I don't think Gigaget is salvagable. Fixing it will probably be more work than wring a barebones downloader from scratch, and all of the mature alternatives have already been mentioned in this issue.

@ghost
Copy link

ghost commented Apr 5, 2018 via email

@placidcasual98
Copy link

So what would the time scale will I be before we can download to SD cards?

@theScrabi
Copy link
Member Author

theScrabi commented Apr 8, 2018

This is hard to tell. It's done when its done, however it got requested so often that I think things will get rolling soon :D

@wb9688 I don't want to sound unpolide, but you also said you where going to implement support for AndroidTV, and PipeCast. So far you started those projects than abandon them.
I think it's ok if you work on things, but notify us about them once you have a decent amount of code, because otherwise people might not consider giving it a shot as well, and when you abandon them again the project is basically blocked.

@ghost
Copy link

ghost commented Apr 8, 2018 via email

@mauriciocolli
Copy link
Contributor

I'm experimenting with this library: okdownload, which is a rewrite of the popular one that @karyogamy posted previously (with improvements in documentation, testing and other aspects).

I may have a working proof-of-concept in the next weekend.

@snappyapple632
Copy link

So with this issue seemingly fixed in 0.17, can this issue be finally closed, that is, when @kapodamy claims his bounty money?

@PeterHindes
Copy link
Contributor

would youtube-dl be a good candidate? It's a separate open source program primarily used from the command line. It could likely be embedded in NewPipe.

@Stypox
Copy link
Member

Stypox commented Feb 27, 2020

We know about youtube-dl (we even take inspiration from there for the extractor). But youtube-dl uses Python, which can't be run on Android unless with a heavy and slow emulator

@wb9688
Copy link
Contributor

wb9688 commented Feb 27, 2020

@PeterHindes and @Stypox: Plus youtube-dl isn't even a download manager and won't solve any of the issues mentioned here.

@PeterHindes
Copy link
Contributor

Fair enough. I don't know much about youtube-dl, but I believe it has a binary form, IDK if it still packages python there though.

@wb9688
Copy link
Contributor

wb9688 commented Feb 28, 2020

@PeterHindes: The issue here is not retrieving the URL of the file, which NewPipeExtractor does wunderfully. The problem is actually downloading the file from the URL that NewPipeExtractor provides. youtube-dl would be an alternative for NewPipeExtractor, which we don't need, besides that youtube-dl lacks a lot of features.

@PeterHindes
Copy link
Contributor

Maybe I'm not understanding. Does NewPipe Extractor provide a URL that you could for example download in a browser? I'm not familiar with the details of the process of downloading a YouTube video.

@opusforlife2
Copy link
Collaborator

Yep. It's Newpipe code that downloads the video. Look at the source file names.

@KaKi87
Copy link

KaKi87 commented May 18, 2021

Hello, any news on this ? Thanks

@SameenAhnaf SameenAhnaf mentioned this issue Sep 14, 2021
3 tasks
@ghost
Copy link

ghost commented Mar 27, 2022

deleted by author i want to take on this bounty puck - make a user happy with downloading within NewPipe the solution will be a process - a library - in a separate repository, added as clean dependency download process will be implemented in clojure with core.async - vegan magic compiled into java loaded via JitPack from github - like with deps.edn or docker-compose - no maven middlemen, straight from Jesus NewPipe will see it just as another java jar library once working and used - repo can be moved/forked or code copied-included - as TeamNewPipe deems better

simply put
there will be a concise pull request adding a new dependency
resulting in downloading UX being what user expects and wants and fulfilling objectives set in this issue

if there are no objections to such a solution - green light it and i will science the Mark-Watney-potatoes-crap out of it

@opusforlife2
Copy link
Collaborator

@Sergei-Udris Have you taken a look at all the issues related to the download manager? If not, I recommend you do so at least once.

@ghost
Copy link

ghost commented Mar 28, 2022

deleted by author > @Sergei-Udris Have you taken a look at all the issues related to the download manager? If not, I recommend you do so at least once.

i did - took a look at all issues mentioned in this thread

i must self-decline though for a different reason - i will not take this issue on
i am looking for bounties - yes, but thinking thoroughly how to do it most mercifully for myself - with highest degree of freedom without creating new worker-programs
clojure jvm - yes, pull request a clean dependency - yes
but - i will go for docker-services, no jvm-libs, to be a "true foreigner" - no linting-style or choice of libraries quarrels with existing app
instead - for example, some golang or multilingual self-hosted docker app
clean dependecy as i described - is exactly a true foreigner, while committing in-place would be like someone stuck in their own country while they are already a foreigner inside
docker - is indeed going true foreigner but in an angrier country-culture one does not want - doing evil servers and services and not whole-foods-plant-based clojurescript and browser-npm fast-unhealthy-snacks world
reason i won't do it - program must be both desktop and mobile, not just one - simple as that

:David-Mitchell i'm not eating a sandwich in WHSmith, you barbarian!

@opusforlife2
Copy link
Collaborator

i did - took a look at all issues mentioned in this thread

🤣 Ah no, that's not nearly enough. I was talking about all the related issues in the repo, with the downloader label. Otherwise, what would be the point of refactoring?

@killerrook

This comment was marked as spam.

@lepras

This comment was marked as off-topic.

@placidcasual98

This comment was marked as off-topic.

@ali-ghamdan

This comment was marked as off-topic.

@placidcasual98

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty Whoever solves this gets a bounty: https://app.bountysource.com/teams/newpipe downloader Issue is related to the downloader feature request Issue is related to a feature in the app help wanted Help is wanted in fixing this issue
Projects
None yet
Development

No branches or pull requests