The original Android source was lost; android/ holds the jadx-decompiled Java (com.mulberry.player) and resources from Android 1.2.2, fixed so it compiles again (broken methods rewritten by hand), plus: - android/build.sh: builds and signs Mulberry-<version>-Android.apk with the plain SDK tools (aapt2, javac, d8, apksigner), no Gradle; fetches jaudiotagger 2.0.3 (the version the old APK bundled) with a pinned checksum - versionName 2.0.4, versionCode 6 - recoloured launcher icon (pink cookie, berry note) to match assets/mulberry.svg Co-Authored-By: Claude Opus 5.5 <[email protected]>
99 lines
3.4 KiB
Java
99 lines
3.4 KiB
Java
package com.mulberry.player;
|
|
|
|
import android.content.ContentUris;
|
|
import android.net.Uri;
|
|
import android.provider.MediaStore;
|
|
import org.jaudiotagger.tag.id3.framebody.FrameBodyCOMM;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* JADX INFO: loaded from: classes.dex */
|
|
public final class Song {
|
|
public long dateAdded;
|
|
public long duration;
|
|
public int track;
|
|
public int year;
|
|
public long id = -1;
|
|
public String uri = FrameBodyCOMM.DEFAULT;
|
|
public String path = FrameBodyCOMM.DEFAULT;
|
|
public String title = FrameBodyCOMM.DEFAULT;
|
|
public String artist = FrameBodyCOMM.DEFAULT;
|
|
public String album = FrameBodyCOMM.DEFAULT;
|
|
public String albumArtist = FrameBodyCOMM.DEFAULT;
|
|
public long albumId = -1;
|
|
public String mime = FrameBodyCOMM.DEFAULT;
|
|
public String folder = FrameBodyCOMM.DEFAULT;
|
|
|
|
public static Song fromStore(long j) {
|
|
Song song = new Song();
|
|
song.id = j;
|
|
song.uri = ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, j).toString();
|
|
return song;
|
|
}
|
|
|
|
public Uri toUri() {
|
|
return Uri.parse(this.uri);
|
|
}
|
|
|
|
public boolean isStream() {
|
|
return this.uri.startsWith("http://") || this.uri.startsWith("https://");
|
|
}
|
|
|
|
public String displayTitle() {
|
|
if (this.title != null && this.title.length() > 0) {
|
|
return this.title;
|
|
}
|
|
if (this.path != null && this.path.length() > 0) {
|
|
String strSubstring = this.path.substring(this.path.lastIndexOf(47) + 1);
|
|
int iLastIndexOf = strSubstring.lastIndexOf(46);
|
|
return iLastIndexOf > 0 ? strSubstring.substring(0, iLastIndexOf) : strSubstring;
|
|
}
|
|
return this.uri;
|
|
}
|
|
|
|
public String displayArtist() {
|
|
if (this.artist == null || this.artist.length() <= 0 || "<unknown>".equals(this.artist)) {
|
|
return this.albumArtist != null ? this.albumArtist : FrameBodyCOMM.DEFAULT;
|
|
}
|
|
return this.artist;
|
|
}
|
|
|
|
public String key() {
|
|
return this.id >= 0 ? "id:" + this.id : this.uri;
|
|
}
|
|
|
|
public JSONObject toJson() {
|
|
JSONObject jSONObject = new JSONObject();
|
|
try {
|
|
jSONObject.put("id", this.id);
|
|
jSONObject.put("uri", this.uri);
|
|
jSONObject.put("path", this.path);
|
|
jSONObject.put("title", this.title);
|
|
jSONObject.put("artist", this.artist);
|
|
jSONObject.put("album", this.album);
|
|
jSONObject.put("aa", this.albumArtist);
|
|
jSONObject.put("aid", this.albumId);
|
|
jSONObject.put("dur", this.duration);
|
|
jSONObject.put("tr", this.track);
|
|
jSONObject.put("yr", this.year);
|
|
} catch (JSONException e) {
|
|
}
|
|
return jSONObject;
|
|
}
|
|
|
|
public static Song fromJson(JSONObject jSONObject) {
|
|
Song song = new Song();
|
|
song.id = jSONObject.optLong("id", -1L);
|
|
song.uri = jSONObject.optString("uri");
|
|
song.path = jSONObject.optString("path");
|
|
song.title = jSONObject.optString("title");
|
|
song.artist = jSONObject.optString("artist");
|
|
song.album = jSONObject.optString("album");
|
|
song.albumArtist = jSONObject.optString("aa");
|
|
song.albumId = jSONObject.optLong("aid", -1L);
|
|
song.duration = jSONObject.optLong("dur");
|
|
song.track = jSONObject.optInt("tr");
|
|
song.year = jSONObject.optInt("yr");
|
|
return song;
|
|
}
|
|
}
|