From 39a3f03e7952de40bbac8719d97dc47721401a65 Mon Sep 17 00:00:00 2001 From: Fynn Godau Date: Thu, 4 Jun 2020 11:05:41 +0200 Subject: [PATCH 1/5] Bandcamp support --- app/src/main/AndroidManifest.xml | 16 +++++++++++++++ .../schabi/newpipe/util/KioskTranslator.java | 8 ++++++++ .../schabi/newpipe/util/ServiceHelper.java | 2 ++ .../drawable-nodpi/place_holder_bandcamp.png | Bin 0 -> 6893 bytes app/src/main/res/values/colors_services.xml | 9 +++++++++ app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/values/styles_services.xml | 19 ++++++++++++++++++ 7 files changed, 56 insertions(+) create mode 100644 app/src/main/res/drawable-nodpi/place_holder_bandcamp.png diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e7fa95759ea..23128117a67 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -317,6 +317,22 @@ + + + + + + + + + + + + + + + + `o9OEtw?*?6qEcs*h-}o8KOPf##3H;@puWD61JMWOfx217-_RkrS_4K zm|nKjLz0eU#%5@xsc>q-6oYnWD?>xm(d7Nyw|0M@c02#U@%i}Ret53?zOL{0`hKrl z`UW57w9n>z1^}3bd#>38fDZgt2N>$ZFaO^6WC(tl9P1gh7XYI>=#y3-b9o0`oX!0@ zkh?i1lFQ%5i2!^)fAP-f-Fw5g#YQZS;Y8)BUFQHW=UaTuSAP4>yjJvFyT(g+`KGB( zpSE$$Z)bxiZ`pJ8SKU3{HYVFVQ|Dd$lK4tRJ42n@QqGG!dTh_G{L>lN;|@nIzwo`| zF@xg!J5$g3t&7#O(mmIFc17-$Fc3HBr_shCobx)UbT^N9!z$C|=`$JgHRm-Kem#kQ_ z*K!wN+^i_XDs81#K5sHORoh22GYhR)n~zNe_+!PAb)2Xf*@q;N&$5*>i2)~>Wof!i z1|TtF;3}3K@g`wLW&PKA&w*rJOey!GeF(slcR5nQ7#CLa>hT<8*XxiFdU(PlnF@mAj(y$4Z?=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8dd3f..45a816924b2 100644 --- a/app/src/main/res/values/colors_services.xml +++ b/app/src/main/res/values/colors_services.xml @@ -44,4 +44,13 @@ #FFFFFF #9e9e9e + + #17a0c4 + #000000 + #17a0c4 + + #17a0c4 + #FFFFFF + #17a0c4 + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 25e7f6210d1..9fb15e4638f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -707,4 +707,6 @@ This content is private, so it cannot be streamed or downloaded by NewPipe. This video is available only to YouTube Music Premium members, so it cannot be streamed or downloaded by NewPipe. This content is only available to users who have paid, so it cannot be streamed or downloaded by NewPipe. + Featured + Radio diff --git a/app/src/main/res/values/styles_services.xml b/app/src/main/res/values/styles_services.xml index ad8b3589984..89d04e49fd9 100644 --- a/app/src/main/res/values/styles_services.xml +++ b/app/src/main/res/values/styles_services.xml @@ -70,4 +70,23 @@ @color/dark_media_ccc_accent_color + + + + + + + From 292e1030735e6860ba4599136f85337784c193ab Mon Sep 17 00:00:00 2001 From: TobiGr Date: Sun, 14 Mar 2021 17:51:47 +0100 Subject: [PATCH 2/5] Ignore ContentNotSupportedException caused by Bandcamp fan pages --- .../fragments/detail/VideoDetailFragment.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 08ec9a5fc8b..5581cf87576 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -62,6 +62,7 @@ import org.schabi.newpipe.error.UserAction; import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.NewPipe; +import org.schabi.newpipe.extractor.exceptions.ContentNotSupportedException; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.stream.AudioStream; import org.schabi.newpipe.extractor.stream.Stream; @@ -1547,8 +1548,19 @@ public void handleResult(@NonNull final StreamInfo info) { } if (!info.getErrors().isEmpty()) { - showSnackBarError(new ErrorInfo(info.getErrors(), - UserAction.REQUESTED_STREAM, info.getUrl(), info)); + // Bandcamp fan pages are not yet supported and thus a ContentNotAvailableException is + // thrown. This is not an error and thus should not be shown to the user. + for (final Throwable throwable : info.getErrors()) { + if (throwable instanceof ContentNotSupportedException + && "Fan pages are not supported".equals(throwable.getMessage())) { + info.getErrors().remove(throwable); + } + } + + if (!info.getErrors().isEmpty()) { + showSnackBarError(new ErrorInfo(info.getErrors(), + UserAction.REQUESTED_STREAM, info.getUrl(), info)); + } } binding.detailControlsDownload.setVisibility(info.getStreamType() == StreamType.LIVE_STREAM From a28aa6a8c438448952b42e6b3ec4bd35546f1794 Mon Sep 17 00:00:00 2001 From: TobiGr Date: Fri, 5 Mar 2021 21:53:13 +0100 Subject: [PATCH 3/5] Add Bandcamp to supported services section in README --- README.ja.md | 1 + README.ko.md | 1 + README.md | 1 + README.pt_BR.md | 1 + README.ro.md | 1 + README.so.md | 1 + 6 files changed, 6 insertions(+) diff --git a/README.ja.md b/README.ja.md index c101f385109..c451586560e 100644 --- a/README.ja.md +++ b/README.ja.md @@ -84,6 +84,7 @@ NewPipe は複数のサービスに対応しています。[ドキュメント]( * SoundCloud \[ベータ\] * media.ccc.de \[ベータ\] * PeerTube インスタンス \[ベータ\] +* Bandcamp \[ベータ\] diff --git a/README.ko.md b/README.ko.md index af5b209be98..34b117bb6c5 100644 --- a/README.ko.md +++ b/README.ko.md @@ -79,6 +79,7 @@ NewPipe는 여러가지 서비스를 지원합니다. 우리의 [문서](https:/ * SoundCloud \[beta\] * media.ccc.de \[beta\] * PeerTube instances \[beta\] +* Bandcamp \[beta\] ## Updates NewPipe 코드의 변경이 있을 때(기능 추가 또는 버그 수정으로 인해), 결국 릴리즈가 발생할 것입니다. 이것들의 형식은 x.xx.x 입니다. diff --git a/README.md b/README.md index f1791de4cc9..4dc88991065 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ NewPipe supports multiple services. Our [docs](https://teamnewpipe.github.io/doc * SoundCloud \[beta\] * media.ccc.de \[beta\] * PeerTube instances \[beta\] +* Bandcamp \[beta\] diff --git a/README.pt_BR.md b/README.pt_BR.md index dedb64a7cf6..28e565c9956 100644 --- a/README.pt_BR.md +++ b/README.pt_BR.md @@ -79,6 +79,7 @@ O NewPipe suporta vários serviços. Nosso [documentação](https://teamnewpipe. * SoundCloud \[beta\] * media.ccc.de \[beta\] * PeerTube instances \[beta\] +* Bandcamp \[beta\] ## Atualizações Quando uma alteração no código NewPipe (devido à adição de recursos ou fixação de bugs), eventualmente ocorrerá uma versão. Estes estão no formato x.xx.x . A fim de obter esta nova versão, você pode: diff --git a/README.ro.md b/README.ro.md index 75e3bd5b052..df88694991e 100644 --- a/README.ro.md +++ b/README.ro.md @@ -81,6 +81,7 @@ NewPipe suportă servicii multiple. [Documentele](https://teamnewpipe.github.io/ * SoundCloud \[beta\] * media.ccc.de \[beta\] * Instanţe PeerTube \[beta\] +* Bandcamp \[beta\] diff --git a/README.so.md b/README.so.md index f8bc51e5939..19f995363ee 100644 --- a/README.so.md +++ b/README.so.md @@ -79,6 +79,7 @@ NewPipe wuxuu taageeraa adeegyo badan. [warqadan](https://teamnewpipe.github.io/ * SoundCloud \[tijaabo\] * media.ccc.de \[tijaabo\] * PeerTube instances \[tijaabo\] +* Bandcamp \[tijaabo\] ## Kushubida iyo cusboonaysiinta Marka koodhka NewPipe isbadal ku dhaco (wax cusub oo lagusoo kordhiyay ama cilad bixin), ugu dambayn waxaa lasii daayaa mid cusub (Siidayn). Siidaynta qaabkeedu waa x.xx.x . Si aad midka cusub u hesho, waxaad samayn kartaa: From 71d3227791702901d6c898d4e9a85f0d0eb3cb8c Mon Sep 17 00:00:00 2001 From: TobiGr Date: Sun, 14 Mar 2021 12:50:56 +0100 Subject: [PATCH 4/5] Fix bottom controls being out of the screen This was caused by too large end screen thumbnails enlarging the whole palyer. Fixed by scaling the thumbnail. Ensure that the player does not use the whole screen height in detail fragment to keep the additional content like title, comments, etc. available. --- .../org/schabi/newpipe/player/Player.java | 96 +++++++++++++++++-- .../org/schabi/newpipe/util/DeviceUtils.java | 18 ++++ 2 files changed, 108 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 42477592867..ab93d8742df 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -1129,6 +1129,12 @@ private void onBroadcastReceived(final Intent intent) { // Close it because when changing orientation from portrait // (in fullscreen mode) the size of queue layout can be larger than the screen size closeItemsList(); + // When the orientation changed, the screen height might be smaller. + // If the end screen thumbnail is not re-scaled, + // it can be larger than the current screen height + // and thus enlarging the whole player. + // This causes the seekbar to be ouf the visible area. + updateEndScreenThumbnail(); break; case Intent.ACTION_SCREEN_ON: // Interrupt playback only when screen turns on @@ -1187,6 +1193,78 @@ private void initThumbnail(final String url) { .loadImage(url, ImageDisplayConstants.DISPLAY_THUMBNAIL_OPTIONS, this); } + /** + * Scale the player audio / end screen thumbnail down if necessary. + *

+ * This is necessary when the thumbnail's height is larger than the device's height + * and thus is enlarging the player's height + * causing the bottom playback controls to be out of the visible screen. + *

+ */ + public void updateEndScreenThumbnail() { + if (currentThumbnail == null) { + return; + } + + final float endScreenHeight = calculateMaxEndScreenThumbnailHeight(); + + final Bitmap endScreenBitmap = Bitmap.createScaledBitmap( + currentThumbnail, + (int) (currentThumbnail.getWidth() + / (currentThumbnail.getHeight() / endScreenHeight)), + (int) endScreenHeight, + true); + + if (DEBUG) { + Log.d(TAG, "Thumbnail - updateEndScreenThumbnail() called with: " + + "currentThumbnail = [" + currentThumbnail + "], " + + currentThumbnail.getWidth() + "x" + currentThumbnail.getHeight() + + ", scaled end screen height = " + endScreenHeight + + ", scaled end screen width = " + endScreenBitmap.getWidth()); + } + + binding.endScreen.setImageBitmap(endScreenBitmap); + } + + /** + * Calculate the maximum allowed height for the {@link R.id.endScreen} + * to prevent it from enlarging the player. + *

+ * The calculating follows these rules: + *

    + *
  • + * Show at least stream title and content creator on TVs and tablets + * when in landscape (always the case for TVs) and not in fullscreen mode. + * This requires to have at least 85dp free space for {@link R.id.detail_root} + * and additional space for the stream title text size + * ({@link R.id.detail_title_root_layout}). + * The text size is 15sp on tablets and 16sp on TVs, + * see {@link R.id.titleTextView}. + *
  • + *
  • + * Otherwise, the max thumbnail height is the screen height. + *
  • + *
+ * + * @return the maximum height for the end screen thumbnail + */ + private float calculateMaxEndScreenThumbnailHeight() { + // ensure that screenHeight is initialized and thus not 0 + updateScreenSize(); + + if (DeviceUtils.isTv(context) && !isFullscreen) { + final int videoInfoHeight = + DeviceUtils.dpToPx(85, context) + DeviceUtils.spToPx(16, context); + return Math.min(currentThumbnail.getHeight(), screenHeight - videoInfoHeight); + } else if (DeviceUtils.isTablet(context) && service.isLandscape() && !isFullscreen) { + final int videoInfoHeight = + DeviceUtils.dpToPx(85, context) + DeviceUtils.spToPx(15, context); + return Math.min(currentThumbnail.getHeight(), screenHeight - videoInfoHeight); + } else { // fullscreen player: max height is the device height + return Math.min(currentThumbnail.getHeight(), screenHeight); + } + } + @Override public void onLoadingStarted(final String imageUri, final View view) { if (DEBUG) { @@ -1207,23 +1285,29 @@ public void onLoadingFailed(final String imageUri, final View view, @Override public void onLoadingComplete(final String imageUri, final View view, final Bitmap loadedImage) { - final float width = Math.min( + // scale down the notification thumbnail for performance + final float notificationThumbnailWidth = Math.min( context.getResources().getDimension(R.dimen.player_notification_thumbnail_width), loadedImage.getWidth()); + currentThumbnail = Bitmap.createScaledBitmap( + loadedImage, + (int) notificationThumbnailWidth, + (int) (loadedImage.getHeight() + / (loadedImage.getWidth() / notificationThumbnailWidth)), + true); if (DEBUG) { Log.d(TAG, "Thumbnail - onLoadingComplete() called with: " + "imageUri = [" + imageUri + "], view = [" + view + "], " + "loadedImage = [" + loadedImage + "], " + loadedImage.getWidth() + "x" + loadedImage.getHeight() - + ", scaled width = " + width); + + ", scaled notification width = " + notificationThumbnailWidth); } - currentThumbnail = Bitmap.createScaledBitmap(loadedImage, - (int) width, - (int) (loadedImage.getHeight() / (loadedImage.getWidth() / width)), true); - binding.endScreen.setImageBitmap(loadedImage); NotificationUtil.getInstance().createNotificationIfNeededAndUpdate(this, false); + + // there is a new thumbnail, thus the end screen thumbnail needs to be changed, too. + updateEndScreenThumbnail(); } @Override diff --git a/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java b/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java index 1afedcaef31..52069fd0e7d 100644 --- a/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java @@ -6,8 +6,10 @@ import android.content.res.Configuration; import android.os.BatteryManager; import android.os.Build; +import android.util.TypedValue; import android.view.KeyEvent; +import androidx.annotation.Dimension; import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; @@ -70,4 +72,20 @@ public static boolean isConfirmKey(final int keyCode) { return false; } } + + public static int dpToPx(@Dimension(unit = Dimension.DP) final int dp, + @NonNull final Context context) { + return (int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, + dp, + context.getResources().getDisplayMetrics()); + } + + public static int spToPx(@Dimension(unit = Dimension.SP) final int sp, + @NonNull final Context context) { + return (int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_SP, + sp, + context.getResources().getDisplayMetrics()); + } } From bdaee25e6116e86ce34ebcfd1444a812aaa175af Mon Sep 17 00:00:00 2001 From: TobiGr Date: Sun, 14 Mar 2021 12:58:25 +0100 Subject: [PATCH 5/5] Use latest extractor version --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 7c504e96895..0b8de4d4158 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -180,7 +180,7 @@ dependencies { // NewPipe dependencies // You can use a local version by uncommenting a few lines in settings.gradle - implementation "com.github.TeamNewPipe:NewPipeExtractor:7e6f464407fc1a2c8fb0886d294093526a6ef0f1" + implementation 'com.github.TeamNewPipe:NewPipeExtractor:def745b801b2ef35c1a0fee1be950331ca6a0cd2' implementation "com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751" implementation "org.jsoup:jsoup:1.13.1"