mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Add audio transcode format option and bitrate
This commit is contained in:
parent
10df98306c
commit
bb9b2d95b5
8 changed files with 175 additions and 36 deletions
|
|
@ -63,14 +63,14 @@ public class DownloadTracker {
|
|||
}
|
||||
|
||||
public boolean isDownloaded(Song song) {
|
||||
MediaItem mediaItem = MusicUtil.getMediaItemFromSong(song);
|
||||
MediaItem mediaItem = MusicUtil.getSongDownloadItem(song);
|
||||
@Nullable Download download = downloads.get(checkNotNull(mediaItem.playbackProperties).uri);
|
||||
return download != null && download.state != Download.STATE_FAILED;
|
||||
}
|
||||
|
||||
public boolean isDownloaded(List<Song> songs) {
|
||||
for (Song song : songs) {
|
||||
MediaItem mediaItem = MusicUtil.getMediaItemFromSong(song);
|
||||
MediaItem mediaItem = MusicUtil.getSongDownloadItem(song);
|
||||
@Nullable Download download = downloads.get(checkNotNull(mediaItem.playbackProperties).uri);
|
||||
|
||||
if (download != null && download.state != Download.STATE_FAILED) {
|
||||
|
|
@ -95,7 +95,7 @@ public class DownloadTracker {
|
|||
continue;
|
||||
}
|
||||
|
||||
MediaItem mediaItem = MusicUtil.getMediaItemFromSong(song);
|
||||
MediaItem mediaItem = MusicUtil.getSongDownloadItem(song);
|
||||
DownloadService.sendAddDownload(context, DownloaderService.class, getDownloadRequest(song.getId(), checkNotNull(mediaItem.playbackProperties).uri), false);
|
||||
downloadRepository.insert(MappingUtil.mapToDownload(song, playlistId, playlistName));
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ public class DownloadTracker {
|
|||
DownloadRepository downloadRepository = new DownloadRepository(App.getInstance());
|
||||
|
||||
for (Song song : songs) {
|
||||
MediaItem mediaItem = MusicUtil.getMediaItemFromSong(song);
|
||||
MediaItem mediaItem = MusicUtil.getSongDownloadItem(song);
|
||||
|
||||
@Nullable Download download = downloads.get(checkNotNull(mediaItem.playbackProperties).uri);
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class MultiPlayer implements Playback {
|
|||
|
||||
@Override
|
||||
public void setDataSource(Song song) {
|
||||
String uri = MusicUtil.getSongFileUri(song);
|
||||
String uri = MusicUtil.getSongStreamUri(context, song);
|
||||
MediaItem mediaItem = exoPlayer.getCurrentMediaItem();
|
||||
|
||||
if (mediaItem != null && mediaItem.playbackProperties != null && mediaItem.playbackProperties.uri.toString().equals(uri)) {
|
||||
|
|
@ -138,7 +138,7 @@ public class MultiPlayer implements Playback {
|
|||
}
|
||||
|
||||
exoPlayer.clearMediaItems();
|
||||
appendDataSource(MusicUtil.getSongFileUri(song));
|
||||
appendDataSource(MusicUtil.getSongStreamUri(context, song));
|
||||
exoPlayer.seekTo(0, 0);
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ public class MultiPlayer implements Playback {
|
|||
exoPlayer.removeMediaItem(1);
|
||||
}
|
||||
|
||||
appendDataSource(MusicUtil.getSongFileUri(song));
|
||||
appendDataSource(MusicUtil.getSongStreamUri(context, song));
|
||||
}
|
||||
|
||||
private void appendDataSource(String path) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue