aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-01-29 21:34:01 -0800
committerScott Jackson <daneren2005@gmail.com>2013-01-29 21:34:01 -0800
commit22563edb7c8227fe1aa6de6a9ccb8f83c8c54257 (patch)
tree314bbd00005a4423cc32967cd437e40066a2b8e4
parent45dc6f4a0d531cfe908096bb209fbf35a190ce64 (diff)
downloaddsub-22563edb7c8227fe1aa6de6a9ccb8f83c8c54257.tar.gz
dsub-22563edb7c8227fe1aa6de6a9ccb8f83c8c54257.tar.bz2
dsub-22563edb7c8227fe1aa6de6a9ccb8f83c8c54257.zip
Closes #102 Rename cover.jpeg to cover.jpg + update all existing images
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/updates/Updater.java1
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/updates/Updater373.java55
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/Constants.java3
3 files changed, 58 insertions, 1 deletions
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<Updater> updaters = new ArrayList<Updater>();
+ 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 <http://www.gnu.org/licenses/>.
+
+ 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() {
}