Fixed bulk live download when user chooses to sync starred tracks

This commit is contained in:
antonio 2023-03-12 17:59:12 +01:00
parent 3f6f3ab06a
commit da7030bee1
7 changed files with 60 additions and 14 deletions

View file

@ -20,9 +20,9 @@ import com.cappielloantonio.play.model.RecentSearch;
import com.cappielloantonio.play.model.Server;
@Database(
version = 61,
version = 62,
entities = {Queue.class, Server.class, RecentSearch.class, Download.class, Chronology.class},
autoMigrations = {@AutoMigration(from = 60, to = 61)}
autoMigrations = {@AutoMigration(from = 61, to = 62)}
)
@TypeConverters({DateConverters.class})
public abstract class AppDatabase extends RoomDatabase {

View file

@ -12,7 +12,7 @@ import java.util.List;
@Dao
public interface DownloadDao {
@Query("SELECT * FROM download ORDER BY album, track ASC")
@Query("SELECT * FROM download WHERE download_state = 1 ORDER BY artist, album, track ASC")
LiveData<List<Download>> getAll();
@Insert(onConflict = OnConflictStrategy.REPLACE)
@ -21,6 +21,9 @@ public interface DownloadDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertAll(List<Download> downloads);
@Query("UPDATE download SET download_state = 1 WHERE id = :id")
void update(String id);
@Query("DELETE FROM download WHERE id = :id")
void delete(String id);