utilize downloaded files within detail activities
This commit is contained in:
parent
5bde02dc8b
commit
395b1227c9
11 changed files with 100 additions and 15 deletions
|
|
@ -21,6 +21,7 @@ import org.jellyfin.apiclient.interaction.ApiClient;
|
|||
import org.jellyfin.apiclient.interaction.Response;
|
||||
import org.jellyfin.apiclient.model.dto.UserItemDataDto;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
|
@ -82,6 +83,15 @@ public class MusicUtil {
|
|||
return builder.toString();
|
||||
}
|
||||
|
||||
public static String getFileUri(Song song) {
|
||||
File root = new File(App.getInstance().getCacheDir(), "music");
|
||||
|
||||
String path = "/" + song.artistName + "/" + song.albumName + "/";
|
||||
String name = song.discNumber + "." + song.trackNumber + " - " + song.title + "." + song.container;
|
||||
|
||||
return root + path + name;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Intent createShareSongFileIntent(@NonNull final Song song, Context context) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -170,11 +170,14 @@ public class QueryUtil {
|
|||
@Override
|
||||
public void onResponse(ItemsResult result) {
|
||||
List<Song> songs = new ArrayList<>();
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (BaseItemDto itemDto : result.getItems()) {
|
||||
songs.add(new Song(itemDto));
|
||||
ids.add(itemDto.getId());
|
||||
}
|
||||
|
||||
callback.onLoadMedia(songs);
|
||||
App.getDatabase().songDao().insertSongs(songs);
|
||||
callback.onLoadMedia(App.getDatabase().cacheDao().getSongs(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue