Implement better image selection strategy

This commit is contained in:
Stypox 2023-05-02 12:30:27 +02:00
parent a6a7c2271a
commit 4164bf36f6
19 changed files with 161 additions and 89 deletions

View file

@ -3,7 +3,7 @@ package org.schabi.newpipe.player.mediaitem;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.StreamType;
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
import org.schabi.newpipe.util.image.PicassoHelper;
import org.schabi.newpipe.util.image.ImageStrategy;
import java.util.List;
import java.util.Optional;
@ -75,7 +75,7 @@ public final class ExceptionTag implements MediaItemTag {
@Override
public String getThumbnailUrl() {
return PicassoHelper.choosePreferredImage(item.getThumbnails());
return ImageStrategy.choosePreferredImage(item.getThumbnails());
}
@Override

View file

@ -6,7 +6,7 @@ import org.schabi.newpipe.extractor.stream.AudioStream;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.StreamType;
import org.schabi.newpipe.extractor.stream.VideoStream;
import org.schabi.newpipe.util.image.PicassoHelper;
import org.schabi.newpipe.util.image.ImageStrategy;
import java.util.Collections;
import java.util.List;
@ -96,7 +96,7 @@ public final class StreamInfoTag implements MediaItemTag {
@Override
public String getThumbnailUrl() {
return PicassoHelper.choosePreferredImage(streamInfo.getThumbnails());
return ImageStrategy.choosePreferredImage(streamInfo.getThumbnails());
}
@Override

View file

@ -20,7 +20,7 @@ import com.google.android.exoplayer2.util.Util;
import org.schabi.newpipe.player.Player;
import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
import org.schabi.newpipe.util.image.PicassoHelper;
import org.schabi.newpipe.util.image.ImageStrategy;
import java.util.ArrayList;
import java.util.Collections;
@ -139,7 +139,7 @@ public class PlayQueueNavigator implements MediaSessionConnector.QueueNavigator
descBuilder.setExtras(additionalMetadata);
final Uri thumbnailUri = Uri.parse(
PicassoHelper.choosePreferredImage(item.getThumbnails()));
ImageStrategy.choosePreferredImage(item.getThumbnails()));
if (thumbnailUri != null) {
descBuilder.setIconUri(thumbnailUri);
}