-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Download playlist #2018
Download playlist #2018
Conversation
I will not add features right now. There are already so many features and bugs at the moment that I/we can not take care about this any time soon. |
@VishalNehra I've just merged a bunch of downloader changes (see #2149). I'd like to take a look at your changes soon. Can you please rebase? |
@TobiGr sure, will try this weekend. |
I tried to resolve the conflicts and I just realize that your download all implementation triggers a pop-up for each item of the playlist that was the idea? |
There is a smart download option in the download dialog which I added, which will identify your last chose setting and based on that will download remaining items of playlist without opening dialog for each. |
Yes! you are right, it's an 'auto' checkbox! |
Alright, after hours of trouble to merge the latest dev branch here, I'm expecting this to get reviewed this time. @theScrabi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and clean code!
app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java
Outdated
Show resolved
Hide resolved
@VishalNehra The code looks good. I'll test it in the during the week. |
@TobiGr looks fine, i submited a review that was not necessary |
Sure @TobiGr I'll be rebasing on weekend, and also have a minor fix which I didn't commit. |
6015fbd
I've rebased dev and fixed some NPEs |
@@ -138,6 +155,231 @@ public static void playOnBackgroundPlayer(final Context context, final PlayQueue | |||
startService(context, getPlayerIntent(context, BackgroundPlayer.class, queue, resumePlayback)); | |||
} | |||
|
|||
public static void downloadPlaylist(final PlaylistFragment context, final PlayQueue queue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do all of these PlaylistFragment
types always have to be like that? Couldn't a Fragment or Activity work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if one wants to download a playlist from a different fragment? It would be better if the type of the parameter context
was the base class Fragment
and not PlaylistFragment
, so that the method can be used everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically I can get away with using FragmentActivity instead (there would be some implications; like I'm passing onError implementation of PlaylistFragment for reactive stream failure, while in FragmentActivity won't be able to do that. If there were an abstract class, I could've used that instead, for this specific use case.
Apart from that, the initial call to initialize DownloadDialog#newInstance requires PlaylistFragment#callback now. Again, an abstract class would help here too, so in future you would need to extend that class wherever you would want to initialize this download dialog.
Right now it's tightly coupled with PlaylistFragment, but the change you're suggesting would require a lot of changes in many parts of your source.
I'll leave it upto you to decide for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmhh OK, in case I ever need to use it from elsewhere I will implement it myself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, in this case it is time for a last round of testing and then we should be ready, finally :)
Thanks again for keeping your branch updated @VishalNehra. I am sorry, we've kept you waiting way too long.
Using KitKat (API 19, Android 4.4) I get this Exception when downloading a YouTube (upstream) playlist:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had an overview, and in my opinion we should not merge this as it is. Here are some reasons:
- Coupling to the fragment, which definitely shouldn't be necessary.
- Spaghetti code in the NavigationHelper.
- Bad UX to the user.
- Rotated the phone? Switched apps? Problems ahead.
- This don't deal with configurations changes.
- As the playlist in the fragment is paged, it isn't completely loaded yet, so this don't download all the playlist.
Creating a new screen showing a list of items giving the user the option to select which one they wanted, and the preferred configurations for all downloads (per-item configuration as well), would be much better here.
PS: Downloading all the items (the stream pages) might have an impact on reCAPTCHAs. YouTube seems to rate limit those a lot, so it should handle this as well.
private StoredFileHelper storedFileHelper; | ||
private int threadCount; | ||
private String[] urls; | ||
private char kind; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a good idea using char for this, a enum would be much better.
@@ -304,6 +308,12 @@ public void handleResult(@NonNull final PlaylistInfo result) { | |||
return true; | |||
}); | |||
|
|||
headerDownloadAllButton.setOnClickListener(view -> { | |||
if (PermissionHelper.checkStoragePermissions(activity, PermissionHelper.DOWNLOAD_DIALOG_REQUEST_CODE)) { | |||
NavigationHelper.downloadPlaylist(this, getPlayQueue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange use of the PlayQueue
items here. Why not the items themselves?
@@ -345,7 +365,7 @@ public void handleNextItems(ListExtractor.InfoItemsPage result) { | |||
//////////////////////////////////////////////////////////////////////////*/ | |||
|
|||
@Override | |||
protected boolean onError(Throwable exception) { | |||
public boolean onError(Throwable exception) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should strictly remain for internal use only.
final Iterator<PlayQueueItem> itemIterator, | ||
DownloadSetting downloadSetting) { | ||
if (downloadSetting != null) { | ||
Completable.create(emitter -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The create method should not be used. Also this isn't the ideal place to subscribe.
* @param streamInfo | ||
* @return | ||
*/ | ||
private static DownloadSetting refactorDownloadSetting(PlaylistFragment activity, DownloadSetting downloadSetting, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire method just feels out of place, navigation should be the only thing done in this class.
@@ -61,11 +61,24 @@ | |||
android:text="@string/caption_setting_title"/> | |||
</RadioGroup> | |||
|
|||
<android.support.v7.widget.AppCompatCheckBox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be just CheckBox
, let the library replace that for you.
android:layout_below="@+id/video_audio_group" | ||
android:layout_marginBottom="6dp" | ||
android:layout_marginLeft="20dp" | ||
android:gravity="left" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to set gravity here, it will mess up the alignment. It'll also cause issues with RTL languages.
@VishalNehra could you address @mauriciocolli's suggestions? @TobiGr it would be good to have this merged after 0.18.0 is released, so that I can start working on #2583. If you @VishalNehra have no time to dedicate to this pr anymore, feel free to tell me, I would be ok creating a new pr myself ;-) |
Any updates here? |
Sorry for late reply, I did agree with @mauriciocolli however, my current schedule doesn't permit me to address all the changes. |
Any updates here? |
I feel like this will never get implemented. I am really hoping this will be added on v0.21.0 so @Spypox's #2583 can be added aswell. :) |
I decided that I will implement half of #2583 without bulk downloading for now, hopefully in a few days I should have something working with the proper code structure (i.e. not just a demonstration) |
@Stypox your just amazing! |
I'm closing this as this is not really a good approach to bulk downloading. It would leak in many places and the current gigaget downloader is just crappy. We a new downloader for NewPipe will be built we will be able to finally implement this properly. @VishalNehra thank you for your work anyway ;-) |
anything new on this topic ? |
Anything new on this topic? |
I think the standard forum etiquette applies here. "Don't necropost/Don't bump zombie threads" = "Don't add noise to zombie PRs or issues." |
Hello,
My first contribution here. Saw there's missing option to download playlist, so tried implementing it.
Open to suggestions.
Fixes #1058
Edit: Also noticed, channel specific playlists are not shown on the channel page. I'm interested in implementing a way to show them too. Please point me to the issue if still exists.