Moved the tag editors album cover folder.
This commit is contained in:
parent
ffa329d978
commit
c7b2111115
3 changed files with 14 additions and 12 deletions
|
|
@ -298,7 +298,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
||||||
File albumArtFile = null;
|
File albumArtFile = null;
|
||||||
if (info.artworkInfo != null && info.artworkInfo.artwork != null) {
|
if (info.artworkInfo != null && info.artworkInfo.artwork != null) {
|
||||||
try {
|
try {
|
||||||
albumArtFile = MusicUtil.createAlbumArtFile(String.valueOf(info.artworkInfo.albumId)).getCanonicalFile();
|
albumArtFile = MusicUtil.createAlbumArtFile().getCanonicalFile();
|
||||||
info.artworkInfo.artwork.compress(Bitmap.CompressFormat.PNG, 0, new FileOutputStream(albumArtFile));
|
info.artworkInfo.artwork.compress(Bitmap.CompressFormat.PNG, 0, new FileOutputStream(albumArtFile));
|
||||||
artwork = ArtworkFactory.createArtworkFromFile(albumArtFile);
|
artwork = ArtworkFactory.createArtworkFromFile(albumArtFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
|
|
@ -273,15 +273,17 @@ public class FoldersFragment extends AbsMainActivityFragment implements MainActi
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getDefaultStartDirectory() {
|
public static File getDefaultStartDirectory() {
|
||||||
File externalStorageDir = Environment.getExternalStorageDirectory();
|
File musicDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
|
||||||
File musicFolder = new File(externalStorageDir, "Music");
|
|
||||||
File startFolder;
|
File startFolder;
|
||||||
if (musicFolder.exists() && musicFolder.isDirectory()) {
|
if (musicDir.exists() && musicDir.isDirectory()) {
|
||||||
startFolder = musicFolder;
|
startFolder = musicDir;
|
||||||
} else if (externalStorageDir.exists() && externalStorageDir.isDirectory()) {
|
|
||||||
startFolder = externalStorageDir;
|
|
||||||
} else {
|
} else {
|
||||||
startFolder = new File("/"); // root
|
File externalStorage = Environment.getExternalStorageDirectory();
|
||||||
|
if (externalStorage.exists() && externalStorage.isDirectory()) {
|
||||||
|
startFolder = externalStorage;
|
||||||
|
} else {
|
||||||
|
startFolder = new File("/"); // root
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return startFolder;
|
return startFolder;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,20 +127,20 @@ public class MusicUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static File createAlbumArtFile(String name) {
|
public static File createAlbumArtFile() {
|
||||||
return new File(createAlbumArtDir(), name + System.currentTimeMillis());
|
return new File(createAlbumArtDir(), String.valueOf(System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
public static File createAlbumArtDir() {
|
public static File createAlbumArtDir() {
|
||||||
File albumArtDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "/.albumart/");
|
File albumArtDir = new File(Environment.getExternalStorageDirectory(), "/albumthumbs/");
|
||||||
if (!albumArtDir.exists()) {
|
if (!albumArtDir.exists()) {
|
||||||
albumArtDir.mkdirs();
|
albumArtDir.mkdirs();
|
||||||
try {
|
try {
|
||||||
new File(albumArtDir, ".nomedia").createNewFile();
|
new File(albumArtDir, ".nomedia").createNewFile();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "error while creating .nomedia file", e);
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return albumArtDir;
|
return albumArtDir;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue