Skip to content

Conversation

@PeterHindes
Copy link
Contributor

@PeterHindes PeterHindes commented Oct 14, 2019

@PeterHindes
Copy link
Contributor Author

Previously playlists with a null uploader (such as album playlists generated by YouTube music) crashed the app (error screen, returns to playlist list). Now the uploader name is left blank and playlists can be used without an uploader. To replicate problem, try adding this playlist (an album generated by YT-Music) to your library.

@PeterHindes
Copy link
Contributor Author

A future commit may be made which fills the uploader with the uploader of the first video/song in the playlist.

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Thank you! I only pointed out a style issue.

@PeterHindes PeterHindes requested a review from Stypox October 14, 2019 21:34
@PeterHindes
Copy link
Contributor Author

I think that fixes it

@PeterHindes
Copy link
Contributor Author

Just added some doc-strings before final merge. (Wrong branch for that other commit, so I reverted that, it will be a different pr)

@PeterHindes PeterHindes changed the title Fixed Playlists With No Uploader Crashing The App [Bug Fixed] Playlists With No Uploader No Longer Crash The App When Added To Users Library Oct 14, 2019
Stypox
Stypox previously approved these changes Oct 15, 2019
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Thank you! :-D
This should be an easy merge, only one line was changed. @TobiGr

@Redirion
Copy link
Member

what happens, if the channel name gets changed? https://support.google.com/youtube/answer/2657964

is the channelName equal to uploader?

also the import of TextUtils can be removed

@PeterHindes
Copy link
Contributor Author

what happens, if the channel name gets changed? https://support.google.com/youtube/answer/2657964

is the channelName equal to uploader?

also the import of TextUtils can be removed

Thanks for the catch I hadn't considered that. Ill use the == fix instead. Ill push the fix later today

@PeterHindes
Copy link
Contributor Author

Fix pushed

@Redirion
Copy link
Member

Redirion commented Oct 15, 2019

== will most likely never be true (good for null checks, but bad for String comparison)

What about readding the import of TextUtils and use
TextUtils.equals(getUploader(), info.getUploaderName())
?

This is a null safe comparison of those Strings and should fix it.

Sorry, I just did see the unused TextUtils import earlier and didn't think about using it as the solution.

@PeterHindes
Copy link
Contributor Author

ill check out some solutions and push a fix later today

@PeterHindes
Copy link
Contributor Author

PeterHindes commented Oct 15, 2019

Ok, that should be better. Sorry for the larger change, but it now lists "Auto-Generated" as the uploader when null, and has debug loging! I tried to follow style from 'PlaylistFragment.java'.

@Redirion
Copy link
Member

Redirion commented Oct 15, 2019

did you test, whether simply replacing
getUploader().equals(info.getUploaderName());
with
TextUtils.equals(getUploader(), info.getUploaderName());
would also work?
I can't see why it wouldn't but maybe I am missing something.
For reference, this is the implementation of TextUtils.equals:


    /**
     * Returns true if a and b are equal, including if they are both null.
     * <p><i>Note: In platform versions 1.1 and earlier, this method only worked well if
     * both the arguments were instances of String.</i></p>
     * @param a first CharSequence to check
     * @param b second CharSequence to check
     * @return true if a and b are equal
     */
    public static boolean equals(CharSequence a, CharSequence b) {
        if (a == b) return true;
        int length;
        if (a != null && b != null && (length = a.length()) == b.length()) {
            if (a instanceof String && b instanceof String) {
                return a.equals(b);
            } else {
                for (int i = 0; i < length; i++) {
                    if (a.charAt(i) != b.charAt(i)) return false;
                }
                return true;
            }
        }
        return false;
    }

@PeterHindes
Copy link
Contributor Author

Yes when loading a playlist with no uploader a little error dialogue shows at the bottom of the screen. It's a bit annoying, but it doesn't crash the app like it did before. A fix to the extractor should make the remaining error go away.

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

This is good to go, I also tested with 4 other playlists/albums and they worked (taken from here, on the right).
The ui changes look good, and I agree that a notice is to be shown in the playlist page (as it is now).
Thank you for the contribution :-D

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Sorry for the double review, I forgot to point out this ;-)

@PeterHindes
Copy link
Contributor Author

allright everything looks good. I removed some unnecessary changes. (I had planed do make a more compact layout without the uploader if there was none found, but it didnt work out)

@PeterHindes PeterHindes requested a review from Stypox December 10, 2019 16:58
@PeterHindes
Copy link
Contributor Author

Cool so does this mean it will be in the next release target?

@Stypox Stypox merged commit 0f04dd6 into TeamNewPipe:dev Dec 10, 2019
@Stypox
Copy link
Member

Stypox commented Dec 10, 2019

@PeterHindes yeah :-)

@TobiGr
Copy link
Contributor

TobiGr commented Dec 10, 2019

@Stypox and @Redirion thanks for reviewing and merging and thanks to @PeterHindes for creating the fix.
@Stypox Please add the PR to the drafted release notes after merging it. This helps to keep track of the changes and speeds up creating the first RC PR.
@Redirion I am glad to hear this! I've sent you an invitation.

@Stypox
Copy link
Member

Stypox commented Dec 11, 2019

Ok, thanks for the tip, I didn't know about the drafted release notes 😉

@PeterHindes PeterHindes deleted the dev branch December 11, 2019 21:20
@PeterHindes
Copy link
Contributor Author

The pr for the extractor fix should also be reviewed for the next release. Thanks @Redirion for the second half of the fix.

@TobiGr
Copy link
Contributor

TobiGr commented Dec 12, 2019

@PeterHindes I merged the extractor PR and updated to the latest extractor commit (see b883ad1 and TeamNewPipe/NewPipeExtractor@8cb3250)

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

Labels

bug Issue is related to a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants