mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Preparation to music streaming
This commit is contained in:
parent
f837bb14e2
commit
a28ad27288
23 changed files with 615 additions and 279 deletions
|
|
@ -14,12 +14,24 @@ import java.util.List;
|
|||
|
||||
@Dao
|
||||
public interface QueueDao {
|
||||
@Query("SELECT * FROM song JOIN queue ON song.id = queue.song_id")
|
||||
@Query("SELECT * FROM song JOIN queue ON song.id = queue.id")
|
||||
LiveData<List<Song>> getAll();
|
||||
|
||||
@Query("SELECT * FROM song JOIN queue ON song.id = queue.song_id")
|
||||
@Query("SELECT * FROM song JOIN queue ON song.id = queue.id")
|
||||
List<Song> getAllSimple();
|
||||
|
||||
@Query("SELECT * FROM song JOIN queue ON song.id = queue.id WHERE queue.rowid = :position")
|
||||
Song getSongByIndex(int position);
|
||||
|
||||
@Query("SELECT * FROM song JOIN queue ON song.id = queue.id WHERE queue.last_played != 0 ORDER BY queue.last_played DESC LIMIT 1")
|
||||
LiveData<Song> getLastPlayedSong();
|
||||
|
||||
@Query("UPDATE queue SET last_played = :timestamp WHERE queue.rowid = :position")
|
||||
void setLastPlayedSong(int position, long timestamp);
|
||||
|
||||
@Query("UPDATE queue SET last_played = :timestamp WHERE queue.id = :songID")
|
||||
void setLastPlayedSong(String songID, long timestamp);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(Queue songQueueObject);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,12 +51,15 @@ public interface SongDao {
|
|||
@Query("SELECT * FROM song INNER Join song_genre_cross ON song.id = song_genre_cross.song_id AND song_genre_cross.genre_id IN (:filters) GROUP BY song.id")
|
||||
LiveData<List<Song>> getFilteredSong(ArrayList<String> filters);
|
||||
|
||||
@Query("SELECT * FROM song WHERE favorite = 1 ORDER BY play_count DESC LIMIT :number")
|
||||
@Query("SELECT * FROM song WHERE favorite = 1 LIMIT :number")
|
||||
LiveData<List<Song>> getFavoriteSongSample(int number);
|
||||
|
||||
@Query("SELECT * FROM song WHERE favorite = 1 ORDER BY play_count DESC")
|
||||
@Query("SELECT * FROM song WHERE favorite = 1")
|
||||
LiveData<List<Song>> getFavoriteSong();
|
||||
|
||||
@Query("SELECT * FROM song WHERE id = :id")
|
||||
Song getSongByID(String id);
|
||||
|
||||
@Query("SELECT EXISTS(SELECT * FROM song WHERE id = :id)")
|
||||
boolean exist(String id);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue