mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Removed unused database references
This commit is contained in:
parent
ca1831d23c
commit
ce79bda976
46 changed files with 182 additions and 1975 deletions
|
|
@ -6,32 +6,16 @@ import androidx.room.Database;
|
|||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
import com.cappielloantonio.play.database.dao.AlbumArtistCrossDao;
|
||||
import com.cappielloantonio.play.database.dao.AlbumDao;
|
||||
import com.cappielloantonio.play.database.dao.ArtistDao;
|
||||
import com.cappielloantonio.play.database.dao.GenreDao;
|
||||
import com.cappielloantonio.play.database.dao.PlaylistDao;
|
||||
import com.cappielloantonio.play.database.dao.PlaylistSongCrossDao;
|
||||
import com.cappielloantonio.play.database.dao.QueueDao;
|
||||
import com.cappielloantonio.play.database.dao.RecentSearchDao;
|
||||
import com.cappielloantonio.play.database.dao.SongArtistCrossDao;
|
||||
import com.cappielloantonio.play.database.dao.SongDao;
|
||||
import com.cappielloantonio.play.database.dao.SongGenreCrossDao;
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.cappielloantonio.play.model.AlbumArtistCross;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Genre;
|
||||
import com.cappielloantonio.play.model.Playlist;
|
||||
import com.cappielloantonio.play.model.PlaylistSongCross;
|
||||
import com.cappielloantonio.play.model.Queue;
|
||||
import com.cappielloantonio.play.model.RecentSearch;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.model.SongArtistCross;
|
||||
import com.cappielloantonio.play.model.SongGenreCross;
|
||||
|
||||
@Database(entities = {Album.class, Artist.class, Genre.class, Playlist.class, Song.class, RecentSearch.class, SongGenreCross.class, Queue.class, AlbumArtistCross.class, SongArtistCross.class, PlaylistSongCross.class}, version = 2, exportSchema = false)
|
||||
@Database(entities = {Queue.class, RecentSearch.class}, version = 2, exportSchema = false)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
private static final String TAG = "AppDatabase";
|
||||
|
||||
private final static String DB_NAME = "play_db";
|
||||
private static AppDatabase instance;
|
||||
|
||||
|
|
@ -44,25 +28,7 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||
return instance;
|
||||
}
|
||||
|
||||
public abstract AlbumDao albumDao();
|
||||
|
||||
public abstract ArtistDao artistDao();
|
||||
|
||||
public abstract GenreDao genreDao();
|
||||
|
||||
public abstract PlaylistDao playlistDao();
|
||||
|
||||
public abstract SongDao songDao();
|
||||
public abstract QueueDao queueDao();
|
||||
|
||||
public abstract RecentSearchDao recentSearchDao();
|
||||
|
||||
public abstract SongGenreCrossDao songGenreCrossDao();
|
||||
|
||||
public abstract AlbumArtistCrossDao albumArtistCrossDao();
|
||||
|
||||
public abstract SongArtistCrossDao songArtistCrossDao();
|
||||
|
||||
public abstract PlaylistSongCrossDao playlistSongCrossDao();
|
||||
|
||||
public abstract QueueDao queueDao();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
package com.cappielloantonio.play.database.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import com.cappielloantonio.play.model.AlbumArtistCross;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface AlbumArtistCrossDao {
|
||||
@Query("SELECT * FROM album_artist_cross")
|
||||
LiveData<List<AlbumArtistCross>> getAll();
|
||||
|
||||
@Query("SELECT EXISTS(SELECT * FROM album_artist_cross WHERE id = :id)")
|
||||
boolean exist(String id);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(AlbumArtistCross albumArtistCross);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<AlbumArtistCross> albumArtistCrosses);
|
||||
|
||||
@Delete
|
||||
void delete(AlbumArtistCross albumArtistCross);
|
||||
|
||||
@Update
|
||||
void update(AlbumArtistCross albumArtistCross);
|
||||
|
||||
@Query("DELETE FROM album_artist_cross")
|
||||
void deleteAll();
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package com.cappielloantonio.play.database.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface AlbumDao {
|
||||
@Query("SELECT * FROM album")
|
||||
LiveData<List<Album>> getAll();
|
||||
|
||||
@Query("SELECT album.* FROM album INNER JOIN album_artist_cross ON album.id = album_artist_cross.album_id AND album_artist_cross.artist_id = :artistId")
|
||||
LiveData<List<Album>> getArtistAlbums(String artistId);
|
||||
|
||||
@Query("SELECT * FROM album ORDER BY RANDOM() LIMIT :number;")
|
||||
LiveData<List<Album>> getSample(int number);
|
||||
|
||||
@Query("SELECT * FROM album WHERE title LIKE '%' || :name || '%' LIMIT :limit")
|
||||
LiveData<List<Album>> searchAlbum(String name, int limit);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(Album album);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<Album> albums);
|
||||
|
||||
@Query("SELECT title FROM album WHERE title LIKE :query || '%' OR title like '% ' || :query || '%' GROUP BY title LIMIT :number")
|
||||
List<String> searchSuggestions(String query, int number);
|
||||
|
||||
@Query("DELETE FROM album")
|
||||
void deleteAll();
|
||||
|
||||
@Query("SELECT * FROM album WHERE id = :id")
|
||||
Album getAlbumByID(String id);
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package com.cappielloantonio.play.database.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface ArtistDao {
|
||||
@Query("SELECT * FROM artist")
|
||||
LiveData<List<Artist>> getAll();
|
||||
|
||||
@Query("SELECT * FROM artist ORDER BY RANDOM() LIMIT :number;")
|
||||
LiveData<List<Artist>> getSample(int number);
|
||||
|
||||
@Query("SELECT * FROM artist WHERE name LIKE '%' || :name || '%' LIMIT :limit")
|
||||
LiveData<List<Artist>> searchArtist(String name, int limit);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<Artist> artists);
|
||||
|
||||
@Query("SELECT name FROM artist WHERE name LIKE :query || '%' OR name like '% ' || :query || '%' GROUP BY name LIMIT :number")
|
||||
List<String> searchSuggestions(String query, int number);
|
||||
|
||||
@Query("DELETE FROM artist")
|
||||
void deleteAll();
|
||||
|
||||
@Query("SELECT * FROM artist WHERE id = :id")
|
||||
Artist getArtistByID(String id);
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package com.cappielloantonio.play.database.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
|
||||
import com.cappielloantonio.play.model.Genre;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface GenreDao {
|
||||
@Query("SELECT * FROM genre")
|
||||
LiveData<List<Genre>> getAll();
|
||||
|
||||
@Query("SELECT * FROM genre")
|
||||
List<Genre> getGenreList();
|
||||
|
||||
@Query("SELECT * FROM genre ORDER BY RANDOM() LIMIT :number;")
|
||||
LiveData<List<Genre>> getSample(int number);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<Genre> genres);
|
||||
|
||||
@Query("DELETE FROM genre")
|
||||
void deleteAll();
|
||||
|
||||
@Query("SELECT * FROM genre WHERE name LIKE '%' || :name || '%' LIMIT :limit")
|
||||
LiveData<List<Genre>> searchGenre(String name, int limit);
|
||||
|
||||
@Query("SELECT name FROM genre WHERE name LIKE :query || '%' OR name like '% ' || :query || '%' GROUP BY name LIMIT :number")
|
||||
List<String> searchSuggestions(String query, int number);
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package com.cappielloantonio.play.database.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
|
||||
import com.cappielloantonio.play.model.Playlist;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface PlaylistDao {
|
||||
@Query("SELECT * FROM playlist")
|
||||
LiveData<List<Playlist>> getAll();
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<Playlist> playlists);
|
||||
|
||||
@Query("DELETE FROM playlist")
|
||||
void deleteAll();
|
||||
|
||||
@Query("SELECT * FROM playlist ORDER BY RANDOM() LIMIT :number")
|
||||
List<Playlist> random(int number);
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
package com.cappielloantonio.play.database.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import com.cappielloantonio.play.model.PlaylistSongCross;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface PlaylistSongCrossDao {
|
||||
@Query("SELECT * FROM playlist_song_cross")
|
||||
LiveData<List<PlaylistSongCross>> getAll();
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(PlaylistSongCross playlistSongCross);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<PlaylistSongCross> playlistSongCrosses);
|
||||
|
||||
@Delete
|
||||
void delete(PlaylistSongCross playlistSongCross);
|
||||
|
||||
@Update
|
||||
void update(PlaylistSongCross playlistSongCross);
|
||||
|
||||
@Query("DELETE FROM playlist_song_cross")
|
||||
void deleteAll();
|
||||
}
|
||||
|
|
@ -13,11 +13,11 @@ import java.util.List;
|
|||
|
||||
@Dao
|
||||
public interface QueueDao {
|
||||
@Query("SELECT song.* FROM song JOIN queue ON song.id = queue.id")
|
||||
LiveData<List<Song>> getAll();
|
||||
@Query("SELECT * FROM queue")
|
||||
LiveData<List<Queue>> getAll();
|
||||
|
||||
@Query("SELECT song.* FROM song JOIN queue ON song.id = queue.id")
|
||||
List<Song> getAllSimple();
|
||||
@Query("SELECT * FROM queue")
|
||||
List<Queue> getAllSimple();
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<Queue> songQueueObject);
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
package com.cappielloantonio.play.database.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import com.cappielloantonio.play.model.SongArtistCross;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface SongArtistCrossDao {
|
||||
@Query("SELECT * FROM song_artist_cross")
|
||||
LiveData<List<SongArtistCross>> getAll();
|
||||
|
||||
@Query("SELECT EXISTS(SELECT * FROM song_artist_cross WHERE id = :id)")
|
||||
boolean exist(String id);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(SongArtistCross songArtistCross);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<SongArtistCross> songArtistCross);
|
||||
|
||||
@Delete
|
||||
void delete(SongArtistCross songArtistCross);
|
||||
|
||||
@Update
|
||||
void update(SongArtistCross songArtistCross);
|
||||
|
||||
@Query("DELETE FROM song_artist_cross")
|
||||
void deleteAll();
|
||||
}
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
package com.cappielloantonio.play.database.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface SongDao {
|
||||
@Query("SELECT * FROM song")
|
||||
LiveData<List<Song>> getAll();
|
||||
|
||||
@Query("SELECT * FROM song")
|
||||
List<Song> getAllList();
|
||||
|
||||
@Query("SELECT * FROM song WHERE title LIKE '%' || :title || '%' LIMIT :limit")
|
||||
LiveData<List<Song>> searchSong(String title, int limit);
|
||||
|
||||
// Da utilizzare in caso si decidesse di migliorare il viewpager nella home
|
||||
@Query("SELECT * FROM song WHERE id IN (:pseudoRandomNumber)")
|
||||
LiveData<List<Song>> getDiscoverySample(List<Integer> pseudoRandomNumber);
|
||||
|
||||
@Query("SELECT * FROM song ORDER BY added DESC LIMIT :number")
|
||||
LiveData<List<Song>> getRecentlyAddedSample(int number);
|
||||
|
||||
@Query("SELECT * FROM song WHERE last_play != 0 ORDER BY last_play DESC LIMIT :number")
|
||||
LiveData<List<Song>> getRecentlyPlayedSample(int number);
|
||||
|
||||
@Query("SELECT * FROM song WHERE play_count != 0 ORDER BY play_count DESC LIMIT :number")
|
||||
LiveData<List<Song>> getMostPlayedSample(int number);
|
||||
|
||||
@Query("SELECT song.* FROM song INNER JOIN song_artist_cross ON song.id = song_artist_cross.song_id AND song_artist_cross.artist_id = :artistID ORDER BY play_count DESC LIMIT :number")
|
||||
LiveData<List<Song>> getArtistTopSongsSample(String artistID, int number);
|
||||
|
||||
@Query("SELECT song.* FROM song INNER JOIN song_artist_cross ON song.id = song_artist_cross.song_id AND song_artist_cross.artist_id = :artistID ORDER BY play_count DESC")
|
||||
LiveData<List<Song>> getArtistTopSongs(String artistID);
|
||||
|
||||
@Query("SELECT song.* FROM song INNER JOIN song_artist_cross ON song.id = song_artist_cross.song_id AND song_artist_cross.artist_id = :artistID ORDER BY RANDOM() LIMIT :number")
|
||||
List<Song> getArtistRandomSongs(String artistID, int number);
|
||||
|
||||
@Query("SELECT * FROM song WHERE albumId = :albumID ORDER BY trackNumber ASC")
|
||||
LiveData<List<Song>> getLiveAlbumSong(String albumID);
|
||||
|
||||
@Query("SELECT song.* FROM song INNER JOIN playlist_song_cross ON song.id = playlist_song_cross.song_id AND playlist_song_cross.playlist_id = :playlistID ORDER BY playlist_song_cross.item_number")
|
||||
LiveData<List<Song>> getLivePlaylistSong(String playlistID);
|
||||
|
||||
@Query("SELECT song.* FROM song INNER JOIN playlist_song_cross ON song.id = playlist_song_cross.song_id AND playlist_song_cross.playlist_id = :playlistID ORDER BY playlist_song_cross.item_number")
|
||||
List<Song> getPlaylistSong(String playlistID);
|
||||
|
||||
@Query("SELECT * FROM song WHERE albumId = :albumID ORDER BY trackNumber ASC")
|
||||
List<Song> getAlbumSong(String albumID);
|
||||
|
||||
@Query("SELECT song.* FROM song INNER JOIN song_genre_cross ON song.id = song_genre_cross.song_id AND song_genre_cross.genre_id = :genreID")
|
||||
LiveData<List<Song>> getSongByGenre(String genreID);
|
||||
|
||||
@Query("SELECT song.* 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 LIMIT :number")
|
||||
LiveData<List<Song>> getFavoriteSongSample(int number);
|
||||
|
||||
@Query("SELECT * FROM song WHERE favorite = 1")
|
||||
LiveData<List<Song>> getFavoriteSong();
|
||||
|
||||
@Query("SELECT * FROM song WHERE offline = 1 LIMIT :number")
|
||||
LiveData<List<Song>> getDownloadedSongSample(int number);
|
||||
|
||||
@Query("SELECT * FROM song WHERE offline = 1 ORDER BY path, albumName, trackNumber")
|
||||
LiveData<List<Song>> getDownloadedSong();
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<Song> songs);
|
||||
|
||||
@Query("DELETE FROM song")
|
||||
void deleteAll();
|
||||
|
||||
@Update
|
||||
void update(Song song);
|
||||
|
||||
@Query("UPDATE song SET offline = 0 WHERE offline == 1")
|
||||
void updateAllOffline();
|
||||
|
||||
@Query("SELECT * FROM song WHERE id IN (:ids)")
|
||||
List<Song> getSongsByID(List<String> ids);
|
||||
|
||||
@Query("SELECT * FROM song ORDER BY RANDOM() LIMIT :number")
|
||||
List<Song> random(int number);
|
||||
|
||||
@Query("SELECT title FROM song WHERE title LIKE :query || '%' OR title like '% ' || :query || '%' GROUP BY title LIMIT :number")
|
||||
List<String> searchSuggestions(String query, int number);
|
||||
|
||||
@Query("SELECT year FROM song WHERE year != 0 GROUP BY year")
|
||||
List<Integer> getYearList();
|
||||
|
||||
@Query("SELECT * FROM song WHERE year = :year")
|
||||
LiveData<List<Song>> getSongsByYear(int year);
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
package com.cappielloantonio.play.database.dao;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import com.cappielloantonio.play.model.SongGenreCross;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface SongGenreCrossDao {
|
||||
@Query("SELECT * FROM song_genre_cross")
|
||||
LiveData<List<SongGenreCross>> getAll();
|
||||
|
||||
@Query("SELECT EXISTS(SELECT * FROM song_genre_cross WHERE id = :id)")
|
||||
boolean exist(String id);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(SongGenreCross songGenreCross);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertAll(List<SongGenreCross> songGenreCrosses);
|
||||
|
||||
@Delete
|
||||
void delete(SongGenreCross songGenreCross);
|
||||
|
||||
@Update
|
||||
void update(SongGenreCross songGenreCross);
|
||||
|
||||
@Query("DELETE FROM song_genre_cross")
|
||||
void deleteAll();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue