mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-02 02:13:33 +00:00
added db function to retrieve pseudo random elements
This commit is contained in:
parent
40e9a6f778
commit
8e3456078b
2 changed files with 9 additions and 0 deletions
|
|
@ -24,6 +24,9 @@ public interface SongDao {
|
||||||
@Query("SELECT * FROM song WHERE title LIKE '%' || :title || '%'")
|
@Query("SELECT * FROM song WHERE title LIKE '%' || :title || '%'")
|
||||||
LiveData<List<Song>> searchSong(String title);
|
LiveData<List<Song>> searchSong(String title);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM song WHERE key IN (:pseudoRandomNumber)")
|
||||||
|
LiveData<List<Song>> getDiscoverySample(List<Integer> pseudoRandomNumber);
|
||||||
|
|
||||||
@Query("SELECT * FROM song ORDER BY added DESC LIMIT :number")
|
@Query("SELECT * FROM song ORDER BY added DESC LIMIT :number")
|
||||||
LiveData<List<Song>> getRecentlyAddedSample(int number);
|
LiveData<List<Song>> getRecentlyAddedSample(int number);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ public class SongRepository {
|
||||||
private SongDao songDao;
|
private SongDao songDao;
|
||||||
private SongGenreCrossDao songGenreCrossDao;
|
private SongGenreCrossDao songGenreCrossDao;
|
||||||
private LiveData<List<Song>> searchListLiveSongs;
|
private LiveData<List<Song>> searchListLiveSongs;
|
||||||
|
private LiveData<List<Song>> listLiveSampleDiscoverSongs;
|
||||||
private LiveData<List<Song>> listLiveSampleRecentlyAddedSongs;
|
private LiveData<List<Song>> listLiveSampleRecentlyAddedSongs;
|
||||||
private LiveData<List<Song>> listLiveSampleRecentlyPlayedSongs;
|
private LiveData<List<Song>> listLiveSampleRecentlyPlayedSongs;
|
||||||
private LiveData<List<Song>> listLiveSampleMostPlayedSongs;
|
private LiveData<List<Song>> listLiveSampleMostPlayedSongs;
|
||||||
|
|
@ -44,6 +45,11 @@ public class SongRepository {
|
||||||
return searchListLiveSongs;
|
return searchListLiveSongs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<List<Song>> getListLiveDiscoverSampleSong(List<Integer> pseudoRandomNumber) {
|
||||||
|
listLiveSampleDiscoverSongs = songDao.getDiscoverySample(pseudoRandomNumber);
|
||||||
|
return listLiveSampleDiscoverSongs;
|
||||||
|
}
|
||||||
|
|
||||||
public LiveData<List<Song>> getListLiveRecentlyAddedSampleSong(int number) {
|
public LiveData<List<Song>> getListLiveRecentlyAddedSampleSong(int number) {
|
||||||
listLiveSampleRecentlyAddedSongs = songDao.getRecentlyAddedSample(number);
|
listLiveSampleRecentlyAddedSongs = songDao.getRecentlyAddedSample(number);
|
||||||
return listLiveSampleRecentlyAddedSongs;
|
return listLiveSampleRecentlyAddedSongs;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue