From 22563edb7c8227fe1aa6de6a9ccb8f83c8c54257 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 29 Jan 2013 21:34:01 -0800 Subject: Closes #102 Rename cover.jpeg to cover.jpg + update all existing images --- .../github/daneren2005/dsub/updates/Updater.java | 1 + .../daneren2005/dsub/updates/Updater373.java | 55 ++++++++++++++++++++++ .../github/daneren2005/dsub/util/Constants.java | 3 +- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 subsonic-android/src/github/daneren2005/dsub/updates/Updater373.java diff --git a/subsonic-android/src/github/daneren2005/dsub/updates/Updater.java b/subsonic-android/src/github/daneren2005/dsub/updates/Updater.java index 356e7958..a62920b9 100644 --- a/subsonic-android/src/github/daneren2005/dsub/updates/Updater.java +++ b/subsonic-android/src/github/daneren2005/dsub/updates/Updater.java @@ -43,6 +43,7 @@ public class Updater { public void checkUpdates(Context context) { this.context = context; List updaters = new ArrayList(); + updaters.add(new Updater373()); SharedPreferences prefs = Util.getPreferences(context); int lastVersion = prefs.getInt(Constants.LAST_VERSION, 372); diff --git a/subsonic-android/src/github/daneren2005/dsub/updates/Updater373.java b/subsonic-android/src/github/daneren2005/dsub/updates/Updater373.java new file mode 100644 index 00000000..4df31580 --- /dev/null +++ b/subsonic-android/src/github/daneren2005/dsub/updates/Updater373.java @@ -0,0 +1,55 @@ +/* + This file is part of Subsonic. + + Subsonic is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Subsonic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Subsonic. If not, see . + + Copyright 2009 (C) Sindre Mehus + */ +package github.daneren2005.dsub.updates; + +import android.content.Context; +import android.util.Log; +import github.daneren2005.dsub.updates.Updater; +import github.daneren2005.dsub.util.Constants; +import github.daneren2005.dsub.util.FileUtil; +import java.io.File; + +/** + * + * @author Scott + */ +public class Updater373 extends Updater { + public Updater373() { + super(373); + } + + @Override + public void update(Context context) { + // Rename cover.jpeg to cover.jpg + Log.i(TAG, "Running Updater373: updating cover.jpeg to cover.jpg"); + File dir = FileUtil.getMusicDirectory(context); + moveArt(dir); + } + + private void moveArt(File dir) { + for(File file: dir.listFiles()) { + if(file.isDirectory()) { + moveArt(file); + } else if("cover.jpeg".equals(file.getName())) { + File renamed = new File(dir, Constants.ALBUM_ART_FILE); + file.renameTo(renamed); + } + } + } +} diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java index 0490b3d3..c116c484 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java @@ -31,6 +31,7 @@ public final class Constants { // Note: Keep it as low as possible to maintain compatibility with older servers. public static final String REST_PROTOCOL_VERSION = "1.2.0"; public static final String REST_CLIENT_ID = "DSub"; + public static final String LAST_VERSION = "subsonic.version"; // Names for intent extras. public static final String INTENT_EXTRA_NAME_ID = "subsonic.id"; @@ -97,7 +98,7 @@ public final class Constants { // URL for project donations. public static final String DONATION_URL = "http://subsonic.org/pages/android-donation.jsp"; - public static final String ALBUM_ART_FILE = "cover.jpeg"; + public static final String ALBUM_ART_FILE = "cover.jpg"; private Constants() { } -- cgit v1.2.3