0.5.6 - Android Auto updates, option to disable nomedia, shuffle fix, minor fixes

This commit is contained in:
exttex 2020-10-15 20:37:36 +02:00
parent 11d93482ff
commit e775e74d8e
35 changed files with 433 additions and 153 deletions

View file

@ -306,12 +306,15 @@ public class Deezer {
tag.setField(FieldKey.DISC_NO, Integer.toString(publicTrack.getInt("disk_number")));
tag.setField(FieldKey.ALBUM_ARTIST, publicAlbum.getJSONObject("artist").getString("name"));
tag.setField(FieldKey.YEAR, publicTrack.getString("release_date").substring(0, 4));
tag.setField(FieldKey.BPM, Integer.toString((int)publicTrack.getDouble("bpm")));
tag.setField(FieldKey.RECORD_LABEL, publicAlbum.getString("label"));
tag.setField(FieldKey.ISRC, publicTrack.getString("isrc"));
tag.setField(FieldKey.BARCODE, publicAlbum.getString("upc"));
tag.setField(FieldKey.TRACK_TOTAL, Integer.toString(publicAlbum.getInt("nb_tracks")));
//BPM
if (publicTrack.has("bpm") && (int)publicTrack.getDouble("bpm") > 0)
tag.setField(FieldKey.BPM, Integer.toString((int)publicTrack.getDouble("bpm")));
//Unsynced lyrics
if (lyricsData != null) {
try {

View file

@ -610,7 +610,8 @@ public class DownloadService extends Service {
connection.disconnect();
} catch (Exception ignored) {}
//Create .nomedia to not spam gallery
new File(parentDir, ".nomedia").createNewFile();
if (settings.nomediaFiles)
new File(parentDir, ".nomedia").createNewFile();
} catch (Exception e) {
logger.warn("Error downloading album cover! " + e.toString(), download);
coverFile.delete();
@ -826,19 +827,21 @@ public class DownloadService extends Service {
boolean trackCover;
String arl;
boolean albumCover;
boolean nomediaFiles;
private DownloadSettings(int downloadThreads, boolean overwriteDownload, boolean downloadLyrics, boolean trackCover, String arl, boolean albumCover) {
private DownloadSettings(int downloadThreads, boolean overwriteDownload, boolean downloadLyrics, boolean trackCover, String arl, boolean albumCover, boolean nomediaFiles) {
this.downloadThreads = downloadThreads;
this.overwriteDownload = overwriteDownload;
this.downloadLyrics = downloadLyrics;
this.trackCover = trackCover;
this.arl = arl;
this.albumCover = albumCover;
this.nomediaFiles = nomediaFiles;
}
//Parse settings from bundle sent from UI
static DownloadSettings fromBundle(Bundle b) {
return new DownloadSettings(b.getInt("downloadThreads"), b.getBoolean("overwriteDownload"), b.getBoolean("downloadLyrics"), b.getBoolean("trackCover"), b.getString("arl"), b.getBoolean("albumCover"));
return new DownloadSettings(b.getInt("downloadThreads"), b.getBoolean("overwriteDownload"), b.getBoolean("downloadLyrics"), b.getBoolean("trackCover"), b.getString("arl"), b.getBoolean("albumCover"), b.getBoolean("nomediaFiles"));
}
}

View file

@ -49,6 +49,16 @@ public class MainActivity extends FlutterActivity {
Messenger activityMessenger;
SQLiteDatabase db;
//Data if started from intent
String intentPreload;
@Override
public void onCreate(Bundle savedInstanceState) {
Intent intent = getIntent();
intentPreload = intent.getStringExtra("preload");
super.onCreate(savedInstanceState);
}
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
@ -118,6 +128,7 @@ public class MainActivity extends FlutterActivity {
bundle.putBoolean("trackCover", (boolean)call.argument("trackCover"));
bundle.putString("arl", (String)call.argument("arl"));
bundle.putBoolean("albumCover", (boolean)call.argument("albumCover"));
bundle.putBoolean("nomediaFiles", (boolean)call.argument("nomediaFiles"));
sendMessage(DownloadService.SERVICE_SETTINGS_UPDATE, bundle);
result.success(null);
@ -163,6 +174,12 @@ public class MainActivity extends FlutterActivity {
result.success(null);
return;
}
//If app was started with preload info (Android Auto)
if (call.method.equals("getPreloadInfo")) {
result.success(intentPreload);
intentPreload = null;
return;
}
result.error("0", "Not implemented!", "Not implemented!");
})));