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

Add Show Channel Details where it's missing #6919

Merged
merged 16 commits into from
Aug 24, 2021

Conversation

ktprograms
Copy link
Contributor

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Add Show Channel Details to Local Playlists, Watch History and Subscription Feeds
  • Had to update StreamEntity to add a uploader_url column. Also added a database Migration and changed the version number to 4.
  • If you click Show Channel Details and the uploader_url is empty in the database, it fetches it using the Newpipe Extractor and saves it to the database.
  • Had to add kapt "org.xerial:sqlite-jdbc:3.34.0" to build.gradle as a workaround on M1 Macs. Doesn't seem to hurt the build on other machines so I left it in.

Before/After Screenshots/Screen Record

  • Before:

Before

- After:

After

Fixes the following issue(s)

TODO:

Options Option 1: Just test migrating directly from `2` to `4`.
Option 2: Use SupportSQLiteDatabase query and DatabaseUtils.dumpCusrorToString.
Option 3: Hopefully someone knows the correct way to do it...

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

Due diligence

@ktprograms ktprograms changed the title Channel details all places Add Show Channel Details where it's missing Aug 14, 2021
@ktprograms
Copy link
Contributor Author

Need to test:

Install the APK from GitHub Actions, then test Show Channel Details in:

  1. Local Playlists
  2. Watched History
  3. Subscription Feed

Open Android Studio and connect to the app process, open newpipe.db and double click the streams table. Find the uploader_url column and delete the channel link for some videos. Then confirm that Show Channel Details still works (will take longer since it needs to call the Newpipe Extractor).

@XiangRongLin
Copy link
Collaborator

Fix AppDatabaseTest (My SO question)

For me that test has served it's purpose and can be deleted. An existing migration should never be changed afterwards =>code never changes => regression can never occur => tests are useless

Opinions? @Stypox

@triallax triallax added the feature request Issue is related to a feature in the app label Aug 14, 2021
@ktprograms
Copy link
Contributor Author

When creating a StreamEntity from a PlayQueueItem, previously it would just save an empty string. I've edited PlayQueueItem to have the uploader url and save it to the StreamEntity.

@Stypox
Copy link
Member

Stypox commented Aug 16, 2021

For me that test has served it's purpose and can be deleted. An existing migration should never be changed afterwards =>code never changes => regression can never occur => tests are useless

Mmmh, you are right. Though, we need to put a comment in the database migrations file explaining that a test must be created when creating a PR with a migration, and then be removed just before the PR is merged. Another option instead would be to always keep a migration test from the current version - 1 to the current version, so that is can be used as reference, can be easily edited and does not need to be created and then removed just afterwards (which may cause problems if e.g. something is changed after it is removed and reviewers do not notice).

@ktprograms
Copy link
Contributor Author

Seems like it would be a good idea to have the most recent migration test kept as a reminder / make sure there haven't been any database changes. I think any change in the database schema would make the test fail.

@ktprograms

This comment has been minimized.

@ktprograms
Copy link
Contributor Author

Bare minimum passing test in 02aa6fc, feel free to request changes.

@XiangRongLin
Copy link
Collaborator

Though, we need to put a comment in the database migrations file explaining that a test must be created when creating a PR with a migration, and then be removed just before the PR is merged

In a better world, you would not test the migrations, but test if the app is still working after applying the migrations.

In this case I don't see any benefit to add a test for the migration. If the feature works by trying it out manually, then the migration already succeeded. And it is simple enough, that having that manual try out is good enough.

@Stypox
Copy link
Member

Stypox commented Aug 16, 2021

Ok, I get your point @XiangRongLin. Let's remove the database test completely and test migrations manually from now on then. @ktprograms sorry for having you write a bare minimum test if it is going to be removed ;-). Could you add a comment just after public final class Migrations { that goes something along the lines of:

// Test new migrations manually by importing a database from daily usage and checking if the migration works
// If you add a migration point it out in the pull request, so that others remember to test it themselves

Thank you :-)

@ktprograms
Copy link
Contributor Author

ktprograms commented Aug 17, 2021

@ktprograms sorry for having you write a bare minimum test if it is going to be removed ;-)

No problem. Wasn't much trouble.

Changes made in 967bdf8

app/build.gradle Outdated Show resolved Hide resolved
Comment on lines +13 to +19
/////////////////////////////////////////////////////////////////////////////
// Test new migrations manually by importing a database from daily usage //
// and checking if the migration works (Use the Database Inspector //
// https://developer.android.com/studio/inspect/database). //
// If you add a migration point it out in the pull request, so that //
// others remember to test it themselves. //
/////////////////////////////////////////////////////////////////////////////
Copy link
Member

Choose a reason for hiding this comment

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

Perfect, thank you :-)

if (isNullOrEmpty(item.getUploaderUrl())) {
final int serviceId = item.getServiceId();
final String url = item.getUrl();
// TODO: Some visual loading indicator
Copy link
Member

Choose a reason for hiding this comment

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

I don't know what to suggest; maybe it can do without a loading indicator (similar to the "Mark as watched" action present in 0.21.9).

Copy link
Contributor Author

@ktprograms ktprograms Aug 17, 2021

Choose a reason for hiding this comment

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

I think there should be some kind of indicator (even just a Toast), won't seem like the app's hanging.

@ktprograms
Copy link
Contributor Author

How can I comment on lines of code without doing a review?

@opusforlife2
Copy link
Collaborator

@ktprograms There is a review type "Comment" meant just for this. You can select that, or choose to "Add a single comment" directly.

@ktprograms
Copy link
Contributor Author

There is a review type "Comment" meant just for this. You can select that, or choose to "Add a single comment" directly.

Thanks, I clicked the "Add single comment" button so why does it show as ktprograms reviewed xx hours ago?

@ktprograms
Copy link
Contributor Author

@Stypox do you mind trying to import again (maybe from a different export) since this issue can't seem to be reproduced?

@opusforlife2
Copy link
Collaborator

@ktprograms Because when you're commenting on the code you're also reviewing it, in essence? Does it matter, though? It's just semantics. The functionality is there for you to comment on code. How Github shows it or what it's called doesn't seem important to me.

Stypox
Stypox previously approved these changes Aug 24, 2021
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.

My database was missing a CREATE INDEX `index_feed_group_sort_order` ON `feed_group` (`sort_order`);}, probably since I used that database in a temporary version of #2309 and then exported and re-imported it in a normal NewPipe release, and the correct migrations never ran since the database version was already up to date. So yes, ignore my crash report. I can confirm this works, thank you!

@Stypox
Copy link
Member

Stypox commented Aug 24, 2021

Uhm, the build is failing @ktprograms

@ktprograms
Copy link
Contributor Author

Not sure why, seems to be a checkstyle error but it doesn't happen on my local repo.

@ktprograms
Copy link
Contributor Author

Oops, was testing building on the wrong branch.

@Stypox can you re-run the build please?

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!

app/build.gradle Outdated Show resolved Hide resolved
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!

@Stypox Stypox merged commit 2027b74 into TeamNewPipe:dev Aug 24, 2021
@ktprograms ktprograms deleted the channel-details-all-places branch August 25, 2021 00:37
@ktprograms ktprograms restored the channel-details-all-places branch August 25, 2021 00:39
This was referenced Sep 5, 2021
ktprograms added a commit to ktprograms/NewPipe that referenced this pull request Dec 13, 2021
This checks if the uploaderUrl is in the database, if not it gets the
uploaderUrl and puts it in the database. This is similar to the fetching
of uploaderUrl when it doesn't exist done in TeamNewPipe#6919.
ktprograms added a commit to ktprograms/NewPipe that referenced this pull request Jan 8, 2022
This checks if the uploaderUrl is in the database, if not it gets the
uploaderUrl and puts it in the database. This is similar to the fetching
of uploaderUrl when it doesn't exist done in TeamNewPipe#6919.

Also use createNotification when error occurs in getStreamInfo.
ktprograms added a commit to ktprograms/NewPipe that referenced this pull request Jan 8, 2022
This checks if the uploaderUrl is in the database, if not it gets the
uploaderUrl and puts it in the database. This is similar to the fetching
of uploaderUrl when it doesn't exist done in TeamNewPipe#6919.

Also use createNotification when error occurs in getStreamInfo.
ktprograms added a commit to ktprograms/NewPipe that referenced this pull request Jan 10, 2022
This checks if the uploaderUrl is in the database, if not it gets the
uploaderUrl and puts it in the database. This is similar to the fetching
of uploaderUrl when it doesn't exist done in TeamNewPipe#6919.

Also use createNotification when error occurs in getStreamInfo.
ktprograms added a commit to ktprograms/NewPipe that referenced this pull request Jan 11, 2022
This checks if the uploaderUrl is in the database, if not it gets the
uploaderUrl and puts it in the database. This is similar to the fetching
of uploaderUrl when it doesn't exist done in TeamNewPipe#6919.

Also use createNotification when error occurs in getStreamInfo.
ktprograms added a commit to ktprograms/NewPipe that referenced this pull request Jan 25, 2022
This checks if the uploaderUrl is in the database, if not it gets the
uploaderUrl and puts it in the database. This is similar to the fetching
of uploaderUrl when it doesn't exist done in TeamNewPipe#6919.

Also use createNotification when error occurs in getStreamInfo.
ktprograms added a commit to ktprograms/NewPipe that referenced this pull request Jan 25, 2022
This checks if the uploaderUrl is in the database, if not it gets the
uploaderUrl and puts it in the database. This is similar to the fetching
of uploaderUrl when it doesn't exist done in TeamNewPipe#6919.

Also use createNotification when error occurs in getStreamInfo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issue is related to a feature in the app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No "show channel details" in long-press menu in feed or local playlist items
5 participants