diff --git a/.gitignore b/.gitignore
index 986f70d62c..f27b68d7ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,3 +49,4 @@ markdown.xml
**/.env
**/.env.*
!**/.env.example
+app/libs/gobackend-sources.jar
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 9f2583065f..9cbee20042 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -237,6 +237,9 @@ kotlin {
}
dependencies {
+ // Embedded Go backend (SpotiFLAC-Mobile, MIT) — see scripts/build_gobackend_aar.sh
+ implementation(files("libs/gobackend.aar"))
+
// Core & Optimization
coreLibraryDesugaring(libs.desugar.jdk.libs)
implementation(libs.androidx.profileinstaller)
@@ -296,6 +299,8 @@ dependencies {
implementation(libs.androidx.media)
implementation(libs.coil.compose)
implementation(libs.taglib)
+ // Decrypts extension downloads (e.g. Amazon "ffmpeg.mov_key") before publishing.
+ implementation(libs.ffmpeg.kit.min)
implementation(libs.jaudiotagger)
implementation(libs.vorbisjava.core)
implementation(libs.wavy.slider)
diff --git a/app/libs/gobackend.aar b/app/libs/gobackend.aar
new file mode 100644
index 0000000000..619406ae2c
Binary files /dev/null and b/app/libs/gobackend.aar differ
diff --git a/app/schemas/com.theveloper.pixelplay.data.database.PixelPlayDatabase/43.json b/app/schemas/com.theveloper.pixelplay.data.database.PixelPlayDatabase/43.json
new file mode 100644
index 0000000000..973c332265
--- /dev/null
+++ b/app/schemas/com.theveloper.pixelplay.data.database.PixelPlayDatabase/43.json
@@ -0,0 +1,2904 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 43,
+ "identityHash": "07ce45dab5a383b78ea4b21f867758bd",
+ "entities": [
+ {
+ "tableName": "album_art_themes",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`albumArtUriString` TEXT NOT NULL, `paletteStyle` TEXT NOT NULL, `light_primary` TEXT NOT NULL, `light_onPrimary` TEXT NOT NULL, `light_primaryContainer` TEXT NOT NULL, `light_onPrimaryContainer` TEXT NOT NULL, `light_secondary` TEXT NOT NULL, `light_onSecondary` TEXT NOT NULL, `light_secondaryContainer` TEXT NOT NULL, `light_onSecondaryContainer` TEXT NOT NULL, `light_tertiary` TEXT NOT NULL, `light_onTertiary` TEXT NOT NULL, `light_tertiaryContainer` TEXT NOT NULL, `light_onTertiaryContainer` TEXT NOT NULL, `light_background` TEXT NOT NULL, `light_onBackground` TEXT NOT NULL, `light_surface` TEXT NOT NULL, `light_onSurface` TEXT NOT NULL, `light_surfaceVariant` TEXT NOT NULL, `light_onSurfaceVariant` TEXT NOT NULL, `light_error` TEXT NOT NULL, `light_onError` TEXT NOT NULL, `light_outline` TEXT NOT NULL, `light_errorContainer` TEXT NOT NULL, `light_onErrorContainer` TEXT NOT NULL, `light_inversePrimary` TEXT NOT NULL, `light_inverseSurface` TEXT NOT NULL, `light_inverseOnSurface` TEXT NOT NULL, `light_surfaceTint` TEXT NOT NULL, `light_outlineVariant` TEXT NOT NULL, `light_scrim` TEXT NOT NULL, `light_surfaceBright` TEXT NOT NULL, `light_surfaceDim` TEXT NOT NULL, `light_surfaceContainer` TEXT NOT NULL, `light_surfaceContainerHigh` TEXT NOT NULL, `light_surfaceContainerHighest` TEXT NOT NULL, `light_surfaceContainerLow` TEXT NOT NULL, `light_surfaceContainerLowest` TEXT NOT NULL, `light_primaryFixed` TEXT NOT NULL, `light_primaryFixedDim` TEXT NOT NULL, `light_onPrimaryFixed` TEXT NOT NULL, `light_onPrimaryFixedVariant` TEXT NOT NULL, `light_secondaryFixed` TEXT NOT NULL, `light_secondaryFixedDim` TEXT NOT NULL, `light_onSecondaryFixed` TEXT NOT NULL, `light_onSecondaryFixedVariant` TEXT NOT NULL, `light_tertiaryFixed` TEXT NOT NULL, `light_tertiaryFixedDim` TEXT NOT NULL, `light_onTertiaryFixed` TEXT NOT NULL, `light_onTertiaryFixedVariant` TEXT NOT NULL, `dark_primary` TEXT NOT NULL, `dark_onPrimary` TEXT NOT NULL, `dark_primaryContainer` TEXT NOT NULL, `dark_onPrimaryContainer` TEXT NOT NULL, `dark_secondary` TEXT NOT NULL, `dark_onSecondary` TEXT NOT NULL, `dark_secondaryContainer` TEXT NOT NULL, `dark_onSecondaryContainer` TEXT NOT NULL, `dark_tertiary` TEXT NOT NULL, `dark_onTertiary` TEXT NOT NULL, `dark_tertiaryContainer` TEXT NOT NULL, `dark_onTertiaryContainer` TEXT NOT NULL, `dark_background` TEXT NOT NULL, `dark_onBackground` TEXT NOT NULL, `dark_surface` TEXT NOT NULL, `dark_onSurface` TEXT NOT NULL, `dark_surfaceVariant` TEXT NOT NULL, `dark_onSurfaceVariant` TEXT NOT NULL, `dark_error` TEXT NOT NULL, `dark_onError` TEXT NOT NULL, `dark_outline` TEXT NOT NULL, `dark_errorContainer` TEXT NOT NULL, `dark_onErrorContainer` TEXT NOT NULL, `dark_inversePrimary` TEXT NOT NULL, `dark_inverseSurface` TEXT NOT NULL, `dark_inverseOnSurface` TEXT NOT NULL, `dark_surfaceTint` TEXT NOT NULL, `dark_outlineVariant` TEXT NOT NULL, `dark_scrim` TEXT NOT NULL, `dark_surfaceBright` TEXT NOT NULL, `dark_surfaceDim` TEXT NOT NULL, `dark_surfaceContainer` TEXT NOT NULL, `dark_surfaceContainerHigh` TEXT NOT NULL, `dark_surfaceContainerHighest` TEXT NOT NULL, `dark_surfaceContainerLow` TEXT NOT NULL, `dark_surfaceContainerLowest` TEXT NOT NULL, `dark_primaryFixed` TEXT NOT NULL, `dark_primaryFixedDim` TEXT NOT NULL, `dark_onPrimaryFixed` TEXT NOT NULL, `dark_onPrimaryFixedVariant` TEXT NOT NULL, `dark_secondaryFixed` TEXT NOT NULL, `dark_secondaryFixedDim` TEXT NOT NULL, `dark_onSecondaryFixed` TEXT NOT NULL, `dark_onSecondaryFixedVariant` TEXT NOT NULL, `dark_tertiaryFixed` TEXT NOT NULL, `dark_tertiaryFixedDim` TEXT NOT NULL, `dark_onTertiaryFixed` TEXT NOT NULL, `dark_onTertiaryFixedVariant` TEXT NOT NULL, PRIMARY KEY(`albumArtUriString`))",
+ "fields": [
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "albumArtUriString",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "paletteStyle",
+ "columnName": "paletteStyle",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primary",
+ "columnName": "light_primary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimary",
+ "columnName": "light_onPrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primaryContainer",
+ "columnName": "light_primaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimaryContainer",
+ "columnName": "light_onPrimaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondary",
+ "columnName": "light_secondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondary",
+ "columnName": "light_onSecondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondaryContainer",
+ "columnName": "light_secondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondaryContainer",
+ "columnName": "light_onSecondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiary",
+ "columnName": "light_tertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiary",
+ "columnName": "light_onTertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiaryContainer",
+ "columnName": "light_tertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiaryContainer",
+ "columnName": "light_onTertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.background",
+ "columnName": "light_background",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onBackground",
+ "columnName": "light_onBackground",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surface",
+ "columnName": "light_surface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSurface",
+ "columnName": "light_onSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceVariant",
+ "columnName": "light_surfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSurfaceVariant",
+ "columnName": "light_onSurfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.error",
+ "columnName": "light_error",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onError",
+ "columnName": "light_onError",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.outline",
+ "columnName": "light_outline",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.errorContainer",
+ "columnName": "light_errorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onErrorContainer",
+ "columnName": "light_onErrorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.inversePrimary",
+ "columnName": "light_inversePrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.inverseSurface",
+ "columnName": "light_inverseSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.inverseOnSurface",
+ "columnName": "light_inverseOnSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceTint",
+ "columnName": "light_surfaceTint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.outlineVariant",
+ "columnName": "light_outlineVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.scrim",
+ "columnName": "light_scrim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceBright",
+ "columnName": "light_surfaceBright",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceDim",
+ "columnName": "light_surfaceDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainer",
+ "columnName": "light_surfaceContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerHigh",
+ "columnName": "light_surfaceContainerHigh",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerHighest",
+ "columnName": "light_surfaceContainerHighest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerLow",
+ "columnName": "light_surfaceContainerLow",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerLowest",
+ "columnName": "light_surfaceContainerLowest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primaryFixed",
+ "columnName": "light_primaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primaryFixedDim",
+ "columnName": "light_primaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimaryFixed",
+ "columnName": "light_onPrimaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimaryFixedVariant",
+ "columnName": "light_onPrimaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondaryFixed",
+ "columnName": "light_secondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondaryFixedDim",
+ "columnName": "light_secondaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondaryFixed",
+ "columnName": "light_onSecondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondaryFixedVariant",
+ "columnName": "light_onSecondaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiaryFixed",
+ "columnName": "light_tertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiaryFixedDim",
+ "columnName": "light_tertiaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiaryFixed",
+ "columnName": "light_onTertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiaryFixedVariant",
+ "columnName": "light_onTertiaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primary",
+ "columnName": "dark_primary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimary",
+ "columnName": "dark_onPrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primaryContainer",
+ "columnName": "dark_primaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimaryContainer",
+ "columnName": "dark_onPrimaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondary",
+ "columnName": "dark_secondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondary",
+ "columnName": "dark_onSecondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondaryContainer",
+ "columnName": "dark_secondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondaryContainer",
+ "columnName": "dark_onSecondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiary",
+ "columnName": "dark_tertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiary",
+ "columnName": "dark_onTertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiaryContainer",
+ "columnName": "dark_tertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiaryContainer",
+ "columnName": "dark_onTertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.background",
+ "columnName": "dark_background",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onBackground",
+ "columnName": "dark_onBackground",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surface",
+ "columnName": "dark_surface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSurface",
+ "columnName": "dark_onSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceVariant",
+ "columnName": "dark_surfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSurfaceVariant",
+ "columnName": "dark_onSurfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.error",
+ "columnName": "dark_error",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onError",
+ "columnName": "dark_onError",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.outline",
+ "columnName": "dark_outline",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.errorContainer",
+ "columnName": "dark_errorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onErrorContainer",
+ "columnName": "dark_onErrorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.inversePrimary",
+ "columnName": "dark_inversePrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.inverseSurface",
+ "columnName": "dark_inverseSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.inverseOnSurface",
+ "columnName": "dark_inverseOnSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceTint",
+ "columnName": "dark_surfaceTint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.outlineVariant",
+ "columnName": "dark_outlineVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.scrim",
+ "columnName": "dark_scrim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceBright",
+ "columnName": "dark_surfaceBright",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceDim",
+ "columnName": "dark_surfaceDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainer",
+ "columnName": "dark_surfaceContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerHigh",
+ "columnName": "dark_surfaceContainerHigh",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerHighest",
+ "columnName": "dark_surfaceContainerHighest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerLow",
+ "columnName": "dark_surfaceContainerLow",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerLowest",
+ "columnName": "dark_surfaceContainerLowest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primaryFixed",
+ "columnName": "dark_primaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primaryFixedDim",
+ "columnName": "dark_primaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimaryFixed",
+ "columnName": "dark_onPrimaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimaryFixedVariant",
+ "columnName": "dark_onPrimaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondaryFixed",
+ "columnName": "dark_secondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondaryFixedDim",
+ "columnName": "dark_secondaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondaryFixed",
+ "columnName": "dark_onSecondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondaryFixedVariant",
+ "columnName": "dark_onSecondaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiaryFixed",
+ "columnName": "dark_tertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiaryFixedDim",
+ "columnName": "dark_tertiaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiaryFixed",
+ "columnName": "dark_onTertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiaryFixedVariant",
+ "columnName": "dark_onTertiaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "albumArtUriString"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_album_art_themes_albumArtUriString_paletteStyle",
+ "unique": false,
+ "columnNames": [
+ "albumArtUriString",
+ "paletteStyle"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_album_art_themes_albumArtUriString_paletteStyle` ON `${TABLE_NAME}` (`albumArtUriString`, `paletteStyle`)"
+ }
+ ]
+ },
+ {
+ "tableName": "search_history",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `query` TEXT NOT NULL, `timestamp` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "query",
+ "columnName": "query",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist_name` TEXT NOT NULL, `artist_id` INTEGER NOT NULL, `album_artist` TEXT, `album_name` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `content_uri_string` TEXT NOT NULL, `album_art_uri_string` TEXT, `duration` INTEGER NOT NULL, `genre` TEXT, `file_path` TEXT NOT NULL, `parent_directory_path` TEXT NOT NULL, `is_favorite` INTEGER NOT NULL DEFAULT 0, `lyrics` TEXT DEFAULT null, `track_number` INTEGER NOT NULL DEFAULT 0, `disc_number` INTEGER DEFAULT null, `year` INTEGER NOT NULL DEFAULT 0, `date_added` INTEGER NOT NULL DEFAULT 0, `mime_type` TEXT, `bitrate` INTEGER, `sample_rate` INTEGER, `telegram_chat_id` INTEGER, `telegram_file_id` INTEGER, `artists_json` TEXT, `source_type` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`), FOREIGN KEY(`album_id`) REFERENCES `albums`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`artist_id`) REFERENCES `artists`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistName",
+ "columnName": "artist_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtist",
+ "columnName": "album_artist",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "albumName",
+ "columnName": "album_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentUriString",
+ "columnName": "content_uri_string",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "album_art_uri_string",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "filePath",
+ "columnName": "file_path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "parentDirectoryPath",
+ "columnName": "parent_directory_path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isFavorite",
+ "columnName": "is_favorite",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "lyrics",
+ "columnName": "lyrics",
+ "affinity": "TEXT",
+ "defaultValue": "null"
+ },
+ {
+ "fieldPath": "trackNumber",
+ "columnName": "track_number",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "discNumber",
+ "columnName": "disc_number",
+ "affinity": "INTEGER",
+ "defaultValue": "null"
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "sampleRate",
+ "columnName": "sample_rate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "telegramChatId",
+ "columnName": "telegram_chat_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "telegramFileId",
+ "columnName": "telegram_file_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "artistsJson",
+ "columnName": "artists_json",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "sourceType",
+ "columnName": "source_type",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_songs_title",
+ "unique": false,
+ "columnNames": [
+ "title"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_title` ON `${TABLE_NAME}` (`title`)"
+ },
+ {
+ "name": "index_songs_album_id",
+ "unique": false,
+ "columnNames": [
+ "album_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_album_id` ON `${TABLE_NAME}` (`album_id`)"
+ },
+ {
+ "name": "index_songs_artist_id",
+ "unique": false,
+ "columnNames": [
+ "artist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_artist_id` ON `${TABLE_NAME}` (`artist_id`)"
+ },
+ {
+ "name": "index_songs_artist_name",
+ "unique": false,
+ "columnNames": [
+ "artist_name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_artist_name` ON `${TABLE_NAME}` (`artist_name`)"
+ },
+ {
+ "name": "index_songs_genre",
+ "unique": false,
+ "columnNames": [
+ "genre"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_genre` ON `${TABLE_NAME}` (`genre`)"
+ },
+ {
+ "name": "index_songs_parent_directory_path",
+ "unique": false,
+ "columnNames": [
+ "parent_directory_path"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_parent_directory_path` ON `${TABLE_NAME}` (`parent_directory_path`)"
+ },
+ {
+ "name": "index_songs_file_path",
+ "unique": false,
+ "columnNames": [
+ "file_path"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_file_path` ON `${TABLE_NAME}` (`file_path`)"
+ },
+ {
+ "name": "index_songs_content_uri_string",
+ "unique": false,
+ "columnNames": [
+ "content_uri_string"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_content_uri_string` ON `${TABLE_NAME}` (`content_uri_string`)"
+ },
+ {
+ "name": "index_songs_date_added",
+ "unique": false,
+ "columnNames": [
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_date_added` ON `${TABLE_NAME}` (`date_added`)"
+ },
+ {
+ "name": "index_songs_duration",
+ "unique": false,
+ "columnNames": [
+ "duration"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_duration` ON `${TABLE_NAME}` (`duration`)"
+ },
+ {
+ "name": "index_songs_source_type",
+ "unique": false,
+ "columnNames": [
+ "source_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_source_type` ON `${TABLE_NAME}` (`source_type`)"
+ },
+ {
+ "name": "index_songs_parent_directory_path_source_type_album_id",
+ "unique": false,
+ "columnNames": [
+ "parent_directory_path",
+ "source_type",
+ "album_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_parent_directory_path_source_type_album_id` ON `${TABLE_NAME}` (`parent_directory_path`, `source_type`, `album_id`)"
+ },
+ {
+ "name": "index_songs_parent_directory_path_source_type_id",
+ "unique": false,
+ "columnNames": [
+ "parent_directory_path",
+ "source_type",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_parent_directory_path_source_type_id` ON `${TABLE_NAME}` (`parent_directory_path`, `source_type`, `id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "albums",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "album_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "artists",
+ "onDelete": "SET NULL",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "artist_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "songs_fts",
+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`title` TEXT NOT NULL, `artist_name` TEXT NOT NULL, tokenize=unicode61)",
+ "fields": [
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistName",
+ "columnName": "artist_name",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "rowid"
+ ]
+ },
+ "ftsVersion": "FTS4",
+ "ftsOptions": {
+ "tokenizer": "unicode61",
+ "tokenizerArgs": [],
+ "contentTable": "",
+ "languageIdColumnName": "",
+ "matchInfo": "FTS4",
+ "notIndexedColumns": [],
+ "prefixSizes": [],
+ "preferredOrder": "ASC"
+ },
+ "contentSyncTriggers": []
+ },
+ {
+ "tableName": "albums",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist_name` TEXT NOT NULL, `artist_id` INTEGER NOT NULL, `album_art_uri_string` TEXT, `song_count` INTEGER NOT NULL, `date_added` INTEGER NOT NULL, `year` INTEGER NOT NULL, `album_artist` TEXT, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistName",
+ "columnName": "artist_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "album_art_uri_string",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtist",
+ "columnName": "album_artist",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_albums_title",
+ "unique": false,
+ "columnNames": [
+ "title"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_title` ON `${TABLE_NAME}` (`title`)"
+ },
+ {
+ "name": "index_albums_artist_id",
+ "unique": false,
+ "columnNames": [
+ "artist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_artist_id` ON `${TABLE_NAME}` (`artist_id`)"
+ },
+ {
+ "name": "index_albums_artist_name",
+ "unique": false,
+ "columnNames": [
+ "artist_name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_artist_name` ON `${TABLE_NAME}` (`artist_name`)"
+ },
+ {
+ "name": "index_albums_album_artist",
+ "unique": false,
+ "columnNames": [
+ "album_artist"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_album_artist` ON `${TABLE_NAME}` (`album_artist`)"
+ }
+ ]
+ },
+ {
+ "tableName": "artists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `track_count` INTEGER NOT NULL, `image_url` TEXT, `custom_image_uri` TEXT, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trackCount",
+ "columnName": "track_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "imageUrl",
+ "columnName": "image_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "customImageUri",
+ "columnName": "custom_image_uri",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_artists_name",
+ "unique": false,
+ "columnNames": [
+ "name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_artists_name` ON `${TABLE_NAME}` (`name`)"
+ }
+ ]
+ },
+ {
+ "tableName": "transition_rules",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `playlistId` TEXT NOT NULL, `fromTrackId` TEXT, `toTrackId` TEXT, `mode` TEXT NOT NULL, `durationMs` INTEGER NOT NULL, `curveIn` TEXT NOT NULL, `curveOut` TEXT NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlistId",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "fromTrackId",
+ "columnName": "fromTrackId",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "toTrackId",
+ "columnName": "toTrackId",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "settings.mode",
+ "columnName": "mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "settings.durationMs",
+ "columnName": "durationMs",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "settings.curveIn",
+ "columnName": "curveIn",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "settings.curveOut",
+ "columnName": "curveOut",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_transition_rules_playlistId_fromTrackId_toTrackId",
+ "unique": true,
+ "columnNames": [
+ "playlistId",
+ "fromTrackId",
+ "toTrackId"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_transition_rules_playlistId_fromTrackId_toTrackId` ON `${TABLE_NAME}` (`playlistId`, `fromTrackId`, `toTrackId`)"
+ }
+ ]
+ },
+ {
+ "tableName": "song_artist_cross_ref",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`song_id` INTEGER NOT NULL, `artist_id` INTEGER NOT NULL, `is_primary` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`song_id`, `artist_id`), FOREIGN KEY(`song_id`) REFERENCES `songs`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`artist_id`) REFERENCES `artists`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "song_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isPrimary",
+ "columnName": "is_primary",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "song_id",
+ "artist_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_song_artist_cross_ref_song_id",
+ "unique": false,
+ "columnNames": [
+ "song_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_artist_cross_ref_song_id` ON `${TABLE_NAME}` (`song_id`)"
+ },
+ {
+ "name": "index_song_artist_cross_ref_artist_id",
+ "unique": false,
+ "columnNames": [
+ "artist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_artist_cross_ref_artist_id` ON `${TABLE_NAME}` (`artist_id`)"
+ },
+ {
+ "name": "index_song_artist_cross_ref_is_primary",
+ "unique": false,
+ "columnNames": [
+ "is_primary"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_artist_cross_ref_is_primary` ON `${TABLE_NAME}` (`is_primary`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "songs",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "song_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "artists",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "artist_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "telegram_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `chat_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `file_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `duration` INTEGER NOT NULL, `file_path` TEXT NOT NULL, `mime_type` TEXT NOT NULL, `date_added` INTEGER NOT NULL, `album_art_uri` TEXT, `thread_id` INTEGER, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "chatId",
+ "columnName": "chat_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "messageId",
+ "columnName": "message_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "fileId",
+ "columnName": "file_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "filePath",
+ "columnName": "file_path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "album_art_uri",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "threadId",
+ "columnName": "thread_id",
+ "affinity": "INTEGER"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_telegram_songs_chat_id",
+ "unique": false,
+ "columnNames": [
+ "chat_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_chat_id` ON `${TABLE_NAME}` (`chat_id`)"
+ },
+ {
+ "name": "index_telegram_songs_message_id",
+ "unique": false,
+ "columnNames": [
+ "message_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_message_id` ON `${TABLE_NAME}` (`message_id`)"
+ },
+ {
+ "name": "index_telegram_songs_file_id",
+ "unique": false,
+ "columnNames": [
+ "file_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_file_id` ON `${TABLE_NAME}` (`file_id`)"
+ },
+ {
+ "name": "index_telegram_songs_chat_id_message_id",
+ "unique": false,
+ "columnNames": [
+ "chat_id",
+ "message_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_chat_id_message_id` ON `${TABLE_NAME}` (`chat_id`, `message_id`)"
+ },
+ {
+ "name": "index_telegram_songs_thread_id",
+ "unique": false,
+ "columnNames": [
+ "thread_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_thread_id` ON `${TABLE_NAME}` (`thread_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "telegram_channels",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chat_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `username` TEXT, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, `photo_path` TEXT, PRIMARY KEY(`chat_id`))",
+ "fields": [
+ {
+ "fieldPath": "chatId",
+ "columnName": "chat_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "username",
+ "columnName": "username",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "photoPath",
+ "columnName": "photo_path",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "chat_id"
+ ]
+ }
+ },
+ {
+ "tableName": "song_engagements",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`song_id` TEXT NOT NULL, `play_count` INTEGER NOT NULL, `total_play_duration_ms` INTEGER NOT NULL, `last_played_timestamp` INTEGER NOT NULL, PRIMARY KEY(`song_id`))",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "song_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playCount",
+ "columnName": "play_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalPlayDurationMs",
+ "columnName": "total_play_duration_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastPlayedTimestamp",
+ "columnName": "last_played_timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "song_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_song_engagements_play_count",
+ "unique": false,
+ "columnNames": [
+ "play_count"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_engagements_play_count` ON `${TABLE_NAME}` (`play_count`)"
+ }
+ ]
+ },
+ {
+ "tableName": "favorites",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`songId` INTEGER NOT NULL, `isFavorite` INTEGER NOT NULL, `timestamp` INTEGER NOT NULL, PRIMARY KEY(`songId`))",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "songId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isFavorite",
+ "columnName": "isFavorite",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "songId"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_favorites_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ]
+ },
+ {
+ "tableName": "lyrics",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`songId` INTEGER NOT NULL, `content` TEXT NOT NULL, `isSynced` INTEGER NOT NULL, `source` TEXT, PRIMARY KEY(`songId`))",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "songId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "content",
+ "columnName": "content",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isSynced",
+ "columnName": "isSynced",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "songId"
+ ]
+ }
+ },
+ {
+ "tableName": "netease_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `netease_id` INTEGER NOT NULL, `playlist_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `album_art_url` TEXT, `mime_type` TEXT NOT NULL, `bitrate` INTEGER, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "neteaseId",
+ "columnName": "netease_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUrl",
+ "columnName": "album_art_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_netease_songs_netease_id",
+ "unique": false,
+ "columnNames": [
+ "netease_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_netease_songs_netease_id` ON `${TABLE_NAME}` (`netease_id`)"
+ },
+ {
+ "name": "index_netease_songs_playlist_id",
+ "unique": false,
+ "columnNames": [
+ "playlist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_netease_songs_playlist_id` ON `${TABLE_NAME}` (`playlist_id`)"
+ },
+ {
+ "name": "index_netease_songs_playlist_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_netease_songs_playlist_id_date_added` ON `${TABLE_NAME}` (`playlist_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "netease_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `cover_url` TEXT, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "coverUrl",
+ "columnName": "cover_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "gdrive_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `drive_file_id` TEXT NOT NULL, `folder_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `album_art_url` TEXT, `mime_type` TEXT NOT NULL, `bitrate` INTEGER, `file_size` INTEGER NOT NULL, `date_added` INTEGER NOT NULL, `date_modified` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "driveFileId",
+ "columnName": "drive_file_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "folderId",
+ "columnName": "folder_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUrl",
+ "columnName": "album_art_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "fileSize",
+ "columnName": "file_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateModified",
+ "columnName": "date_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_gdrive_songs_drive_file_id",
+ "unique": false,
+ "columnNames": [
+ "drive_file_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_gdrive_songs_drive_file_id` ON `${TABLE_NAME}` (`drive_file_id`)"
+ },
+ {
+ "name": "index_gdrive_songs_folder_id",
+ "unique": false,
+ "columnNames": [
+ "folder_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_gdrive_songs_folder_id` ON `${TABLE_NAME}` (`folder_id`)"
+ },
+ {
+ "name": "index_gdrive_songs_folder_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "folder_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_gdrive_songs_folder_id_date_added` ON `${TABLE_NAME}` (`folder_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "gdrive_folders",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `created_at` INTEGER NOT NULL, `last_modified` INTEGER NOT NULL, `is_ai_generated` INTEGER NOT NULL, `is_queue_generated` INTEGER NOT NULL, `cover_image_uri` TEXT, `cover_color_argb` INTEGER, `cover_icon_name` TEXT, `cover_shape_type` TEXT, `cover_shape_detail_1` REAL, `cover_shape_detail_2` REAL, `cover_shape_detail_3` REAL, `cover_shape_detail_4` REAL, `source` TEXT NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastModified",
+ "columnName": "last_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAiGenerated",
+ "columnName": "is_ai_generated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isQueueGenerated",
+ "columnName": "is_queue_generated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "coverImageUri",
+ "columnName": "cover_image_uri",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverColorArgb",
+ "columnName": "cover_color_argb",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "coverIconName",
+ "columnName": "cover_icon_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverShapeType",
+ "columnName": "cover_shape_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverShapeDetail1",
+ "columnName": "cover_shape_detail_1",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "coverShapeDetail2",
+ "columnName": "cover_shape_detail_2",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "coverShapeDetail3",
+ "columnName": "cover_shape_detail_3",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "coverShapeDetail4",
+ "columnName": "cover_shape_detail_4",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_playlists_last_modified",
+ "unique": false,
+ "columnNames": [
+ "last_modified"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playlists_last_modified` ON `${TABLE_NAME}` (`last_modified`)"
+ }
+ ]
+ },
+ {
+ "tableName": "playlist_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`playlist_id` TEXT NOT NULL, `song_id` TEXT NOT NULL, `sort_order` INTEGER NOT NULL, PRIMARY KEY(`playlist_id`, `song_id`))",
+ "fields": [
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songId",
+ "columnName": "song_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "sortOrder",
+ "columnName": "sort_order",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "playlist_id",
+ "song_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_playlist_songs_playlist_id_sort_order",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "sort_order"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playlist_songs_playlist_id_sort_order` ON `${TABLE_NAME}` (`playlist_id`, `sort_order`)"
+ },
+ {
+ "name": "index_playlist_songs_song_id",
+ "unique": false,
+ "columnNames": [
+ "song_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playlist_songs_song_id` ON `${TABLE_NAME}` (`song_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "qqmusic_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `song_mid` TEXT NOT NULL, `playlist_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_mid` TEXT, `duration` INTEGER NOT NULL, `album_art_url` TEXT, `mime_type` TEXT NOT NULL, `bitrate` INTEGER, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songMid",
+ "columnName": "song_mid",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumMid",
+ "columnName": "album_mid",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUrl",
+ "columnName": "album_art_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "qqmusic_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `cover_url` TEXT, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "coverUrl",
+ "columnName": "cover_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "navidrome_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `navidrome_id` TEXT NOT NULL, `playlist_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `artist_id` TEXT, `album` TEXT NOT NULL, `album_id` TEXT, `cover_art_id` TEXT, `duration` INTEGER NOT NULL, `track_number` INTEGER NOT NULL, `disc_number` INTEGER NOT NULL, `year` INTEGER NOT NULL, `genre` TEXT, `bitRate` INTEGER, `mime_type` TEXT, `suffix` TEXT, `path` TEXT NOT NULL, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "navidromeId",
+ "columnName": "navidrome_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverArtId",
+ "columnName": "cover_art_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trackNumber",
+ "columnName": "track_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "discNumber",
+ "columnName": "disc_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bitRate",
+ "columnName": "bitRate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "suffix",
+ "columnName": "suffix",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "path",
+ "columnName": "path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_navidrome_songs_navidrome_id",
+ "unique": false,
+ "columnNames": [
+ "navidrome_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_navidrome_songs_navidrome_id` ON `${TABLE_NAME}` (`navidrome_id`)"
+ },
+ {
+ "name": "index_navidrome_songs_playlist_id",
+ "unique": false,
+ "columnNames": [
+ "playlist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_navidrome_songs_playlist_id` ON `${TABLE_NAME}` (`playlist_id`)"
+ },
+ {
+ "name": "index_navidrome_songs_playlist_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_navidrome_songs_playlist_id_date_added` ON `${TABLE_NAME}` (`playlist_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "navidrome_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `comment` TEXT, `owner` TEXT, `cover_art_id` TEXT, `song_count` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `public` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "comment",
+ "columnName": "comment",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "owner",
+ "columnName": "owner",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverArtId",
+ "columnName": "cover_art_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "public",
+ "columnName": "public",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "telegram_topics",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `chat_id` INTEGER NOT NULL, `thread_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, `icon_emoji` TEXT, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "chatId",
+ "columnName": "chat_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "threadId",
+ "columnName": "thread_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iconEmoji",
+ "columnName": "icon_emoji",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_telegram_topics_chat_id",
+ "unique": false,
+ "columnNames": [
+ "chat_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_topics_chat_id` ON `${TABLE_NAME}` (`chat_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "jellyfin_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `jellyfin_id` TEXT NOT NULL, `playlist_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `artist_id` TEXT, `album` TEXT NOT NULL, `album_id` TEXT, `duration` INTEGER NOT NULL, `track_number` INTEGER NOT NULL, `disc_number` INTEGER NOT NULL, `year` INTEGER NOT NULL, `genre` TEXT, `bitRate` INTEGER, `mime_type` TEXT, `path` TEXT NOT NULL, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "jellyfinId",
+ "columnName": "jellyfin_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trackNumber",
+ "columnName": "track_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "discNumber",
+ "columnName": "disc_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bitRate",
+ "columnName": "bitRate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "path",
+ "columnName": "path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_jellyfin_songs_jellyfin_id",
+ "unique": false,
+ "columnNames": [
+ "jellyfin_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_jellyfin_songs_jellyfin_id` ON `${TABLE_NAME}` (`jellyfin_id`)"
+ },
+ {
+ "name": "index_jellyfin_songs_playlist_id",
+ "unique": false,
+ "columnNames": [
+ "playlist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_jellyfin_songs_playlist_id` ON `${TABLE_NAME}` (`playlist_id`)"
+ },
+ {
+ "name": "index_jellyfin_songs_playlist_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_jellyfin_songs_playlist_id_date_added` ON `${TABLE_NAME}` (`playlist_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "jellyfin_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "s3_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `object_key` TEXT NOT NULL, `folder_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `mimeType` TEXT NOT NULL, `bitrate` INTEGER, `file_size` INTEGER NOT NULL, `date_added` INTEGER NOT NULL, `date_modified` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "objectKey",
+ "columnName": "object_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "folderId",
+ "columnName": "folder_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mimeType",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "fileSize",
+ "columnName": "file_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateModified",
+ "columnName": "date_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_s3_songs_object_key",
+ "unique": false,
+ "columnNames": [
+ "object_key"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_s3_songs_object_key` ON `${TABLE_NAME}` (`object_key`)"
+ },
+ {
+ "name": "index_s3_songs_folder_id",
+ "unique": false,
+ "columnNames": [
+ "folder_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_s3_songs_folder_id` ON `${TABLE_NAME}` (`folder_id`)"
+ },
+ {
+ "name": "index_s3_songs_folder_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "folder_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_s3_songs_folder_id_date_added` ON `${TABLE_NAME}` (`folder_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "s3_folders",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "ai_cache",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`promptHash` TEXT NOT NULL, `responseJson` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, PRIMARY KEY(`promptHash`))",
+ "fields": [
+ {
+ "fieldPath": "promptHash",
+ "columnName": "promptHash",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "responseJson",
+ "columnName": "responseJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "promptHash"
+ ]
+ }
+ },
+ {
+ "tableName": "ai_usage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `provider` TEXT NOT NULL, `model` TEXT NOT NULL, `promptType` TEXT NOT NULL, `promptTokens` INTEGER NOT NULL, `outputTokens` INTEGER NOT NULL, `thoughtTokens` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "provider",
+ "columnName": "provider",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "model",
+ "columnName": "model",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "promptType",
+ "columnName": "promptType",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "promptTokens",
+ "columnName": "promptTokens",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "outputTokens",
+ "columnName": "outputTokens",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "thoughtTokens",
+ "columnName": "thoughtTokens",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ }
+ }
+ ],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '07ce45dab5a383b78ea4b21f867758bd')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/app/schemas/com.theveloper.pixelplay.data.database.PixelPlayDatabase/44.json b/app/schemas/com.theveloper.pixelplay.data.database.PixelPlayDatabase/44.json
new file mode 100644
index 0000000000..1e961762e5
--- /dev/null
+++ b/app/schemas/com.theveloper.pixelplay.data.database.PixelPlayDatabase/44.json
@@ -0,0 +1,2909 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 44,
+ "identityHash": "502d882063b46e105090ef8f83c5d6ef",
+ "entities": [
+ {
+ "tableName": "album_art_themes",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`albumArtUriString` TEXT NOT NULL, `paletteStyle` TEXT NOT NULL, `light_primary` TEXT NOT NULL, `light_onPrimary` TEXT NOT NULL, `light_primaryContainer` TEXT NOT NULL, `light_onPrimaryContainer` TEXT NOT NULL, `light_secondary` TEXT NOT NULL, `light_onSecondary` TEXT NOT NULL, `light_secondaryContainer` TEXT NOT NULL, `light_onSecondaryContainer` TEXT NOT NULL, `light_tertiary` TEXT NOT NULL, `light_onTertiary` TEXT NOT NULL, `light_tertiaryContainer` TEXT NOT NULL, `light_onTertiaryContainer` TEXT NOT NULL, `light_background` TEXT NOT NULL, `light_onBackground` TEXT NOT NULL, `light_surface` TEXT NOT NULL, `light_onSurface` TEXT NOT NULL, `light_surfaceVariant` TEXT NOT NULL, `light_onSurfaceVariant` TEXT NOT NULL, `light_error` TEXT NOT NULL, `light_onError` TEXT NOT NULL, `light_outline` TEXT NOT NULL, `light_errorContainer` TEXT NOT NULL, `light_onErrorContainer` TEXT NOT NULL, `light_inversePrimary` TEXT NOT NULL, `light_inverseSurface` TEXT NOT NULL, `light_inverseOnSurface` TEXT NOT NULL, `light_surfaceTint` TEXT NOT NULL, `light_outlineVariant` TEXT NOT NULL, `light_scrim` TEXT NOT NULL, `light_surfaceBright` TEXT NOT NULL, `light_surfaceDim` TEXT NOT NULL, `light_surfaceContainer` TEXT NOT NULL, `light_surfaceContainerHigh` TEXT NOT NULL, `light_surfaceContainerHighest` TEXT NOT NULL, `light_surfaceContainerLow` TEXT NOT NULL, `light_surfaceContainerLowest` TEXT NOT NULL, `light_primaryFixed` TEXT NOT NULL, `light_primaryFixedDim` TEXT NOT NULL, `light_onPrimaryFixed` TEXT NOT NULL, `light_onPrimaryFixedVariant` TEXT NOT NULL, `light_secondaryFixed` TEXT NOT NULL, `light_secondaryFixedDim` TEXT NOT NULL, `light_onSecondaryFixed` TEXT NOT NULL, `light_onSecondaryFixedVariant` TEXT NOT NULL, `light_tertiaryFixed` TEXT NOT NULL, `light_tertiaryFixedDim` TEXT NOT NULL, `light_onTertiaryFixed` TEXT NOT NULL, `light_onTertiaryFixedVariant` TEXT NOT NULL, `dark_primary` TEXT NOT NULL, `dark_onPrimary` TEXT NOT NULL, `dark_primaryContainer` TEXT NOT NULL, `dark_onPrimaryContainer` TEXT NOT NULL, `dark_secondary` TEXT NOT NULL, `dark_onSecondary` TEXT NOT NULL, `dark_secondaryContainer` TEXT NOT NULL, `dark_onSecondaryContainer` TEXT NOT NULL, `dark_tertiary` TEXT NOT NULL, `dark_onTertiary` TEXT NOT NULL, `dark_tertiaryContainer` TEXT NOT NULL, `dark_onTertiaryContainer` TEXT NOT NULL, `dark_background` TEXT NOT NULL, `dark_onBackground` TEXT NOT NULL, `dark_surface` TEXT NOT NULL, `dark_onSurface` TEXT NOT NULL, `dark_surfaceVariant` TEXT NOT NULL, `dark_onSurfaceVariant` TEXT NOT NULL, `dark_error` TEXT NOT NULL, `dark_onError` TEXT NOT NULL, `dark_outline` TEXT NOT NULL, `dark_errorContainer` TEXT NOT NULL, `dark_onErrorContainer` TEXT NOT NULL, `dark_inversePrimary` TEXT NOT NULL, `dark_inverseSurface` TEXT NOT NULL, `dark_inverseOnSurface` TEXT NOT NULL, `dark_surfaceTint` TEXT NOT NULL, `dark_outlineVariant` TEXT NOT NULL, `dark_scrim` TEXT NOT NULL, `dark_surfaceBright` TEXT NOT NULL, `dark_surfaceDim` TEXT NOT NULL, `dark_surfaceContainer` TEXT NOT NULL, `dark_surfaceContainerHigh` TEXT NOT NULL, `dark_surfaceContainerHighest` TEXT NOT NULL, `dark_surfaceContainerLow` TEXT NOT NULL, `dark_surfaceContainerLowest` TEXT NOT NULL, `dark_primaryFixed` TEXT NOT NULL, `dark_primaryFixedDim` TEXT NOT NULL, `dark_onPrimaryFixed` TEXT NOT NULL, `dark_onPrimaryFixedVariant` TEXT NOT NULL, `dark_secondaryFixed` TEXT NOT NULL, `dark_secondaryFixedDim` TEXT NOT NULL, `dark_onSecondaryFixed` TEXT NOT NULL, `dark_onSecondaryFixedVariant` TEXT NOT NULL, `dark_tertiaryFixed` TEXT NOT NULL, `dark_tertiaryFixedDim` TEXT NOT NULL, `dark_onTertiaryFixed` TEXT NOT NULL, `dark_onTertiaryFixedVariant` TEXT NOT NULL, PRIMARY KEY(`albumArtUriString`))",
+ "fields": [
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "albumArtUriString",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "paletteStyle",
+ "columnName": "paletteStyle",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primary",
+ "columnName": "light_primary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimary",
+ "columnName": "light_onPrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primaryContainer",
+ "columnName": "light_primaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimaryContainer",
+ "columnName": "light_onPrimaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondary",
+ "columnName": "light_secondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondary",
+ "columnName": "light_onSecondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondaryContainer",
+ "columnName": "light_secondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondaryContainer",
+ "columnName": "light_onSecondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiary",
+ "columnName": "light_tertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiary",
+ "columnName": "light_onTertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiaryContainer",
+ "columnName": "light_tertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiaryContainer",
+ "columnName": "light_onTertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.background",
+ "columnName": "light_background",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onBackground",
+ "columnName": "light_onBackground",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surface",
+ "columnName": "light_surface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSurface",
+ "columnName": "light_onSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceVariant",
+ "columnName": "light_surfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSurfaceVariant",
+ "columnName": "light_onSurfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.error",
+ "columnName": "light_error",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onError",
+ "columnName": "light_onError",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.outline",
+ "columnName": "light_outline",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.errorContainer",
+ "columnName": "light_errorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onErrorContainer",
+ "columnName": "light_onErrorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.inversePrimary",
+ "columnName": "light_inversePrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.inverseSurface",
+ "columnName": "light_inverseSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.inverseOnSurface",
+ "columnName": "light_inverseOnSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceTint",
+ "columnName": "light_surfaceTint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.outlineVariant",
+ "columnName": "light_outlineVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.scrim",
+ "columnName": "light_scrim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceBright",
+ "columnName": "light_surfaceBright",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceDim",
+ "columnName": "light_surfaceDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainer",
+ "columnName": "light_surfaceContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerHigh",
+ "columnName": "light_surfaceContainerHigh",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerHighest",
+ "columnName": "light_surfaceContainerHighest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerLow",
+ "columnName": "light_surfaceContainerLow",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerLowest",
+ "columnName": "light_surfaceContainerLowest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primaryFixed",
+ "columnName": "light_primaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primaryFixedDim",
+ "columnName": "light_primaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimaryFixed",
+ "columnName": "light_onPrimaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimaryFixedVariant",
+ "columnName": "light_onPrimaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondaryFixed",
+ "columnName": "light_secondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondaryFixedDim",
+ "columnName": "light_secondaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondaryFixed",
+ "columnName": "light_onSecondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondaryFixedVariant",
+ "columnName": "light_onSecondaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiaryFixed",
+ "columnName": "light_tertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiaryFixedDim",
+ "columnName": "light_tertiaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiaryFixed",
+ "columnName": "light_onTertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiaryFixedVariant",
+ "columnName": "light_onTertiaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primary",
+ "columnName": "dark_primary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimary",
+ "columnName": "dark_onPrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primaryContainer",
+ "columnName": "dark_primaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimaryContainer",
+ "columnName": "dark_onPrimaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondary",
+ "columnName": "dark_secondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondary",
+ "columnName": "dark_onSecondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondaryContainer",
+ "columnName": "dark_secondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondaryContainer",
+ "columnName": "dark_onSecondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiary",
+ "columnName": "dark_tertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiary",
+ "columnName": "dark_onTertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiaryContainer",
+ "columnName": "dark_tertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiaryContainer",
+ "columnName": "dark_onTertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.background",
+ "columnName": "dark_background",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onBackground",
+ "columnName": "dark_onBackground",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surface",
+ "columnName": "dark_surface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSurface",
+ "columnName": "dark_onSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceVariant",
+ "columnName": "dark_surfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSurfaceVariant",
+ "columnName": "dark_onSurfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.error",
+ "columnName": "dark_error",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onError",
+ "columnName": "dark_onError",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.outline",
+ "columnName": "dark_outline",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.errorContainer",
+ "columnName": "dark_errorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onErrorContainer",
+ "columnName": "dark_onErrorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.inversePrimary",
+ "columnName": "dark_inversePrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.inverseSurface",
+ "columnName": "dark_inverseSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.inverseOnSurface",
+ "columnName": "dark_inverseOnSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceTint",
+ "columnName": "dark_surfaceTint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.outlineVariant",
+ "columnName": "dark_outlineVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.scrim",
+ "columnName": "dark_scrim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceBright",
+ "columnName": "dark_surfaceBright",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceDim",
+ "columnName": "dark_surfaceDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainer",
+ "columnName": "dark_surfaceContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerHigh",
+ "columnName": "dark_surfaceContainerHigh",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerHighest",
+ "columnName": "dark_surfaceContainerHighest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerLow",
+ "columnName": "dark_surfaceContainerLow",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerLowest",
+ "columnName": "dark_surfaceContainerLowest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primaryFixed",
+ "columnName": "dark_primaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primaryFixedDim",
+ "columnName": "dark_primaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimaryFixed",
+ "columnName": "dark_onPrimaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimaryFixedVariant",
+ "columnName": "dark_onPrimaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondaryFixed",
+ "columnName": "dark_secondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondaryFixedDim",
+ "columnName": "dark_secondaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondaryFixed",
+ "columnName": "dark_onSecondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondaryFixedVariant",
+ "columnName": "dark_onSecondaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiaryFixed",
+ "columnName": "dark_tertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiaryFixedDim",
+ "columnName": "dark_tertiaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiaryFixed",
+ "columnName": "dark_onTertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiaryFixedVariant",
+ "columnName": "dark_onTertiaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "albumArtUriString"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_album_art_themes_albumArtUriString_paletteStyle",
+ "unique": false,
+ "columnNames": [
+ "albumArtUriString",
+ "paletteStyle"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_album_art_themes_albumArtUriString_paletteStyle` ON `${TABLE_NAME}` (`albumArtUriString`, `paletteStyle`)"
+ }
+ ]
+ },
+ {
+ "tableName": "search_history",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `query` TEXT NOT NULL, `timestamp` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "query",
+ "columnName": "query",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist_name` TEXT NOT NULL, `artist_id` INTEGER NOT NULL, `album_artist` TEXT, `album_name` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `content_uri_string` TEXT NOT NULL, `album_art_uri_string` TEXT, `duration` INTEGER NOT NULL, `genre` TEXT, `file_path` TEXT NOT NULL, `parent_directory_path` TEXT NOT NULL, `is_favorite` INTEGER NOT NULL DEFAULT 0, `lyrics` TEXT DEFAULT null, `track_number` INTEGER NOT NULL DEFAULT 0, `disc_number` INTEGER DEFAULT null, `year` INTEGER NOT NULL DEFAULT 0, `date_added` INTEGER NOT NULL DEFAULT 0, `mime_type` TEXT, `bitrate` INTEGER, `sample_rate` INTEGER, `telegram_chat_id` INTEGER, `telegram_file_id` INTEGER, `artists_json` TEXT, `source_type` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`), FOREIGN KEY(`album_id`) REFERENCES `albums`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`artist_id`) REFERENCES `artists`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistName",
+ "columnName": "artist_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtist",
+ "columnName": "album_artist",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "albumName",
+ "columnName": "album_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentUriString",
+ "columnName": "content_uri_string",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "album_art_uri_string",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "filePath",
+ "columnName": "file_path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "parentDirectoryPath",
+ "columnName": "parent_directory_path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isFavorite",
+ "columnName": "is_favorite",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "lyrics",
+ "columnName": "lyrics",
+ "affinity": "TEXT",
+ "defaultValue": "null"
+ },
+ {
+ "fieldPath": "trackNumber",
+ "columnName": "track_number",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "discNumber",
+ "columnName": "disc_number",
+ "affinity": "INTEGER",
+ "defaultValue": "null"
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "sampleRate",
+ "columnName": "sample_rate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "telegramChatId",
+ "columnName": "telegram_chat_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "telegramFileId",
+ "columnName": "telegram_file_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "artistsJson",
+ "columnName": "artists_json",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "sourceType",
+ "columnName": "source_type",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_songs_title",
+ "unique": false,
+ "columnNames": [
+ "title"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_title` ON `${TABLE_NAME}` (`title`)"
+ },
+ {
+ "name": "index_songs_album_id",
+ "unique": false,
+ "columnNames": [
+ "album_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_album_id` ON `${TABLE_NAME}` (`album_id`)"
+ },
+ {
+ "name": "index_songs_artist_id",
+ "unique": false,
+ "columnNames": [
+ "artist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_artist_id` ON `${TABLE_NAME}` (`artist_id`)"
+ },
+ {
+ "name": "index_songs_artist_name",
+ "unique": false,
+ "columnNames": [
+ "artist_name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_artist_name` ON `${TABLE_NAME}` (`artist_name`)"
+ },
+ {
+ "name": "index_songs_genre",
+ "unique": false,
+ "columnNames": [
+ "genre"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_genre` ON `${TABLE_NAME}` (`genre`)"
+ },
+ {
+ "name": "index_songs_parent_directory_path",
+ "unique": false,
+ "columnNames": [
+ "parent_directory_path"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_parent_directory_path` ON `${TABLE_NAME}` (`parent_directory_path`)"
+ },
+ {
+ "name": "index_songs_file_path",
+ "unique": false,
+ "columnNames": [
+ "file_path"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_file_path` ON `${TABLE_NAME}` (`file_path`)"
+ },
+ {
+ "name": "index_songs_content_uri_string",
+ "unique": false,
+ "columnNames": [
+ "content_uri_string"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_content_uri_string` ON `${TABLE_NAME}` (`content_uri_string`)"
+ },
+ {
+ "name": "index_songs_date_added",
+ "unique": false,
+ "columnNames": [
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_date_added` ON `${TABLE_NAME}` (`date_added`)"
+ },
+ {
+ "name": "index_songs_duration",
+ "unique": false,
+ "columnNames": [
+ "duration"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_duration` ON `${TABLE_NAME}` (`duration`)"
+ },
+ {
+ "name": "index_songs_source_type",
+ "unique": false,
+ "columnNames": [
+ "source_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_source_type` ON `${TABLE_NAME}` (`source_type`)"
+ },
+ {
+ "name": "index_songs_parent_directory_path_source_type_album_id",
+ "unique": false,
+ "columnNames": [
+ "parent_directory_path",
+ "source_type",
+ "album_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_parent_directory_path_source_type_album_id` ON `${TABLE_NAME}` (`parent_directory_path`, `source_type`, `album_id`)"
+ },
+ {
+ "name": "index_songs_parent_directory_path_source_type_id",
+ "unique": false,
+ "columnNames": [
+ "parent_directory_path",
+ "source_type",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_parent_directory_path_source_type_id` ON `${TABLE_NAME}` (`parent_directory_path`, `source_type`, `id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "albums",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "album_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "artists",
+ "onDelete": "SET NULL",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "artist_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "songs_fts",
+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`title` TEXT NOT NULL, `artist_name` TEXT NOT NULL, tokenize=unicode61)",
+ "fields": [
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistName",
+ "columnName": "artist_name",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "rowid"
+ ]
+ },
+ "ftsVersion": "FTS4",
+ "ftsOptions": {
+ "tokenizer": "unicode61",
+ "tokenizerArgs": [],
+ "contentTable": "",
+ "languageIdColumnName": "",
+ "matchInfo": "FTS4",
+ "notIndexedColumns": [],
+ "prefixSizes": [],
+ "preferredOrder": "ASC"
+ },
+ "contentSyncTriggers": []
+ },
+ {
+ "tableName": "albums",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist_name` TEXT NOT NULL, `artist_id` INTEGER NOT NULL, `album_art_uri_string` TEXT, `song_count` INTEGER NOT NULL, `date_added` INTEGER NOT NULL, `year` INTEGER NOT NULL, `album_artist` TEXT, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistName",
+ "columnName": "artist_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "album_art_uri_string",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtist",
+ "columnName": "album_artist",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_albums_title",
+ "unique": false,
+ "columnNames": [
+ "title"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_title` ON `${TABLE_NAME}` (`title`)"
+ },
+ {
+ "name": "index_albums_artist_id",
+ "unique": false,
+ "columnNames": [
+ "artist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_artist_id` ON `${TABLE_NAME}` (`artist_id`)"
+ },
+ {
+ "name": "index_albums_artist_name",
+ "unique": false,
+ "columnNames": [
+ "artist_name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_artist_name` ON `${TABLE_NAME}` (`artist_name`)"
+ },
+ {
+ "name": "index_albums_album_artist",
+ "unique": false,
+ "columnNames": [
+ "album_artist"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_album_artist` ON `${TABLE_NAME}` (`album_artist`)"
+ }
+ ]
+ },
+ {
+ "tableName": "artists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `track_count` INTEGER NOT NULL, `image_url` TEXT, `custom_image_uri` TEXT, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trackCount",
+ "columnName": "track_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "imageUrl",
+ "columnName": "image_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "customImageUri",
+ "columnName": "custom_image_uri",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_artists_name",
+ "unique": false,
+ "columnNames": [
+ "name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_artists_name` ON `${TABLE_NAME}` (`name`)"
+ }
+ ]
+ },
+ {
+ "tableName": "transition_rules",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `playlistId` TEXT NOT NULL, `fromTrackId` TEXT, `toTrackId` TEXT, `mode` TEXT NOT NULL, `durationMs` INTEGER NOT NULL, `curveIn` TEXT NOT NULL, `curveOut` TEXT NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlistId",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "fromTrackId",
+ "columnName": "fromTrackId",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "toTrackId",
+ "columnName": "toTrackId",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "settings.mode",
+ "columnName": "mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "settings.durationMs",
+ "columnName": "durationMs",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "settings.curveIn",
+ "columnName": "curveIn",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "settings.curveOut",
+ "columnName": "curveOut",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_transition_rules_playlistId_fromTrackId_toTrackId",
+ "unique": true,
+ "columnNames": [
+ "playlistId",
+ "fromTrackId",
+ "toTrackId"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_transition_rules_playlistId_fromTrackId_toTrackId` ON `${TABLE_NAME}` (`playlistId`, `fromTrackId`, `toTrackId`)"
+ }
+ ]
+ },
+ {
+ "tableName": "song_artist_cross_ref",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`song_id` INTEGER NOT NULL, `artist_id` INTEGER NOT NULL, `is_primary` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`song_id`, `artist_id`), FOREIGN KEY(`song_id`) REFERENCES `songs`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`artist_id`) REFERENCES `artists`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "song_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isPrimary",
+ "columnName": "is_primary",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "song_id",
+ "artist_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_song_artist_cross_ref_song_id",
+ "unique": false,
+ "columnNames": [
+ "song_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_artist_cross_ref_song_id` ON `${TABLE_NAME}` (`song_id`)"
+ },
+ {
+ "name": "index_song_artist_cross_ref_artist_id",
+ "unique": false,
+ "columnNames": [
+ "artist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_artist_cross_ref_artist_id` ON `${TABLE_NAME}` (`artist_id`)"
+ },
+ {
+ "name": "index_song_artist_cross_ref_is_primary",
+ "unique": false,
+ "columnNames": [
+ "is_primary"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_artist_cross_ref_is_primary` ON `${TABLE_NAME}` (`is_primary`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "songs",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "song_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "artists",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "artist_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "telegram_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `chat_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `file_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `duration` INTEGER NOT NULL, `file_path` TEXT NOT NULL, `mime_type` TEXT NOT NULL, `date_added` INTEGER NOT NULL, `album_art_uri` TEXT, `thread_id` INTEGER, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "chatId",
+ "columnName": "chat_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "messageId",
+ "columnName": "message_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "fileId",
+ "columnName": "file_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "filePath",
+ "columnName": "file_path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "album_art_uri",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "threadId",
+ "columnName": "thread_id",
+ "affinity": "INTEGER"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_telegram_songs_chat_id",
+ "unique": false,
+ "columnNames": [
+ "chat_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_chat_id` ON `${TABLE_NAME}` (`chat_id`)"
+ },
+ {
+ "name": "index_telegram_songs_message_id",
+ "unique": false,
+ "columnNames": [
+ "message_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_message_id` ON `${TABLE_NAME}` (`message_id`)"
+ },
+ {
+ "name": "index_telegram_songs_file_id",
+ "unique": false,
+ "columnNames": [
+ "file_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_file_id` ON `${TABLE_NAME}` (`file_id`)"
+ },
+ {
+ "name": "index_telegram_songs_chat_id_message_id",
+ "unique": false,
+ "columnNames": [
+ "chat_id",
+ "message_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_chat_id_message_id` ON `${TABLE_NAME}` (`chat_id`, `message_id`)"
+ },
+ {
+ "name": "index_telegram_songs_thread_id",
+ "unique": false,
+ "columnNames": [
+ "thread_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_thread_id` ON `${TABLE_NAME}` (`thread_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "telegram_channels",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chat_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `username` TEXT, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, `photo_path` TEXT, PRIMARY KEY(`chat_id`))",
+ "fields": [
+ {
+ "fieldPath": "chatId",
+ "columnName": "chat_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "username",
+ "columnName": "username",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "photoPath",
+ "columnName": "photo_path",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "chat_id"
+ ]
+ }
+ },
+ {
+ "tableName": "song_engagements",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`song_id` TEXT NOT NULL, `play_count` INTEGER NOT NULL, `total_play_duration_ms` INTEGER NOT NULL, `last_played_timestamp` INTEGER NOT NULL, PRIMARY KEY(`song_id`))",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "song_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playCount",
+ "columnName": "play_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalPlayDurationMs",
+ "columnName": "total_play_duration_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastPlayedTimestamp",
+ "columnName": "last_played_timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "song_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_song_engagements_play_count",
+ "unique": false,
+ "columnNames": [
+ "play_count"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_engagements_play_count` ON `${TABLE_NAME}` (`play_count`)"
+ }
+ ]
+ },
+ {
+ "tableName": "favorites",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`songId` INTEGER NOT NULL, `isFavorite` INTEGER NOT NULL, `timestamp` INTEGER NOT NULL, PRIMARY KEY(`songId`))",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "songId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isFavorite",
+ "columnName": "isFavorite",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "songId"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_favorites_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ]
+ },
+ {
+ "tableName": "lyrics",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`songId` INTEGER NOT NULL, `content` TEXT NOT NULL, `isSynced` INTEGER NOT NULL, `source` TEXT, PRIMARY KEY(`songId`))",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "songId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "content",
+ "columnName": "content",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isSynced",
+ "columnName": "isSynced",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "songId"
+ ]
+ }
+ },
+ {
+ "tableName": "netease_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `netease_id` INTEGER NOT NULL, `playlist_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `album_art_url` TEXT, `mime_type` TEXT NOT NULL, `bitrate` INTEGER, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "neteaseId",
+ "columnName": "netease_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUrl",
+ "columnName": "album_art_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_netease_songs_netease_id",
+ "unique": false,
+ "columnNames": [
+ "netease_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_netease_songs_netease_id` ON `${TABLE_NAME}` (`netease_id`)"
+ },
+ {
+ "name": "index_netease_songs_playlist_id",
+ "unique": false,
+ "columnNames": [
+ "playlist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_netease_songs_playlist_id` ON `${TABLE_NAME}` (`playlist_id`)"
+ },
+ {
+ "name": "index_netease_songs_playlist_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_netease_songs_playlist_id_date_added` ON `${TABLE_NAME}` (`playlist_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "netease_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `cover_url` TEXT, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "coverUrl",
+ "columnName": "cover_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "gdrive_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `drive_file_id` TEXT NOT NULL, `folder_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `album_art_url` TEXT, `mime_type` TEXT NOT NULL, `bitrate` INTEGER, `file_size` INTEGER NOT NULL, `date_added` INTEGER NOT NULL, `date_modified` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "driveFileId",
+ "columnName": "drive_file_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "folderId",
+ "columnName": "folder_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUrl",
+ "columnName": "album_art_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "fileSize",
+ "columnName": "file_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateModified",
+ "columnName": "date_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_gdrive_songs_drive_file_id",
+ "unique": false,
+ "columnNames": [
+ "drive_file_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_gdrive_songs_drive_file_id` ON `${TABLE_NAME}` (`drive_file_id`)"
+ },
+ {
+ "name": "index_gdrive_songs_folder_id",
+ "unique": false,
+ "columnNames": [
+ "folder_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_gdrive_songs_folder_id` ON `${TABLE_NAME}` (`folder_id`)"
+ },
+ {
+ "name": "index_gdrive_songs_folder_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "folder_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_gdrive_songs_folder_id_date_added` ON `${TABLE_NAME}` (`folder_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "gdrive_folders",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `created_at` INTEGER NOT NULL, `last_modified` INTEGER NOT NULL, `is_ai_generated` INTEGER NOT NULL, `is_queue_generated` INTEGER NOT NULL, `cover_image_uri` TEXT, `cover_color_argb` INTEGER, `cover_icon_name` TEXT, `cover_shape_type` TEXT, `cover_shape_detail_1` REAL, `cover_shape_detail_2` REAL, `cover_shape_detail_3` REAL, `cover_shape_detail_4` REAL, `source` TEXT NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastModified",
+ "columnName": "last_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAiGenerated",
+ "columnName": "is_ai_generated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isQueueGenerated",
+ "columnName": "is_queue_generated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "coverImageUri",
+ "columnName": "cover_image_uri",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverColorArgb",
+ "columnName": "cover_color_argb",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "coverIconName",
+ "columnName": "cover_icon_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverShapeType",
+ "columnName": "cover_shape_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverShapeDetail1",
+ "columnName": "cover_shape_detail_1",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "coverShapeDetail2",
+ "columnName": "cover_shape_detail_2",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "coverShapeDetail3",
+ "columnName": "cover_shape_detail_3",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "coverShapeDetail4",
+ "columnName": "cover_shape_detail_4",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_playlists_last_modified",
+ "unique": false,
+ "columnNames": [
+ "last_modified"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playlists_last_modified` ON `${TABLE_NAME}` (`last_modified`)"
+ }
+ ]
+ },
+ {
+ "tableName": "playlist_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`playlist_id` TEXT NOT NULL, `song_id` TEXT NOT NULL, `sort_order` INTEGER NOT NULL, PRIMARY KEY(`playlist_id`, `song_id`))",
+ "fields": [
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songId",
+ "columnName": "song_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "sortOrder",
+ "columnName": "sort_order",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "playlist_id",
+ "song_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_playlist_songs_playlist_id_sort_order",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "sort_order"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playlist_songs_playlist_id_sort_order` ON `${TABLE_NAME}` (`playlist_id`, `sort_order`)"
+ },
+ {
+ "name": "index_playlist_songs_song_id",
+ "unique": false,
+ "columnNames": [
+ "song_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playlist_songs_song_id` ON `${TABLE_NAME}` (`song_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "qqmusic_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `song_mid` TEXT NOT NULL, `playlist_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_mid` TEXT, `duration` INTEGER NOT NULL, `album_art_url` TEXT, `mime_type` TEXT NOT NULL, `bitrate` INTEGER, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songMid",
+ "columnName": "song_mid",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumMid",
+ "columnName": "album_mid",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUrl",
+ "columnName": "album_art_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "qqmusic_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `cover_url` TEXT, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "coverUrl",
+ "columnName": "cover_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "navidrome_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `navidrome_id` TEXT NOT NULL, `playlist_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `artist_id` TEXT, `album` TEXT NOT NULL, `album_id` TEXT, `cover_art_id` TEXT, `duration` INTEGER NOT NULL, `track_number` INTEGER NOT NULL, `disc_number` INTEGER NOT NULL, `year` INTEGER NOT NULL, `genre` TEXT, `bitRate` INTEGER, `mime_type` TEXT, `suffix` TEXT, `path` TEXT NOT NULL, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "navidromeId",
+ "columnName": "navidrome_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverArtId",
+ "columnName": "cover_art_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trackNumber",
+ "columnName": "track_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "discNumber",
+ "columnName": "disc_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bitRate",
+ "columnName": "bitRate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "suffix",
+ "columnName": "suffix",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "path",
+ "columnName": "path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_navidrome_songs_navidrome_id",
+ "unique": false,
+ "columnNames": [
+ "navidrome_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_navidrome_songs_navidrome_id` ON `${TABLE_NAME}` (`navidrome_id`)"
+ },
+ {
+ "name": "index_navidrome_songs_playlist_id",
+ "unique": false,
+ "columnNames": [
+ "playlist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_navidrome_songs_playlist_id` ON `${TABLE_NAME}` (`playlist_id`)"
+ },
+ {
+ "name": "index_navidrome_songs_playlist_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_navidrome_songs_playlist_id_date_added` ON `${TABLE_NAME}` (`playlist_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "navidrome_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `comment` TEXT, `owner` TEXT, `cover_art_id` TEXT, `song_count` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `public` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "comment",
+ "columnName": "comment",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "owner",
+ "columnName": "owner",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverArtId",
+ "columnName": "cover_art_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "public",
+ "columnName": "public",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "telegram_topics",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `chat_id` INTEGER NOT NULL, `thread_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, `icon_emoji` TEXT, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "chatId",
+ "columnName": "chat_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "threadId",
+ "columnName": "thread_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iconEmoji",
+ "columnName": "icon_emoji",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_telegram_topics_chat_id",
+ "unique": false,
+ "columnNames": [
+ "chat_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_topics_chat_id` ON `${TABLE_NAME}` (`chat_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "jellyfin_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `jellyfin_id` TEXT NOT NULL, `playlist_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `artist_id` TEXT, `album` TEXT NOT NULL, `album_id` TEXT, `duration` INTEGER NOT NULL, `track_number` INTEGER NOT NULL, `disc_number` INTEGER NOT NULL, `year` INTEGER NOT NULL, `genre` TEXT, `bitRate` INTEGER, `mime_type` TEXT, `path` TEXT NOT NULL, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "jellyfinId",
+ "columnName": "jellyfin_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trackNumber",
+ "columnName": "track_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "discNumber",
+ "columnName": "disc_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bitRate",
+ "columnName": "bitRate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "path",
+ "columnName": "path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_jellyfin_songs_jellyfin_id",
+ "unique": false,
+ "columnNames": [
+ "jellyfin_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_jellyfin_songs_jellyfin_id` ON `${TABLE_NAME}` (`jellyfin_id`)"
+ },
+ {
+ "name": "index_jellyfin_songs_playlist_id",
+ "unique": false,
+ "columnNames": [
+ "playlist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_jellyfin_songs_playlist_id` ON `${TABLE_NAME}` (`playlist_id`)"
+ },
+ {
+ "name": "index_jellyfin_songs_playlist_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_jellyfin_songs_playlist_id_date_added` ON `${TABLE_NAME}` (`playlist_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "jellyfin_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "s3_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `object_key` TEXT NOT NULL, `folder_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `mimeType` TEXT NOT NULL, `bitrate` INTEGER, `file_size` INTEGER NOT NULL, `date_added` INTEGER NOT NULL, `date_modified` INTEGER NOT NULL, `album_art_uri` TEXT, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "objectKey",
+ "columnName": "object_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "folderId",
+ "columnName": "folder_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mimeType",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "fileSize",
+ "columnName": "file_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateModified",
+ "columnName": "date_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUri",
+ "columnName": "album_art_uri",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_s3_songs_object_key",
+ "unique": false,
+ "columnNames": [
+ "object_key"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_s3_songs_object_key` ON `${TABLE_NAME}` (`object_key`)"
+ },
+ {
+ "name": "index_s3_songs_folder_id",
+ "unique": false,
+ "columnNames": [
+ "folder_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_s3_songs_folder_id` ON `${TABLE_NAME}` (`folder_id`)"
+ },
+ {
+ "name": "index_s3_songs_folder_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "folder_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_s3_songs_folder_id_date_added` ON `${TABLE_NAME}` (`folder_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "s3_folders",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "ai_cache",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`promptHash` TEXT NOT NULL, `responseJson` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, PRIMARY KEY(`promptHash`))",
+ "fields": [
+ {
+ "fieldPath": "promptHash",
+ "columnName": "promptHash",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "responseJson",
+ "columnName": "responseJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "promptHash"
+ ]
+ }
+ },
+ {
+ "tableName": "ai_usage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `provider` TEXT NOT NULL, `model` TEXT NOT NULL, `promptType` TEXT NOT NULL, `promptTokens` INTEGER NOT NULL, `outputTokens` INTEGER NOT NULL, `thoughtTokens` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "provider",
+ "columnName": "provider",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "model",
+ "columnName": "model",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "promptType",
+ "columnName": "promptType",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "promptTokens",
+ "columnName": "promptTokens",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "outputTokens",
+ "columnName": "outputTokens",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "thoughtTokens",
+ "columnName": "thoughtTokens",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ }
+ }
+ ],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '502d882063b46e105090ef8f83c5d6ef')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/app/schemas/com.theveloper.pixelplay.data.database.PixelPlayDatabase/45.json b/app/schemas/com.theveloper.pixelplay.data.database.PixelPlayDatabase/45.json
new file mode 100644
index 0000000000..0c847cea19
--- /dev/null
+++ b/app/schemas/com.theveloper.pixelplay.data.database.PixelPlayDatabase/45.json
@@ -0,0 +1,2916 @@
+{
+ "formatVersion": 1,
+ "database": {
+ "version": 45,
+ "identityHash": "f313ce810095cfaa93da8320af98ddb2",
+ "entities": [
+ {
+ "tableName": "album_art_themes",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`albumArtUriString` TEXT NOT NULL, `paletteStyle` TEXT NOT NULL, `light_primary` TEXT NOT NULL, `light_onPrimary` TEXT NOT NULL, `light_primaryContainer` TEXT NOT NULL, `light_onPrimaryContainer` TEXT NOT NULL, `light_secondary` TEXT NOT NULL, `light_onSecondary` TEXT NOT NULL, `light_secondaryContainer` TEXT NOT NULL, `light_onSecondaryContainer` TEXT NOT NULL, `light_tertiary` TEXT NOT NULL, `light_onTertiary` TEXT NOT NULL, `light_tertiaryContainer` TEXT NOT NULL, `light_onTertiaryContainer` TEXT NOT NULL, `light_background` TEXT NOT NULL, `light_onBackground` TEXT NOT NULL, `light_surface` TEXT NOT NULL, `light_onSurface` TEXT NOT NULL, `light_surfaceVariant` TEXT NOT NULL, `light_onSurfaceVariant` TEXT NOT NULL, `light_error` TEXT NOT NULL, `light_onError` TEXT NOT NULL, `light_outline` TEXT NOT NULL, `light_errorContainer` TEXT NOT NULL, `light_onErrorContainer` TEXT NOT NULL, `light_inversePrimary` TEXT NOT NULL, `light_inverseSurface` TEXT NOT NULL, `light_inverseOnSurface` TEXT NOT NULL, `light_surfaceTint` TEXT NOT NULL, `light_outlineVariant` TEXT NOT NULL, `light_scrim` TEXT NOT NULL, `light_surfaceBright` TEXT NOT NULL, `light_surfaceDim` TEXT NOT NULL, `light_surfaceContainer` TEXT NOT NULL, `light_surfaceContainerHigh` TEXT NOT NULL, `light_surfaceContainerHighest` TEXT NOT NULL, `light_surfaceContainerLow` TEXT NOT NULL, `light_surfaceContainerLowest` TEXT NOT NULL, `light_primaryFixed` TEXT NOT NULL, `light_primaryFixedDim` TEXT NOT NULL, `light_onPrimaryFixed` TEXT NOT NULL, `light_onPrimaryFixedVariant` TEXT NOT NULL, `light_secondaryFixed` TEXT NOT NULL, `light_secondaryFixedDim` TEXT NOT NULL, `light_onSecondaryFixed` TEXT NOT NULL, `light_onSecondaryFixedVariant` TEXT NOT NULL, `light_tertiaryFixed` TEXT NOT NULL, `light_tertiaryFixedDim` TEXT NOT NULL, `light_onTertiaryFixed` TEXT NOT NULL, `light_onTertiaryFixedVariant` TEXT NOT NULL, `dark_primary` TEXT NOT NULL, `dark_onPrimary` TEXT NOT NULL, `dark_primaryContainer` TEXT NOT NULL, `dark_onPrimaryContainer` TEXT NOT NULL, `dark_secondary` TEXT NOT NULL, `dark_onSecondary` TEXT NOT NULL, `dark_secondaryContainer` TEXT NOT NULL, `dark_onSecondaryContainer` TEXT NOT NULL, `dark_tertiary` TEXT NOT NULL, `dark_onTertiary` TEXT NOT NULL, `dark_tertiaryContainer` TEXT NOT NULL, `dark_onTertiaryContainer` TEXT NOT NULL, `dark_background` TEXT NOT NULL, `dark_onBackground` TEXT NOT NULL, `dark_surface` TEXT NOT NULL, `dark_onSurface` TEXT NOT NULL, `dark_surfaceVariant` TEXT NOT NULL, `dark_onSurfaceVariant` TEXT NOT NULL, `dark_error` TEXT NOT NULL, `dark_onError` TEXT NOT NULL, `dark_outline` TEXT NOT NULL, `dark_errorContainer` TEXT NOT NULL, `dark_onErrorContainer` TEXT NOT NULL, `dark_inversePrimary` TEXT NOT NULL, `dark_inverseSurface` TEXT NOT NULL, `dark_inverseOnSurface` TEXT NOT NULL, `dark_surfaceTint` TEXT NOT NULL, `dark_outlineVariant` TEXT NOT NULL, `dark_scrim` TEXT NOT NULL, `dark_surfaceBright` TEXT NOT NULL, `dark_surfaceDim` TEXT NOT NULL, `dark_surfaceContainer` TEXT NOT NULL, `dark_surfaceContainerHigh` TEXT NOT NULL, `dark_surfaceContainerHighest` TEXT NOT NULL, `dark_surfaceContainerLow` TEXT NOT NULL, `dark_surfaceContainerLowest` TEXT NOT NULL, `dark_primaryFixed` TEXT NOT NULL, `dark_primaryFixedDim` TEXT NOT NULL, `dark_onPrimaryFixed` TEXT NOT NULL, `dark_onPrimaryFixedVariant` TEXT NOT NULL, `dark_secondaryFixed` TEXT NOT NULL, `dark_secondaryFixedDim` TEXT NOT NULL, `dark_onSecondaryFixed` TEXT NOT NULL, `dark_onSecondaryFixedVariant` TEXT NOT NULL, `dark_tertiaryFixed` TEXT NOT NULL, `dark_tertiaryFixedDim` TEXT NOT NULL, `dark_onTertiaryFixed` TEXT NOT NULL, `dark_onTertiaryFixedVariant` TEXT NOT NULL, PRIMARY KEY(`albumArtUriString`))",
+ "fields": [
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "albumArtUriString",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "paletteStyle",
+ "columnName": "paletteStyle",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primary",
+ "columnName": "light_primary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimary",
+ "columnName": "light_onPrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primaryContainer",
+ "columnName": "light_primaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimaryContainer",
+ "columnName": "light_onPrimaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondary",
+ "columnName": "light_secondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondary",
+ "columnName": "light_onSecondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondaryContainer",
+ "columnName": "light_secondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondaryContainer",
+ "columnName": "light_onSecondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiary",
+ "columnName": "light_tertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiary",
+ "columnName": "light_onTertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiaryContainer",
+ "columnName": "light_tertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiaryContainer",
+ "columnName": "light_onTertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.background",
+ "columnName": "light_background",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onBackground",
+ "columnName": "light_onBackground",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surface",
+ "columnName": "light_surface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSurface",
+ "columnName": "light_onSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceVariant",
+ "columnName": "light_surfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSurfaceVariant",
+ "columnName": "light_onSurfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.error",
+ "columnName": "light_error",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onError",
+ "columnName": "light_onError",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.outline",
+ "columnName": "light_outline",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.errorContainer",
+ "columnName": "light_errorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onErrorContainer",
+ "columnName": "light_onErrorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.inversePrimary",
+ "columnName": "light_inversePrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.inverseSurface",
+ "columnName": "light_inverseSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.inverseOnSurface",
+ "columnName": "light_inverseOnSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceTint",
+ "columnName": "light_surfaceTint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.outlineVariant",
+ "columnName": "light_outlineVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.scrim",
+ "columnName": "light_scrim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceBright",
+ "columnName": "light_surfaceBright",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceDim",
+ "columnName": "light_surfaceDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainer",
+ "columnName": "light_surfaceContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerHigh",
+ "columnName": "light_surfaceContainerHigh",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerHighest",
+ "columnName": "light_surfaceContainerHighest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerLow",
+ "columnName": "light_surfaceContainerLow",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.surfaceContainerLowest",
+ "columnName": "light_surfaceContainerLowest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primaryFixed",
+ "columnName": "light_primaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.primaryFixedDim",
+ "columnName": "light_primaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimaryFixed",
+ "columnName": "light_onPrimaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onPrimaryFixedVariant",
+ "columnName": "light_onPrimaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondaryFixed",
+ "columnName": "light_secondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.secondaryFixedDim",
+ "columnName": "light_secondaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondaryFixed",
+ "columnName": "light_onSecondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onSecondaryFixedVariant",
+ "columnName": "light_onSecondaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiaryFixed",
+ "columnName": "light_tertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.tertiaryFixedDim",
+ "columnName": "light_tertiaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiaryFixed",
+ "columnName": "light_onTertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lightThemeValues.onTertiaryFixedVariant",
+ "columnName": "light_onTertiaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primary",
+ "columnName": "dark_primary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimary",
+ "columnName": "dark_onPrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primaryContainer",
+ "columnName": "dark_primaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimaryContainer",
+ "columnName": "dark_onPrimaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondary",
+ "columnName": "dark_secondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondary",
+ "columnName": "dark_onSecondary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondaryContainer",
+ "columnName": "dark_secondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondaryContainer",
+ "columnName": "dark_onSecondaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiary",
+ "columnName": "dark_tertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiary",
+ "columnName": "dark_onTertiary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiaryContainer",
+ "columnName": "dark_tertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiaryContainer",
+ "columnName": "dark_onTertiaryContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.background",
+ "columnName": "dark_background",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onBackground",
+ "columnName": "dark_onBackground",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surface",
+ "columnName": "dark_surface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSurface",
+ "columnName": "dark_onSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceVariant",
+ "columnName": "dark_surfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSurfaceVariant",
+ "columnName": "dark_onSurfaceVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.error",
+ "columnName": "dark_error",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onError",
+ "columnName": "dark_onError",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.outline",
+ "columnName": "dark_outline",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.errorContainer",
+ "columnName": "dark_errorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onErrorContainer",
+ "columnName": "dark_onErrorContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.inversePrimary",
+ "columnName": "dark_inversePrimary",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.inverseSurface",
+ "columnName": "dark_inverseSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.inverseOnSurface",
+ "columnName": "dark_inverseOnSurface",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceTint",
+ "columnName": "dark_surfaceTint",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.outlineVariant",
+ "columnName": "dark_outlineVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.scrim",
+ "columnName": "dark_scrim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceBright",
+ "columnName": "dark_surfaceBright",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceDim",
+ "columnName": "dark_surfaceDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainer",
+ "columnName": "dark_surfaceContainer",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerHigh",
+ "columnName": "dark_surfaceContainerHigh",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerHighest",
+ "columnName": "dark_surfaceContainerHighest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerLow",
+ "columnName": "dark_surfaceContainerLow",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.surfaceContainerLowest",
+ "columnName": "dark_surfaceContainerLowest",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primaryFixed",
+ "columnName": "dark_primaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.primaryFixedDim",
+ "columnName": "dark_primaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimaryFixed",
+ "columnName": "dark_onPrimaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onPrimaryFixedVariant",
+ "columnName": "dark_onPrimaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondaryFixed",
+ "columnName": "dark_secondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.secondaryFixedDim",
+ "columnName": "dark_secondaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondaryFixed",
+ "columnName": "dark_onSecondaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onSecondaryFixedVariant",
+ "columnName": "dark_onSecondaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiaryFixed",
+ "columnName": "dark_tertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.tertiaryFixedDim",
+ "columnName": "dark_tertiaryFixedDim",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiaryFixed",
+ "columnName": "dark_onTertiaryFixed",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "darkThemeValues.onTertiaryFixedVariant",
+ "columnName": "dark_onTertiaryFixedVariant",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "albumArtUriString"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_album_art_themes_albumArtUriString_paletteStyle",
+ "unique": false,
+ "columnNames": [
+ "albumArtUriString",
+ "paletteStyle"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_album_art_themes_albumArtUriString_paletteStyle` ON `${TABLE_NAME}` (`albumArtUriString`, `paletteStyle`)"
+ }
+ ]
+ },
+ {
+ "tableName": "search_history",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `query` TEXT NOT NULL, `timestamp` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "query",
+ "columnName": "query",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist_name` TEXT NOT NULL, `artist_id` INTEGER NOT NULL, `album_artist` TEXT, `album_name` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `content_uri_string` TEXT NOT NULL, `album_art_uri_string` TEXT, `duration` INTEGER NOT NULL, `genre` TEXT, `file_path` TEXT NOT NULL, `parent_directory_path` TEXT NOT NULL, `is_favorite` INTEGER NOT NULL DEFAULT 0, `lyrics` TEXT DEFAULT null, `track_number` INTEGER NOT NULL DEFAULT 0, `disc_number` INTEGER DEFAULT null, `year` INTEGER NOT NULL DEFAULT 0, `date_added` INTEGER NOT NULL DEFAULT 0, `mime_type` TEXT, `bitrate` INTEGER, `sample_rate` INTEGER, `telegram_chat_id` INTEGER, `telegram_file_id` INTEGER, `artists_json` TEXT, `source_type` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`), FOREIGN KEY(`album_id`) REFERENCES `albums`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`artist_id`) REFERENCES `artists`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistName",
+ "columnName": "artist_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtist",
+ "columnName": "album_artist",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "albumName",
+ "columnName": "album_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "contentUriString",
+ "columnName": "content_uri_string",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "album_art_uri_string",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "filePath",
+ "columnName": "file_path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "parentDirectoryPath",
+ "columnName": "parent_directory_path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isFavorite",
+ "columnName": "is_favorite",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "lyrics",
+ "columnName": "lyrics",
+ "affinity": "TEXT",
+ "defaultValue": "null"
+ },
+ {
+ "fieldPath": "trackNumber",
+ "columnName": "track_number",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "discNumber",
+ "columnName": "disc_number",
+ "affinity": "INTEGER",
+ "defaultValue": "null"
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "sampleRate",
+ "columnName": "sample_rate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "telegramChatId",
+ "columnName": "telegram_chat_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "telegramFileId",
+ "columnName": "telegram_file_id",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "artistsJson",
+ "columnName": "artists_json",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "sourceType",
+ "columnName": "source_type",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_songs_title",
+ "unique": false,
+ "columnNames": [
+ "title"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_title` ON `${TABLE_NAME}` (`title`)"
+ },
+ {
+ "name": "index_songs_album_id",
+ "unique": false,
+ "columnNames": [
+ "album_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_album_id` ON `${TABLE_NAME}` (`album_id`)"
+ },
+ {
+ "name": "index_songs_artist_id",
+ "unique": false,
+ "columnNames": [
+ "artist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_artist_id` ON `${TABLE_NAME}` (`artist_id`)"
+ },
+ {
+ "name": "index_songs_artist_name",
+ "unique": false,
+ "columnNames": [
+ "artist_name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_artist_name` ON `${TABLE_NAME}` (`artist_name`)"
+ },
+ {
+ "name": "index_songs_genre",
+ "unique": false,
+ "columnNames": [
+ "genre"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_genre` ON `${TABLE_NAME}` (`genre`)"
+ },
+ {
+ "name": "index_songs_parent_directory_path",
+ "unique": false,
+ "columnNames": [
+ "parent_directory_path"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_parent_directory_path` ON `${TABLE_NAME}` (`parent_directory_path`)"
+ },
+ {
+ "name": "index_songs_file_path",
+ "unique": false,
+ "columnNames": [
+ "file_path"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_file_path` ON `${TABLE_NAME}` (`file_path`)"
+ },
+ {
+ "name": "index_songs_content_uri_string",
+ "unique": false,
+ "columnNames": [
+ "content_uri_string"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_content_uri_string` ON `${TABLE_NAME}` (`content_uri_string`)"
+ },
+ {
+ "name": "index_songs_date_added",
+ "unique": false,
+ "columnNames": [
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_date_added` ON `${TABLE_NAME}` (`date_added`)"
+ },
+ {
+ "name": "index_songs_duration",
+ "unique": false,
+ "columnNames": [
+ "duration"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_duration` ON `${TABLE_NAME}` (`duration`)"
+ },
+ {
+ "name": "index_songs_source_type",
+ "unique": false,
+ "columnNames": [
+ "source_type"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_source_type` ON `${TABLE_NAME}` (`source_type`)"
+ },
+ {
+ "name": "index_songs_parent_directory_path_source_type_album_id",
+ "unique": false,
+ "columnNames": [
+ "parent_directory_path",
+ "source_type",
+ "album_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_parent_directory_path_source_type_album_id` ON `${TABLE_NAME}` (`parent_directory_path`, `source_type`, `album_id`)"
+ },
+ {
+ "name": "index_songs_parent_directory_path_source_type_id",
+ "unique": false,
+ "columnNames": [
+ "parent_directory_path",
+ "source_type",
+ "id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_songs_parent_directory_path_source_type_id` ON `${TABLE_NAME}` (`parent_directory_path`, `source_type`, `id`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "albums",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "album_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "artists",
+ "onDelete": "SET NULL",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "artist_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "songs_fts",
+ "createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`title` TEXT NOT NULL, `artist_name` TEXT NOT NULL, tokenize=unicode61)",
+ "fields": [
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistName",
+ "columnName": "artist_name",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "rowid"
+ ]
+ },
+ "ftsVersion": "FTS4",
+ "ftsOptions": {
+ "tokenizer": "unicode61",
+ "tokenizerArgs": [],
+ "contentTable": "",
+ "languageIdColumnName": "",
+ "matchInfo": "FTS4",
+ "notIndexedColumns": [],
+ "prefixSizes": [],
+ "preferredOrder": "ASC"
+ },
+ "contentSyncTriggers": []
+ },
+ {
+ "tableName": "albums",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist_name` TEXT NOT NULL, `artist_id` INTEGER NOT NULL, `album_art_uri_string` TEXT, `song_count` INTEGER NOT NULL, `date_added` INTEGER NOT NULL, `year` INTEGER NOT NULL, `album_artist` TEXT, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistName",
+ "columnName": "artist_name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "album_art_uri_string",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtist",
+ "columnName": "album_artist",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_albums_title",
+ "unique": false,
+ "columnNames": [
+ "title"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_title` ON `${TABLE_NAME}` (`title`)"
+ },
+ {
+ "name": "index_albums_artist_id",
+ "unique": false,
+ "columnNames": [
+ "artist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_artist_id` ON `${TABLE_NAME}` (`artist_id`)"
+ },
+ {
+ "name": "index_albums_artist_name",
+ "unique": false,
+ "columnNames": [
+ "artist_name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_artist_name` ON `${TABLE_NAME}` (`artist_name`)"
+ },
+ {
+ "name": "index_albums_album_artist",
+ "unique": false,
+ "columnNames": [
+ "album_artist"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_albums_album_artist` ON `${TABLE_NAME}` (`album_artist`)"
+ }
+ ]
+ },
+ {
+ "tableName": "artists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `track_count` INTEGER NOT NULL, `image_url` TEXT, `custom_image_uri` TEXT, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trackCount",
+ "columnName": "track_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "imageUrl",
+ "columnName": "image_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "customImageUri",
+ "columnName": "custom_image_uri",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_artists_name",
+ "unique": false,
+ "columnNames": [
+ "name"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_artists_name` ON `${TABLE_NAME}` (`name`)"
+ }
+ ]
+ },
+ {
+ "tableName": "transition_rules",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `playlistId` TEXT NOT NULL, `fromTrackId` TEXT, `toTrackId` TEXT, `mode` TEXT NOT NULL, `durationMs` INTEGER NOT NULL, `curveIn` TEXT NOT NULL, `curveOut` TEXT NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlistId",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "fromTrackId",
+ "columnName": "fromTrackId",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "toTrackId",
+ "columnName": "toTrackId",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "settings.mode",
+ "columnName": "mode",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "settings.durationMs",
+ "columnName": "durationMs",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "settings.curveIn",
+ "columnName": "curveIn",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "settings.curveOut",
+ "columnName": "curveOut",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_transition_rules_playlistId_fromTrackId_toTrackId",
+ "unique": true,
+ "columnNames": [
+ "playlistId",
+ "fromTrackId",
+ "toTrackId"
+ ],
+ "orders": [],
+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_transition_rules_playlistId_fromTrackId_toTrackId` ON `${TABLE_NAME}` (`playlistId`, `fromTrackId`, `toTrackId`)"
+ }
+ ]
+ },
+ {
+ "tableName": "song_artist_cross_ref",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`song_id` INTEGER NOT NULL, `artist_id` INTEGER NOT NULL, `is_primary` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`song_id`, `artist_id`), FOREIGN KEY(`song_id`) REFERENCES `songs`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`artist_id`) REFERENCES `artists`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "song_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isPrimary",
+ "columnName": "is_primary",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "song_id",
+ "artist_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_song_artist_cross_ref_song_id",
+ "unique": false,
+ "columnNames": [
+ "song_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_artist_cross_ref_song_id` ON `${TABLE_NAME}` (`song_id`)"
+ },
+ {
+ "name": "index_song_artist_cross_ref_artist_id",
+ "unique": false,
+ "columnNames": [
+ "artist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_artist_cross_ref_artist_id` ON `${TABLE_NAME}` (`artist_id`)"
+ },
+ {
+ "name": "index_song_artist_cross_ref_is_primary",
+ "unique": false,
+ "columnNames": [
+ "is_primary"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_artist_cross_ref_is_primary` ON `${TABLE_NAME}` (`is_primary`)"
+ }
+ ],
+ "foreignKeys": [
+ {
+ "table": "songs",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "song_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ },
+ {
+ "table": "artists",
+ "onDelete": "CASCADE",
+ "onUpdate": "NO ACTION",
+ "columns": [
+ "artist_id"
+ ],
+ "referencedColumns": [
+ "id"
+ ]
+ }
+ ]
+ },
+ {
+ "tableName": "telegram_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `chat_id` INTEGER NOT NULL, `message_id` INTEGER NOT NULL, `file_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `duration` INTEGER NOT NULL, `file_path` TEXT NOT NULL, `mime_type` TEXT NOT NULL, `date_added` INTEGER NOT NULL, `album_art_uri` TEXT, `thread_id` INTEGER, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "chatId",
+ "columnName": "chat_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "messageId",
+ "columnName": "message_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "fileId",
+ "columnName": "file_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "filePath",
+ "columnName": "file_path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUriString",
+ "columnName": "album_art_uri",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "threadId",
+ "columnName": "thread_id",
+ "affinity": "INTEGER"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_telegram_songs_chat_id",
+ "unique": false,
+ "columnNames": [
+ "chat_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_chat_id` ON `${TABLE_NAME}` (`chat_id`)"
+ },
+ {
+ "name": "index_telegram_songs_message_id",
+ "unique": false,
+ "columnNames": [
+ "message_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_message_id` ON `${TABLE_NAME}` (`message_id`)"
+ },
+ {
+ "name": "index_telegram_songs_file_id",
+ "unique": false,
+ "columnNames": [
+ "file_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_file_id` ON `${TABLE_NAME}` (`file_id`)"
+ },
+ {
+ "name": "index_telegram_songs_chat_id_message_id",
+ "unique": false,
+ "columnNames": [
+ "chat_id",
+ "message_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_chat_id_message_id` ON `${TABLE_NAME}` (`chat_id`, `message_id`)"
+ },
+ {
+ "name": "index_telegram_songs_thread_id",
+ "unique": false,
+ "columnNames": [
+ "thread_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_songs_thread_id` ON `${TABLE_NAME}` (`thread_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "telegram_channels",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chat_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `username` TEXT, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, `photo_path` TEXT, PRIMARY KEY(`chat_id`))",
+ "fields": [
+ {
+ "fieldPath": "chatId",
+ "columnName": "chat_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "username",
+ "columnName": "username",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "photoPath",
+ "columnName": "photo_path",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "chat_id"
+ ]
+ }
+ },
+ {
+ "tableName": "song_engagements",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`song_id` TEXT NOT NULL, `play_count` INTEGER NOT NULL, `total_play_duration_ms` INTEGER NOT NULL, `last_played_timestamp` INTEGER NOT NULL, PRIMARY KEY(`song_id`))",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "song_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playCount",
+ "columnName": "play_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "totalPlayDurationMs",
+ "columnName": "total_play_duration_ms",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastPlayedTimestamp",
+ "columnName": "last_played_timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "song_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_song_engagements_play_count",
+ "unique": false,
+ "columnNames": [
+ "play_count"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_song_engagements_play_count` ON `${TABLE_NAME}` (`play_count`)"
+ }
+ ]
+ },
+ {
+ "tableName": "favorites",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`songId` INTEGER NOT NULL, `isFavorite` INTEGER NOT NULL, `timestamp` INTEGER NOT NULL, PRIMARY KEY(`songId`))",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "songId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isFavorite",
+ "columnName": "isFavorite",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "songId"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_favorites_timestamp",
+ "unique": false,
+ "columnNames": [
+ "timestamp"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_favorites_timestamp` ON `${TABLE_NAME}` (`timestamp`)"
+ }
+ ]
+ },
+ {
+ "tableName": "lyrics",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`songId` INTEGER NOT NULL, `content` TEXT NOT NULL, `isSynced` INTEGER NOT NULL, `source` TEXT, PRIMARY KEY(`songId`))",
+ "fields": [
+ {
+ "fieldPath": "songId",
+ "columnName": "songId",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "content",
+ "columnName": "content",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isSynced",
+ "columnName": "isSynced",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "songId"
+ ]
+ }
+ },
+ {
+ "tableName": "netease_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `netease_id` INTEGER NOT NULL, `playlist_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `album_art_url` TEXT, `mime_type` TEXT NOT NULL, `bitrate` INTEGER, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "neteaseId",
+ "columnName": "netease_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUrl",
+ "columnName": "album_art_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_netease_songs_netease_id",
+ "unique": false,
+ "columnNames": [
+ "netease_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_netease_songs_netease_id` ON `${TABLE_NAME}` (`netease_id`)"
+ },
+ {
+ "name": "index_netease_songs_playlist_id",
+ "unique": false,
+ "columnNames": [
+ "playlist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_netease_songs_playlist_id` ON `${TABLE_NAME}` (`playlist_id`)"
+ },
+ {
+ "name": "index_netease_songs_playlist_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_netease_songs_playlist_id_date_added` ON `${TABLE_NAME}` (`playlist_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "netease_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `cover_url` TEXT, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "coverUrl",
+ "columnName": "cover_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "gdrive_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `drive_file_id` TEXT NOT NULL, `folder_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `album_art_url` TEXT, `mime_type` TEXT NOT NULL, `bitrate` INTEGER, `file_size` INTEGER NOT NULL, `date_added` INTEGER NOT NULL, `date_modified` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "driveFileId",
+ "columnName": "drive_file_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "folderId",
+ "columnName": "folder_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUrl",
+ "columnName": "album_art_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "fileSize",
+ "columnName": "file_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateModified",
+ "columnName": "date_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_gdrive_songs_drive_file_id",
+ "unique": false,
+ "columnNames": [
+ "drive_file_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_gdrive_songs_drive_file_id` ON `${TABLE_NAME}` (`drive_file_id`)"
+ },
+ {
+ "name": "index_gdrive_songs_folder_id",
+ "unique": false,
+ "columnNames": [
+ "folder_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_gdrive_songs_folder_id` ON `${TABLE_NAME}` (`folder_id`)"
+ },
+ {
+ "name": "index_gdrive_songs_folder_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "folder_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_gdrive_songs_folder_id_date_added` ON `${TABLE_NAME}` (`folder_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "gdrive_folders",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `created_at` INTEGER NOT NULL, `last_modified` INTEGER NOT NULL, `is_ai_generated` INTEGER NOT NULL, `is_queue_generated` INTEGER NOT NULL, `cover_image_uri` TEXT, `cover_color_argb` INTEGER, `cover_icon_name` TEXT, `cover_shape_type` TEXT, `cover_shape_detail_1` REAL, `cover_shape_detail_2` REAL, `cover_shape_detail_3` REAL, `cover_shape_detail_4` REAL, `source` TEXT NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "createdAt",
+ "columnName": "created_at",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastModified",
+ "columnName": "last_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isAiGenerated",
+ "columnName": "is_ai_generated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "isQueueGenerated",
+ "columnName": "is_queue_generated",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "coverImageUri",
+ "columnName": "cover_image_uri",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverColorArgb",
+ "columnName": "cover_color_argb",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "coverIconName",
+ "columnName": "cover_icon_name",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverShapeType",
+ "columnName": "cover_shape_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverShapeDetail1",
+ "columnName": "cover_shape_detail_1",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "coverShapeDetail2",
+ "columnName": "cover_shape_detail_2",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "coverShapeDetail3",
+ "columnName": "cover_shape_detail_3",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "coverShapeDetail4",
+ "columnName": "cover_shape_detail_4",
+ "affinity": "REAL"
+ },
+ {
+ "fieldPath": "source",
+ "columnName": "source",
+ "affinity": "TEXT",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_playlists_last_modified",
+ "unique": false,
+ "columnNames": [
+ "last_modified"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playlists_last_modified` ON `${TABLE_NAME}` (`last_modified`)"
+ }
+ ]
+ },
+ {
+ "tableName": "playlist_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`playlist_id` TEXT NOT NULL, `song_id` TEXT NOT NULL, `sort_order` INTEGER NOT NULL, PRIMARY KEY(`playlist_id`, `song_id`))",
+ "fields": [
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songId",
+ "columnName": "song_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "sortOrder",
+ "columnName": "sort_order",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "playlist_id",
+ "song_id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_playlist_songs_playlist_id_sort_order",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "sort_order"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playlist_songs_playlist_id_sort_order` ON `${TABLE_NAME}` (`playlist_id`, `sort_order`)"
+ },
+ {
+ "name": "index_playlist_songs_song_id",
+ "unique": false,
+ "columnNames": [
+ "song_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_playlist_songs_song_id` ON `${TABLE_NAME}` (`song_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "qqmusic_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `song_mid` TEXT NOT NULL, `playlist_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_mid` TEXT, `duration` INTEGER NOT NULL, `album_art_url` TEXT, `mime_type` TEXT NOT NULL, `bitrate` INTEGER, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songMid",
+ "columnName": "song_mid",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumMid",
+ "columnName": "album_mid",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUrl",
+ "columnName": "album_art_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "qqmusic_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, `cover_url` TEXT, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "coverUrl",
+ "columnName": "cover_url",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "navidrome_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `navidrome_id` TEXT NOT NULL, `playlist_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `artist_id` TEXT, `album` TEXT NOT NULL, `album_id` TEXT, `cover_art_id` TEXT, `duration` INTEGER NOT NULL, `track_number` INTEGER NOT NULL, `disc_number` INTEGER NOT NULL, `year` INTEGER NOT NULL, `genre` TEXT, `bitRate` INTEGER, `mime_type` TEXT, `suffix` TEXT, `path` TEXT NOT NULL, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "navidromeId",
+ "columnName": "navidrome_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverArtId",
+ "columnName": "cover_art_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trackNumber",
+ "columnName": "track_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "discNumber",
+ "columnName": "disc_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bitRate",
+ "columnName": "bitRate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "suffix",
+ "columnName": "suffix",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "path",
+ "columnName": "path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_navidrome_songs_navidrome_id",
+ "unique": false,
+ "columnNames": [
+ "navidrome_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_navidrome_songs_navidrome_id` ON `${TABLE_NAME}` (`navidrome_id`)"
+ },
+ {
+ "name": "index_navidrome_songs_playlist_id",
+ "unique": false,
+ "columnNames": [
+ "playlist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_navidrome_songs_playlist_id` ON `${TABLE_NAME}` (`playlist_id`)"
+ },
+ {
+ "name": "index_navidrome_songs_playlist_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_navidrome_songs_playlist_id_date_added` ON `${TABLE_NAME}` (`playlist_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "navidrome_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `comment` TEXT, `owner` TEXT, `cover_art_id` TEXT, `song_count` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `public` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "comment",
+ "columnName": "comment",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "owner",
+ "columnName": "owner",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "coverArtId",
+ "columnName": "cover_art_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "public",
+ "columnName": "public",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "telegram_topics",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `chat_id` INTEGER NOT NULL, `thread_id` INTEGER NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, `icon_emoji` TEXT, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "chatId",
+ "columnName": "chat_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "threadId",
+ "columnName": "thread_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "iconEmoji",
+ "columnName": "icon_emoji",
+ "affinity": "TEXT"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_telegram_topics_chat_id",
+ "unique": false,
+ "columnNames": [
+ "chat_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_telegram_topics_chat_id` ON `${TABLE_NAME}` (`chat_id`)"
+ }
+ ]
+ },
+ {
+ "tableName": "jellyfin_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `jellyfin_id` TEXT NOT NULL, `playlist_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `artist_id` TEXT, `album` TEXT NOT NULL, `album_id` TEXT, `duration` INTEGER NOT NULL, `track_number` INTEGER NOT NULL, `disc_number` INTEGER NOT NULL, `year` INTEGER NOT NULL, `genre` TEXT, `bitRate` INTEGER, `mime_type` TEXT, `path` TEXT NOT NULL, `date_added` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "jellyfinId",
+ "columnName": "jellyfin_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "playlistId",
+ "columnName": "playlist_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artistId",
+ "columnName": "artist_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "trackNumber",
+ "columnName": "track_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "discNumber",
+ "columnName": "disc_number",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "year",
+ "columnName": "year",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "genre",
+ "columnName": "genre",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "bitRate",
+ "columnName": "bitRate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mime_type",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "path",
+ "columnName": "path",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_jellyfin_songs_jellyfin_id",
+ "unique": false,
+ "columnNames": [
+ "jellyfin_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_jellyfin_songs_jellyfin_id` ON `${TABLE_NAME}` (`jellyfin_id`)"
+ },
+ {
+ "name": "index_jellyfin_songs_playlist_id",
+ "unique": false,
+ "columnNames": [
+ "playlist_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_jellyfin_songs_playlist_id` ON `${TABLE_NAME}` (`playlist_id`)"
+ },
+ {
+ "name": "index_jellyfin_songs_playlist_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "playlist_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_jellyfin_songs_playlist_id_date_added` ON `${TABLE_NAME}` (`playlist_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "jellyfin_playlists",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "s3_songs",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `object_key` TEXT NOT NULL, `folder_id` TEXT NOT NULL, `title` TEXT NOT NULL, `artist` TEXT NOT NULL, `album` TEXT NOT NULL, `album_id` INTEGER NOT NULL, `duration` INTEGER NOT NULL, `mimeType` TEXT NOT NULL, `bitrate` INTEGER, `file_size` INTEGER NOT NULL, `date_added` INTEGER NOT NULL, `date_modified` INTEGER NOT NULL, `album_art_uri` TEXT, `metadata_probed` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "objectKey",
+ "columnName": "object_key",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "folderId",
+ "columnName": "folder_id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "title",
+ "columnName": "title",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "artist",
+ "columnName": "artist",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "album",
+ "columnName": "album",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumId",
+ "columnName": "album_id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "duration",
+ "columnName": "duration",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "mimeType",
+ "columnName": "mimeType",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "bitrate",
+ "columnName": "bitrate",
+ "affinity": "INTEGER"
+ },
+ {
+ "fieldPath": "fileSize",
+ "columnName": "file_size",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateAdded",
+ "columnName": "date_added",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "dateModified",
+ "columnName": "date_modified",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "albumArtUri",
+ "columnName": "album_art_uri",
+ "affinity": "TEXT"
+ },
+ {
+ "fieldPath": "metadataProbed",
+ "columnName": "metadata_probed",
+ "affinity": "INTEGER",
+ "notNull": true,
+ "defaultValue": "0"
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ },
+ "indices": [
+ {
+ "name": "index_s3_songs_object_key",
+ "unique": false,
+ "columnNames": [
+ "object_key"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_s3_songs_object_key` ON `${TABLE_NAME}` (`object_key`)"
+ },
+ {
+ "name": "index_s3_songs_folder_id",
+ "unique": false,
+ "columnNames": [
+ "folder_id"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_s3_songs_folder_id` ON `${TABLE_NAME}` (`folder_id`)"
+ },
+ {
+ "name": "index_s3_songs_folder_id_date_added",
+ "unique": false,
+ "columnNames": [
+ "folder_id",
+ "date_added"
+ ],
+ "orders": [],
+ "createSql": "CREATE INDEX IF NOT EXISTS `index_s3_songs_folder_id_date_added` ON `${TABLE_NAME}` (`folder_id`, `date_added`)"
+ }
+ ]
+ },
+ {
+ "tableName": "s3_folders",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `song_count` INTEGER NOT NULL, `last_sync_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "name",
+ "columnName": "name",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "songCount",
+ "columnName": "song_count",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "lastSyncTime",
+ "columnName": "last_sync_time",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "id"
+ ]
+ }
+ },
+ {
+ "tableName": "ai_cache",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`promptHash` TEXT NOT NULL, `responseJson` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, PRIMARY KEY(`promptHash`))",
+ "fields": [
+ {
+ "fieldPath": "promptHash",
+ "columnName": "promptHash",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "responseJson",
+ "columnName": "responseJson",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": false,
+ "columnNames": [
+ "promptHash"
+ ]
+ }
+ },
+ {
+ "tableName": "ai_usage",
+ "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestamp` INTEGER NOT NULL, `provider` TEXT NOT NULL, `model` TEXT NOT NULL, `promptType` TEXT NOT NULL, `promptTokens` INTEGER NOT NULL, `outputTokens` INTEGER NOT NULL, `thoughtTokens` INTEGER NOT NULL)",
+ "fields": [
+ {
+ "fieldPath": "id",
+ "columnName": "id",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "timestamp",
+ "columnName": "timestamp",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "provider",
+ "columnName": "provider",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "model",
+ "columnName": "model",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "promptType",
+ "columnName": "promptType",
+ "affinity": "TEXT",
+ "notNull": true
+ },
+ {
+ "fieldPath": "promptTokens",
+ "columnName": "promptTokens",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "outputTokens",
+ "columnName": "outputTokens",
+ "affinity": "INTEGER",
+ "notNull": true
+ },
+ {
+ "fieldPath": "thoughtTokens",
+ "columnName": "thoughtTokens",
+ "affinity": "INTEGER",
+ "notNull": true
+ }
+ ],
+ "primaryKey": {
+ "autoGenerate": true,
+ "columnNames": [
+ "id"
+ ]
+ }
+ }
+ ],
+ "setupQueries": [
+ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'f313ce810095cfaa93da8320af98ddb2')"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1afb6f4044..9acc2f5986 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -78,6 +78,23 @@
android:resource="@xml/shortcuts" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/theveloper/pixelplay/PixelPlayApplication.kt b/app/src/main/java/com/theveloper/pixelplay/PixelPlayApplication.kt
index 30014e1d09..0fe44ffe57 100644
--- a/app/src/main/java/com/theveloper/pixelplay/PixelPlayApplication.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/PixelPlayApplication.kt
@@ -13,6 +13,7 @@ import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import coil.ImageLoader
import coil.ImageLoaderFactory
+import com.theveloper.pixelplay.data.download.DownloadWorker
import com.theveloper.pixelplay.data.preferences.UserPreferencesRepository
import com.theveloper.pixelplay.data.diagnostics.AdvancedPerformanceDiagnosticsController
import com.theveloper.pixelplay.data.repository.ArtistImageRepository
@@ -116,6 +117,7 @@ class PixelPlayApplication : Application(), ImageLoaderFactory, Configuration.Pr
)
val notificationManager = getSystemService(NotificationManager::class.java)
notificationManager.createNotificationChannel(channel)
+ DownloadWorker.ensureNotificationChannel(this)
}
ProcessLifecycleOwner.get().lifecycle.addObserver(appLifecycleObserver)
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/database/MusicDao.kt b/app/src/main/java/com/theveloper/pixelplay/data/database/MusicDao.kt
index 8a141e350e..c7071dba82 100644
--- a/app/src/main/java/com/theveloper/pixelplay/data/database/MusicDao.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/data/database/MusicDao.kt
@@ -273,6 +273,9 @@ interface MusicDao {
@Query("SELECT id FROM songs WHERE source_type = 6")
suspend fun getAllJellyfinSongIds(): List
+ @Query("SELECT id FROM songs WHERE source_type = 7")
+ suspend fun getAllS3SongIds(): List
+
@Transaction
suspend fun deleteSongsAndRelatedData(songIds: List) {
if (songIds.isEmpty()) return
@@ -321,6 +324,13 @@ interface MusicDao {
deleteSongsAndRelatedData(jellyfinSongIds)
}
+ @Transaction
+ suspend fun clearAllS3Songs() {
+ val s3SongIds = getAllS3SongIds()
+ if (s3SongIds.isEmpty()) return
+ deleteSongsAndRelatedData(s3SongIds)
+ }
+
@Transaction
suspend fun clearAllTelegramSongs() {
val telegramSongIds = getAllTelegramSongIds()
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/database/PixelPlayDatabase.kt b/app/src/main/java/com/theveloper/pixelplay/data/database/PixelPlayDatabase.kt
index 094929dd9f..ffc3b0b731 100644
--- a/app/src/main/java/com/theveloper/pixelplay/data/database/PixelPlayDatabase.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/data/database/PixelPlayDatabase.kt
@@ -33,10 +33,12 @@ import androidx.sqlite.db.SupportSQLiteDatabase
TelegramTopicEntity::class,
JellyfinSongEntity::class,
JellyfinPlaylistEntity::class,
+ S3SongEntity::class,
+ S3FolderEntity::class,
AiCacheEntity::class,
AiUsageEntity::class
],
- version = 42,
+ version = 45,
exportSchema = true
)
abstract class PixelPlayDatabase : RoomDatabase() {
@@ -54,6 +56,7 @@ abstract class PixelPlayDatabase : RoomDatabase() {
abstract fun qqmusicDao(): QqMusicDao
abstract fun navidromeDao(): NavidromeDao
abstract fun jellyfinDao(): JellyfinDao
+ abstract fun s3Dao(): S3Dao
abstract fun aiCacheDao(): AiCacheDao
abstract fun aiUsageDao(): AiUsageDao
@@ -747,6 +750,62 @@ abstract class PixelPlayDatabase : RoomDatabase() {
}
}
+ /**
+ * Add S3-compatible storage tables (s3_songs, s3_folders).
+ */
+ val MIGRATION_42_43 = object : Migration(42, 43) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("""
+ CREATE TABLE IF NOT EXISTS s3_songs (
+ id TEXT NOT NULL PRIMARY KEY,
+ object_key TEXT NOT NULL,
+ folder_id TEXT NOT NULL,
+ title TEXT NOT NULL,
+ artist TEXT NOT NULL,
+ album TEXT NOT NULL,
+ album_id INTEGER NOT NULL,
+ duration INTEGER NOT NULL,
+ mime_type TEXT NOT NULL,
+ bitrate INTEGER,
+ file_size INTEGER NOT NULL,
+ date_added INTEGER NOT NULL,
+ date_modified INTEGER NOT NULL
+ )
+ """.trimIndent())
+
+ db.execSQL("""
+ CREATE TABLE IF NOT EXISTS s3_folders (
+ id TEXT NOT NULL PRIMARY KEY,
+ name TEXT NOT NULL,
+ song_count INTEGER NOT NULL DEFAULT 0,
+ last_sync_time INTEGER NOT NULL DEFAULT 0
+ )
+ """.trimIndent())
+
+ db.execSQL("CREATE INDEX IF NOT EXISTS index_s3_songs_object_key ON s3_songs(object_key)")
+ db.execSQL("CREATE INDEX IF NOT EXISTS index_s3_songs_folder_id ON s3_songs(folder_id)")
+ db.execSQL("CREATE INDEX IF NOT EXISTS index_s3_songs_folder_id_date_added ON s3_songs(folder_id, date_added)")
+ }
+ }
+
+ /**
+ * Add embedded artwork column to s3_songs.
+ */
+ val MIGRATION_43_44 = object : Migration(43, 44) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("ALTER TABLE s3_songs ADD COLUMN album_art_uri TEXT")
+ }
+ }
+
+ /**
+ * Add tag-probe flag to s3_songs (background metadata queue).
+ */
+ val MIGRATION_44_45 = object : Migration(44, 45) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("ALTER TABLE s3_songs ADD COLUMN metadata_probed INTEGER NOT NULL DEFAULT 0")
+ }
+ }
+
private fun ensureSongsTableHasDateAdded(db: SupportSQLiteDatabase) {
if (!tableExists(db, "songs")) {
recreateSongsTable(db)
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/database/S3Dao.kt b/app/src/main/java/com/theveloper/pixelplay/data/database/S3Dao.kt
new file mode 100644
index 0000000000..4cc67f4de3
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/database/S3Dao.kt
@@ -0,0 +1,68 @@
+package com.theveloper.pixelplay.data.database
+
+import androidx.room.Dao
+import androidx.room.Insert
+import androidx.room.OnConflictStrategy
+import androidx.room.Query
+import kotlinx.coroutines.flow.Flow
+
+@Dao
+interface S3Dao {
+
+ // --- Songs ---
+
+ @Query("SELECT * FROM s3_songs ORDER BY date_added DESC")
+ fun getAllS3Songs(): Flow>
+
+ @Query("SELECT * FROM s3_songs ORDER BY date_added DESC")
+ suspend fun getAllS3SongsList(): List
+
+ @Query("SELECT * FROM s3_songs WHERE folder_id = :folderId ORDER BY title ASC")
+ fun getSongsByFolder(folderId: String): Flow>
+
+ @Query("SELECT * FROM s3_songs WHERE metadata_probed = 0 LIMIT :limit")
+ suspend fun getUnprobedBatch(limit: Int = 8): List
+
+ @Query("SELECT COUNT(*) FROM s3_songs WHERE metadata_probed = 0")
+ fun countUnprobedFlow(): Flow
+
+ @Query(
+ """UPDATE s3_songs SET title = :title, artist = :artist, album = :album,
+ duration = :duration, album_art_uri = :albumArtUri, metadata_probed = 1 WHERE id = :id"""
+ )
+ suspend fun applyProbeResult(
+ id: String, title: String, artist: String, album: String,
+ duration: Long, albumArtUri: String?
+ )
+
+ @Insert(onConflict = OnConflictStrategy.REPLACE)
+ suspend fun insertSongs(songs: List)
+
+ @Query("DELETE FROM s3_songs WHERE id IN (:ids)")
+ suspend fun deleteSongsByIds(ids: List)
+
+ @Query("DELETE FROM s3_songs WHERE folder_id = :folderId")
+ suspend fun deleteSongsByFolder(folderId: String)
+
+ // --- Folders ---
+
+ @Insert(onConflict = OnConflictStrategy.REPLACE)
+ suspend fun insertFolder(folder: S3FolderEntity)
+
+ @Query("SELECT * FROM s3_folders ORDER BY name ASC")
+ fun getAllFolders(): Flow>
+
+ @Query("SELECT * FROM s3_folders")
+ suspend fun getAllFoldersList(): List
+
+ @Query("DELETE FROM s3_folders WHERE id = :folderId")
+ suspend fun deleteFolder(folderId: String)
+
+ // --- Clear All ---
+
+ @Query("DELETE FROM s3_songs")
+ suspend fun clearAllSongs()
+
+ @Query("DELETE FROM s3_folders")
+ suspend fun clearAllFolders()
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/database/S3FolderEntity.kt b/app/src/main/java/com/theveloper/pixelplay/data/database/S3FolderEntity.kt
new file mode 100644
index 0000000000..7cb2582696
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/database/S3FolderEntity.kt
@@ -0,0 +1,13 @@
+package com.theveloper.pixelplay.data.database
+
+import androidx.room.ColumnInfo
+import androidx.room.Entity
+import androidx.room.PrimaryKey
+
+@Entity(tableName = "s3_folders")
+data class S3FolderEntity(
+ @PrimaryKey val id: String, // S3 prefix, e.g. "Music/"
+ val name: String, // display name (last segment)
+ @ColumnInfo(name = "song_count") val songCount: Int = 0,
+ @ColumnInfo(name = "last_sync_time") val lastSyncTime: Long = 0
+)
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/database/S3SongEntity.kt b/app/src/main/java/com/theveloper/pixelplay/data/database/S3SongEntity.kt
new file mode 100644
index 0000000000..2094e5d31f
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/database/S3SongEntity.kt
@@ -0,0 +1,83 @@
+package com.theveloper.pixelplay.data.database
+
+import androidx.room.ColumnInfo
+import androidx.room.Entity
+import androidx.room.Index
+import androidx.room.PrimaryKey
+import com.theveloper.pixelplay.data.model.Song
+import com.theveloper.pixelplay.data.s3.S3Repository
+
+@Entity(
+ tableName = "s3_songs",
+ indices = [
+ Index(value = ["object_key"]),
+ Index(value = ["folder_id"]),
+ Index(value = ["folder_id", "date_added"])
+ ]
+)
+data class S3SongEntity(
+ @PrimaryKey val id: String, // "{folderId}_{objectKey}"
+ @ColumnInfo(name = "object_key") val objectKey: String, // full S3 object key
+ @ColumnInfo(name = "folder_id") val folderId: String,
+ val title: String,
+ val artist: String,
+ val album: String,
+ @ColumnInfo(name = "album_id") val albumId: Long,
+ val duration: Long, // milliseconds (0 = unknown)
+ val mimeType: String,
+ val bitrate: Int?,
+ @ColumnInfo(name = "file_size") val fileSize: Long,
+ @ColumnInfo(name = "date_added") val dateAdded: Long,
+ @ColumnInfo(name = "date_modified") val dateModified: Long,
+ @ColumnInfo(name = "album_art_uri") val albumArtUri: String? = null,
+ @ColumnInfo(name = "metadata_probed", defaultValue = "0") val metadataProbed: Boolean = false
+)
+
+fun S3SongEntity.toSong(): Song {
+ return Song(
+ id = "s3_$objectKey",
+ title = title,
+ artist = artist,
+ artistId = artistIdFor(artist),
+ album = album,
+ albumId = albumIdFor(album),
+ path = "",
+ contentUriString = "s3://$objectKey",
+ albumArtUriString = albumArtUri,
+ duration = duration,
+ genre = S3Repository.S3_GENRE,
+ mimeType = mimeType,
+ bitrate = bitrate,
+ sampleRate = 0,
+ year = 0,
+ trackNumber = 0,
+ dateAdded = dateAdded,
+ isFavorite = false,
+ s3ObjectKey = objectKey
+ )
+}
+
+fun Song.toS3SongEntity(folderId: String): S3SongEntity {
+ val resolvedKey = s3ObjectKey ?: ""
+ return S3SongEntity(
+ id = "${folderId}_${resolvedKey}",
+ objectKey = resolvedKey,
+ folderId = folderId,
+ title = title,
+ artist = artist,
+ album = album,
+ albumId = albumId,
+ duration = duration,
+ mimeType = mimeType ?: "audio/mpeg",
+ bitrate = bitrate,
+ fileSize = 0L,
+ dateAdded = dateAdded,
+ dateModified = dateAdded
+ )
+}
+
+internal fun artistIdFor(artist: String): Long =
+ -(S3Repository.S3_ARTIST_ID_OFFSET + artist.lowercase().hashCode().toLong().let { if (it < 0) -it else it })
+
+internal fun albumIdFor(album: String): Long =
+ -(S3Repository.S3_ALBUM_ID_OFFSET + album.lowercase().hashCode().toLong().let { if (it < 0) -it else it })
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/database/SongEntity.kt b/app/src/main/java/com/theveloper/pixelplay/data/database/SongEntity.kt
index 19f948b792..decb4f6a0f 100644
--- a/app/src/main/java/com/theveloper/pixelplay/data/database/SongEntity.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/data/database/SongEntity.kt
@@ -22,6 +22,7 @@ object SourceType {
const val QQMUSIC = 4
const val NAVIDROME = 5
const val JELLYFIN = 6
+ const val S3 = 7
/** Derive source type from a content URI string (fallback for migration / conversion). */
fun fromContentUri(uri: String): Int = when {
@@ -31,6 +32,7 @@ object SourceType {
uri.startsWith("qqmusic://") -> QQMUSIC
uri.startsWith("navidrome://") -> NAVIDROME
uri.startsWith("jellyfin://") -> JELLYFIN
+ uri.startsWith("s3://") -> S3
else -> LOCAL
}
}
@@ -145,6 +147,9 @@ private fun SongEntity.toSongInternal(artists: List): Song {
jellyfinId = if (this.contentUriString.startsWith("jellyfin://")) {
this.contentUriString.removePrefix("jellyfin://")
} else null,
+ s3ObjectKey = if (this.contentUriString.startsWith("s3://")) {
+ this.contentUriString.removePrefix("s3://")
+ } else null,
mimeType = this.mimeType,
bitrate = this.bitrate,
sampleRate = this.sampleRate
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadBackend.kt b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadBackend.kt
new file mode 100644
index 0000000000..6a04bf3b5a
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadBackend.kt
@@ -0,0 +1,260 @@
+package com.theveloper.pixelplay.data.download
+
+import kotlinx.serialization.Serializable
+import kotlinx.serialization.json.buildJsonObject
+import kotlinx.serialization.json.put
+import android.util.Log
+import java.io.File
+import javax.inject.Inject
+import javax.inject.Singleton
+
+/** Search result bundle */
+data class SearchResult(val tracks: List)
+
+sealed interface BackendResult {
+ data class Ok(val value: T) : BackendResult
+ data class Failed(val response: DownloadResponse) : BackendResult
+}
+
+interface DownloadBackendApi {
+ fun initIfNeeded()
+ fun listInstalled(): List
+ fun installFromFile(path: String): BackendResult
+ fun listRepoExtensions(forceRefresh: Boolean): List
+ fun installFromRepo(id: String): BackendResult
+ /** Persists and applies a user-supplied registry URL. Returns null on success, error message on failure. */
+ fun setRegistryUrl(url: String): String?
+ /** Removes the stored registry URL and clears the repo cache. */
+ fun clearRegistryUrl()
+ fun remove(id: String)
+ fun setEnabled(id: String, enabled: Boolean)
+ fun search(query: String, limit: Int = 30): List
+ fun homeFeed(extensionId: String): HomeFeed
+ /** Extension customSearch with a manifest filter id; throws with the extension's message on failure. */
+ fun customSearch(extensionId: String, query: String, filter: String?, limit: Int = 30): List
+ /** Album/playlist/artist details from a metadata extension; throws on failure. */
+ fun providerMetadata(providerId: String, type: String, id: String): ProviderMetadata
+ fun download(request: DownloadRequest): BackendResult
+ fun progressDelta(sinceSeq: Long): ProgressDelta
+ fun waitProgressDelta(sinceSeq: Long, timeoutMs: Long): ProgressDelta
+ fun cancel(itemId: String)
+ fun pendingAuth(extensionId: String): String
+ fun submitAuthCode(extensionId: String, code: String)
+ /**
+ * Completes a browser verification callback (spotiflac://session-grant or an OAuth
+ * callback). Returns the owning extension id; throws when the extension rejects it.
+ */
+ fun completeCallback(sessionGrant: Boolean, state: String, code: String): String
+}
+
+@Singleton
+class GobackendDownloadBackend @Inject constructor(
+ private val settings: DownloadSettings,
+) : DownloadBackendApi {
+
+ private companion object { const val TAG = "DownloadBackend" }
+
+ private val lock = Any()
+ private var initialized = false
+
+ override fun initIfNeeded() {
+ synchronized(lock) {
+ if (initialized) return
+ val extDir = File(settings.rootDir, "extensions")
+ val dataDir = File(settings.rootDir, "download_data")
+ extDir.mkdirs(); dataDir.mkdirs()
+ runCatching {
+ gobackend.Gobackend.setExtensionStorageMasterKey(settings.extensionMasterKey)
+ gobackend.Gobackend.initExtensionSystem(extDir.absolutePath, dataDir.absolutePath)
+ gobackend.Gobackend.loadExtensionsFromDir(extDir.absolutePath)
+ }
+ .onSuccess { initialized = true }
+ .onFailure { Log.e(TAG, "initExtensionSystem($extDir, $dataDir) failed", it) }
+ // Best-effort repo init: offline/failure must NOT flip initialized
+ // back to false, the core extension system still works without it.
+ runCatching {
+ gobackend.Gobackend.initExtensionRepoJSON(dataDir.absolutePath)
+ settings.registryUrl?.let { gobackend.Gobackend.setRepoRegistryURLJSON(it) }
+ }
+ }
+ }
+
+ override fun listInstalled(): List {
+ initIfNeeded()
+ if (!initialized) return emptyList()
+ val raw = gobackend.Gobackend.getInstalledExtensions()
+ val list = runCatching { DownloadJson.decodeFromString>(raw.ifEmpty { "[]" }) }
+ .getOrElse { emptyList() }
+ // Go builds this from a map, so the order changes between calls; keep it stable A→Z.
+ .sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER, InstalledExtension::displayName).thenBy { it.id })
+ Log.d(TAG, "listInstalled: ${list.size} extensions: ${list.map { "${it.id}(types=${it.types},download=${it.isDownloadProvider},enabled=${it.enabled},err=${it.error},qualities=${it.qualityOptions.map(QualityOption::id)})" }}")
+ return list
+ }
+
+ override fun installFromFile(path: String): BackendResult {
+ initIfNeeded()
+ if (!initialized) {
+ Log.e(TAG, "installFromFile($path): extension system not initialized")
+ return BackendResult.Failed(
+ DownloadResponse(success = false, error = "extension system failed to initialize", errorType = "install_failed"),
+ )
+ }
+ return runCatching {
+ val raw = gobackend.Gobackend.loadExtensionFromPath(path)
+ val id = DownloadJson.decodeFromString(raw.ifEmpty { "{}" })
+ BackendResult.Ok(listInstalled().firstOrNull { it.id == id.name })
+ }.getOrElse {
+ Log.e(TAG, "installFromFile($path) failed", it)
+ BackendResult.Failed(
+ DownloadResponse(success = false, error = it.message, errorType = "install_failed"),
+ )
+ }
+ }
+
+ override fun listRepoExtensions(forceRefresh: Boolean): List {
+ if (settings.registryUrl == null) return emptyList() // no registry configured yet
+ initIfNeeded()
+ // getRepoExtensionsJSON returns a JSON string and may throw (gomobile
+ // String method); empty list on any failure.
+ return runCatching {
+ // GetRepoExtensionsJSON marshals the extensions array directly.
+ DownloadJson.decodeFromString>(
+ gobackend.Gobackend.getRepoExtensionsJSON(forceRefresh),
+ )
+ }.onFailure { Log.e(TAG, "listRepoExtensions failed", it) }.getOrDefault(emptyList())
+ .sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.displayName.ifEmpty { it.name.ifEmpty { it.id } } })
+ }
+
+ override fun setRegistryUrl(url: String): String? {
+ initIfNeeded()
+ val applied = runCatching { gobackend.Gobackend.setRepoRegistryURLJSON(url.trim()) }
+ return applied.fold(
+ onSuccess = { settings.registryUrl = url.trim(); null },
+ onFailure = { it.message ?: "Invalid registry URL" },
+ )
+ }
+
+ override fun clearRegistryUrl() {
+ initIfNeeded()
+ runCatching { gobackend.Gobackend.clearRepoRegistryURLJSON() }
+ settings.registryUrl = null
+ }
+
+ override fun installFromRepo(id: String): BackendResult {
+ initIfNeeded()
+ val dir = File(settings.rootDir, "repo_dl")
+ return runCatching {
+ dir.mkdirs()
+ // downloadRepoExtensionJSON verifies sha256 and returns the plain
+ // .sflx destPath, not JSON.
+ val destPath = gobackend.Gobackend.downloadRepoExtensionJSON(id, dir.absolutePath)
+ installFromFile(destPath)
+ }.getOrElse {
+ Log.e(TAG, "installFromRepo($id) failed", it)
+ BackendResult.Failed(
+ DownloadResponse(success = false, error = it.message, errorType = "repo_download_failed"),
+ )
+ }.also { dir.deleteRecursively() }
+ }
+
+ override fun remove(id: String) { initIfNeeded(); gobackend.Gobackend.removeExtensionByID(id) }
+
+ override fun setEnabled(id: String, enabled: Boolean) {
+ initIfNeeded(); gobackend.Gobackend.setExtensionEnabledByID(id, enabled)
+ }
+
+ override fun search(query: String, limit: Int): List {
+ initIfNeeded()
+ val raw = gobackend.Gobackend.searchTracksWithMetadataProvidersJSON(query, limit.toLong(), true)
+ return runCatching { DownloadJson.decodeFromString>(raw) }.getOrDefault(emptyList())
+ }
+
+ override fun homeFeed(extensionId: String): HomeFeed {
+ initIfNeeded()
+ return runCatching {
+ DownloadJson.decodeFromString(gobackend.Gobackend.getExtensionHomeFeedJSON(extensionId))
+ }.getOrElse {
+ Log.e(TAG, "homeFeed($extensionId) failed", it)
+ HomeFeed(error = it.message)
+ }.also { Log.d(TAG, "homeFeed($extensionId): ${it.sections.size} sections, error=${it.error}") }
+ }
+
+ override fun customSearch(extensionId: String, query: String, filter: String?, limit: Int): List {
+ initIfNeeded()
+ val options = buildJsonObject {
+ filter?.let { put("filter", it) }
+ put("limit", limit)
+ }
+ val raw = gobackend.Gobackend.customSearchWithExtensionJSON(extensionId, query, options.toString())
+ // Go sets provider_id on every result; keep the extension id as a fallback.
+ return DownloadJson.decodeFromString>(raw.ifEmpty { "[]" })
+ .map { if (it.providerId.isBlank()) it.copy(providerId = extensionId) else it }
+ .also { Log.d(TAG, "customSearch($extensionId, filter=$filter): ${it.size} results") }
+ }
+
+ override fun providerMetadata(providerId: String, type: String, id: String): ProviderMetadata {
+ initIfNeeded()
+ val raw = gobackend.Gobackend.getProviderMetadataJSON(providerId, type, id)
+ return DownloadJson.decodeFromString(raw.ifEmpty { "{}" })
+ }
+
+ override fun download(request: DownloadRequest): BackendResult {
+ initIfNeeded()
+ return runCatching {
+ val raw = gobackend.Gobackend.downloadByStrategy(DownloadJson.encodeToString(request))
+ DownloadJson.decodeFromString(raw)
+ }.fold(
+ onSuccess = { resp -> if (resp.success) BackendResult.Ok(resp) else BackendResult.Failed(resp) },
+ onFailure = { BackendResult.Failed(DownloadResponse(success = false, error = it.message, errorType = "backend_crash")) },
+ )
+ }
+
+ override fun progressDelta(sinceSeq: Long): ProgressDelta {
+ val raw = gobackend.Gobackend.getAllDownloadProgressDelta(sinceSeq)
+ return runCatching { DownloadJson.decodeFromString(raw) }
+ .getOrDefault(ProgressDelta(seq = sinceSeq))
+ }
+
+ override fun waitProgressDelta(sinceSeq: Long, timeoutMs: Long): ProgressDelta {
+ val raw = gobackend.Gobackend.waitForAllDownloadProgressDelta(sinceSeq, timeoutMs)
+ return runCatching { DownloadJson.decodeFromString(raw) }
+ .getOrDefault(ProgressDelta(seq = sinceSeq))
+ }
+
+ override fun cancel(itemId: String) { gobackend.Gobackend.cancelDownload(itemId) }
+
+ override fun pendingAuth(extensionId: String): String {
+ return runCatching { gobackend.Gobackend.getExtensionPendingAuthJSON(extensionId) }.getOrDefault("{}")
+ }
+
+ override fun submitAuthCode(extensionId: String, code: String) {
+ gobackend.Gobackend.setExtensionAuthCodeByID(extensionId, code)
+ }
+
+ // Same sequence as SpotiFLAC MainActivity.handleExtensionOAuthIntent.
+ override fun completeCallback(sessionGrant: Boolean, state: String, code: String): String {
+ initIfNeeded()
+ val extId: String
+ val raw: String
+ if (sessionGrant) {
+ extId = gobackend.Gobackend.resolveExtensionCallbackState(state)
+ gobackend.Gobackend.setExtensionSessionGrantByID(extId, code)
+ raw = gobackend.Gobackend.invokeExtensionActionJSON(extId, "completeGrant")
+ val result = runCatching { DownloadJson.decodeFromString(raw) }.getOrDefault(ActionResult())
+ if (!result.success) {
+ throw IllegalStateException(result.error ?: result.message ?: "completeGrant failed for $extId")
+ }
+ } else {
+ extId = gobackend.Gobackend.consumeExtensionCallbackState(state)
+ gobackend.Gobackend.setExtensionAuthCodeByID(extId, code)
+ gobackend.Gobackend.invokeExtensionActionJSON(extId, "completeSpotifyLogin")
+ }
+ return extId
+ }
+}
+
+@Serializable
+private data class InstallResult(val name: String = "", val success: Boolean = false, val error: String? = null)
+
+@Serializable
+private data class ActionResult(val success: Boolean = false, val error: String? = null, val message: String? = null)
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadFinalizer.kt b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadFinalizer.kt
new file mode 100644
index 0000000000..07ea88d69d
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadFinalizer.kt
@@ -0,0 +1,157 @@
+package com.theveloper.pixelplay.data.download
+
+import android.os.ParcelFileDescriptor
+import android.util.Base64
+import android.util.Log
+import com.antonkarpenko.ffmpegkit.FFmpegKit
+import com.antonkarpenko.ffmpegkit.ReturnCode
+import com.kyant.taglib.Picture
+import com.kyant.taglib.TagLib
+import java.io.File
+import java.net.HttpURLConnection
+import java.net.URL
+import javax.inject.Inject
+import javax.inject.Singleton
+
+/**
+ * Host-side post-processing of an extension download, ported from SpotiFLAC-Mobile's
+ * NativeDownloadFinalizer: decrypt protected streams with FFmpeg, then (re)write tags,
+ * since the backend cannot tag a file that was still encrypted when it finished.
+ */
+@Singleton
+class DownloadFinalizer @Inject constructor() {
+
+ /** The decryption the extension asked for, or null when the file is already playable. */
+ fun decryptionFor(response: DownloadResponse): DecryptionInfo? {
+ val info = response.decryption
+ val key = info?.key?.trim().orEmpty().ifEmpty { response.decryptionKey?.trim().orEmpty() }
+ if (key.isEmpty()) return null
+ return (info ?: DecryptionInfo(strategy = "ffmpeg.mov_key")).copy(key = key)
+ }
+
+ /** Decrypts [input] next to itself. Returns the decrypted file or throws with FFmpeg's output. */
+ fun decrypt(input: File, info: DecryptionInfo): File {
+ if (info.strategy.isNotBlank() && normalizeStrategy(info.strategy) !in MOV_KEY_STRATEGIES) {
+ throw IllegalStateException("Unsupported decryption strategy: ${info.strategy}")
+ }
+ val inputFormat = info.inputFormat.trim().ifEmpty { "mov" }
+ val preferredExt = normalizeExt(info.outputExtension).ifEmpty { ".flac" }
+
+ // Same fallback ladder as the reference: FLAC (audio only) -> M4A -> MP4 -> MOV muxer
+ // (the MP4 muxer rejects some codecs such as AC-4, MOV keeps the codec params).
+ val attempts = buildList {
+ add(Attempt(preferredExt, audioOnly = preferredExt == ".flac", forceMov = false))
+ if (preferredExt == ".flac") add(Attempt(".m4a", audioOnly = false, forceMov = false))
+ if (preferredExt == ".flac" || preferredExt == ".m4a") add(Attempt(".mp4", audioOnly = false, forceMov = false))
+ add(Attempt(".mp4", audioOnly = false, forceMov = true))
+ }
+
+ var lastOutput = ""
+ for (key in keyCandidates(info.key)) {
+ for (attempt in attempts) {
+ val output = File(input.parentFile, "decrypted${attempt.ext}")
+ output.delete()
+ val args = buildList {
+ addAll(listOf("-v", "error", "-decryption_key", key, "-f", inputFormat, "-i", input.absolutePath))
+ if (attempt.audioOnly) addAll(listOf("-map", "0:a"))
+ addAll(listOf("-c", "copy"))
+ when {
+ attempt.forceMov -> addAll(listOf("-f", "mov"))
+ // Without this FFmpeg writes FLAC-in-MP4 under a .flac name.
+ attempt.ext == ".flac" -> addAll(listOf("-f", "flac"))
+ }
+ addAll(listOf(output.absolutePath, "-y"))
+ }
+ val session = FFmpegKit.executeWithArguments(args.toTypedArray())
+ lastOutput = session.output.orEmpty()
+ if (ReturnCode.isSuccess(session.returnCode) && output.length() > 0) {
+ Log.i(TAG, "Decrypted ${input.name} -> ${output.name}")
+ input.delete()
+ return output
+ }
+ output.delete()
+ }
+ }
+ throw IllegalStateException("Failed to decrypt encrypted stream: ${lastOutput.takeLast(300)}")
+ }
+
+ /** Fills in tags (and cover) the file is missing, preferring backend-resolved metadata. */
+ fun writeTags(file: File, track: ExtTrack, response: DownloadResponse) {
+ runCatching {
+ ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE).use { fd ->
+ val existing = TagLib.getMetadata(fd.dup().detachFd(), readPictures = false)
+ val map = HashMap(existing?.propertyMap ?: emptyMap())
+ fun put(key: String, value: String?) {
+ if (value.isNullOrBlank() || !map[key].isNullOrEmpty()) return
+ map[key] = arrayOf(value)
+ }
+ fun putNumber(key: String, value: Int) { if (value > 0) put(key, value.toString()) }
+ put("TITLE", response.title ?: track.name)
+ put("ARTIST", response.artist ?: track.artists)
+ put("ALBUM", response.album ?: track.albumName)
+ put("ALBUMARTIST", response.albumArtist ?: track.albumArtist)
+ putNumber("TRACKNUMBER", response.trackNumber.takeIf { it > 0 } ?: track.trackNumber)
+ putNumber("DISCNUMBER", response.discNumber.takeIf { it > 0 } ?: track.discNumber)
+ put("DATE", response.releaseDate ?: track.releaseDate)
+ put("ISRC", response.isrc ?: track.isrc)
+ put("GENRE", response.genre ?: track.genre)
+ put("LABEL", response.label ?: track.label)
+ put("COPYRIGHT", response.copyright ?: track.copyright)
+ put("COMPOSER", response.composer ?: track.composer)
+ put("LYRICS", response.lyricsLrc)
+ if (!TagLib.savePropertyMap(fd.dup().detachFd(), map)) Log.w(TAG, "Tag save failed for ${file.name}")
+
+ val hasCover = TagLib.getPictures(fd.dup().detachFd()).isNotEmpty()
+ val coverUrl = response.coverUrl?.takeIf { it.isNotBlank() } ?: track.coverUrl
+ if (!hasCover && !coverUrl.isNullOrBlank()) {
+ fetch(coverUrl)?.let { bytes ->
+ val mime = if (bytes.size > 3 && bytes[0] == 0x89.toByte() && bytes[1] == 'P'.code.toByte()) "image/png" else "image/jpeg"
+ TagLib.savePictures(
+ fd.dup().detachFd(),
+ arrayOf(Picture(data = bytes, description = "Front Cover", pictureType = "Front Cover", mimeType = mime)),
+ )
+ }
+ }
+ }
+ }.onFailure { Log.w(TAG, "Tagging ${file.name} failed", it) }
+ }
+
+ private fun fetch(url: String): ByteArray? = runCatching {
+ (URL(url).openConnection() as HttpURLConnection).run {
+ connectTimeout = 15_000
+ readTimeout = 15_000
+ try { if (responseCode in 200..299) inputStream.use { it.readBytes() } else null } finally { disconnect() }
+ }
+ }.getOrNull()
+
+ private data class Attempt(val ext: String, val audioOnly: Boolean, val forceMov: Boolean)
+
+ private companion object {
+ const val TAG = "DownloadFinalizer"
+
+ val MOV_KEY_STRATEGIES = setOf("ffmpeg.mov_key", "mov_decryption_key", "mp4_decryption_key", "ffmpeg.mp4_decryption_key")
+
+ fun normalizeStrategy(s: String) = s.trim().lowercase().replace("ffmpeg_", "ffmpeg.")
+
+ fun normalizeExt(ext: String): String {
+ val e = ext.trim().lowercase()
+ return if (e.isEmpty() || e.startsWith(".")) e else ".$e"
+ }
+
+ /** Extensions hand out keys as hex, 0x-hex or base64; FFmpeg wants plain hex. */
+ fun keyCandidates(raw: String): List {
+ val out = linkedSetOf()
+ val trimmed = raw.trim()
+ if (trimmed.isEmpty()) return emptyList()
+ out += trimmed
+ val noPrefix = trimmed.removePrefix("0x").removePrefix("0X")
+ out += noPrefix
+ val hex = noPrefix.replace(Regex("[^0-9a-fA-F]"), "")
+ if (hex.isNotEmpty() && hex.length % 2 == 0) out += hex
+ runCatching { Base64.decode(noPrefix.replace(Regex("\\s+"), ""), Base64.DEFAULT) }
+ .getOrNull()?.takeIf { it.isNotEmpty() }
+ ?.let { bytes -> out += bytes.joinToString("") { "%02x".format(it) } }
+ return out.filter { it.isNotBlank() }
+ }
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadModels.kt b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadModels.kt
new file mode 100644
index 0000000000..73edf55590
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadModels.kt
@@ -0,0 +1,299 @@
+package com.theveloper.pixelplay.data.download
+
+import kotlinx.serialization.SerialName
+import kotlinx.serialization.Serializable
+import kotlinx.serialization.json.Json
+import kotlinx.serialization.json.JsonObject
+import kotlinx.serialization.json.JsonPrimitive
+import kotlinx.serialization.json.booleanOrNull
+
+/**
+ * Wire models for the gobackend JSON API. Field names MUST match the Go
+ * structs in SpotiFLAC-Mobile's go_backend (exports_download.go,
+ * extension_provider_types.go, progress.go, extension_manager.go).
+ */
+@Serializable
+data class DownloadRequest(
+ /** Download extension id; Go locks the download to it (strict mode, use_fallback=false). */
+ val service: String,
+ /** Extension the track was found with; Go uses it for metadata enrichment. */
+ val source: String = "",
+ @SerialName("track_name") val trackName: String,
+ @SerialName("artist_name") val artistName: String,
+ @SerialName("album_name") val albumName: String,
+ @SerialName("album_artist") val albumArtist: String = "",
+ @SerialName("cover_url") val coverUrl: String = "",
+ /** Go builds "/" here; the extension picks the real extension. */
+ @SerialName("output_dir") val outputDir: String,
+ @SerialName("output_ext") val outputExt: String = "",
+ @SerialName("filename_format") val filenameFormat: String = "{artist} - {title}",
+ val quality: String,
+ @SerialName("deezer_id") val deezerId: String = "",
+ @SerialName("tidal_id") val tidalId: String = "",
+ @SerialName("qobuz_id") val qobuzId: String = "",
+ val genre: String = "",
+ val label: String = "",
+ val copyright: String = "",
+ val composer: String = "",
+ val explicit: Boolean = false,
+ @SerialName("album_type") val albumType: String = "",
+ val upc: String = "",
+ @SerialName("embed_metadata") val embedMetadata: Boolean = true,
+ @SerialName("item_id") val itemId: String,
+ @SerialName("duration_ms") val durationMs: Int = 0,
+ @SerialName("track_number") val trackNumber: Int = 0,
+ @SerialName("disc_number") val discNumber: Int = 0,
+ @SerialName("total_tracks") val totalTracks: Int = 0,
+ @SerialName("total_discs") val totalDiscs: Int = 0,
+ @SerialName("release_date") val releaseDate: String = "",
+ val isrc: String = "",
+ @SerialName("spotify_id") val spotifyId: String = "",
+ @SerialName("provider_track_id") val providerTrackId: String = "",
+ @SerialName("download_provider") val downloadProvider: String = "",
+ // Spec: built-in providers are retired; extension mode is mandatory.
+ @SerialName("use_extensions") val useExtensions: Boolean = true,
+ @SerialName("use_fallback") val useFallback: Boolean = false,
+)
+
+@Serializable
+data class DownloadResponse(
+ val success: Boolean = false,
+ val message: String = "",
+ @SerialName("file_path") val filePath: String? = null,
+ @SerialName("resolved_file_name") val resolvedFileName: String? = null,
+ val error: String? = null,
+ @SerialName("error_type") val errorType: String? = null,
+ @SerialName("retry_after_seconds") val retryAfterSeconds: Int = 0,
+ @SerialName("already_exists") val alreadyExists: Boolean = false,
+ @SerialName("actual_extension") val actualExtension: String? = null,
+ @SerialName("audio_codec") val audioCodec: String? = null,
+ @SerialName("actual_bit_depth") val actualBitDepth: Int = 0,
+ @SerialName("actual_sample_rate") val actualSampleRate: Int = 0,
+ val service: String? = null,
+ val title: String? = null,
+ val artist: String? = null,
+ val album: String? = null,
+ @SerialName("album_artist") val albumArtist: String? = null,
+ @SerialName("release_date") val releaseDate: String? = null,
+ @SerialName("track_number") val trackNumber: Int = 0,
+ @SerialName("disc_number") val discNumber: Int = 0,
+ @SerialName("total_tracks") val totalTracks: Int = 0,
+ @SerialName("total_discs") val totalDiscs: Int = 0,
+ val isrc: String? = null,
+ @SerialName("cover_url") val coverUrl: String? = null,
+ val genre: String? = null,
+ val label: String? = null,
+ val copyright: String? = null,
+ val composer: String? = null,
+ @SerialName("lyrics_lrc") val lyricsLrc: String? = null,
+ /** Legacy flat key; newer extensions use [decryption]. */
+ @SerialName("decryption_key") val decryptionKey: String? = null,
+ val decryption: DecryptionInfo? = null,
+)
+
+/** Go extension_provider_types.go DownloadDecryptionInfo: the host must decrypt file_path itself. */
+@Serializable
+data class DecryptionInfo(
+ val strategy: String = "",
+ val key: String = "",
+ val iv: String = "",
+ @SerialName("input_format") val inputFormat: String = "",
+ @SerialName("output_extension") val outputExtension: String = "",
+)
+
+@Serializable
+data class ItemProgress(
+ @SerialName("item_id") val itemId: String,
+ @SerialName("bytes_total") val bytesTotal: Long = 0,
+ @SerialName("bytes_received") val bytesReceived: Long = 0,
+ val progress: Float = 0f,
+ @SerialName("speed_mbps") val speedMbps: Float = 0f,
+ @SerialName("is_downloading") val isDownloading: Boolean = false,
+ val status: String = "",
+ val stage: String? = null,
+)
+
+@Serializable
+data class ProgressDelta(
+ val seq: Long,
+ val reset: Boolean = false,
+ val items: Map = emptyMap(),
+ val removed: List = emptyList(),
+)
+
+@Serializable
+data class ExtTrack(
+ val id: String,
+ val name: String,
+ val artists: String = "",
+ @SerialName("album_name") val albumName: String = "",
+ @SerialName("album_artist") val albumArtist: String = "",
+ @SerialName("duration_ms") val durationMs: Int = 0,
+ @SerialName("cover_url") val coverUrl: String? = null,
+ @SerialName("provider_id") val providerId: String = "",
+ val isrc: String? = null,
+ @SerialName("spotify_id") val spotifyId: String? = null,
+ @SerialName("provider_track_id") val providerTrackId: String? = null,
+ @SerialName("track_number") val trackNumber: Int = 0,
+ @SerialName("disc_number") val discNumber: Int = 0,
+ @SerialName("total_tracks") val totalTracks: Int = 0,
+ @SerialName("total_discs") val totalDiscs: Int = 0,
+ @SerialName("release_date") val releaseDate: String? = null,
+ val genre: String? = null,
+ @SerialName("album_type") val albumType: String? = null,
+ val explicit: Boolean = false,
+ @SerialName("deezer_id") val deezerId: String? = null,
+ @SerialName("tidal_id") val tidalId: String? = null,
+ @SerialName("qobuz_id") val qobuzId: String? = null,
+ val upc: String? = null,
+ val label: String? = null,
+ val copyright: String? = null,
+ val composer: String? = null,
+ /** "track" (or empty), "album", "artist" or "playlist" in custom search results. */
+ @SerialName("item_type") val itemType: String? = null,
+ @SerialName("album_id") val albumId: String? = null,
+ @SerialName("artist_id") val artistId: String? = null,
+) {
+ /** Album/artist/playlist result: opens a detail page instead of downloading. */
+ val collectionType: String? get() = collectionTypeOf(itemType)
+}
+
+/** Normalizes extension type/filter ids ("albums", "Artist", "songs") to album/artist/playlist, or null for tracks. */
+fun collectionTypeOf(raw: String?): String? = when (raw?.lowercase()?.removeSuffix("s")) {
+ "album" -> "album"
+ "artist" -> "artist"
+ "playlist" -> "playlist"
+ else -> null
+}
+
+@Serializable
+data class SearchFilterOption(val id: String, val label: String = "", val icon: String = "")
+
+/** Manifest searchBehavior: the extension supports customSearch with these filters. */
+@Serializable
+data class SearchBehavior(
+ val enabled: Boolean = false,
+ val placeholder: String = "",
+ val primary: Boolean = false,
+ val filters: List = emptyList(),
+)
+
+/** Album/playlist/artist header from GetProviderMetadataJSON (album_info, artist_info, albums[]...). */
+@Serializable
+data class CollectionInfo(
+ val id: String = "",
+ val name: String = "",
+ val artists: String = "",
+ @SerialName("cover_url") val coverUrl: String? = null,
+ @SerialName("release_date") val releaseDate: String? = null,
+ @SerialName("total_tracks") val totalTracks: Int = 0,
+ @SerialName("album_type") val albumType: String? = null,
+ @SerialName("provider_id") val providerId: String? = null,
+)
+
+/** GetProviderMetadataJSON(provider, "album"|"playlist"|"artist", id). */
+@Serializable
+data class ProviderMetadata(
+ @SerialName("album_info") val albumInfo: CollectionInfo? = null,
+ @SerialName("playlist_info") val playlistInfo: CollectionInfo? = null,
+ @SerialName("artist_info") val artistInfo: CollectionInfo? = null,
+ @SerialName("track_list") val trackList: List = emptyList(),
+ val albums: List = emptyList(),
+ val releases: List = emptyList(),
+ @SerialName("top_tracks") val topTracks: List = emptyList(),
+)
+
+@Serializable
+data class QualityOption(
+ val id: String,
+ val kind: String = "",
+ val label: String = "",
+ val description: String = "",
+)
+
+/** One entry of GetInstalledExtensions (Go extension_manager.go ExtensionInfo, a flat object). */
+@Serializable
+data class InstalledExtension(
+ val id: String,
+ val name: String = "",
+ @SerialName("display_name") val displayNameRaw: String = "",
+ val version: String = "",
+ val description: String? = null,
+ val types: List = emptyList(),
+ val enabled: Boolean = false,
+ val status: String = "",
+ @SerialName("error_message") val error: String? = null,
+ @SerialName("quality_options") val qualityOptions: List = emptyList(),
+ @SerialName("has_metadata_provider") val hasMetadataProvider: Boolean = false,
+ @SerialName("has_download_provider") val hasDownloadProvider: Boolean = false,
+ val capabilities: JsonObject? = null,
+ @SerialName("search_behavior") val searchBehavior: SearchBehavior? = null,
+) {
+ val hasCustomSearch: Boolean get() = searchBehavior?.enabled == true
+ val displayName: String get() = displayNameRaw.ifEmpty { name.ifEmpty { id } }
+ val isDownloadProvider: Boolean get() = hasDownloadProvider || "download_provider" in types
+ val hasHomeFeed: Boolean
+ get() = (capabilities?.get("homeFeed") as? JsonPrimitive)?.booleanOrNull == true
+}
+
+/** Extension getHomeFeed result (same shape SpotiFLAC's explore_provider parses). */
+@Serializable
+data class HomeFeed(
+ val success: Boolean = false,
+ val error: String? = null,
+ val sections: List = emptyList(),
+)
+
+@Serializable
+data class FeedSection(
+ val uri: String = "",
+ val title: String = "",
+ val items: List = emptyList(),
+)
+
+@Serializable
+data class FeedItem(
+ val id: String = "",
+ val uri: String = "",
+ val type: String = "track",
+ val name: String = "",
+ val artists: String = "",
+ val description: String? = null,
+ @SerialName("cover_url") val coverUrl: String? = null,
+ @SerialName("provider_id") val providerId: String? = null,
+ @SerialName("album_name") val albumName: String? = null,
+ @SerialName("duration_ms") val durationMs: Double = 0.0,
+) {
+ fun toTrack(defaultProvider: String) = ExtTrack(
+ id = id,
+ name = name,
+ artists = artists,
+ albumName = albumName.orEmpty(),
+ durationMs = durationMs.toInt(),
+ coverUrl = coverUrl,
+ providerId = providerId?.takeIf { it.isNotBlank() } ?: defaultProvider,
+ )
+}
+
+/**
+ * Entry from the extension registry. The Go repoExtension struct emits BOTH
+ * snake_case and camelCase keys (alt fields), so ignoreUnknownKeys +
+ * snake_case SerialNames is the correct pairing. Defaults everywhere so a
+ * partial registry entry never breaks parsing.
+ */
+@Serializable
+data class RepoExtension(
+ val id: String = "",
+ val name: String = "",
+ @SerialName("display_name") val displayName: String = "",
+ val version: String = "",
+ val description: String? = null,
+ @SerialName("download_url") val downloadUrl: String = "",
+ @SerialName("icon_url") val iconUrl: String? = null,
+ val category: String = "",
+ val sha256: String = "",
+ @SerialName("min_app_version") val minAppVersion: String = "",
+)
+
+// isLenient: extension JSON sometimes sends numbers where we expect strings.
+val DownloadJson: Json = Json { ignoreUnknownKeys = true; encodeDefaults = true; isLenient = true; coerceInputValues = true }
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadRepository.kt b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadRepository.kt
new file mode 100644
index 0000000000..1b0ba58ea0
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadRepository.kt
@@ -0,0 +1,102 @@
+package com.theveloper.pixelplay.data.download
+
+import java.util.UUID
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.update
+import javax.inject.Inject
+import javax.inject.Singleton
+
+enum class JobStatus { QUEUED, DOWNLOADING, COMPLETED, FAILED, CANCELLED }
+
+data class DownloadJob(
+ val itemId: String = UUID.randomUUID().toString(),
+ val track: ExtTrack,
+ val quality: String,
+ val downloadProvider: String = "",
+ val status: JobStatus = JobStatus.QUEUED,
+ val progress: Float = 0f,
+ val bytesReceived: Long = 0,
+ val bytesTotal: Long = 0,
+ val error: String? = null,
+ val errorType: String? = null,
+ val resultFilePath: String? = null,
+ val actualExtension: String? = null,
+ val published: Boolean = false,
+) {
+ val title: String get() = track.name
+}
+
+@Singleton
+class DownloadRepository @Inject constructor() {
+
+ private val _jobs = MutableStateFlow>(emptyList())
+ val jobs: StateFlow> = _jobs.asStateFlow()
+
+ fun enqueue(track: ExtTrack, quality: String, downloadProvider: String): String {
+ val job = DownloadJob(track = track, quality = quality, downloadProvider = downloadProvider)
+ _jobs.update { list -> list + job }
+ return job.itemId
+ }
+
+ fun claimNextQueued(): DownloadJob? =
+ _jobs.value.firstOrNull { it.status == JobStatus.QUEUED }?.also { job ->
+ _jobs.update { list -> list.map { if (it.itemId == job.itemId) it.copy(status = JobStatus.DOWNLOADING) else it } }
+ }
+
+ fun applyDelta(delta: ProgressDelta) {
+ _jobs.update { list ->
+ list.map { job ->
+ val p = delta.items[job.itemId] ?: return@map job
+ // Only QUEUED/DOWNLOADING jobs track live status; never downgrade
+ // terminal CANCELLED/FAILED/COMPLETED on a late delta.
+ val active = job.status == JobStatus.QUEUED || job.status == JobStatus.DOWNLOADING
+ job.copy(
+ progress = p.progress.coerceIn(0f, 1f),
+ bytesReceived = p.bytesReceived,
+ bytesTotal = p.bytesTotal,
+ status = if (!active) job.status
+ else when (p.status) {
+ "completed" -> JobStatus.COMPLETED
+ else -> JobStatus.DOWNLOADING
+ },
+ )
+ }
+ }
+ }
+
+ fun markCompleted(itemId: String, filePath: String, actualExtension: String?) {
+ _jobs.update { list -> list.map { if (it.itemId == itemId) it.copy(status = JobStatus.COMPLETED, progress = 1f, resultFilePath = filePath, actualExtension = actualExtension) else it } }
+ }
+
+ fun markPublished(itemId: String) {
+ _jobs.update { list -> list.map { if (it.itemId == itemId) it.copy(published = true) else it } }
+ }
+
+ fun markFailed(itemId: String, error: String, errorType: String?) {
+ _jobs.update { list -> list.map { if (it.itemId == itemId) it.copy(status = JobStatus.FAILED, error = error, errorType = errorType) else it } }
+ }
+
+ fun markCancelled(itemId: String) {
+ _jobs.update { list -> list.map { if (it.itemId == itemId) it.copy(status = JobStatus.CANCELLED) else it } }
+ }
+
+ fun retry(itemId: String) {
+ _jobs.update { list -> list.map { if (it.itemId == itemId) it.copy(status = JobStatus.QUEUED, error = null, errorType = null, progress = 0f) else it } }
+ }
+
+ /** Requeues downloads that failed waiting on [extensionId]'s verification. */
+ fun retryVerification(extensionId: String) {
+ _jobs.value
+ .filter {
+ it.status == JobStatus.FAILED && it.errorType == "verification_required" &&
+ it.downloadProvider.equals(extensionId, ignoreCase = true)
+ }
+ .forEach { retry(it.itemId) }
+ }
+
+ fun dismiss(itemId: String) {
+ _jobs.update { list -> list.filterNot { it.itemId == itemId } }
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadSettings.kt b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadSettings.kt
new file mode 100644
index 0000000000..a277d083b3
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadSettings.kt
@@ -0,0 +1,83 @@
+package com.theveloper.pixelplay.data.download
+
+import android.content.Context
+import android.content.SharedPreferences
+import androidx.security.crypto.EncryptedSharedPreferences
+import androidx.security.crypto.MasterKey
+import dagger.hilt.android.qualifiers.ApplicationContext
+import java.io.File
+import java.security.SecureRandom
+import android.util.Base64
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class DownloadSettings @Inject constructor(@ApplicationContext private val context: Context) {
+ private val prefs = context.getSharedPreferences("download_prefs", Context.MODE_PRIVATE)
+ val rootDir: File get() = File(context.filesDir, "downloads").apply { mkdirs() }
+
+ /**
+ * 32-byte master key for Go-side extension storage encryption, generated once
+ * and kept in EncryptedSharedPreferences (Android Keystore backed). The Go
+ * layer requires it via SetExtensionStorageMasterKey before InitExtensionSystem.
+ */
+ val extensionMasterKey: String by lazy {
+ val secure = runCatching {
+ val masterKey = MasterKey.Builder(context)
+ .setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
+ .build()
+ EncryptedSharedPreferences.create(
+ context,
+ "extension_key_prefs",
+ masterKey,
+ EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
+ EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM,
+ )
+ }.getOrNull()
+ // ponytail: plaintext fallback mirrors JellyfinRepository; upgrade path = fail
+ // closed instead, but then the whole download feature dies on Keystore errors.
+ val target: SharedPreferences = secure
+ ?: context.getSharedPreferences("extension_key_prefs_plain", Context.MODE_PRIVATE)
+ target.getString(KEY_MASTER_KEY, null) ?: SecureRandom().let { rng ->
+ val bytes = ByteArray(32).also(rng::nextBytes)
+ val encoded = Base64.encodeToString(bytes, Base64.NO_WRAP)
+ target.edit().putString(KEY_MASTER_KEY, encoded).apply()
+ encoded
+ }
+ }
+
+ /** SAF tree URI of the user-chosen destination folder; null until picked. */
+ var safTreeUri: String?
+ get() = prefs.getString(KEY_TREE_URI, null)
+ set(value) = prefs.edit().putString(KEY_TREE_URI, value).apply()
+
+ var defaultQuality: String
+ get() = prefs.getString(KEY_QUALITY, "flac") ?: "flac"
+ set(value) = prefs.edit().putString(KEY_QUALITY, value).apply()
+
+ /** Extension registry URL entered by the user; null until set. */
+ var registryUrl: String?
+ get() = prefs.getString(KEY_REGISTRY_URL, null)
+ set(value) = prefs.edit().putString(KEY_REGISTRY_URL, value).apply()
+
+ /** Last-chosen download provider extension id; remembered across sessions. */
+ var defaultProvider: String?
+ get() = prefs.getString(KEY_DEFAULT_PROVIDER, null)
+ set(value) = prefs.edit().putString(KEY_DEFAULT_PROVIDER, value).apply()
+
+ /** Extension used for search (customSearch); null = combined metadata search. */
+ var searchProvider: String?
+ get() = prefs.getString(KEY_SEARCH_PROVIDER, null)
+ set(value) = prefs.edit().putString(KEY_SEARCH_PROVIDER, value).apply()
+
+ fun clearSafTree() = prefs.edit().remove(KEY_TREE_URI).apply()
+
+ private companion object {
+ const val KEY_TREE_URI = "saf_tree_uri"
+ const val KEY_QUALITY = "default_quality"
+ const val KEY_REGISTRY_URL = "registry_url"
+ const val KEY_DEFAULT_PROVIDER = "default_download_provider"
+ const val KEY_SEARCH_PROVIDER = "search_provider"
+ const val KEY_MASTER_KEY = "extension_master_key"
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadWorker.kt b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadWorker.kt
new file mode 100644
index 0000000000..ced49295f0
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/download/DownloadWorker.kt
@@ -0,0 +1,267 @@
+package com.theveloper.pixelplay.data.download
+
+import android.app.Notification
+import android.app.NotificationChannel
+import android.app.NotificationManager
+import android.content.Context
+import android.content.pm.ServiceInfo
+import android.media.MediaScannerConnection
+import android.net.Uri
+import android.util.Log
+import androidx.core.app.NotificationCompat
+import androidx.core.app.NotificationManagerCompat
+import androidx.documentfile.provider.DocumentFile
+import androidx.hilt.work.HiltWorker
+import androidx.work.CoroutineWorker
+import androidx.work.ExistingWorkPolicy
+import androidx.work.ForegroundInfo
+import androidx.work.OneTimeWorkRequestBuilder
+import androidx.work.WorkManager
+import androidx.work.WorkerParameters
+import com.theveloper.pixelplay.R
+import dagger.assisted.Assisted
+import dagger.assisted.AssistedInject
+import java.io.File
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.isActive
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
+
+/**
+ * Serial download queue: claims queued jobs from [DownloadRepository], downloads
+ * via gobackend to a cache work file, publishes the result into the user's SAF
+ * folder, then media-scans it so the track lands in the local library.
+ */
+@HiltWorker
+class DownloadWorker @AssistedInject constructor(
+ @Assisted appContext: Context,
+ @Assisted params: WorkerParameters,
+ private val backend: DownloadBackendApi,
+ private val repository: DownloadRepository,
+ private val settings: DownloadSettings,
+ private val finalizer: DownloadFinalizer,
+) : CoroutineWorker(appContext, params) {
+
+ override suspend fun doWork(): Result = withContext(Dispatchers.IO) {
+ ensureNotificationChannel(applicationContext)
+ setForeground(createForegroundInfo(str(R.string.download_notif_starting)))
+ while (true) {
+ val job = repository.claimNextQueued() ?: break
+ val treeUri = settings.safTreeUri ?: run {
+ repository.markFailed(job.itemId, str(R.string.download_error_no_folder), "no_folder")
+ continue
+ }
+ process(job, treeUri)
+ }
+ Result.success()
+ }
+
+ private suspend fun process(job: DownloadJob, treeUri: String) {
+ // Per-item cache dir: Go writes "/ - " here and the extension
+ // picks the real extension. SAF publishing copies from it. Never output_fd.
+ val workDir = File(applicationContext.cacheDir, "downloads/${job.itemId}").apply { deleteRecursively(); mkdirs() }
+ try {
+ process(job, treeUri, workDir)
+ } finally {
+ workDir.deleteRecursively()
+ }
+ }
+
+ private suspend fun process(job: DownloadJob, treeUri: String, workDir: File) {
+ val track = job.track
+ val provider = job.downloadProvider
+ // Mirrors SpotiFLAC's _buildDownloadRequestPayload: service/download_provider = the
+ // chosen download extension (Go locks to it), source = the extension the track came from.
+ val request = DownloadRequest(
+ service = provider,
+ source = track.providerId,
+ trackName = track.name,
+ artistName = track.artists,
+ albumName = track.albumName,
+ albumArtist = track.albumArtist,
+ coverUrl = track.coverUrl.orEmpty(),
+ outputDir = workDir.absolutePath,
+ quality = job.quality,
+ downloadProvider = provider,
+ embedMetadata = true,
+ itemId = job.itemId,
+ durationMs = track.durationMs,
+ trackNumber = track.trackNumber,
+ discNumber = track.discNumber,
+ totalTracks = track.totalTracks,
+ totalDiscs = track.totalDiscs,
+ releaseDate = track.releaseDate.orEmpty(),
+ isrc = track.isrc.orEmpty(),
+ spotifyId = track.spotifyId?.takeIf { it.isNotBlank() } ?: track.id,
+ providerTrackId = track.providerTrackId?.takeIf { it.isNotBlank() } ?: knownProviderTrackId(track, provider),
+ deezerId = track.deezerId.orEmpty(),
+ tidalId = track.tidalId.orEmpty(),
+ qobuzId = track.qobuzId.orEmpty(),
+ genre = track.genre.orEmpty(),
+ label = track.label.orEmpty(),
+ copyright = track.copyright.orEmpty(),
+ composer = track.composer.orEmpty(),
+ explicit = track.explicit,
+ albumType = track.albumType.orEmpty(),
+ upc = track.upc.orEmpty(),
+ )
+ var seq = 0L
+ val result = coroutineScope {
+ val poller = launch {
+ while (isActive) {
+ val delta = backend.waitProgressDelta(seq, 400)
+ seq = delta.seq
+ repository.applyDelta(delta)
+ updateNotification(job, delta)
+ }
+ }
+ val r = backend.download(request)
+ poller.cancel()
+ r
+ }
+ when (result) {
+ is BackendResult.Failed ->
+ repository.markFailed(job.itemId, result.response.error ?: str(R.string.download_error_failed), result.response.errorType)
+ is BackendResult.Ok -> finalizeAndPublish(job, treeUri, result.value)
+ }
+ }
+
+ private fun finalizeAndPublish(job: DownloadJob, treeUri: String, response: DownloadResponse) {
+ val path = response.filePath?.takeIf { it.isNotBlank() && !it.startsWith("content://") }
+ var file = path?.let(::File)?.takeIf { it.isFile && it.length() > 0 } ?: run {
+ repository.markFailed(job.itemId, str(R.string.download_error_no_file), "no_file")
+ return
+ }
+ try {
+ val decryption = finalizer.decryptionFor(response)
+ if (decryption != null && !response.alreadyExists) {
+ notify(str(R.string.download_notif_decrypting, "${job.track.artists} - ${job.track.name}"))
+ file = try {
+ finalizer.decrypt(file, decryption)
+ } catch (e: Exception) {
+ Log.e(TAG, "Decrypt failed for ${job.itemId}", e)
+ repository.markFailed(job.itemId, e.message ?: str(R.string.download_error_decrypt), "decrypt_failed")
+ return
+ }
+ }
+ finalizer.writeTags(file, job.track, response)
+
+ val ext = file.extension.lowercase().ifEmpty {
+ response.actualExtension?.trimStart('.')?.lowercase().orEmpty().ifEmpty { "flac" }
+ }
+ val target = publish(file, treeUri, job, ext) ?: return
+ repository.markCompleted(job.itemId, target.toString(), ext)
+ MediaScannerConnection.scanFile(applicationContext, arrayOf(target.toString()), arrayOf(mimeFor(ext)), null)
+ repository.markPublished(job.itemId)
+ } finally {
+ file.delete() // Go may write outside workDir (extension data dir)
+ }
+ }
+
+ /** SpotiFLAC _knownProviderTrackId: the track's own id only counts for the provider it came from. */
+ private fun knownProviderTrackId(track: ExtTrack, provider: String): String {
+ val id = track.id.trim()
+ if (id.isEmpty()) return ""
+ val sep = id.indexOf(':')
+ if (track.providerId.isNotBlank() && track.providerId.equals(provider, ignoreCase = true)) {
+ return if (sep >= 0 && sep + 1 < id.length) id.substring(sep + 1) else id
+ }
+ return if (sep > 0 && id.substring(0, sep).equals(provider, ignoreCase = true)) id.substring(sep + 1) else ""
+ }
+
+ /** Copies [src] into the SAF tree as " - ." (collision-safe). Returns target uri or null after marking failed. */
+ private fun publish(src: File, treeUri: String, job: DownloadJob, ext: String): Uri? {
+ val dir = DocumentFile.fromTreeUri(applicationContext, Uri.parse(treeUri))
+ ?: run {
+ repository.markFailed(job.itemId, str(R.string.download_error_folder_unavailable), "no_folder")
+ return null
+ }
+ val base = sanitize("${job.track.artists.ifEmpty { "Unknown artist" }} - ${job.track.name}")
+ var name = "$base.$ext"
+ var n = 1
+ while (dir.findFile(name) != null) name = "$base (${n++}).$ext"
+ val target = dir.createFile(mimeFor(ext), name)
+ ?: run {
+ repository.markFailed(job.itemId, str(R.string.download_error_create_file), "saf_error")
+ return null
+ }
+ try {
+ applicationContext.contentResolver.openOutputStream(target.uri)?.use { out ->
+ src.inputStream().use { it.copyTo(out, DEFAULT_BUFFER_SIZE * 8) }
+ } ?: run {
+ repository.markFailed(job.itemId, str(R.string.download_error_open_file), "saf_error")
+ return null
+ }
+ } catch (e: Exception) {
+ repository.markFailed(job.itemId, e.message ?: str(R.string.download_error_publish), "saf_error")
+ return null
+ }
+ return target.uri
+ }
+
+ /** applicationContext follows the in-app language (AppCompatDelegate.setApplicationLocales). */
+ private fun str(id: Int, vararg args: Any): String = applicationContext.getString(id, *args)
+
+ private fun sanitize(s: String) = s.replace(Regex("[\\\\/:*?\"<>|]"), "_").trim().take(150)
+
+ private fun mimeFor(ext: String) = when (ext) {
+ "flac" -> "audio/flac"
+ "mp3" -> "audio/mpeg"
+ "m4a", "mp4" -> "audio/mp4"
+ "ogg", "opus" -> "audio/ogg"
+ "wav" -> "audio/wav"
+ else -> "audio/*"
+ }
+
+ private fun updateNotification(job: DownloadJob, delta: ProgressDelta) {
+ val p = delta.items[job.itemId] ?: return
+ notify(str(R.string.download_notif_progress, "${job.track.artists} - ${job.track.name}", (p.progress * 100).toInt()))
+ }
+
+ private fun notify(text: String) {
+ NotificationManagerCompat.from(applicationContext).notify(NOTIF_ID, buildNotification(text))
+ }
+
+ // dataSync type must match the manifest override on androidx.work's
+ // SystemForegroundService (required on API 34+; WorkManager ships none).
+ private fun createForegroundInfo(text: String) = ForegroundInfo(
+ NOTIF_ID,
+ buildNotification(text),
+ ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC,
+ )
+
+ private fun buildNotification(text: String): Notification =
+ NotificationCompat.Builder(applicationContext, CHANNEL_ID)
+ .setSmallIcon(android.R.drawable.stat_sys_download)
+ .setContentText(text)
+ .setOngoing(true)
+ .setOnlyAlertOnce(true)
+ .setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)
+ .build()
+
+ companion object {
+ private const val TAG = "DownloadWorker"
+ const val CHANNEL_ID = "download_channel"
+ const val NOTIF_ID = 4001
+ const val UNIQUE_WORK = "external_download"
+
+ fun ensureNotificationChannel(context: Context) {
+ val channel = NotificationChannel(
+ CHANNEL_ID,
+ context.getString(R.string.download_notif_channel),
+ NotificationManager.IMPORTANCE_LOW,
+ )
+ context.getSystemService(NotificationManager::class.java).createNotificationChannel(channel)
+ }
+
+ /** Enqueues the serial queue pass. APPEND_OR_REPLACE: appends to a running pass, replaces a dead one. */
+ fun enqueue(context: Context) {
+ WorkManager.getInstance(context).enqueueUniqueWork(
+ UNIQUE_WORK,
+ ExistingWorkPolicy.APPEND_OR_REPLACE,
+ OneTimeWorkRequestBuilder().build(),
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/model/Song.kt b/app/src/main/java/com/theveloper/pixelplay/data/model/Song.kt
index 951db81179..89d1fc4263 100644
--- a/app/src/main/java/com/theveloper/pixelplay/data/model/Song.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/data/model/Song.kt
@@ -42,6 +42,7 @@ data class Song(
val qqMusicMid: String? = null, // QQ Music song MID
val navidromeId: String? = null, // Navidrome song ID
val jellyfinId: String? = null, // Jellyfin item ID
+ val s3ObjectKey: String? = null // S3-compatible object key
) : Parcelable {
/**
* Returns the display string for artists.
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/s3/S3ApiService.kt b/app/src/main/java/com/theveloper/pixelplay/data/s3/S3ApiService.kt
new file mode 100644
index 0000000000..85e996b798
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/s3/S3ApiService.kt
@@ -0,0 +1,173 @@
+package com.theveloper.pixelplay.data.s3
+
+import android.util.Xml
+import com.theveloper.pixelplay.data.stream.CloudStreamSecurity
+import java.io.IOException
+import javax.inject.Inject
+import javax.inject.Singleton
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
+import okhttp3.OkHttpClient
+import okhttp3.Request
+import org.xmlpull.v1.XmlPullParser
+
+/** One "folder" = an S3 common prefix (e.g. `Music/`). */
+data class S3FolderEntry(
+ val prefix: String,
+ val songCount: Int
+)
+
+data class S3ObjectEntry(
+ val key: String,
+ val sizeBytes: Long,
+ val lastModified: String
+)
+
+data class S3ListPage(
+ val folders: List,
+ val objects: List,
+ val isTruncated: Boolean,
+ val continuationToken: String?
+)
+
+@Singleton
+class S3ApiService @Inject constructor(
+ private val okHttpClient: OkHttpClient
+) {
+
+ /**
+ * Lists one level of folders and (optionally all) objects under [prefix].
+ * With [delimiter] = "/" returns immediate sub-folders only.
+ */
+ suspend fun listObjects(
+ endpoint: String,
+ bucket: String,
+ accessKey: String,
+ secretKey: String,
+ region: String,
+ prefix: String = "",
+ delimiter: String? = "/",
+ continuationToken: String? = null,
+ maxKeys: Int = 1000
+ ): S3ListPage = withContext(Dispatchers.IO) {
+ val params = sortedMapOf("list-type" to "2")
+ if (prefix.isNotEmpty()) params["prefix"] = prefix
+ if (delimiter != null) params["delimiter"] = delimiter
+ params["max-keys"] = maxKeys.toString()
+ continuationToken?.let { params["continuation-token"] = it }
+
+ val request = S3SigV4.signedHeaders(
+ builder = Request.Builder(),
+ endpoint = endpoint,
+ bucket = bucket,
+ query = params,
+ accessKey = accessKey,
+ secretKey = secretKey,
+ region = region
+ ).build()
+
+ okHttpClient.newCall(request).execute().use { response ->
+ val body = response.body?.string().orEmpty()
+ if (!response.isSuccessful) {
+ throw IOException("S3 list failed (${response.code}): $body")
+ }
+ parseListBucketResult(body)
+ }
+ }
+
+ /** Lists every object under [prefix], following continuation tokens. */
+ suspend fun listAllObjects(
+ endpoint: String,
+ bucket: String,
+ accessKey: String,
+ secretKey: String,
+ region: String,
+ prefix: String,
+ maxKeys: Int = 1000
+ ): List {
+ val all = mutableListOf()
+ var token: String? = null
+ do {
+ val page = listObjects(
+ endpoint, bucket, accessKey, secretKey, region,
+ prefix = prefix, delimiter = null,
+ continuationToken = token, maxKeys = maxKeys
+ )
+ all += page.objects
+ token = if (page.isTruncated) page.continuationToken else null
+ } while (token != null)
+ return all
+ }
+
+ /** Cheap connectivity + credential check: a single-key listing. */
+ suspend fun ping(
+ endpoint: String,
+ bucket: String,
+ accessKey: String,
+ secretKey: String,
+ region: String
+ ) {
+ listObjects(endpoint, bucket, accessKey, secretKey, region, maxKeys = 1)
+ }
+
+ suspend fun presignGetUrl(
+ endpoint: String,
+ bucket: String,
+ objectKey: String,
+ accessKey: String,
+ secretKey: String,
+ region: String,
+ expiresInSeconds: Long = 3600
+ ): String {
+ CloudStreamSecurity.validateS3ObjectKey(objectKey)
+ return S3SigV4.presignGetUrl(
+ endpoint, bucket, objectKey, accessKey, secretKey, region, expiresInSeconds
+ )
+ }
+
+ internal fun parseListBucketResult(xml: String): S3ListPage {
+ val parser = Xml.newPullParser()
+ parser.setInput(xml.reader())
+ val folders = mutableListOf()
+ val objects = mutableListOf()
+ var isTruncated = false
+ var continuationToken: String? = null
+
+ var insideContents = false
+ var insideCommonPrefixes = false
+ var currentKey: String? = null
+ var currentSize = 0L
+
+ var eventType = parser.eventType
+ while (eventType != XmlPullParser.END_DOCUMENT) {
+ when (eventType) {
+ XmlPullParser.START_TAG -> when (parser.name) {
+ "Contents" -> {
+ insideContents = true
+ currentKey = null
+ currentSize = 0L
+ }
+ "CommonPrefixes" -> insideCommonPrefixes = true
+ "Key" -> if (insideContents) currentKey = parser.nextText()
+ "Size" -> if (insideContents) currentSize = parser.nextText()?.toLongOrNull() ?: 0L
+ "Prefix" -> if (insideCommonPrefixes) folders.add(
+ S3FolderEntry(prefix = parser.nextText().orEmpty(), songCount = 0)
+ )
+ "IsTruncated" -> isTruncated = parser.nextText().equals("true", ignoreCase = true)
+ "NextContinuationToken" -> continuationToken = parser.nextText()
+ }
+ XmlPullParser.END_TAG -> when (parser.name) {
+ "Contents" -> {
+ insideContents = false
+ currentKey?.takeIf { it.isNotEmpty() }?.let {
+ objects.add(S3ObjectEntry(key = it, sizeBytes = currentSize, lastModified = ""))
+ }
+ }
+ "CommonPrefixes" -> insideCommonPrefixes = false
+ }
+ }
+ eventType = parser.next()
+ }
+ return S3ListPage(folders, objects, isTruncated, continuationToken)
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/s3/S3Repository.kt b/app/src/main/java/com/theveloper/pixelplay/data/s3/S3Repository.kt
new file mode 100644
index 0000000000..d49d03a757
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/s3/S3Repository.kt
@@ -0,0 +1,550 @@
+package com.theveloper.pixelplay.data.s3
+
+import android.content.Context
+import android.content.SharedPreferences
+import android.media.MediaMetadataRetriever
+import android.net.Uri
+import androidx.security.crypto.EncryptedSharedPreferences
+import androidx.security.crypto.MasterKey
+import androidx.work.Constraints
+import androidx.work.ExistingWorkPolicy
+import androidx.work.NetworkType
+import androidx.work.OneTimeWorkRequestBuilder
+import androidx.work.WorkInfo
+import androidx.work.WorkManager
+import com.theveloper.pixelplay.data.database.AlbumEntity
+import com.theveloper.pixelplay.data.database.ArtistEntity
+import com.theveloper.pixelplay.data.database.MusicDao
+import com.theveloper.pixelplay.data.database.S3Dao
+import com.theveloper.pixelplay.data.database.S3FolderEntity
+import com.theveloper.pixelplay.data.database.S3SongEntity
+import com.theveloper.pixelplay.data.database.SongArtistCrossRef
+import com.theveloper.pixelplay.data.database.SongEntity
+import com.theveloper.pixelplay.data.database.SourceType
+import com.theveloper.pixelplay.data.stream.CloudMusicUtils
+import com.theveloper.pixelplay.data.worker.S3MetadataWorker
+import dagger.hilt.android.qualifiers.ApplicationContext
+import java.io.File
+import java.io.IOException
+import javax.inject.Inject
+import javax.inject.Singleton
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.async
+import kotlinx.coroutines.awaitAll
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.SharingStarted
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.combine
+import kotlinx.coroutines.flow.stateIn
+import kotlinx.coroutines.sync.Mutex
+import kotlinx.coroutines.sync.Semaphore
+import kotlinx.coroutines.sync.withLock
+import kotlinx.coroutines.sync.withPermit
+import kotlinx.coroutines.withContext
+import timber.log.Timber
+import kotlin.math.absoluteValue
+
+/** Data for one configured S3-compatible endpoint. */
+data class S3Connection(
+ val endpoint: String,
+ val region: String,
+ val bucket: String,
+ val accessKey: String,
+ val secretKey: String,
+ val prefix: String = ""
+) {
+ val endpointHost: String get() = endpoint.removePrefix("https://").removePrefix("http://").trimEnd('/')
+}
+
+@Singleton
+class S3Repository @Inject constructor(
+ private val api: S3ApiService,
+ private val dao: S3Dao,
+ private val musicDao: MusicDao,
+ @ApplicationContext private val context: Context
+) {
+ data class BulkSyncResult(
+ val folderCount: Int,
+ val syncedSongCount: Int,
+ val failedFolderCount: Int
+ )
+
+ private val prefs: SharedPreferences = createPrefs(context)
+ private val syncMutex = Mutex()
+
+ private val _isLoggedInFlow = MutableStateFlow(false)
+ val isLoggedInFlow: StateFlow = _isLoggedInFlow.asStateFlow()
+
+ init {
+ _isLoggedInFlow.value = getConnection() != null
+ }
+
+ private fun createPrefs(context: Context): SharedPreferences {
+ val masterKey = MasterKey.Builder(context)
+ .setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
+ .build()
+ return EncryptedSharedPreferences.create(
+ context,
+ "s3_prefs",
+ masterKey,
+ EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
+ EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
+ )
+ }
+
+ fun getConnection(): S3Connection? {
+ val endpoint = prefs.getString(KEY_ENDPOINT, null)?.takeIf { it.isNotBlank() } ?: return null
+ return S3Connection(
+ endpoint = endpoint.trimEnd('/'),
+ region = prefs.getString(KEY_REGION, null).orEmpty().ifBlank { "us-east-1" },
+ bucket = prefs.getString(KEY_BUCKET, null).orEmpty(),
+ accessKey = prefs.getString(KEY_ACCESS_KEY, null).orEmpty(),
+ secretKey = prefs.getString(KEY_SECRET_KEY, null).orEmpty(),
+ prefix = prefs.getString(KEY_PREFIX, null).orEmpty()
+ )
+ }
+
+ suspend fun connect(
+ endpoint: String,
+ region: String,
+ bucket: String,
+ accessKey: String,
+ secretKey: String,
+ prefix: String = ""
+ ): Result = withContext(Dispatchers.IO) {
+ runCatching {
+ val normalizedEndpoint = endpoint.trim().trimEnd('/')
+ require(normalizedEndpoint.startsWith("https://")) {
+ "Endpoint must use https:// (http is only reachable on plain-text-allowed networks)"
+ }
+ require(bucket.isNotBlank()) { "Bucket is required" }
+ require(accessKey.isNotBlank() && secretKey.isNotBlank()) { "Access keys are required" }
+
+ val connection = S3Connection(
+ endpoint = normalizedEndpoint,
+ region = region.trim().ifBlank { "us-east-1" },
+ bucket = bucket.trim(),
+ accessKey = accessKey.trim(),
+ secretKey = secretKey.trim(),
+ prefix = prefix.trim().trim('/').let { if (it.isEmpty()) "" else "$it/" }
+ )
+ // Fail fast on bad credentials / wrong bucket before persisting anything.
+ api.ping(
+ endpoint = connection.endpoint,
+ bucket = connection.bucket,
+ accessKey = connection.accessKey,
+ secretKey = connection.secretKey,
+ region = connection.region
+ )
+ prefs.edit()
+ .putString(KEY_ENDPOINT, connection.endpoint)
+ .putString(KEY_REGION, connection.region)
+ .putString(KEY_BUCKET, connection.bucket)
+ .putString(KEY_ACCESS_KEY, connection.accessKey)
+ .putString(KEY_SECRET_KEY, connection.secretKey)
+ .putString(KEY_PREFIX, connection.prefix)
+ .apply()
+ _isLoggedInFlow.value = true
+ }.onFailure { Timber.e(it, "S3 connect failed") }
+ }
+
+ suspend fun logout() = withContext(Dispatchers.IO) {
+ prefs.edit().clear().apply()
+ _isLoggedInFlow.value = false
+ dao.clearAllSongs()
+ dao.clearAllFolders()
+ musicDao.clearAllS3Songs()
+ }
+
+ fun getFolders(): Flow> = dao.getAllFolders()
+
+ fun userBucketLabel(): String? = getConnection()?.let { "${it.bucket}/${it.prefix.trimEnd('/')}".trimEnd('/') }
+
+ /** Lists immediate sub-folders of [prefix] (plus the objects at that level). */
+ suspend fun browseFolders(prefix: String): Result> =
+ withContext(Dispatchers.IO) {
+ runCatching {
+ val conn = requireNotNull(getConnection()) { "Not connected" }
+ val page = api.listObjects(
+ endpoint = conn.endpoint, bucket = conn.bucket,
+ accessKey = conn.accessKey, secretKey = conn.secretKey, region = conn.region,
+ prefix = prefix, delimiter = "/"
+ )
+ page.folders
+ }.onFailure { Timber.e(it, "S3 browse failed") }
+ }
+
+ /** Picks a folder (by prefix) and syncs every audio object under it. */
+ suspend fun addFolder(prefix: String): Result = withContext(Dispatchers.IO) {
+ runCatching {
+ val conn = requireNotNull(getConnection()) { "Not connected" }
+ val normalized = prefix.trim('/').let { if (it.isEmpty()) "" else "$it/" }
+ syncFolderInternal(conn, normalized)
+ countSongsInFolder(normalized)
+ }.onFailure { Timber.e(it, "S3 addFolder failed") }
+ }
+
+ suspend fun syncFolder(folderId: String): Result = withContext(Dispatchers.IO) {
+ runCatching {
+ val conn = requireNotNull(getConnection()) { "Not connected" }
+ syncFolderInternal(conn, folderId)
+ countSongsInFolder(folderId)
+ }.onFailure { Timber.e(it, "S3 syncFolder failed") }
+ }
+
+ suspend fun syncAllFoldersAndSongs(): BulkSyncResult = withContext(Dispatchers.IO) {
+ val conn = getConnection() ?: return@withContext BulkSyncResult(0, 0, 0)
+ syncMutex.withLock {
+ val folders = dao.getAllFoldersList()
+ var synced = 0
+ var failed = 0
+ folders.forEach { folder ->
+ runCatching {
+ syncFolderInternal(conn, folder.id)
+ synced += 1
+ }.onFailure {
+ failed += 1
+ Timber.e(it, "S3 sync failed for folder ${folder.id}")
+ }
+ }
+ BulkSyncResult(folders.size, synced, failed)
+ }
+ }
+
+ suspend fun removeFolder(folderId: String) = withContext(Dispatchers.IO) {
+ dao.deleteSongsByFolder(folderId)
+ dao.deleteFolder(folderId)
+ resyncUnifiedLibrary()
+ }
+
+ suspend fun presignGetUrl(objectKey: String, expiresInSeconds: Long = 3600): String =
+ withContext(Dispatchers.IO) {
+ val conn = requireNotNull(getConnection()) { "Not connected" }
+ api.presignGetUrl(
+ endpoint = conn.endpoint, bucket = conn.bucket, objectKey = objectKey,
+ accessKey = conn.accessKey, secretKey = conn.secretKey,
+ region = conn.region, expiresInSeconds = expiresInSeconds
+ )
+ }
+
+ // --- Internals ---
+
+ private suspend fun countSongsInFolder(folderId: String): Int {
+ val existing = dao.getAllS3SongsList().filter { it.folderId == folderId }
+ return existing.size
+ }
+
+ /** Lists every audio object under [folderId], replaces the folder's song set, refreshes folder row. */
+ private suspend fun syncFolderInternal(conn: S3Connection, folderId: String) {
+ val objects = api.listAllObjects(
+ endpoint = conn.endpoint, bucket = conn.bucket,
+ accessKey = conn.accessKey, secretKey = conn.secretKey, region = conn.region,
+ prefix = folderId
+ ).filter { it.key.isAudioFile() }
+
+ val now = System.currentTimeMillis()
+ // Tags are probed later in the background (S3MetadataWorker) — sync stays fast.
+ val entities = objects.mapNotNull { obj -> parseFileToEntity(obj, folderId) }
+
+ val oldSongs = dao.getAllS3SongsList().filter { it.folderId == folderId }
+ val newKeys = entities.map { it.objectKey }.toSet()
+ val removedIds = oldSongs.filter { it.objectKey !in newKeys }.map { it.id }
+
+ dao.insertSongs(entities)
+ scheduleMetadataProbe()
+ if (removedIds.isNotEmpty()) dao.deleteSongsByIds(removedIds)
+ // Removed objects disappear from the unified library via the ID diff in resyncUnifiedLibrary().
+
+ val folderName = folderId.trimEnd('/').substringAfterLast('/').ifBlank { conn.bucket }
+ dao.insertFolder(
+ S3FolderEntity(
+ id = folderId,
+ name = folderName,
+ songCount = entities.size,
+ lastSyncTime = now
+ )
+ )
+ resyncUnifiedLibrary()
+ }
+
+ /** Live state of the background tag-probe queue. */
+ data class ProbeQueueState(val isRunning: Boolean, val remaining: Int)
+
+ val probeQueueFlow: Flow = combine(
+ WorkManager.getInstance(context).getWorkInfosForUniqueWorkFlow("s3_metadata_probe"),
+ dao.countUnprobedFlow()
+ ) { infos, remaining ->
+ ProbeQueueState(
+ isRunning = infos.any {
+ it.state == WorkInfo.State.RUNNING || it.state == WorkInfo.State.ENQUEUED
+ },
+ remaining = remaining
+ )
+ }
+
+ /** Enqueues the background tag-probe queue (unique, network-constrained). */
+ fun scheduleMetadataProbe() {
+ val request = OneTimeWorkRequestBuilder()
+ .setConstraints(
+ Constraints.Builder()
+ .setRequiredNetworkType(NetworkType.CONNECTED)
+ .build()
+ )
+ .build()
+ WorkManager.getInstance(context).enqueueUniqueWork(
+ "s3_metadata_probe",
+ ExistingWorkPolicy.KEEP,
+ request
+ )
+ }
+
+ /** Mirrors all s3_songs into the unified `songs` table. */
+ suspend fun refreshUnifiedLibrary() = resyncUnifiedLibrary()
+
+ private suspend fun resyncUnifiedLibrary() {
+ val s3Songs = dao.getAllS3SongsList()
+ val existingUnifiedIds = musicDao.getAllS3SongIds()
+
+ if (s3Songs.isEmpty()) {
+ if (existingUnifiedIds.isNotEmpty()) musicDao.clearAllS3Songs()
+ return
+ }
+
+ val songs = ArrayList(s3Songs.size)
+ val artists = LinkedHashMap()
+ val albums = LinkedHashMap()
+ val crossRefs = mutableListOf()
+
+ s3Songs.forEach { s3Song ->
+ val songId = s3Song.objectKey.toUnifiedSongId()
+ val artistNames = CloudMusicUtils.parseArtistNames(s3Song.artist)
+ val primaryArtistName = artistNames.firstOrNull() ?: "Unknown Artist"
+ val primaryArtistId = primaryArtistName.toUnifiedArtistId()
+
+ artistNames.forEachIndexed { index, artistName ->
+ val artistId = artistName.toUnifiedArtistId()
+ artists.putIfAbsent(
+ artistId,
+ ArtistEntity(id = artistId, name = artistName, trackCount = 0, imageUrl = null)
+ )
+ crossRefs.add(SongArtistCrossRef(songId = songId, artistId = artistId, isPrimary = index == 0))
+ }
+
+ val albumName = s3Song.album.ifBlank { "Unknown Album" }
+ val albumId = albumName.toUnifiedAlbumId()
+ albums.putIfAbsent(
+ albumId,
+ AlbumEntity(
+ id = albumId,
+ title = albumName,
+ artistName = primaryArtistName,
+ artistId = primaryArtistId,
+ songCount = 0,
+ dateAdded = s3Song.dateAdded,
+ year = 0,
+ albumArtUriString = s3Song.albumArtUri
+ )
+ )
+
+ songs.add(
+ SongEntity(
+ id = songId,
+ title = s3Song.title,
+ artistName = s3Song.artist.ifBlank { primaryArtistName },
+ artistId = primaryArtistId,
+ albumArtist = null,
+ albumName = albumName,
+ albumId = albumId,
+ contentUriString = "s3://${s3Song.objectKey}",
+ albumArtUriString = s3Song.albumArtUri,
+ duration = s3Song.duration,
+ genre = S3_GENRE,
+ filePath = "",
+ parentDirectoryPath = S3_PARENT_DIRECTORY,
+ isFavorite = false,
+ lyrics = null,
+ trackNumber = 0,
+ year = 0,
+ dateAdded = s3Song.dateAdded.takeIf { it > 0 } ?: System.currentTimeMillis(),
+ mimeType = s3Song.mimeType,
+ bitrate = s3Song.bitrate,
+ sampleRate = null,
+ telegramChatId = null,
+ telegramFileId = null,
+ sourceType = SourceType.S3
+ )
+ )
+ }
+
+ val albumCounts = songs.groupingBy { it.albumId }.eachCount()
+ val finalAlbums = albums.values.map { it.copy(songCount = albumCounts[it.id] ?: 0) }
+
+ val currentIds = songs.map { it.id }.toSet()
+ val deletedIds = existingUnifiedIds.filter { it !in currentIds }
+
+ musicDao.incrementalSyncMusicData(
+ songs = songs,
+ albums = finalAlbums,
+ artists = artists.values.toList(),
+ crossRefs = crossRefs,
+ deletedSongIds = deletedIds
+ )
+ }
+
+ private class ProbedMeta(
+ val title: String?,
+ val artist: String?,
+ val album: String?,
+ val durationMs: Long?,
+ val albumArtUri: String?
+ )
+
+ /** Probes one batch of un-probed songs; returns true when more work likely remains. */
+ suspend fun probeUnprobedBatch(batchSize: Int = 8): Boolean = withContext(Dispatchers.IO) {
+ val batch = dao.getUnprobedBatch(batchSize)
+ if (batch.isEmpty()) return@withContext false
+ val limiter = Semaphore(permits = 4)
+ coroutineScope {
+ batch.map { entity ->
+ async {
+ limiter.withPermit {
+ val meta = probeMetadata(entity.objectKey)
+ dao.applyProbeResult(
+ id = entity.id,
+ title = meta?.title ?: entity.title,
+ artist = meta?.artist ?: entity.artist,
+ album = meta?.album ?: entity.album,
+ duration = meta?.durationMs ?: entity.duration,
+ albumArtUri = meta?.albumArtUri
+ )
+ }
+ }
+ }.awaitAll()
+ }
+ true
+ }
+
+ /** Reads embedded tags/artwork over a presigned partial fetch. Null on any failure. */
+ private suspend fun probeMetadata(objectKey: String): ProbedMeta? = withContext(Dispatchers.IO) {
+ runCatching {
+ val url = presignGetUrl(objectKey, expiresInSeconds = 600L)
+ val mmr = MediaMetadataRetriever()
+ try {
+ mmr.setDataSource(url, emptyMap())
+ fun meta(key: Int) = mmr.extractMetadata(key)?.trim()?.takeIf { it.isNotEmpty() }
+ val title = meta(MediaMetadataRetriever.METADATA_KEY_TITLE)
+ val artist = meta(MediaMetadataRetriever.METADATA_KEY_ARTIST)
+ ?: meta(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST)
+ val album = meta(MediaMetadataRetriever.METADATA_KEY_ALBUM)
+ val duration = meta(MediaMetadataRetriever.METADATA_KEY_DURATION)
+ ?.toLongOrNull()?.takeIf { it > 0L }
+ val artUri = mmr.embeddedPicture
+ ?.takeIf { it.isNotEmpty() }
+ ?.let { bytes -> saveAlbumArt(album, bytes) }
+ ProbedMeta(title, artist, album, duration, artUri)
+ } finally {
+ mmr.release()
+ }
+ }.onFailure { Timber.tag("S3Repo").d(it, "Tag probe failed for %s", objectKey) }
+ .getOrNull()
+ }
+
+ /** One artwork file per album (hash-named) under cacheDir/s3_artwork. */
+ private fun saveAlbumArt(album: String?, bytes: ByteArray): String {
+ val dir = File(context.cacheDir, "s3_artwork").apply { mkdirs() }
+ val name = (album ?: "").hashCode().absoluteValue.toString(16)
+ val file = File(dir, "$name.img")
+ if (!file.exists() || file.length() == 0L) {
+ file.writeBytes(bytes)
+ }
+ return Uri.fromFile(file).toString()
+ }
+
+ private fun parseFileToEntity(obj: S3ObjectEntry, folderId: String): S3SongEntity? {
+ val fileName = obj.key.substringAfterLast('/')
+ if (fileName.isBlank()) return null
+ val ext = fileName.substringAfterLast('.', "").lowercase()
+ val nameWithoutExt = fileName.substringBeforeLast('.')
+
+ // "Artist - Title.ext" or just "Title.ext"
+ val parts = nameWithoutExt.split(" - ", limit = 2)
+ val (artist, title) = if (parts.size == 2) {
+ parts[0].trim() to parts[1].trim()
+ } else {
+ "Unknown Artist" to nameWithoutExt.trim()
+ }
+
+ // Album = first path segment under the synced folder, else "S3".
+ val relativeDir = obj.key.removePrefix(folderId).substringBeforeLast('/')
+ val album = relativeDir.substringBefore('/').ifBlank { "S3" }
+
+ return S3SongEntity(
+ id = "${folderId}_${obj.key}",
+ objectKey = obj.key,
+ folderId = folderId,
+ title = title,
+ artist = artist,
+ album = album,
+ albumId = album.toUnifiedAlbumId(),
+ duration = 0L, // Not available from object metadata
+ mimeType = mimeTypeForExtension(ext),
+ bitrate = null,
+ fileSize = obj.sizeBytes,
+ dateAdded = System.currentTimeMillis(),
+ dateModified = System.currentTimeMillis()
+ )
+ }
+
+ private fun mimeTypeForExtension(ext: String): String = when (ext) {
+ "mp3" -> "audio/mpeg"
+ "flac" -> "audio/flac"
+ "wav" -> "audio/wav"
+ "ogg", "oga" -> "audio/ogg"
+ "opus" -> "audio/opus"
+ "m4a", "m4b" -> "audio/mp4"
+ "aac" -> "audio/aac"
+ "wma" -> "audio/x-ms-wma"
+ "aiff", "aif" -> "audio/aiff"
+ "ape" -> "audio/x-ape"
+ "dsf" -> "audio/dsf"
+ "wv" -> "audio/x-wavpack"
+ else -> "audio/mpeg"
+ }
+
+ private fun String.isAudioFile(): Boolean {
+ val ext = substringAfterLast('.', "").lowercase()
+ return ext in AUDIO_EXTENSIONS
+ }
+
+ private fun String.toUnifiedSongId(): Long =
+ -(S3_SONG_ID_OFFSET + hashCode().toLong().absoluteValue)
+
+ private fun String.toUnifiedAlbumId(): Long =
+ -(S3_ALBUM_ID_OFFSET + lowercase().hashCode().toLong().absoluteValue)
+
+ private fun String.toUnifiedArtistId(): Long =
+ -(S3_ARTIST_ID_OFFSET + lowercase().hashCode().toLong().absoluteValue)
+
+ companion object {
+ const val S3_SONG_ID_OFFSET = 15_000_000_000_000L
+ const val S3_ALBUM_ID_OFFSET = 16_000_000_000_000L
+ const val S3_ARTIST_ID_OFFSET = 17_000_000_000_000L
+ const val S3_PARENT_DIRECTORY = "/Cloud/S3"
+ const val S3_GENRE = "S3"
+
+ private val AUDIO_EXTENSIONS = setOf(
+ "mp3", "flac", "wav", "ogg", "oga", "opus", "m4a", "m4b",
+ "aac", "wma", "aiff", "aif", "ape", "dsf", "wv"
+ )
+
+ private const val KEY_ENDPOINT = "s3_endpoint"
+ private const val KEY_REGION = "s3_region"
+ private const val KEY_BUCKET = "s3_bucket"
+ private const val KEY_ACCESS_KEY = "s3_access_key"
+ private const val KEY_SECRET_KEY = "s3_secret_key"
+ private const val KEY_PREFIX = "s3_prefix"
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/s3/S3SigV4.kt b/app/src/main/java/com/theveloper/pixelplay/data/s3/S3SigV4.kt
new file mode 100644
index 0000000000..9187e2f4b6
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/s3/S3SigV4.kt
@@ -0,0 +1,203 @@
+package com.theveloper.pixelplay.data.s3
+
+import android.util.Base64
+import java.net.URI
+import javax.crypto.Mac
+import javax.crypto.spec.SecretKeySpec
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
+
+/**
+ * Minimal AWS Signature V4 signer for S3-compatible object storage
+ * (AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi...).
+ *
+ * Supports the two request styles the app needs:
+ * - [signedHeaders] : header-based auth for ListObjectsV2
+ * - [presignUrl] : query-string presigned GET for streaming (no headers needed)
+ */
+object S3SigV4 {
+
+ private const val ALGORITHM = "AWS4-HMAC-SHA256"
+ private const val SERVICE = "s3"
+
+ /** Amazon-style timestamp, e.g. 20130524T000000Z. */
+ data class AmzDate(val amzDate: String, val dateStamp: String)
+
+ fun amzDate(epochMillis: Long): AmzDate {
+ val utc = java.time.Instant.ofEpochMilli(epochMillis)
+ .atZone(java.time.ZoneOffset.UTC)
+ val dateStamp = String.format("%04d%02d%02d", utc.year, utc.monthValue, utc.dayOfMonth)
+ val amzDate = dateStamp + String.format(
+ "T%02d%02d%02dZ", utc.hour, utc.minute, utc.second
+ )
+ return AmzDate(amzDate, dateStamp)
+ }
+
+ /** Builds a full request URL with a presigned GET (default expiry: 1 hour). */
+ suspend fun presignGetUrl(
+ endpoint: String,
+ bucket: String,
+ objectKey: String,
+ accessKey: String,
+ secretKey: String,
+ region: String,
+ expiresInSeconds: Long = 3600,
+ nowMillis: Long = System.currentTimeMillis()
+ ): String = withContext(Dispatchers.Default) {
+ val host = hostOf(endpoint)
+ val date = amzDate(nowMillis)
+ val scope = "${date.dateStamp}/$region/$SERVICE/aws4_request"
+
+ val query = sortedMapOf(
+ "X-Amz-Algorithm" to ALGORITHM,
+ "X-Amz-Credential" to "$accessKey/$scope",
+ "X-Amz-Date" to date.amzDate,
+ "X-Amz-Expires" to expiresInSeconds.toString(),
+ "X-Amz-SignedHeaders" to "host"
+ )
+ val canonicalQuery = canonicalQueryString(query)
+ val canonicalUri = if (bucket.isBlank()) canonicalUri(objectKey)
+ else "/$bucket" + canonicalUri(objectKey) // path-style: bucket is part of the signed path
+ val canonicalRequest = listOf(
+ "GET",
+ canonicalUri,
+ canonicalQuery,
+ "host:$host\n",
+ "host",
+ "UNSIGNED-PAYLOAD"
+ ).joinToString("\n")
+
+ val signature = sign(secretKey, date.amzDate, date.dateStamp, region, canonicalRequest)
+
+ // canonicalUri already includes "/$bucket" (path-style) — don't prepend it again.
+ "$endpoint$canonicalUri?$canonicalQuery&X-Amz-Signature=$signature"
+ }
+
+ /** Adds header-based SigV4 auth (including the signed x-amz-* headers) to a builder.
+ * [query] entries are URI-encoded and sorted per the SigV4 canonical form.
+ * Request URL becomes "/?". */
+ suspend fun signedHeaders(
+ builder: okhttp3.Request.Builder,
+ endpoint: String,
+ bucket: String,
+ query: Map,
+ accessKey: String,
+ secretKey: String,
+ region: String,
+ nowMillis: Long = System.currentTimeMillis()
+ ): okhttp3.Request.Builder = withContext(Dispatchers.Default) {
+ val host = hostOf(endpoint)
+ val canonicalUri = if (bucket.isBlank()) "/" else "/$bucket"
+ val canonicalQuery = canonicalQueryString(query)
+ val date = amzDate(nowMillis)
+ val payloadHash = sha256Hex("")
+ val amzHeaders = sortedMapOf(
+ "x-amz-content-sha256" to payloadHash,
+ "x-amz-date" to date.amzDate
+ )
+
+ val canonicalRequest = listOf(
+ "GET",
+ canonicalUri,
+ canonicalQuery,
+ "host:$host\n" + amzHeaders.entries.joinToString("") { "${it.key}:${it.value}\n" },
+ "host;" + amzHeaders.keys.joinToString(";"),
+ payloadHash
+ ).joinToString("\n")
+
+ val signature = sign(secretKey, date.amzDate, date.dateStamp, region, canonicalRequest)
+ val credential = "$accessKey/${date.dateStamp}/$region/$SERVICE/aws4_request"
+
+ val url = buildString {
+ append(endpoint).append(canonicalUri)
+ if (canonicalQuery.isNotEmpty()) append('?').append(canonicalQuery)
+ }
+ builder.url(url)
+ builder.header("Host", host)
+ builder.header("x-amz-content-sha256", payloadHash)
+ builder.header("x-amz-date", date.amzDate)
+ builder.header(
+ "Authorization",
+ "$ALGORITHM Credential=$credential, SignedHeaders=host;${amzHeaders.keys.joinToString(";")}, Signature=$signature"
+ )
+ builder
+ }
+
+ private fun sign(
+ secretKey: String,
+ amzDate: String,
+ dateStamp: String,
+ region: String,
+ canonicalRequest: String
+ ): String {
+ val kDate = hmac("AWS4$secretKey".toByteArray(), dateStamp)
+ val kRegion = hmac(kDate, region)
+ val kService = hmac(kRegion, SERVICE)
+ val kSigning = hmac(kService, "aws4_request")
+ val stringToSign = listOf(
+ ALGORITHM,
+ amzDate,
+ "$dateStamp/$region/$SERVICE/aws4_request",
+ sha256Hex(canonicalRequest)
+ ).joinToString("\n")
+ return hex(hmac(kSigning, stringToSign))
+ }
+
+ internal fun signForTest(
+ secretKey: String,
+ dateStamp: String,
+ region: String,
+ canonicalRequest: String,
+ amzDate: String = "${dateStamp}T000000Z"
+ ): String = sign(secretKey, amzDate, dateStamp, region, canonicalRequest)
+
+ private fun hmac(key: ByteArray, data: String): ByteArray {
+ val mac = Mac.getInstance("HmacSHA256")
+ mac.init(SecretKeySpec(key, "HmacSHA256"))
+ return mac.doFinal(data.toByteArray())
+ }
+
+ fun sha256Hex(data: String): String {
+ val digest = java.security.MessageDigest.getInstance("SHA-256")
+ .digest(data.toByteArray())
+ return hex(digest)
+ }
+
+ private fun hex(bytes: ByteArray): String =
+ bytes.joinToString("") { "%02x".format(it) }
+
+ /** URI-encode each path segment, preserving '/'. */
+ fun canonicalUri(objectKey: String): String {
+ val path = objectKey.trim('/')
+ if (path.isEmpty()) return "/"
+ return "/" + path.split("/").joinToString("/") { uriEncode(it, encodeSlash = false) }
+ }
+
+ private fun canonicalQueryString(query: Map): String =
+ query.entries
+ .sortedBy { uriEncode(it.key) }
+ .joinToString("&") { (k, v) ->
+ "${uriEncode(k)}=${uriEncode(v)}"
+ }
+
+ /**
+ * Strict AWS URI-encoding: unreserved chars kept, everything else percent-encoded
+ * (space becomes %20). Base64 flag NO_WRAP | NO_PADDING for hex-safe use.
+ */
+ fun uriEncode(value: String, encodeSlash: Boolean = true): String {
+ val encoded = StringBuilder()
+ for (byte in value.toByteArray(Charsets.UTF_8)) {
+ val c = byte.toInt().toChar()
+ when {
+ c in 'A'..'Z' || c in 'a'..'z' || c in '0'..'9' ||
+ c == '-' || c == '.' || c == '_' || c == '~' -> encoded.append(c)
+ c == '/' && !encodeSlash -> encoded.append('/')
+ else -> encoded.append('%').append("%02X".format(byte.toInt() and 0xFF))
+ }
+ }
+ return encoded.toString()
+ }
+
+ // java.net.URI (bukan android.net.Uri) agar signer testable di plain JVM.
+ private fun hostOf(endpoint: String): String = runCatching { URI(endpoint).host }.getOrNull() ?: ""
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/s3/S3StreamProxy.kt b/app/src/main/java/com/theveloper/pixelplay/data/s3/S3StreamProxy.kt
new file mode 100644
index 0000000000..688f606753
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/s3/S3StreamProxy.kt
@@ -0,0 +1,51 @@
+package com.theveloper.pixelplay.data.s3
+
+import android.net.Uri
+import com.theveloper.pixelplay.data.stream.CloudStreamProxy
+import com.theveloper.pixelplay.data.stream.CloudStreamSecurity
+import okhttp3.OkHttpClient
+import javax.inject.Inject
+import javax.inject.Singleton
+
+/**
+ * Local HTTP proxy for S3-compatible object storage streaming.
+ *
+ * Resolves `s3://{objectKey}` URIs by presigning a GET URL (SigV4, 1 h)
+ * and proxying it through the shared [CloudStreamProxy] loopback server.
+ * Object keys contain '/', so route params are URL-encoded; Ktor decodes
+ * them back into [parseRouteParam].
+ */
+@Singleton
+class S3StreamProxy @Inject constructor(
+ private val repository: S3Repository,
+ okHttpClient: OkHttpClient
+) : CloudStreamProxy(okHttpClient) {
+
+ override val allowedHostSuffixes: Set
+ get() = repository.getConnection()?.endpointHost?.let { setOf(it) } ?: emptySet()
+
+ override val cacheExpirationMs = 55L * 60 * 1000 // presign TTL is 1 h
+ override val proxyTag = "S3StreamProxy"
+ override val routePath = "/s3/{key}"
+ override val routeParamName = "key"
+ override val uriScheme = "s3"
+ override val routePrefix = "/s3"
+
+ override fun parseRouteParam(value: String): String? =
+ value.takeIf { it.isNotBlank() }
+
+ override fun validateId(id: String): Boolean =
+ CloudStreamSecurity.validateS3ObjectKey(id)
+
+ override fun formatIdForUrl(id: String): String =
+ Uri.encode(id, "") // encode everything incl '/' and ' ' (URLEncoder's '+' would break)
+
+ override suspend fun resolveStreamUrl(id: String): String? =
+ repository.presignGetUrl(id)
+
+ // "s3://bucket-prefix/path/song.mp3" — Uri splits host/path at the first '/'.
+ override fun extractIdFromUri(uri: Uri): String? =
+ ((uri.host ?: "") + (uri.path ?: "")).removePrefix("/").takeIf { it.isNotEmpty() }
+
+ fun resolveS3Uri(uriString: String): String? = resolveUri(uriString)
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/service/MusicService.kt b/app/src/main/java/com/theveloper/pixelplay/data/service/MusicService.kt
index adab461ca8..64e9d2b8d6 100644
--- a/app/src/main/java/com/theveloper/pixelplay/data/service/MusicService.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/data/service/MusicService.kt
@@ -1669,7 +1669,10 @@ class MusicService : MediaLibraryService() {
for (index in 0 until mediaItemCount) {
val mediaItem = player.getMediaItemAt(index)
val metadata = mediaItem.mediaMetadata
- val uri = mediaItem.localConfiguration?.uri?.toString()
+ // Prefer the original cloud URI (stored at resolve time) — the live
+ // localConfiguration URI may be a loopback proxy URL whose port dies with the process.
+ val uri = metadata.extras?.getString(MediaItemBuilder.ORIGINAL_CONTENT_URI)
+ ?: mediaItem.localConfiguration?.uri?.toString()
?: metadata.extras?.getString(MediaItemBuilder.EXTERNAL_EXTRA_CONTENT_URI)
if (mediaItem.mediaId.isBlank() || uri.isNullOrBlank()) {
@@ -1817,6 +1820,11 @@ class MusicService : MediaLibraryService() {
if (snapshotItem.mediaId.isBlank() || snapshotItem.uri.isBlank()) {
return null
}
+ // Stale loopback proxy URL from an older snapshot — the proxy port died with the
+ // old process. Drop the item instead of queueing a guaranteed-connect-fail URI.
+ if (Uri.parse(snapshotItem.uri).host == "127.0.0.1") {
+ return null
+ }
val metadataBuilder = MediaMetadata.Builder()
snapshotItem.title?.takeIf { it.isNotBlank() }?.let { metadataBuilder.setTitle(it) }
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/service/player/DualPlayerEngine.kt b/app/src/main/java/com/theveloper/pixelplay/data/service/player/DualPlayerEngine.kt
index c8f05dc0a2..018656239e 100644
--- a/app/src/main/java/com/theveloper/pixelplay/data/service/player/DualPlayerEngine.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/data/service/player/DualPlayerEngine.kt
@@ -6,6 +6,7 @@ import android.media.AudioAttributes
import android.media.AudioFocusRequest
import android.media.AudioManager
import android.net.Uri
+import android.os.Bundle
import android.os.Build
import android.os.SystemClock
import android.util.LruCache
@@ -39,6 +40,7 @@ import androidx.media3.extractor.flac.FlacExtractor
import com.theveloper.pixelplay.data.diagnostics.PerformanceMetrics
import com.theveloper.pixelplay.data.model.TransitionSettings
import com.theveloper.pixelplay.data.telegram.TelegramRepository
+import com.theveloper.pixelplay.utils.MediaItemBuilder
import com.theveloper.pixelplay.utils.envelope
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.CoroutineScope
@@ -220,6 +222,7 @@ class DualPlayerEngine @Inject constructor(
private val navidromeStreamProxy: NavidromeStreamProxy,
private val jellyfinStreamProxy: com.theveloper.pixelplay.data.jellyfin.JellyfinStreamProxy,
private val gdriveStreamProxy: com.theveloper.pixelplay.data.gdrive.GDriveStreamProxy,
+ private val s3StreamProxy: com.theveloper.pixelplay.data.s3.S3StreamProxy,
private val telegramCacheManager: com.theveloper.pixelplay.data.telegram.TelegramCacheManager,
private val connectivityStateHolder: com.theveloper.pixelplay.presentation.viewmodel.ConnectivityStateHolder
) {
@@ -234,10 +237,10 @@ class DualPlayerEngine @Inject constructor(
private const val POST_TRANSITION_OFFLOAD_GUARD_MS = 2_000L
private const val MAX_AUXILIARY_TIMELINE_ITEMS = 200
private val LOCAL_MEDIA_SCHEMES = setOf("content", "file", "android.resource")
- private val REMOTE_MEDIA_SCHEMES = setOf("http", "https", "telegram", "netease", "qqmusic", "navidrome", "jellyfin", "gdrive")
+ private val REMOTE_MEDIA_SCHEMES = setOf("http", "https", "telegram", "netease", "qqmusic", "navidrome", "jellyfin", "gdrive", "s3")
// Subset of REMOTE_MEDIA_SCHEMES: schemes that need proxy resolution.
// http/https resolve directly and must NOT enter the resolvedUriCache lookup path.
- private val CLOUD_PROXY_SCHEMES = setOf("telegram", "netease", "qqmusic", "navidrome", "jellyfin", "gdrive")
+ private val CLOUD_PROXY_SCHEMES = setOf("telegram", "netease", "qqmusic", "navidrome", "jellyfin", "gdrive", "s3")
}
data class TransitionTarget(
@@ -1197,16 +1200,26 @@ class DualPlayerEngine @Inject constructor(
val uriString = uri.toString()
resolvedUriCache.get(uriString)?.let { return@withContext it }
- val resolved: Uri? = when (uri.scheme) {
+ suspend fun tryResolve(): Uri? = when (uri.scheme) {
"telegram" -> resolveTelegramUriAsync(uri, uriString)
"netease" -> resolveNeteaseUriAsync(uriString)
"qqmusic" -> resolveQqMusicUriAsync(uriString)
"navidrome" -> resolveNavidromeUriAsync(uriString)
"jellyfin" -> resolveJellyfinUriAsync(uriString)
"gdrive" -> resolveGDriveUriAsync(uriString)
+ "s3" -> resolveS3UriAsync(uriString)
else -> null
}
+ var resolved = tryResolve()
+ if (resolved == null) {
+ // Transient failures (proxy warm-up race, network blip) resolve on retry;
+ // a raw cloud URI would hit ExoPlayer as "unknown protocol" and error out.
+ Timber.tag("DualPlayerEngine").w("Cloud resolve failed for %s — retrying once", uri.scheme)
+ delay(400)
+ resolved = tryResolve()
+ }
+
if (resolved != null) {
resolvedUriCache.put(uriString, resolved)
return@withContext resolved
@@ -1269,6 +1282,21 @@ class DualPlayerEngine @Inject constructor(
gdriveStreamProxy.resolveGDriveUri(uriString)?.toUri()
}
+ private suspend fun resolveS3UriAsync(uriString: String): Uri? = withContext(Dispatchers.IO) {
+ if (!connectivityStateHolder.isOnline.value) {
+ Timber.tag("DualPlayerEngine").w("S3 resolve blocked: offline")
+ connectivityStateHolder.triggerOfflineBlockedEvent()
+ return@withContext null
+ }
+ if (!s3StreamProxy.ensureReady(5_000L)) {
+ Timber.tag("DualPlayerEngine").w("S3 resolve failed: proxy not ready within 5s")
+ return@withContext null
+ }
+ s3StreamProxy.resolveS3Uri(uriString)?.toUri().also {
+ if (it == null) Timber.tag("DualPlayerEngine").w("S3 resolve returned null for %s", uriString)
+ }
+ }
+
suspend fun resolveMediaItem(mediaItem: MediaItem): MediaItem {
val uri = mediaItem.localConfiguration?.uri ?: return mediaItem
val scheme = uri.scheme
@@ -1276,7 +1304,15 @@ class DualPlayerEngine @Inject constructor(
// reach resolveCloudUri, so checking them wastes an IO dispatch.
if (scheme !in CLOUD_PROXY_SCHEMES) return mediaItem
val resolvedUri = resolveCloudUri(uri)
- return if (resolvedUri == uri) mediaItem else mediaItem.buildUpon().setUri(resolvedUri).build()
+ if (resolvedUri == uri) return mediaItem
+ // Keep the original cloud URI in extras so queue persistence never stores a
+ // stale loopback proxy URL (its port dies with the process).
+ val metadata = mediaItem.mediaMetadata.buildUpon()
+ .setExtras((mediaItem.mediaMetadata.extras ?: Bundle()).apply {
+ putString(MediaItemBuilder.ORIGINAL_CONTENT_URI, uri.toString())
+ })
+ .build()
+ return mediaItem.buildUpon().setUri(resolvedUri).setMediaMetadata(metadata).build()
}
suspend fun prepareNext(target: TransitionTarget, startPositionMs: Long = 0L) {
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/stream/CloudStreamProxy.kt b/app/src/main/java/com/theveloper/pixelplay/data/stream/CloudStreamProxy.kt
index f8fb67866c..e383e451d8 100644
--- a/app/src/main/java/com/theveloper/pixelplay/data/stream/CloudStreamProxy.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/data/stream/CloudStreamProxy.kt
@@ -38,9 +38,15 @@ import java.util.concurrent.ConcurrentHashMap
*
* @param K The song identifier type (e.g. [String] for QQ Music songMid, [Long] for Netease songId)
*/
-abstract class CloudStreamProxy(
- private val okHttpClient: OkHttpClient
-) {
+abstract class CloudStreamProxy(okHttpClient: OkHttpClient) {
+
+ /** Upstream fetches need more patience than the shared 8s client — first byte
+ * from slow clouds (Cloudeka etc.) routinely exceeds it, esp. under load. */
+ private val upstreamClient = okHttpClient.newBuilder()
+ .connectTimeout(15, java.util.concurrent.TimeUnit.SECONDS)
+ .readTimeout(30, java.util.concurrent.TimeUnit.SECONDS)
+ .build()
+
// ─── Subclass Configuration ────────────────────────────────────────
protected abstract val allowedHostSuffixes: Set
@@ -212,7 +218,7 @@ abstract class CloudStreamProxy(
}
val response = withContext(Dispatchers.IO) {
- okHttpClient.newCall(requestBuilder.build()).execute()
+ upstreamClient.newCall(requestBuilder.build()).execute()
}
response.use { upstream ->
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/stream/CloudStreamSecurity.kt b/app/src/main/java/com/theveloper/pixelplay/data/stream/CloudStreamSecurity.kt
index 411346f09b..5e7aa92faf 100644
--- a/app/src/main/java/com/theveloper/pixelplay/data/stream/CloudStreamSecurity.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/data/stream/CloudStreamSecurity.kt
@@ -19,6 +19,7 @@ object CloudStreamSecurity {
private val QQMUSIC_SONG_MID_REGEX = Regex("^[A-Za-z0-9_-]{6,50}$")
private val NAVIDROME_SONG_ID_REGEX = Regex("^[A-Za-z0-9_-]{1,100}$")
private val JELLYFIN_ITEM_ID_REGEX = Regex("^[A-Za-z0-9]{1,100}$")
+ private val S3_OBJECT_KEY_REGEX = Regex("^[A-Za-z0-9][A-Za-z0-9/_. ()&'!,+\\-]{0,1023}$")
private val FORBIDDEN_HOSTS = setOf("localhost", "127.0.0.1", "0.0.0.0", "::1", "[::1]")
// DNS suffixes that only resolve on a local network: mDNS (.local), common
@@ -52,6 +53,12 @@ object CloudStreamSecurity {
fun validateJellyfinItemId(itemId: String): Boolean = JELLYFIN_ITEM_ID_REGEX.matches(itemId)
+ /** S3 object keys: printable, no leading '/', no '..' path traversal segments. */
+ fun validateS3ObjectKey(objectKey: String): Boolean {
+ if (!S3_OBJECT_KEY_REGEX.matches(objectKey)) return false
+ return objectKey.split('/').none { it == ".." }
+ }
+
fun validateRangeHeader(rawHeader: String?): RangeHeaderValidation {
if (rawHeader.isNullOrBlank()) {
return RangeHeaderValidation(isValid = true)
@@ -133,11 +140,13 @@ object CloudStreamSecurity {
val httpUrl = url.toHttpUrlOrNull() ?: return false
val host = httpUrl.host.lowercase()
- // Allow private IPs and .local for Subsonic/Navidrome/Jellyfin servers which are often self-hosted
+ // Allow private IPs and .local for Subsonic/Navidrome/Jellyfin servers and
+ // S3-compatible endpoints (MinIO, NAS gateways) which are often self-hosted
val isNavidromeStream = httpUrl.pathSegments.contains("stream.view")
val isJellyfinStream = httpUrl.pathSegments.contains("Audio") && httpUrl.pathSegments.contains("universal")
+ val isS3PresignedStream = httpUrl.queryParameter("X-Amz-Signature") != null
- if (!isNavidromeStream && !isJellyfinStream) {
+ if (!isNavidromeStream && !isJellyfinStream && !isS3PresignedStream) {
if (host in FORBIDDEN_HOSTS) return false
if (host.endsWith(".local")) return false
if (isPrivateIpv4Literal(host)) return false
diff --git a/app/src/main/java/com/theveloper/pixelplay/data/worker/S3MetadataWorker.kt b/app/src/main/java/com/theveloper/pixelplay/data/worker/S3MetadataWorker.kt
new file mode 100644
index 0000000000..51c92f1af6
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/data/worker/S3MetadataWorker.kt
@@ -0,0 +1,41 @@
+package com.theveloper.pixelplay.data.worker
+
+import android.content.Context
+import androidx.hilt.work.HiltWorker
+import androidx.work.CoroutineWorker
+import androidx.work.WorkerParameters
+import com.theveloper.pixelplay.data.s3.S3Repository
+import dagger.assisted.Assisted
+import dagger.assisted.AssistedInject
+import timber.log.Timber
+
+/**
+ * Background queue that reads embedded tags (title/artist/album/duration/artwork)
+ * for S3 songs whose metadata still comes from the filename. Processes batches
+ * until the `metadata_probed = 0` backlog is empty, then refreshes the unified library.
+ */
+@HiltWorker
+class S3MetadataWorker @AssistedInject constructor(
+ @Assisted appContext: Context,
+ @Assisted workerParams: WorkerParameters,
+ private val repository: S3Repository
+) : CoroutineWorker(appContext, workerParams) {
+
+ override suspend fun doWork(): Result = try {
+ var probed = 0
+ while (repository.probeUnprobedBatch()) {
+ probed += 8
+ setProgress(androidx.work.workDataOf(PROGRESS_PROBED to probed))
+ }
+ if (probed > 0) repository.refreshUnifiedLibrary()
+ Timber.tag("S3MetadataWorker").d("Tag probe finished (%d songs)", probed)
+ Result.success()
+ } catch (e: Exception) {
+ Timber.tag("S3MetadataWorker").w(e, "Tag probe failed")
+ Result.retry()
+ }
+
+ companion object {
+ const val PROGRESS_PROBED = "probed"
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/di/AppModule.kt b/app/src/main/java/com/theveloper/pixelplay/di/AppModule.kt
index 7f1d935994..3721e81a35 100644
--- a/app/src/main/java/com/theveloper/pixelplay/di/AppModule.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/di/AppModule.kt
@@ -165,7 +165,10 @@ object AppModule {
PixelPlayDatabase.MIGRATION_38_39,
PixelPlayDatabase.MIGRATION_39_40,
PixelPlayDatabase.MIGRATION_40_41,
- PixelPlayDatabase.MIGRATION_41_42
+ PixelPlayDatabase.MIGRATION_41_42,
+ PixelPlayDatabase.MIGRATION_42_43,
+ PixelPlayDatabase.MIGRATION_43_44,
+ PixelPlayDatabase.MIGRATION_44_45
)
.addCallback(PixelPlayDatabase.createRuntimeArtifactsCallback())
.setJournalMode(RoomDatabase.JournalMode.WRITE_AHEAD_LOGGING)
@@ -263,6 +266,12 @@ object AppModule {
return database.jellyfinDao()
}
+ @Singleton
+ @Provides
+ fun provideS3Dao(database: PixelPlayDatabase): com.theveloper.pixelplay.data.database.S3Dao {
+ return database.s3Dao()
+ }
+
@Provides
@Singleton
fun provideImageLoader(
diff --git a/app/src/main/java/com/theveloper/pixelplay/di/DownloadModule.kt b/app/src/main/java/com/theveloper/pixelplay/di/DownloadModule.kt
new file mode 100644
index 0000000000..c42198fad5
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/di/DownloadModule.kt
@@ -0,0 +1,16 @@
+package com.theveloper.pixelplay.di
+
+import com.theveloper.pixelplay.data.download.DownloadBackendApi
+import com.theveloper.pixelplay.data.download.GobackendDownloadBackend
+import dagger.Binds
+import dagger.Module
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+
+@Module
+@InstallIn(SingletonComponent::class)
+abstract class DownloadModule {
+ @Binds @Singleton
+ abstract fun bindDownloadBackend(impl: GobackendDownloadBackend): DownloadBackendApi
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/components/StreamingProviderSheet.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/components/StreamingProviderSheet.kt
index a75eeefa9c..fce1a8449b 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/components/StreamingProviderSheet.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/components/StreamingProviderSheet.kt
@@ -9,6 +9,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowForwardIos
import androidx.compose.material.icons.automirrored.rounded.KeyboardArrowRight
+import androidx.compose.material.icons.rounded.Download
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
@@ -17,6 +18,7 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.Painter
+import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
@@ -29,6 +31,7 @@ import com.theveloper.pixelplay.presentation.jellyfin.auth.JellyfinLoginActivity
import com.theveloper.pixelplay.presentation.navidrome.auth.NavidromeLoginActivity
import com.theveloper.pixelplay.presentation.netease.auth.NeteaseLoginActivity
import com.theveloper.pixelplay.presentation.qqmusic.auth.QqMusicLoginActivity
+import com.theveloper.pixelplay.presentation.s3.auth.S3LoginActivity
import com.theveloper.pixelplay.presentation.telegram.auth.TelegramLoginActivity
import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
@@ -49,6 +52,9 @@ fun StreamingProviderSheet(
onNavigateToNavidromeDashboard: () -> Unit = {},
isJellyfinLoggedIn: Boolean = false,
onNavigateToJellyfinDashboard: () -> Unit = {},
+ isS3LoggedIn: Boolean = false,
+ onNavigateToS3Dashboard: () -> Unit = {},
+ onOpenDownload: () -> Unit = {},
sheetState: SheetState = rememberModalBottomSheetState(
skipPartiallyExpanded = true
)
@@ -104,6 +110,18 @@ fun StreamingProviderSheet(
.clip(providerSegmentContainerShape),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
+ ProviderRow(
+ iconPainter = rememberVectorPainter(Icons.Rounded.Download),
+ iconTint = MaterialTheme.colorScheme.primary,
+ title = stringResource(R.string.download_title),
+ subtitle = stringResource(R.string.download_entry_subtitle),
+ shape = providerSegmentItemShape,
+ onClick = {
+ onOpenDownload()
+ onDismissRequest()
+ }
+ )
+
ProviderRow(
iconPainter = painterResource(R.drawable.telegram),
iconTint = Color(0xFF2AABEE),
@@ -160,6 +178,23 @@ fun StreamingProviderSheet(
}
)
+ ProviderRow(
+ iconPainter = painterResource(R.drawable.rounded_storage_24),
+ iconTint = MaterialTheme.colorScheme.tertiary,
+ title = "S3 Storage",
+ subtitle = if (isS3LoggedIn) "Connected" else "AWS S3 · R2 · B2 · MinIO · Wasabi",
+ shape = providerSegmentItemShape,
+ isConnected = isS3LoggedIn,
+ onClick = {
+ if (isS3LoggedIn) {
+ onNavigateToS3Dashboard()
+ } else {
+ context.startActivity(Intent(context, S3LoginActivity::class.java))
+ }
+ onDismissRequest()
+ }
+ )
+
ProviderRow(
iconPainter = painterResource(R.drawable.netease_cloud_music_logo_icon_206716__1_),
iconTint = Color(0xFFE85959),
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/download/DownloadScreen.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/download/DownloadScreen.kt
new file mode 100644
index 0000000000..87d2554629
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/download/DownloadScreen.kt
@@ -0,0 +1,1085 @@
+package com.theveloper.pixelplay.presentation.download
+
+import androidx.activity.compose.BackHandler
+import androidx.activity.compose.rememberLauncherForActivityResult
+import androidx.activity.result.contract.ActivityResultContracts
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.LazyRow
+import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.automirrored.rounded.ArrowBack
+import androidx.compose.material.icons.automirrored.rounded.KeyboardArrowRight
+import androidx.compose.material.icons.rounded.ArrowDropDown
+import androidx.compose.material.icons.rounded.CheckCircle
+import androidx.compose.material.icons.rounded.Close
+import androidx.compose.material.icons.rounded.Download
+import androidx.compose.material.icons.rounded.ErrorOutline
+import androidx.compose.material.icons.rounded.Extension
+import androidx.compose.material.icons.rounded.Refresh
+import androidx.compose.material.icons.rounded.Search
+import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.AssistChip
+import androidx.compose.material3.Button
+import androidx.compose.material3.Card
+import androidx.compose.material3.CardDefaults
+import androidx.compose.material3.CircularProgressIndicator
+import androidx.compose.material3.DropdownMenu
+import androidx.compose.material3.DropdownMenuItem
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
+import androidx.compose.material3.FilterChip
+import androidx.compose.material3.FilterChipDefaults
+import androidx.compose.material3.HorizontalDivider
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.LinearProgressIndicator
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.ModalBottomSheet
+import androidx.compose.material3.RadioButton
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.SnackbarHost
+import androidx.compose.material3.SnackbarHostState
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.material3.TopAppBar
+import androidx.compose.material3.pulltorefresh.PullToRefreshBox
+import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults
+import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.StrokeCap
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.platform.LocalUriHandler
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.unit.dp
+import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import coil.compose.AsyncImage
+import com.theveloper.pixelplay.R
+import com.theveloper.pixelplay.data.download.CollectionInfo
+import com.theveloper.pixelplay.data.download.DownloadJob
+import com.theveloper.pixelplay.data.download.ExtTrack
+import com.theveloper.pixelplay.data.download.FeedItem
+import com.theveloper.pixelplay.data.download.FeedSection
+import com.theveloper.pixelplay.data.download.InstalledExtension
+import com.theveloper.pixelplay.data.download.JobStatus
+import com.theveloper.pixelplay.data.download.SearchFilterOption
+import com.theveloper.pixelplay.data.download.collectionTypeOf
+import com.theveloper.pixelplay.presentation.components.MiniPlayerHeight
+import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun DownloadScreen(
+ viewModel: DownloadViewModel = hiltViewModel(),
+ onNavigateBack: () -> Unit,
+ onOpenExtensions: () -> Unit,
+) {
+ val context = LocalContext.current
+ val ui by viewModel.ui.collectAsStateWithLifecycle()
+ val snackbarHostState = remember { SnackbarHostState() }
+
+ val folderPicker = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocumentTree()) { uri ->
+ uri?.let { viewModel.onFolderPicked(it.toString()) }
+ }
+
+ LaunchedEffect(ui.error) {
+ ui.error?.let {
+ snackbarHostState.showSnackbar(it)
+ viewModel.consumeError()
+ }
+ }
+ LaunchedEffect(ui.jobs) { viewModel.checkPendingAuth() }
+ // Album/artist pages reuse the top bar back button instead of adding their own.
+ val detail = ui.details.lastOrNull()
+ BackHandler(enabled = detail != null) { viewModel.closeDetail() }
+
+ Scaffold(
+ topBar = {
+ TopAppBar(
+ title = {
+ Text(
+ stringResource(R.string.download_title),
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold,
+ )
+ },
+ navigationIcon = {
+ IconButton(onClick = { if (detail != null) viewModel.closeDetail() else onNavigateBack() }) {
+ Icon(Icons.AutoMirrored.Rounded.ArrowBack, contentDescription = stringResource(R.string.common_back))
+ }
+ },
+ actions = {
+ IconButton(onClick = onOpenExtensions) {
+ Icon(
+ Icons.Rounded.Extension,
+ contentDescription = stringResource(R.string.download_cd_extensions),
+ tint = MaterialTheme.colorScheme.secondary,
+ )
+ }
+ },
+ )
+ },
+ snackbarHost = { SnackbarHost(snackbarHostState) },
+ ) { paddingValues ->
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(paddingValues)
+ // Clear the main screen's bottom nav + mini player overlay.
+ .padding(bottom = MiniPlayerHeight + 24.dp)
+ .padding(horizontal = 16.dp),
+ ) {
+ if (!ui.safFolderSet) {
+ Card(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(vertical = 8.dp),
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.tertiaryContainer,
+ ),
+ ) {
+ Column(modifier = Modifier.padding(16.dp)) {
+ Text(
+ text = stringResource(R.string.download_no_folder),
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onTertiaryContainer,
+ )
+ Spacer(Modifier.height(8.dp))
+ Button(onClick = { folderPicker.launch(null) }) {
+ Text(stringResource(R.string.download_pick_folder), fontFamily = GoogleSansRounded)
+ }
+ }
+ }
+ }
+
+ if (detail != null) {
+ DetailPane(
+ detail = detail,
+ onDownload = viewModel::requestDownload,
+ onDownloadAll = { viewModel.requestDownloadAll(detail.tracks, detail.title) },
+ onOpenAlbum = { viewModel.openAlbum(it, detail.providerId) },
+ modifier = Modifier
+ .fillMaxWidth()
+ .weight(1f),
+ )
+ } else {
+ SmoothOutlinedField(
+ value = ui.query,
+ onValueChange = viewModel::onQueryChange,
+ modifier = Modifier.padding(vertical = 4.dp),
+ placeholder = ui.searchExtension?.searchBehavior?.placeholder?.takeIf { it.isNotBlank() }
+ ?: stringResource(R.string.download_search_hint),
+ enabled = !ui.searching,
+ keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
+ keyboardActions = KeyboardActions(onSearch = { viewModel.search(ui.query) }),
+ trailingIcon = {
+ if (ui.searching) {
+ CircularProgressIndicator(modifier = Modifier.size(20.dp), strokeWidth = 2.dp)
+ } else {
+ IconButton(onClick = { viewModel.search(ui.query) }) {
+ Icon(
+ Icons.Rounded.Search,
+ contentDescription = stringResource(R.string.download_cd_search),
+ )
+ }
+ }
+ },
+ )
+
+ if (ui.searchProviders.isNotEmpty()) {
+ SearchSourceBar(
+ providers = ui.searchProviders,
+ selected = ui.searchExtension,
+ filter = ui.searchFilter,
+ onProvider = viewModel::selectSearchProvider,
+ onFilter = viewModel::selectSearchFilter,
+ )
+ }
+
+ // Results, or the extension catalog until the user searches.
+ if (ui.results.isEmpty() && !ui.searching) {
+ FeedCatalog(
+ sections = ui.feed,
+ loading = ui.feedLoading,
+ onItemClick = viewModel::openFeedItem,
+ onRefresh = viewModel::loadFeed,
+ modifier = Modifier
+ .fillMaxWidth()
+ .weight(1f),
+ )
+ } else {
+ LazyColumn(
+ modifier = Modifier
+ .fillMaxWidth()
+ .weight(1f),
+ contentPadding = PaddingValues(vertical = 4.dp),
+ verticalArrangement = Arrangement.spacedBy(4.dp),
+ ) {
+ items(ui.results, key = { "${it.providerId}:${it.itemType}:${it.id}" }) { track ->
+ val type = track.collectionType
+ if (type != null) {
+ CollectionRow(
+ title = track.name,
+ subtitle = listOf(stringResource(collectionTypeLabel(type)), track.artists)
+ .filter { it.isNotBlank() }.joinToString(" · "),
+ coverUrl = track.coverUrl,
+ round = type == "artist",
+ onClick = { viewModel.openResult(track) },
+ )
+ } else {
+ DownloadResultRow(track = track, onEnqueue = { viewModel.requestDownload(track) })
+ }
+ }
+ }
+ }
+ }
+
+ // Queue: only takes space once something is queued.
+ if (ui.jobs.isNotEmpty()) {
+ HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
+ Row(
+ modifier = Modifier.padding(top = 12.dp, bottom = 8.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Text(
+ text = stringResource(R.string.download_queue),
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold,
+ )
+ Spacer(Modifier.width(8.dp))
+ Text(
+ text = ui.jobs.size.toString(),
+ style = MaterialTheme.typography.labelMedium,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSecondaryContainer,
+ modifier = Modifier
+ .clip(CircleShape)
+ .background(MaterialTheme.colorScheme.secondaryContainer)
+ .padding(horizontal = 8.dp, vertical = 2.dp),
+ )
+ }
+ LazyColumn(
+ modifier = Modifier
+ .fillMaxWidth()
+ .heightIn(max = 280.dp),
+ contentPadding = PaddingValues(bottom = 8.dp),
+ verticalArrangement = Arrangement.spacedBy(8.dp),
+ ) {
+ items(ui.jobs, key = { it.itemId }) { job ->
+ DownloadJobRow(job = job, viewModel = viewModel, modifier = Modifier.animateItem())
+ }
+ }
+ }
+ }
+
+ ui.authPrompt?.let { prompt ->
+ AuthCodeDialog(
+ prompt = prompt,
+ onSubmit = viewModel::submitAuthCode,
+ onDismiss = viewModel::dismissAuth,
+ )
+ }
+
+ ui.sheetTracks.firstOrNull()?.let { track ->
+ DownloadOptionsSheet(
+ track = track,
+ title = ui.sheetTitle,
+ providers = ui.downloadProviders,
+ installedCount = ui.installedAll.size,
+ lastProvider = ui.lastProvider,
+ lastQuality = ui.lastQuality,
+ onDownload = { providerId, quality -> viewModel.enqueue(ui.sheetTracks, quality, providerId) },
+ onDismiss = viewModel::dismissDownloadSheet,
+ )
+ }
+ }
+}
+
+@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
+@Composable
+private fun FeedCatalog(
+ sections: List,
+ loading: Boolean,
+ onItemClick: (FeedItem) -> Unit,
+ onRefresh: () -> Unit,
+ modifier: Modifier = Modifier,
+) {
+ // Pull down to reload the extension home feed; the old sections stay visible meanwhile.
+ // Same expressive loading indicator as the library tabs.
+ val pullState = rememberPullToRefreshState()
+ PullToRefreshBox(
+ isRefreshing = loading,
+ onRefresh = onRefresh,
+ state = pullState,
+ modifier = modifier,
+ indicator = {
+ PullToRefreshDefaults.LoadingIndicator(
+ state = pullState,
+ isRefreshing = loading,
+ modifier = Modifier.align(Alignment.TopCenter),
+ )
+ },
+ ) {
+ LazyColumn(
+ modifier = Modifier.fillMaxSize(),
+ contentPadding = PaddingValues(vertical = 8.dp),
+ verticalArrangement = Arrangement.spacedBy(20.dp),
+ ) {
+ // Empty feed still needs a scrollable child, or the pull gesture never reaches the box.
+ if (sections.isEmpty()) item { Spacer(Modifier.fillParentMaxSize()) }
+ items(sections, key = { "${it.uri}:${it.title}" }) { section ->
+ Column {
+ Text(
+ text = section.title,
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.padding(bottom = 10.dp),
+ )
+ LazyRow(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
+ items(section.items, key = { "${it.type}:${it.id}:${it.uri}" }) { item ->
+ FeedItemCard(item = item, onClick = { onItemClick(item) })
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+@Composable
+private fun FeedItemCard(item: FeedItem, onClick: () -> Unit) {
+ val isArtist = item.type.equals("artist", ignoreCase = true)
+ Column(
+ modifier = Modifier
+ .width(136.dp)
+ .clip(RoundedCornerShape(16.dp))
+ .clickable(onClick = onClick),
+ ) {
+ AsyncImage(
+ model = item.coverUrl,
+ contentDescription = null,
+ contentScale = ContentScale.Crop,
+ modifier = Modifier
+ .size(136.dp)
+ .clip(if (isArtist) CircleShape else RoundedCornerShape(16.dp))
+ .background(MaterialTheme.colorScheme.surfaceContainerHigh),
+ )
+ Text(
+ text = item.name,
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.SemiBold,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.padding(top = 8.dp),
+ )
+ val subtitle = item.artists.ifBlank { item.description.orEmpty() }
+ if (subtitle.isNotBlank()) {
+ Text(
+ text = subtitle,
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ }
+}
+
+/** Extension source picker + its search filters (songs / albums / artists / playlists). */
+@Composable
+private fun SearchSourceBar(
+ providers: List,
+ selected: InstalledExtension?,
+ filter: String?,
+ onProvider: (String) -> Unit,
+ onFilter: (String) -> Unit,
+) {
+ var menuOpen by remember { mutableStateOf(false) }
+ LazyRow(
+ modifier = Modifier.padding(bottom = 4.dp),
+ horizontalArrangement = Arrangement.spacedBy(8.dp),
+ ) {
+ item {
+ Box {
+ FilterChip(
+ selected = false,
+ onClick = { menuOpen = true },
+ label = { Text(selected?.displayName.orEmpty(), fontFamily = GoogleSansRounded) },
+ leadingIcon = { Icon(Icons.Rounded.Extension, contentDescription = null, modifier = Modifier.size(FilterChipDefaults.IconSize)) },
+ trailingIcon = { Icon(Icons.Rounded.ArrowDropDown, contentDescription = stringResource(R.string.download_search_source)) },
+ shape = CircleShape,
+ border = null,
+ colors = FilterChipDefaults.filterChipColors(
+ containerColor = MaterialTheme.colorScheme.tertiaryContainer,
+ labelColor = MaterialTheme.colorScheme.onTertiaryContainer,
+ iconColor = MaterialTheme.colorScheme.onTertiaryContainer,
+ ),
+ )
+ DropdownMenu(expanded = menuOpen, onDismissRequest = { menuOpen = false }) {
+ providers.forEach { ext ->
+ DropdownMenuItem(
+ text = { Text(ext.displayName, fontFamily = GoogleSansRounded) },
+ onClick = {
+ menuOpen = false
+ onProvider(ext.id)
+ },
+ )
+ }
+ }
+ }
+ }
+ items(selected?.searchBehavior?.filters.orEmpty(), key = { it.id }) { option ->
+ // Same pill chips as the library SearchScreen filters.
+ val isSelected = option.id == filter
+ FilterChip(
+ selected = isSelected,
+ onClick = { onFilter(option.id) },
+ label = { Text(filterLabel(option), fontFamily = GoogleSansRounded) },
+ shape = CircleShape,
+ border = null,
+ colors = FilterChipDefaults.filterChipColors(
+ containerColor = MaterialTheme.colorScheme.secondaryContainer,
+ labelColor = MaterialTheme.colorScheme.onSecondaryContainer,
+ selectedContainerColor = MaterialTheme.colorScheme.primary,
+ selectedLabelColor = MaterialTheme.colorScheme.onPrimary,
+ ),
+ leadingIcon = if (isSelected) {
+ {
+ Icon(
+ painter = painterResource(R.drawable.rounded_check_circle_24),
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.onPrimary,
+ modifier = Modifier.size(FilterChipDefaults.IconSize),
+ )
+ }
+ } else null,
+ )
+ }
+ }
+}
+
+@Composable
+private fun filterLabel(option: SearchFilterOption): String =
+ when (collectionTypeOf(option.id) ?: option.id.lowercase().removeSuffix("s")) {
+ "album" -> stringResource(R.string.library_tab_albums)
+ "artist" -> stringResource(R.string.library_tab_artists)
+ "playlist" -> stringResource(R.string.library_tab_playlists)
+ "track", "song" -> stringResource(R.string.library_tab_songs)
+ else -> option.label.ifEmpty { option.id }
+ }
+
+private fun collectionTypeLabel(type: String): Int = when (type) {
+ "artist" -> R.string.download_type_artist
+ "playlist" -> R.string.download_type_playlist
+ else -> R.string.download_type_album
+}
+
+@Composable
+private fun CollectionRow(
+ title: String,
+ subtitle: String,
+ coverUrl: String?,
+ round: Boolean,
+ onClick: () -> Unit,
+) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .clip(RoundedCornerShape(12.dp))
+ .clickable(onClick = onClick)
+ .padding(vertical = 4.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ AsyncImage(
+ model = coverUrl,
+ contentDescription = null,
+ contentScale = ContentScale.Crop,
+ modifier = Modifier
+ .size(56.dp)
+ .clip(if (round) CircleShape else RoundedCornerShape(12.dp))
+ .background(MaterialTheme.colorScheme.surfaceContainerHigh),
+ )
+ Spacer(Modifier.width(12.dp))
+ Column(modifier = Modifier.weight(1f)) {
+ Text(
+ text = title,
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ if (subtitle.isNotBlank()) {
+ Text(
+ text = subtitle,
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ }
+ Icon(
+ Icons.AutoMirrored.Rounded.KeyboardArrowRight,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
+}
+
+/** Album / playlist / artist page opened from search or the catalog. */
+@Composable
+private fun DetailPane(
+ detail: DownloadViewModel.Detail,
+ onDownload: (ExtTrack) -> Unit,
+ onDownloadAll: () -> Unit,
+ onOpenAlbum: (CollectionInfo) -> Unit,
+ modifier: Modifier = Modifier,
+) {
+ val isArtist = detail.type == "artist"
+ LazyColumn(
+ modifier = modifier,
+ contentPadding = PaddingValues(vertical = 4.dp),
+ verticalArrangement = Arrangement.spacedBy(4.dp),
+ ) {
+ item(key = "header") {
+ Column {
+ Row(
+ modifier = Modifier.padding(vertical = 8.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ AsyncImage(
+ model = detail.coverUrl,
+ contentDescription = null,
+ contentScale = ContentScale.Crop,
+ modifier = Modifier
+ .size(112.dp)
+ .clip(if (isArtist) CircleShape else RoundedCornerShape(16.dp))
+ .background(MaterialTheme.colorScheme.surfaceContainerHigh),
+ )
+ Spacer(Modifier.width(16.dp))
+ Column(modifier = Modifier.weight(1f)) {
+ Text(
+ text = stringResource(collectionTypeLabel(detail.type)),
+ style = MaterialTheme.typography.labelLarge,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.primary,
+ )
+ Text(
+ text = detail.title,
+ style = MaterialTheme.typography.titleLarge,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold,
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis,
+ )
+ if (detail.subtitle.isNotBlank()) {
+ Text(
+ text = detail.subtitle,
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ if (!isArtist && detail.tracks.isNotEmpty()) {
+ Button(
+ onClick = onDownloadAll,
+ modifier = Modifier.padding(top = 8.dp),
+ shape = RoundedCornerShape(20.dp),
+ ) {
+ Icon(Icons.Rounded.Download, contentDescription = null, modifier = Modifier.size(18.dp))
+ Spacer(Modifier.width(8.dp))
+ Text(
+ stringResource(R.string.download_all, detail.tracks.size),
+ fontFamily = GoogleSansRounded,
+ )
+ }
+ }
+ }
+ }
+ }
+ }
+ when {
+ detail.loading -> item(key = "loading") {
+ Box(Modifier.fillMaxWidth().padding(32.dp), contentAlignment = Alignment.Center) {
+ CircularProgressIndicator()
+ }
+ }
+ detail.error != null -> item(key = "error") {
+ Text(
+ text = detail.error,
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.error,
+ modifier = Modifier.padding(vertical = 16.dp),
+ )
+ }
+ }
+ if (isArtist && detail.tracks.isNotEmpty()) {
+ item(key = "top-title") { SectionTitle(stringResource(R.string.download_top_tracks)) }
+ }
+ items(detail.tracks, key = { "t:${it.providerId}:${it.id}" }) { track ->
+ DownloadResultRow(track = track, onEnqueue = { onDownload(track) })
+ }
+ if (detail.albums.isNotEmpty()) {
+ item(key = "albums-title") { SectionTitle(stringResource(R.string.library_tab_albums)) }
+ items(detail.albums, key = { "a:${it.id}" }) { album ->
+ CollectionRow(
+ title = album.name,
+ subtitle = listOfNotNull(album.releaseDate?.take(4), album.albumType)
+ .filter { it.isNotBlank() }.joinToString(" · "),
+ coverUrl = album.coverUrl,
+ round = false,
+ onClick = { onOpenAlbum(album) },
+ )
+ }
+ }
+ }
+}
+
+@Composable
+private fun SectionTitle(text: String) {
+ Text(
+ text = text,
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold,
+ modifier = Modifier.padding(top = 12.dp, bottom = 4.dp),
+ )
+}
+
+@Composable
+private fun DownloadResultRow(track: ExtTrack, onEnqueue: () -> Unit) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(vertical = 4.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ AsyncImage(
+ model = track.coverUrl,
+ contentDescription = null,
+ contentScale = ContentScale.Crop,
+ modifier = Modifier
+ .size(56.dp)
+ .clip(RoundedCornerShape(12.dp)),
+ )
+ Spacer(Modifier.width(12.dp))
+ Column(modifier = Modifier.weight(1f)) {
+ Text(
+ text = track.name,
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ Text(
+ text = if (track.albumName.isEmpty()) track.artists
+ else stringResource(R.string.download_artists_album, track.artists, track.albumName),
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ if (track.providerId.isNotEmpty()) {
+ AssistChip(
+ onClick = {},
+ label = { Text(track.providerId, style = MaterialTheme.typography.labelSmall) },
+ modifier = Modifier.heightIn(min = 24.dp),
+ )
+ }
+ }
+ IconButton(onClick = onEnqueue) {
+ Icon(
+ Icons.Rounded.Download,
+ contentDescription = stringResource(R.string.download_cd_download),
+ tint = MaterialTheme.colorScheme.secondary,
+ )
+ }
+ }
+}
+
+@Composable
+private fun DownloadJobRow(job: DownloadJob, viewModel: DownloadViewModel, modifier: Modifier = Modifier) {
+ val context = LocalContext.current
+ val colors = MaterialTheme.colorScheme
+ val active = job.status == JobStatus.QUEUED || job.status == JobStatus.DOWNLOADING
+ val statusColor = when (job.status) {
+ JobStatus.FAILED -> colors.error
+ JobStatus.COMPLETED -> colors.primary
+ else -> colors.onSurfaceVariant
+ }
+ Card(
+ modifier = modifier.fillMaxWidth(),
+ shape = RoundedCornerShape(20.dp),
+ colors = CardDefaults.cardColors(containerColor = colors.surfaceContainerHigh),
+ ) {
+ Row(
+ modifier = Modifier.padding(start = 12.dp, top = 12.dp, bottom = 12.dp, end = 4.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Box(contentAlignment = Alignment.Center) {
+ AsyncImage(
+ model = job.track.coverUrl,
+ contentDescription = null,
+ contentScale = ContentScale.Crop,
+ modifier = Modifier
+ .size(48.dp)
+ .clip(RoundedCornerShape(12.dp))
+ .background(colors.surfaceVariant),
+ )
+ val badge = when (job.status) {
+ JobStatus.COMPLETED -> Icons.Rounded.CheckCircle to colors.primary
+ JobStatus.FAILED -> Icons.Rounded.ErrorOutline to colors.error
+ else -> null
+ }
+ badge?.let { (icon, tint) ->
+ Box(
+ modifier = Modifier
+ .size(48.dp)
+ .clip(RoundedCornerShape(12.dp))
+ .background(colors.scrim.copy(alpha = 0.45f)),
+ contentAlignment = Alignment.Center,
+ ) {
+ Icon(icon, contentDescription = null, tint = tint, modifier = Modifier.size(24.dp))
+ }
+ }
+ }
+ Spacer(Modifier.width(12.dp))
+ Column(modifier = Modifier.weight(1f)) {
+ Text(
+ text = job.title,
+ style = MaterialTheme.typography.titleSmall,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.SemiBold,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ if (job.track.artists.isNotEmpty()) {
+ Text(
+ text = job.track.artists,
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = colors.onSurfaceVariant,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ if (active) {
+ Spacer(Modifier.height(8.dp))
+ val progressModifier = Modifier
+ .fillMaxWidth()
+ .height(6.dp)
+ // Queued or still resolving (no bytes yet): indeterminate.
+ if (job.status == JobStatus.QUEUED || job.bytesTotal <= 0) {
+ LinearProgressIndicator(
+ modifier = progressModifier,
+ trackColor = colors.secondaryContainer,
+ strokeCap = StrokeCap.Round,
+ gapSize = 0.dp,
+ )
+ } else {
+ LinearProgressIndicator(
+ progress = { job.progress.coerceIn(0f, 1f) },
+ modifier = progressModifier,
+ trackColor = colors.secondaryContainer,
+ strokeCap = StrokeCap.Round,
+ gapSize = 0.dp,
+ drawStopIndicator = {},
+ )
+ }
+ }
+ Spacer(Modifier.height(6.dp))
+ Text(
+ text = bytesLine(job, context),
+ style = MaterialTheme.typography.labelMedium,
+ fontFamily = GoogleSansRounded,
+ color = statusColor,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ if (job.status == JobStatus.FAILED && !job.error.isNullOrBlank()) {
+ Text(
+ text = job.error,
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = colors.onSurfaceVariant,
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ }
+ when (job.status) {
+ JobStatus.QUEUED, JobStatus.DOWNLOADING ->
+ IconButton(onClick = { viewModel.cancel(job.itemId) }) {
+ Icon(Icons.Rounded.Close, contentDescription = stringResource(R.string.download_cancel))
+ }
+ JobStatus.FAILED -> {
+ IconButton(onClick = { viewModel.retry(job.itemId) }) {
+ Icon(
+ Icons.Rounded.Refresh,
+ contentDescription = stringResource(R.string.download_retry),
+ tint = colors.primary,
+ )
+ }
+ IconButton(onClick = { viewModel.dismiss(job.itemId) }) {
+ Icon(Icons.Rounded.Close, contentDescription = stringResource(R.string.download_dismiss))
+ }
+ }
+ JobStatus.COMPLETED, JobStatus.CANCELLED ->
+ IconButton(onClick = { viewModel.dismiss(job.itemId) }) {
+ Icon(Icons.Rounded.Close, contentDescription = stringResource(R.string.download_dismiss))
+ }
+ }
+ }
+ }
+}
+
+private fun bytesLine(job: DownloadJob, context: android.content.Context): String {
+ val status = when (job.status) {
+ JobStatus.QUEUED -> context.getString(R.string.download_status_queued)
+ JobStatus.DOWNLOADING -> context.getString(R.string.download_status_downloading)
+ JobStatus.COMPLETED -> context.getString(R.string.download_status_completed)
+ JobStatus.FAILED -> context.getString(R.string.download_status_failed)
+ JobStatus.CANCELLED -> context.getString(R.string.download_status_cancelled)
+ }
+ if (job.bytesReceived <= 0 && job.bytesTotal <= 0) return status
+ val received = android.text.format.Formatter.formatShortFileSize(context, job.bytesReceived)
+ return if (job.bytesTotal > 0) {
+ "$status · $received / ${android.text.format.Formatter.formatShortFileSize(context, job.bytesTotal)}"
+ } else {
+ "$status · $received"
+ }
+}
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+private fun DownloadOptionsSheet(
+ track: ExtTrack,
+ title: String,
+ providers: List,
+ installedCount: Int,
+ lastProvider: String?,
+ lastQuality: String?,
+ onDownload: (providerId: String, quality: String) -> Unit,
+ onDismiss: () -> Unit,
+) {
+ // Search and download extensions may differ (e.g. found via a metadata-only extension).
+ // Preselect: the track's own extension if it can download, else the last one used,
+ // else the only one installed. Otherwise the user picks an extension first.
+ var selectedProvider by remember(track, providers) {
+ mutableStateOf(
+ (providers.firstOrNull { it.id.equals(track.providerId, ignoreCase = true) }
+ ?: providers.firstOrNull { it.id == lastProvider }
+ ?: providers.singleOrNull())?.id.orEmpty(),
+ )
+ }
+ // Quality IDs belong to the chosen extension, so the list appears once one is picked.
+ val qualityOptions = remember(selectedProvider, providers) {
+ providers.firstOrNull { it.id == selectedProvider }?.qualityOptions.orEmpty()
+ }
+ var selectedQuality by remember(selectedProvider, qualityOptions) {
+ mutableStateOf(
+ qualityOptions.firstOrNull { it.id == lastQuality }?.id
+ ?: qualityOptions.firstOrNull()?.id
+ ?: "LOSSLESS",
+ )
+ }
+
+ ModalBottomSheet(onDismissRequest = onDismiss) {
+ Column(modifier = Modifier.padding(horizontal = 24.dp)) {
+ Text(
+ text = stringResource(R.string.download_options_title),
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold,
+ )
+ Text(
+ text = title.ifEmpty { track.name },
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.padding(top = 2.dp),
+ )
+
+ Text(
+ text = stringResource(R.string.download_options_extension),
+ style = MaterialTheme.typography.labelLarge,
+ fontFamily = GoogleSansRounded,
+ modifier = Modifier.padding(top = 16.dp, bottom = 4.dp),
+ )
+ if (providers.isEmpty()) {
+ Text(
+ text = if (installedCount == 0) stringResource(R.string.download_options_no_provider)
+ else stringResource(R.string.download_options_not_download_provider),
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.error,
+ modifier = Modifier.padding(vertical = 8.dp),
+ )
+ } else {
+ providers.forEach { ext ->
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .clip(RoundedCornerShape(12.dp))
+ .clickable { selectedProvider = ext.id }
+ .padding(vertical = 6.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ RadioButton(selected = selectedProvider == ext.id, onClick = { selectedProvider = ext.id })
+ Column {
+ Text(ext.displayName, style = MaterialTheme.typography.bodyMedium, fontFamily = GoogleSansRounded)
+ Text(
+ text = ext.id,
+ style = MaterialTheme.typography.labelSmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
+ }
+ }
+ }
+
+ if (qualityOptions.isNotEmpty()) {
+ Text(
+ text = stringResource(R.string.download_options_quality),
+ style = MaterialTheme.typography.labelLarge,
+ fontFamily = GoogleSansRounded,
+ modifier = Modifier.padding(top = 16.dp, bottom = 4.dp),
+ )
+ qualityOptions.forEach { q ->
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .clip(RoundedCornerShape(12.dp))
+ .clickable { selectedQuality = q.id }
+ .padding(vertical = 6.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ RadioButton(selected = selectedQuality == q.id, onClick = { selectedQuality = q.id })
+ Column {
+ Text(
+ text = q.label.ifEmpty { q.id },
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ )
+ if (q.description.isNotEmpty()) {
+ Text(
+ text = q.description,
+ style = MaterialTheme.typography.labelSmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
+ }
+ }
+ }
+ }
+
+ Button(
+ onClick = { onDownload(selectedProvider, selectedQuality) },
+ enabled = selectedProvider.isNotEmpty(),
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(top = 16.dp, bottom = 32.dp),
+ shape = RoundedCornerShape(20.dp),
+ ) {
+ Icon(Icons.Rounded.Download, contentDescription = null, modifier = Modifier.size(18.dp))
+ Spacer(Modifier.width(8.dp))
+ Text(stringResource(R.string.download_options_download), fontFamily = GoogleSansRounded)
+ }
+ }
+ }
+}
+
+@Composable
+private fun AuthCodeDialog(prompt: String, onSubmit: (String) -> Unit, onDismiss: () -> Unit) {
+ var code by remember { mutableStateOf("") }
+ AlertDialog(
+ onDismissRequest = onDismiss,
+ title = { Text(stringResource(R.string.download_auth_title), fontFamily = GoogleSansRounded) },
+ text = {
+ Column {
+ Text(
+ text = stringResource(R.string.download_auth_message, prompt),
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ )
+ Spacer(Modifier.height(12.dp))
+ SmoothOutlinedField(
+ value = code,
+ onValueChange = { code = it },
+ label = stringResource(R.string.download_auth_code_label),
+ isError = false,
+ )
+ }
+ },
+ confirmButton = {
+ TextButton(
+ onClick = { if (code.isNotBlank()) onSubmit(code.trim()) },
+ enabled = code.isNotBlank(),
+ ) {
+ Text(stringResource(R.string.download_auth_submit), fontFamily = GoogleSansRounded)
+ }
+ },
+ dismissButton = {
+ val uriHandler = LocalUriHandler.current
+ Row {
+ TextButton(onClick = onDismiss) {
+ Text(stringResource(R.string.download_auth_cancel), fontFamily = GoogleSansRounded)
+ }
+ // The browser redirects to spotiflac://session-grant, handled by ExtensionCallbackActivity.
+ if (prompt.startsWith("http", ignoreCase = true)) {
+ TextButton(onClick = { runCatching { uriHandler.openUri(prompt) }; onDismiss() }) {
+ Text(stringResource(R.string.download_auth_open), fontFamily = GoogleSansRounded)
+ }
+ }
+ }
+ },
+ )
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/download/DownloadViewModel.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/download/DownloadViewModel.kt
new file mode 100644
index 0000000000..a2ba5265a4
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/download/DownloadViewModel.kt
@@ -0,0 +1,353 @@
+package com.theveloper.pixelplay.presentation.download
+
+import android.content.Context
+import android.content.Intent
+import android.net.Uri
+import com.theveloper.pixelplay.R
+import com.theveloper.pixelplay.data.download.CollectionInfo
+import com.theveloper.pixelplay.data.download.DownloadBackendApi
+import com.theveloper.pixelplay.data.download.DownloadJob
+import com.theveloper.pixelplay.data.download.DownloadJson
+import com.theveloper.pixelplay.data.download.DownloadRepository
+import com.theveloper.pixelplay.data.download.DownloadSettings
+import com.theveloper.pixelplay.data.download.DownloadWorker
+import com.theveloper.pixelplay.data.download.ExtTrack
+import com.theveloper.pixelplay.data.download.FeedItem
+import com.theveloper.pixelplay.data.download.FeedSection
+import com.theveloper.pixelplay.data.download.InstalledExtension
+import com.theveloper.pixelplay.data.download.JobStatus
+import com.theveloper.pixelplay.data.download.collectionTypeOf
+import dagger.hilt.android.lifecycle.HiltViewModel
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import dagger.hilt.android.qualifiers.ApplicationContext
+import javax.inject.Inject
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.update
+import kotlinx.coroutines.launch
+import kotlinx.serialization.SerialName
+import kotlinx.serialization.Serializable
+
+/**
+ * Wire shape of GetExtensionPendingAuthJSON / GetAllPendingAuthRequestsJSON
+ * (SpotiFLAC go_backend exports_extensions.go): {"extension_id","auth_url",
+ * "callback_url"}. There is no prompt text — the auth_url IS the prompt.
+ */
+@Serializable
+private data class PendingAuth(
+ @SerialName("extension_id") val extensionId: String = "",
+ @SerialName("auth_url") val authUrl: String = "",
+ @SerialName("callback_url") val callbackUrl: String = "",
+)
+
+@HiltViewModel
+class DownloadViewModel @Inject constructor(
+ private val backend: DownloadBackendApi,
+ private val repository: DownloadRepository,
+ private val settings: DownloadSettings,
+ @ApplicationContext private val context: Context,
+) : ViewModel() {
+
+ data class UiState(
+ val query: String = "",
+ val results: List = emptyList(),
+ val searching: Boolean = false,
+ val error: String? = null,
+ val jobs: List = emptyList(),
+ val safFolderSet: Boolean = false,
+ val authRequestId: String? = null,
+ val authPrompt: String? = null,
+ val downloadProviders: List = emptyList(),
+ /** Total installed extensions regardless of type (for sheet messaging). */
+ val installedAll: List = emptyList(),
+ /** Tracks awaiting the extension/quality picker sheet; empty when hidden. */
+ val sheetTracks: List = emptyList(),
+ /** Sheet subtitle: the track name, or the album/playlist name for "download all". */
+ val sheetTitle: String = "",
+ /** Last provider/quality the user downloaded with; preselected in the sheet. */
+ val lastProvider: String? = null,
+ val lastQuality: String? = null,
+ /** Catalog shown before the user searches (extension getHomeFeed). */
+ val feed: List = emptyList(),
+ val feedProvider: String? = null,
+ val feedLoading: Boolean = false,
+ /** Extensions with customSearch (manifest searchBehavior); picked one drives search. */
+ val searchProviders: List = emptyList(),
+ val searchProvider: String? = null,
+ val searchFilter: String? = null,
+ /** Album/artist/playlist pages opened from results; last one is shown. */
+ val details: List = emptyList(),
+ ) {
+ val searchExtension: InstalledExtension? get() = searchProviders.firstOrNull { it.id == searchProvider }
+ }
+
+ data class Detail(
+ val type: String,
+ val id: String,
+ val providerId: String,
+ val title: String,
+ val subtitle: String = "",
+ val coverUrl: String? = null,
+ val loading: Boolean = true,
+ val error: String? = null,
+ val tracks: List = emptyList(),
+ val albums: List = emptyList(),
+ )
+
+ private val _ui = MutableStateFlow(
+ UiState(
+ safFolderSet = settings.safTreeUri != null,
+ lastProvider = settings.defaultProvider,
+ lastQuality = settings.defaultQuality,
+ ),
+ )
+ val ui: StateFlow = _ui.asStateFlow()
+
+ init {
+ loadDownloadProviders()
+ loadFeed()
+ viewModelScope.launch {
+ repository.jobs.collect { jobs ->
+ _ui.update { it.copy(jobs = jobs, safFolderSet = settings.safTreeUri != null) }
+ // Surface the auth dialog whenever a download fails with
+ // errorType == verification_required (e.g. Spotify/Amazon need
+ // login verification before downloading).
+ checkPendingAuth()
+ }
+ }
+ }
+
+ // Clearing the query brings the catalog back.
+ fun onQueryChange(query: String) =
+ _ui.update { it.copy(query = query, results = if (query.isBlank()) emptyList() else it.results, error = null) }
+
+ /** Loads the catalog from a homeFeed extension, preferring a search (non-download) one. */
+ fun loadFeed() {
+ if (_ui.value.feedLoading) return
+ _ui.update { it.copy(feedLoading = true) }
+ viewModelScope.launch(Dispatchers.IO) {
+ val candidates = runCatching { backend.listInstalled() }.getOrDefault(emptyList())
+ .filter { it.enabled && it.error == null && it.hasHomeFeed }
+ .sortedBy { it.isDownloadProvider }
+ for (ext in candidates) {
+ val sections = backend.homeFeed(ext.id).sections
+ .map { section -> section.copy(items = section.items.filter { it.name.isNotBlank() }) }
+ .filter { it.items.isNotEmpty() }
+ if (sections.isNotEmpty()) {
+ _ui.update { it.copy(feed = sections, feedProvider = ext.id, feedLoading = false) }
+ return@launch
+ }
+ }
+ _ui.update { it.copy(feedLoading = false) }
+ }
+ }
+
+ /** Tracks open the download sheet; albums/playlists/artists open their page. */
+ fun openFeedItem(item: FeedItem) {
+ val provider = item.providerId?.takeIf { it.isNotBlank() } ?: _ui.value.feedProvider.orEmpty()
+ val type = collectionTypeOf(item.type)
+ if (type == null) {
+ requestDownload(item.toTrack(provider))
+ } else {
+ openDetail(Detail(type, item.id, provider, item.name, item.artists, item.coverUrl))
+ }
+ }
+
+ /** Search result tap: collections open their page, tracks open the download sheet. */
+ fun openResult(track: ExtTrack) {
+ val type = track.collectionType ?: return requestDownload(track)
+ openDetail(Detail(type, track.id, track.providerId, track.name, track.artists, track.coverUrl))
+ }
+
+ fun openAlbum(album: CollectionInfo, providerId: String) =
+ openDetail(Detail("album", album.id, album.providerId?.takeIf { it.isNotBlank() } ?: providerId, album.name, album.artists, album.coverUrl))
+
+ fun closeDetail() = _ui.update { it.copy(details = it.details.dropLast(1)) }
+
+ private fun openDetail(detail: Detail) {
+ _ui.update { it.copy(details = it.details + detail) }
+ viewModelScope.launch(Dispatchers.IO) {
+ val loaded = runCatching { backend.providerMetadata(detail.providerId, detail.type, detail.id) }
+ .map { meta ->
+ val info = meta.albumInfo ?: meta.playlistInfo ?: meta.artistInfo
+ detail.copy(
+ loading = false,
+ title = info?.name?.takeIf { it.isNotBlank() } ?: detail.title,
+ subtitle = info?.artists?.takeIf { it.isNotBlank() } ?: detail.subtitle,
+ coverUrl = info?.coverUrl?.takeIf { it.isNotBlank() } ?: detail.coverUrl,
+ // Artist pages: top tracks, then albums + singles/releases.
+ tracks = (meta.trackList.ifEmpty { meta.topTracks })
+ .map { if (it.providerId.isBlank()) it.copy(providerId = detail.providerId) else it },
+ albums = (meta.albums + meta.releases).distinctBy { it.id },
+ )
+ }
+ .getOrElse { detail.copy(loading = false, error = it.message ?: context.getString(R.string.download_no_results)) }
+ // Replace the matching page only if the user is still on it (or under it).
+ _ui.update { state -> state.copy(details = state.details.map { if (it === detail) loaded else it }) }
+ }
+ }
+
+ private fun loadDownloadProviders() {
+ viewModelScope.launch(Dispatchers.IO) {
+ val installed = runCatching { backend.listInstalled() }.getOrDefault(emptyList())
+ val providers = installed.filter { it.isDownloadProvider && it.enabled && it.error == null }
+ val searchable = installed.filter { it.hasCustomSearch && it.enabled && it.error == null }
+ _ui.update { state ->
+ // Keep the saved/selected source while it is still installed; else the primary one.
+ val current = state.searchProvider ?: settings.searchProvider
+ val provider = searchable.firstOrNull { it.id == current }
+ ?: searchable.firstOrNull { it.searchBehavior?.primary == true }
+ ?: searchable.firstOrNull()
+ state.copy(
+ downloadProviders = providers,
+ installedAll = installed,
+ searchProviders = searchable,
+ searchProvider = provider?.id,
+ searchFilter = state.searchFilter?.takeIf { f -> provider?.searchBehavior?.filters?.any { it.id == f } == true }
+ ?: provider?.searchBehavior?.filters?.firstOrNull()?.id,
+ )
+ }
+ }
+ }
+
+ fun selectSearchProvider(id: String) {
+ val ext = _ui.value.searchProviders.firstOrNull { it.id == id } ?: return
+ settings.searchProvider = id
+ _ui.update { it.copy(searchProvider = id, searchFilter = ext.searchBehavior?.filters?.firstOrNull()?.id) }
+ rerunSearch()
+ }
+
+ fun selectSearchFilter(id: String) {
+ if (_ui.value.searchFilter == id) return
+ _ui.update { it.copy(searchFilter = id) }
+ rerunSearch()
+ }
+
+ private fun rerunSearch() {
+ val query = _ui.value.query
+ if (query.isNotBlank()) search(query)
+ }
+
+ /** Tap download: refresh provider list, then open the picker sheet. */
+ fun requestDownload(track: ExtTrack) = requestDownloadAll(listOf(track), track.name)
+
+ fun requestDownloadAll(tracks: List, title: String) {
+ if (tracks.isEmpty()) return
+ loadDownloadProviders()
+ _ui.update { it.copy(sheetTracks = tracks, sheetTitle = title) }
+ }
+
+ fun dismissDownloadSheet() = _ui.update { it.copy(sheetTracks = emptyList()) }
+
+ fun enqueue(tracks: List, quality: String, providerId: String) {
+ _ui.update { it.copy(sheetTracks = emptyList()) }
+ if (settings.safTreeUri == null) {
+ _ui.update { it.copy(error = context.getString(R.string.download_pick_folder_first)) }
+ return
+ }
+ settings.defaultQuality = quality
+ settings.defaultProvider = providerId
+ _ui.update { it.copy(lastProvider = providerId, lastQuality = quality) }
+ tracks.forEach { repository.enqueue(it, quality, providerId) }
+ DownloadWorker.enqueue(context)
+ }
+
+ fun search(query: String) = viewModelScope.launch(Dispatchers.IO) {
+ if (query.isBlank()) return@launch
+ val state = _ui.value
+ _ui.update { it.copy(query = query, searching = true, details = emptyList()) }
+ // Extension search honours the chosen filter (songs/albums/artists); otherwise the
+ // combined metadata search, which only returns tracks.
+ val provider = state.searchExtension
+ val result = runCatching {
+ if (provider != null) backend.customSearch(provider.id, query, state.searchFilter)
+ else backend.search(query)
+ }
+ val items = result.getOrDefault(emptyList())
+ _ui.update {
+ it.copy(
+ results = items,
+ searching = false,
+ error = when {
+ result.isFailure -> result.exceptionOrNull()?.message ?: context.getString(R.string.download_no_results)
+ items.isEmpty() -> context.getString(R.string.download_no_results)
+ else -> null
+ },
+ )
+ }
+ }
+
+ fun onFolderPicked(uri: String) {
+ runCatching {
+ context.contentResolver.takePersistableUriPermission(
+ Uri.parse(uri),
+ Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION,
+ )
+ }
+ settings.safTreeUri = uri
+ _ui.update { it.copy(safFolderSet = true) }
+ }
+
+ /** Called when a FAILED job with errorType "verification_required" appears. */
+ fun checkPendingAuth() {
+ val state = _ui.value
+ if (state.authRequestId != null) return
+ val job = state.jobs.firstOrNull {
+ it.status == JobStatus.FAILED && it.errorType == "verification_required"
+ } ?: return
+ viewModelScope.launch(Dispatchers.IO) {
+ // Verification belongs to the download extension, not the one the track was found with.
+ val extId = job.downloadProvider.ifEmpty { job.track.providerId }
+ val pending = if (extId.isNotEmpty()) {
+ decodePendingAuth(backend.pendingAuth(extId))
+ } else {
+ decodeAllPendingAuth().firstOrNull { it.authUrl.isNotEmpty() }
+ }
+ if (pending != null && pending.authUrl.isNotEmpty()) {
+ _ui.update {
+ it.copy(authRequestId = pending.extensionId.ifEmpty { extId }, authPrompt = pending.authUrl)
+ }
+ }
+ }
+ }
+
+ private fun decodePendingAuth(json: String): PendingAuth? =
+ runCatching { DownloadJson.decodeFromString(json.ifEmpty { "{}" }) }.getOrNull()
+ ?.takeIf { it.authUrl.isNotEmpty() || it.extensionId.isNotEmpty() }
+
+ /** Fallback when the extension id is unknown: list every pending auth request. */
+ private fun decodeAllPendingAuth(): List =
+ runCatching {
+ DownloadJson.decodeFromString>(gobackend.Gobackend.getAllPendingAuthRequestsJSON())
+ }.getOrDefault(emptyList())
+
+ fun submitAuthCode(code: String) {
+ val id = _ui.value.authRequestId ?: return
+ _ui.update { it.copy(authRequestId = null, authPrompt = null) }
+ viewModelScope.launch(Dispatchers.IO) {
+ runCatching { backend.submitAuthCode(id, code) }
+ // Retry the failed downloads now that the extension is authenticated.
+ repository.retryVerification(id)
+ DownloadWorker.enqueue(context)
+ }
+ }
+
+ fun cancel(itemId: String) {
+ viewModelScope.launch(Dispatchers.IO) { runCatching { backend.cancel(itemId) } }
+ repository.markCancelled(itemId)
+ }
+
+ fun retry(itemId: String) {
+ repository.retry(itemId)
+ DownloadWorker.enqueue(context)
+ }
+
+ fun dismiss(itemId: String) = repository.dismiss(itemId)
+
+ fun consumeError() = _ui.update { it.copy(error = null) }
+
+ fun dismissAuth() = _ui.update { it.copy(authRequestId = null, authPrompt = null) }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionCallbackActivity.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionCallbackActivity.kt
new file mode 100644
index 0000000000..a73ac40158
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionCallbackActivity.kt
@@ -0,0 +1,66 @@
+package com.theveloper.pixelplay.presentation.download
+
+import android.os.Bundle
+import android.util.Log
+import android.widget.Toast
+import androidx.activity.ComponentActivity
+import com.theveloper.pixelplay.R
+import com.theveloper.pixelplay.data.download.DownloadBackendApi
+import com.theveloper.pixelplay.data.download.DownloadRepository
+import com.theveloper.pixelplay.data.download.DownloadWorker
+import dagger.hilt.android.AndroidEntryPoint
+import javax.inject.Inject
+import kotlinx.coroutines.DelicateCoroutinesApi
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
+
+/**
+ * Receives the browser redirect after an extension verification (extensions hard-code
+ * spotiflac://session-grant as their callback), completes it in the backend and retries
+ * the downloads that were waiting on it. Finishes immediately; work continues in background.
+ */
+@AndroidEntryPoint
+class ExtensionCallbackActivity : ComponentActivity() {
+
+ @Inject lateinit var backend: DownloadBackendApi
+ @Inject lateinit var repository: DownloadRepository
+
+ @OptIn(DelicateCoroutinesApi::class)
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ val uri = intent?.data
+ finish()
+ if (uri == null || !uri.scheme.equals("spotiflac", ignoreCase = true)) return
+
+ val sessionGrant = uri.host.equals("session-grant", ignoreCase = true)
+ val code = (if (sessionGrant) uri.getQueryParameter("grant") ?: uri.getQueryParameter("code")
+ else uri.getQueryParameter("code"))?.trim().orEmpty()
+ val state = uri.getQueryParameter("state")?.trim().orEmpty()
+ if (code.isEmpty() || state.isEmpty()) {
+ Log.w(TAG, "Extension callback missing code or state")
+ return
+ }
+
+ val app = applicationContext
+ GlobalScope.launch(Dispatchers.IO) {
+ val extId = runCatching { backend.completeCallback(sessionGrant, state, code) }
+ .onFailure { Log.w(TAG, "Extension callback failed", it) }
+ .getOrNull()
+ if (extId != null) {
+ repository.retryVerification(extId)
+ DownloadWorker.enqueue(app)
+ }
+ withContext(Dispatchers.Main) {
+ Toast.makeText(
+ app,
+ if (extId != null) R.string.download_auth_success else R.string.download_auth_failed,
+ Toast.LENGTH_LONG,
+ ).show()
+ }
+ }
+ }
+
+ private companion object { const val TAG = "ExtensionCallback" }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionsScreen.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionsScreen.kt
new file mode 100644
index 0000000000..469586df19
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionsScreen.kt
@@ -0,0 +1,555 @@
+package com.theveloper.pixelplay.presentation.download
+
+import androidx.activity.compose.rememberLauncherForActivityResult
+import androidx.activity.result.contract.ActivityResultContracts
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.ui.draw.clip
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.automirrored.rounded.ArrowBack
+import androidx.compose.material.icons.outlined.Delete
+import androidx.compose.material.icons.rounded.Add
+import androidx.compose.material.icons.rounded.Edit
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.Card
+import androidx.compose.material3.CardDefaults
+import androidx.compose.material3.PrimaryTabRow
+import androidx.compose.material3.Tab
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.LinearProgressIndicator
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedCard
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.SnackbarHost
+import androidx.compose.material3.SnackbarHostState
+import androidx.compose.material3.Switch
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.material3.TopAppBar
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalUriHandler
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.unit.dp
+import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import com.theveloper.pixelplay.R
+import com.theveloper.pixelplay.presentation.components.MiniPlayerHeight
+import com.theveloper.pixelplay.presentation.screens.TabAnimation
+import com.theveloper.pixelplay.data.download.InstalledExtension
+import com.theveloper.pixelplay.data.download.RepoExtension
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.input.KeyboardType
+import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun ExtensionsScreen(
+ viewModel: ExtensionsViewModel = hiltViewModel(),
+ onNavigateBack: () -> Unit,
+) {
+ val ui by viewModel.ui.collectAsStateWithLifecycle()
+ val snackbarHostState = remember { SnackbarHostState() }
+ var selectedTab by rememberSaveable { mutableIntStateOf(0) }
+
+ // Refresh the (cached) registry listing every time the repo tab opens.
+ LaunchedEffect(selectedTab) {
+ if (selectedTab == 1) viewModel.browseRepo()
+ }
+
+ val filePicker = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocument()) { uri ->
+ uri?.let(viewModel::install)
+ }
+
+ LaunchedEffect(ui.error) {
+ ui.error?.let {
+ snackbarHostState.showSnackbar(it)
+ viewModel.consumeError()
+ }
+ }
+
+ Scaffold(
+ topBar = {
+ TopAppBar(
+ title = {
+ Text(
+ stringResource(R.string.extensions_title),
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold,
+ )
+ },
+ navigationIcon = {
+ IconButton(onClick = onNavigateBack) {
+ Icon(Icons.AutoMirrored.Rounded.ArrowBack, contentDescription = stringResource(R.string.common_back))
+ }
+ },
+ actions = {
+ TextButton(
+ onClick = { filePicker.launch(arrayOf("*/*")) },
+ enabled = !ui.installing,
+ ) {
+ Icon(
+ Icons.Rounded.Add,
+ contentDescription = null,
+ modifier = Modifier.size(18.dp),
+ )
+ Spacer(Modifier.width(4.dp))
+ Text(stringResource(R.string.extensions_install), fontFamily = GoogleSansRounded)
+ }
+ },
+ )
+ },
+ snackbarHost = {
+ // Lift above the main screen's bottom nav + mini player overlay.
+ SnackbarHost(snackbarHostState, modifier = Modifier.padding(bottom = MiniPlayerHeight + 24.dp))
+ },
+ ) { paddingValues ->
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(paddingValues)
+ // Clear the main screen's bottom nav + mini player overlay.
+ .padding(bottom = MiniPlayerHeight + 24.dp)
+ .padding(horizontal = 16.dp),
+ ) {
+ if (ui.installing) {
+ LinearProgressIndicator(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(vertical = 8.dp),
+ )
+ }
+ PrimaryTabRow(
+ selectedTabIndex = selectedTab,
+ modifier = Modifier
+ .fillMaxWidth()
+ .clip(CircleShape)
+ .background(MaterialTheme.colorScheme.surfaceContainerHighest)
+ .padding(5.dp),
+ containerColor = Color.Transparent,
+ divider = {},
+ indicator = {},
+ ) {
+ TabAnimation(
+ index = 0,
+ title = stringResource(R.string.extensions_tab_installed),
+ selectedIndex = selectedTab,
+ onClick = { selectedTab = 0 },
+ ) {
+ Text(
+ text = stringResource(R.string.extensions_tab_installed),
+ fontWeight = FontWeight.Bold,
+ maxLines = 1,
+ fontFamily = GoogleSansRounded,
+ )
+ }
+ TabAnimation(
+ index = 1,
+ title = stringResource(R.string.extensions_tab_repo),
+ selectedIndex = selectedTab,
+ onClick = { selectedTab = 1 },
+ ) {
+ Text(
+ text = stringResource(R.string.extensions_tab_repo),
+ fontWeight = FontWeight.Bold,
+ maxLines = 1,
+ fontFamily = GoogleSansRounded,
+ )
+ }
+ }
+ if (selectedTab == 1) {
+ val repoError = ui.repoError
+ val registryError = ui.registryError
+ when {
+ ui.registryEditing || ui.registryUrl == null -> RegistryUrlInput(
+ initialUrl = ui.registryUrl.orEmpty(),
+ error = registryError,
+ enabled = !ui.repoLoading,
+ onSubmit = viewModel::setRegistryUrl,
+ onCancel = if (ui.registryUrl != null) ({ viewModel.consumeRegistryEdit() }) else null,
+ modifier = Modifier.weight(1f),
+ )
+ ui.repoLoading -> TabPlaceholder(
+ stringResource(R.string.extensions_repo_loading),
+ modifier = Modifier.weight(1f),
+ )
+ repoError != null -> TabPlaceholder(
+ repoError,
+ modifier = Modifier.weight(1f),
+ color = MaterialTheme.colorScheme.error,
+ )
+ else -> LazyColumn(
+ modifier = Modifier
+ .fillMaxWidth()
+ .weight(1f),
+ contentPadding = PaddingValues(vertical = 8.dp),
+ verticalArrangement = Arrangement.spacedBy(8.dp),
+ ) {
+ items(ui.repoBrowse, key = { it.id }) { repoExtension ->
+ RepoExtensionRow(
+ extension = repoExtension,
+ installedVersion = ui.extensions.firstOrNull { it.id == repoExtension.id }?.version,
+ installing = ui.installing,
+ onInstall = { viewModel.installFromRepo(repoExtension.id) },
+ )
+ }
+ item {
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.Center,
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Text(
+ text = ui.registryUrl.orEmpty(),
+ style = MaterialTheme.typography.bodySmall,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.weight(1f, fill = false),
+ )
+ IconButton(onClick = viewModel::editRegistry) {
+ Icon(Icons.Rounded.Edit, contentDescription = stringResource(R.string.extensions_registry_edit))
+ }
+ IconButton(onClick = viewModel::clearRegistry) {
+ Icon(Icons.Outlined.Delete, contentDescription = stringResource(R.string.extensions_registry_clear))
+ }
+ }
+ }
+ }
+ }
+ } else if (ui.extensions.isEmpty()) {
+ Box(
+ modifier = Modifier
+ .weight(1f)
+ .fillMaxWidth(),
+ contentAlignment = Alignment.Center,
+ ) {
+ Text(
+ text = stringResource(R.string.extensions_empty),
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ textAlign = TextAlign.Center,
+ )
+ }
+ } else {
+ LazyColumn(
+ modifier = Modifier
+ .fillMaxWidth()
+ .weight(1f),
+ contentPadding = PaddingValues(vertical = 8.dp),
+ verticalArrangement = Arrangement.spacedBy(8.dp),
+ ) {
+ items(ui.extensions, key = { it.id }) { extension ->
+ ExtensionRow(
+ extension = extension,
+ onToggle = { viewModel.toggle(extension.id, it) },
+ onRemove = { viewModel.remove(extension.id) },
+ )
+ }
+ item {
+ OutlinedCard(modifier = Modifier.fillMaxWidth()) {
+ Text(
+ text = stringResource(R.string.extensions_disclaimer),
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ modifier = Modifier.padding(12.dp),
+ )
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+@Composable
+private fun RegistryUrlInput(
+ initialUrl: String,
+ error: String?,
+ enabled: Boolean,
+ onSubmit: (String) -> Unit,
+ onCancel: (() -> Unit)?,
+ modifier: Modifier = Modifier,
+) {
+ var url by rememberSaveable(initialUrl) { mutableStateOf(initialUrl) }
+ Column(
+ modifier = modifier
+ .fillMaxWidth()
+ .padding(vertical = 16.dp),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.spacedBy(12.dp, Alignment.CenterVertically),
+ ) {
+ Text(
+ text = stringResource(R.string.extensions_registry_hint),
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ )
+ SmoothOutlinedField(
+ value = url,
+ onValueChange = { url = it },
+ label = stringResource(R.string.extensions_registry_label),
+ placeholder = stringResource(R.string.extensions_registry_placeholder),
+ supportingText = error,
+ isError = error != null,
+ enabled = enabled,
+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri, imeAction = ImeAction.Done),
+ keyboardActions = KeyboardActions(onDone = { onSubmit(url) }),
+ )
+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ if (onCancel != null) {
+ TextButton(onClick = onCancel, enabled = enabled) {
+ Text(stringResource(android.R.string.cancel), fontFamily = GoogleSansRounded)
+ }
+ }
+ TextButton(onClick = { onSubmit(url) }, enabled = enabled && url.isNotBlank()) {
+ Text(stringResource(R.string.extensions_registry_load), fontFamily = GoogleSansRounded)
+ }
+ }
+ if (initialUrl.isEmpty()) RegistryGuide()
+ }
+}
+
+/** Registry category ids are English keys; show them in the app language. */
+@Composable
+private fun categoryLabel(category: String): String? = when (category.lowercase()) {
+ "" -> null
+ "metadata" -> stringResource(R.string.extensions_type_metadata)
+ "download" -> stringResource(R.string.extensions_type_download)
+ "lyrics" -> stringResource(R.string.extensions_type_lyrics)
+ "utility" -> stringResource(R.string.extensions_type_utility)
+ "integration" -> stringResource(R.string.extensions_type_integration)
+ else -> category
+}
+
+/** How to find a registry URL; Go (resolveRegistryURL) accepts a GitHub repo or a direct registry.json link. */
+@Composable
+private fun RegistryGuide() {
+ Card(
+ modifier = Modifier.fillMaxWidth(),
+ colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerHigh),
+ ) {
+ Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ Text(
+ text = stringResource(R.string.extensions_registry_guide_title),
+ style = MaterialTheme.typography.titleSmall,
+ fontFamily = GoogleSansRounded,
+ )
+ listOf(
+ R.string.extensions_registry_guide_1,
+ R.string.extensions_registry_guide_2,
+ R.string.extensions_registry_guide_3,
+ R.string.extensions_registry_guide_4,
+ ).forEachIndexed { i, res ->
+ Text(
+ text = "${i + 1}. ${stringResource(res)}",
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
+ Text(
+ text = stringResource(R.string.extensions_registry_compatible),
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ )
+ val uriHandler = LocalUriHandler.current
+ TextButton(onClick = { runCatching { uriHandler.openUri(COMPATIBLE_EXTENSIONS_URL) } }) {
+ Text(COMPATIBLE_EXTENSIONS_URL, fontFamily = GoogleSansRounded)
+ }
+ }
+ }
+}
+
+private const val COMPATIBLE_EXTENSIONS_URL = "https://spotiflac.com/extension"
+
+@Composable
+private fun TabPlaceholder(
+ text: String,
+ modifier: Modifier = Modifier,
+ color: Color = MaterialTheme.colorScheme.onSurfaceVariant,
+) {
+ Box(
+ modifier = modifier
+ .fillMaxWidth(),
+ contentAlignment = Alignment.Center,
+ ) {
+ Text(
+ text = text,
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ color = color,
+ textAlign = TextAlign.Center,
+ )
+ }
+}
+
+@Composable
+private fun RepoExtensionRow(
+ extension: RepoExtension,
+ installedVersion: String?,
+ installing: Boolean,
+ onInstall: () -> Unit,
+) {
+ Card(modifier = Modifier.fillMaxWidth()) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(horizontal = 16.dp, vertical = 8.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Column(modifier = Modifier.weight(1f)) {
+ Text(
+ text = extension.displayName.ifEmpty { extension.name.ifEmpty { extension.id } },
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ Text(
+ text = listOfNotNull(
+ extension.version.takeIf { it.isNotEmpty() }?.let { "v$it" },
+ categoryLabel(extension.category),
+ ).joinToString(" · "),
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ if (!extension.description.isNullOrEmpty()) {
+ Text(
+ text = extension.description,
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ }
+ if (installedVersion != null) {
+ Text(
+ text = if (installedVersion.isEmpty()) {
+ stringResource(R.string.extensions_install_done)
+ } else {
+ "v$installedVersion"
+ },
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.primary,
+ )
+ } else {
+ TextButton(onClick = onInstall, enabled = !installing) {
+ Text(stringResource(R.string.download_cd_download), fontFamily = GoogleSansRounded)
+ }
+ }
+ }
+ }
+}
+
+@Composable
+private fun ExtensionRow(
+ extension: InstalledExtension,
+ onToggle: (Boolean) -> Unit,
+ onRemove: () -> Unit,
+) {
+ Card(modifier = Modifier.fillMaxWidth()) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(horizontal = 16.dp, vertical = 8.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Column(modifier = Modifier.weight(1f)) {
+ Text(
+ text = extension.displayName,
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis,
+ )
+ val statusLabel = stringResource(
+ when {
+ extension.error != null -> R.string.extensions_status_error
+ extension.enabled -> R.string.extensions_status_enabled
+ else -> R.string.extensions_status_disabled
+ },
+ )
+ // Same "v · " line and description as the repository rows.
+ val category = extension.types.mapNotNull { type ->
+ when (type) {
+ "metadata_provider" -> R.string.extensions_type_metadata
+ "download_provider" -> R.string.extensions_type_download
+ "lyrics_provider" -> R.string.extensions_type_lyrics
+ else -> null
+ }
+ }.map { stringResource(it) }.joinToString(", ")
+ Text(
+ text = listOfNotNull(
+ extension.version.takeIf { it.isNotEmpty() }?.let { "v$it" },
+ category.takeIf { it.isNotEmpty() },
+ statusLabel,
+ ).joinToString(" · "),
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ if (!extension.description.isNullOrEmpty()) {
+ Text(
+ text = extension.description,
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ extension.error?.let { error ->
+ Text(
+ text = error,
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.error,
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis,
+ )
+ }
+ }
+ Switch(checked = extension.enabled, onCheckedChange = onToggle)
+ IconButton(onClick = onRemove) {
+ Icon(
+ Icons.Outlined.Delete,
+ contentDescription = stringResource(R.string.extensions_cd_remove),
+ tint = MaterialTheme.colorScheme.error,
+ )
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionsViewModel.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionsViewModel.kt
new file mode 100644
index 0000000000..e02857ccdc
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionsViewModel.kt
@@ -0,0 +1,148 @@
+package com.theveloper.pixelplay.presentation.download
+
+import android.content.Context
+import android.net.Uri
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import com.theveloper.pixelplay.R
+import com.theveloper.pixelplay.data.download.BackendResult
+import com.theveloper.pixelplay.data.download.DownloadBackendApi
+import com.theveloper.pixelplay.data.download.InstalledExtension
+import com.theveloper.pixelplay.data.download.RepoExtension
+import com.theveloper.pixelplay.data.download.DownloadSettings
+import dagger.hilt.android.lifecycle.HiltViewModel
+import dagger.hilt.android.qualifiers.ApplicationContext
+import java.io.File
+import javax.inject.Inject
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.update
+import kotlinx.coroutines.launch
+
+@HiltViewModel
+class ExtensionsViewModel @Inject constructor(
+ private val backend: DownloadBackendApi,
+ private val settings: DownloadSettings,
+ @ApplicationContext private val context: Context,
+) : ViewModel() {
+
+ data class UiState(
+ val extensions: List = emptyList(),
+ val repoBrowse: List = emptyList(),
+ val repoLoading: Boolean = false,
+ val repoError: String? = null,
+ val registryUrl: String? = null,
+ val registryEditing: Boolean = false,
+ val registryError: String? = null,
+ val installing: Boolean = false,
+ val error: String? = null,
+ )
+
+ private val _ui = MutableStateFlow(UiState())
+ val ui: StateFlow = _ui.asStateFlow()
+
+ init {
+ load()
+ }
+
+ fun load() = viewModelScope.launch(Dispatchers.IO) {
+ val extensions = runCatching { backend.listInstalled() }.getOrDefault(emptyList())
+ _ui.update { it.copy(extensions = extensions) }
+ }
+
+ /**
+ * Copies the picked document to a cache temp file before handing it to the
+ * backend: .spotiflac-ext documents report opaque MIME types, so the
+ * extension suffix is the only reliable signal for LoadExtensionFromPath.
+ */
+ fun install(uri: Uri) = viewModelScope.launch(Dispatchers.IO) {
+ _ui.update { it.copy(installing = true) }
+ val temp = File(context.cacheDir, "extension-${System.currentTimeMillis()}.spotiflac-ext")
+ try {
+ context.contentResolver.openInputStream(uri)?.use { input ->
+ temp.outputStream().use { input.copyTo(it) }
+ } ?: run {
+ _ui.update { it.copy(error = context.getString(R.string.extensions_install_failed)) }
+ return@launch
+ }
+ when (val result = backend.installFromFile(temp.absolutePath)) {
+ is BackendResult.Failed -> _ui.update {
+ it.copy(error = result.response.error ?: context.getString(R.string.extensions_install_failed))
+ }
+ is BackendResult.Ok -> load()
+ }
+ } catch (e: Exception) {
+ _ui.update { it.copy(error = context.getString(R.string.extensions_install_failed)) }
+ } finally {
+ temp.delete()
+ _ui.update { it.copy(installing = false) }
+ }
+ }
+
+ fun remove(id: String) = viewModelScope.launch(Dispatchers.IO) {
+ runCatching { backend.remove(id) }
+ .onFailure { t -> _ui.update { it.copy(error = t.message ?: context.getString(R.string.extensions_install_failed)) } }
+ load()
+ }
+
+ fun toggle(id: String, enabled: Boolean) = viewModelScope.launch(Dispatchers.IO) {
+ runCatching { backend.setEnabled(id, enabled) }
+ .onFailure { t -> _ui.update { it.copy(error = t.message ?: context.getString(R.string.extensions_install_failed)) } }
+ load()
+ }
+
+ fun browseRepo(forceRefresh: Boolean = false) = viewModelScope.launch(Dispatchers.IO) {
+ val configured = settings.registryUrl
+ if (configured == null) {
+ _ui.update { it.copy(registryUrl = null, registryEditing = true, repoBrowse = emptyList(), repoLoading = false, repoError = null) }
+ return@launch
+ }
+ _ui.update { it.copy(registryUrl = configured, repoLoading = true, repoError = null) }
+ val items = runCatching { backend.listRepoExtensions(forceRefresh) }.getOrDefault(emptyList())
+ _ui.update {
+ // Empty can only mean failure here: the registry is never empty.
+ it.copy(
+ repoBrowse = items,
+ repoLoading = false,
+ repoError = if (items.isEmpty()) context.getString(R.string.extensions_repo_error) else null,
+ )
+ }
+ }
+
+ fun installFromRepo(id: String) = viewModelScope.launch(Dispatchers.IO) {
+ _ui.update { it.copy(installing = true) }
+ when (val result = backend.installFromRepo(id)) {
+ is BackendResult.Failed -> _ui.update {
+ it.copy(error = result.response.error ?: context.getString(R.string.extensions_install_failed))
+ }
+ is BackendResult.Ok -> {
+ load()
+ browseRepo()
+ }
+ }
+ _ui.update { it.copy(installing = false) }
+ }
+
+ fun setRegistryUrl(url: String) = viewModelScope.launch(Dispatchers.IO) {
+ val err = backend.setRegistryUrl(url)
+ if (err == null) {
+ _ui.update { it.copy(registryEditing = false, registryUrl = url.trim()) }
+ browseRepo(forceRefresh = true)
+ } else {
+ _ui.update { it.copy(registryError = err) }
+ }
+ }
+
+ fun editRegistry() = _ui.update { it.copy(registryEditing = true) }
+
+ fun clearRegistry() = viewModelScope.launch(Dispatchers.IO) {
+ backend.clearRegistryUrl()
+ _ui.update { it.copy(registryUrl = null, registryEditing = true, repoBrowse = emptyList(), repoError = null) }
+ }
+
+ fun consumeRegistryEdit() = _ui.update { it.copy(registryEditing = false, registryError = null) }
+
+ fun consumeError() = _ui.update { it.copy(error = null) }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/download/SmoothOutlinedField.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/download/SmoothOutlinedField.kt
new file mode 100644
index 0000000000..521b75264a
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/download/SmoothOutlinedField.kt
@@ -0,0 +1,64 @@
+package com.theveloper.pixelplay.presentation.download
+
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedTextField
+import androidx.compose.material3.OutlinedTextFieldDefaults
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.text.font.FontFamily
+import androidx.compose.ui.unit.dp
+import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
+import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
+
+/** Text field matching the app's S3 login field style (smooth corners, filled container). */
+@Composable
+internal fun SmoothOutlinedField(
+ value: String,
+ onValueChange: (String) -> Unit,
+ modifier: Modifier = Modifier,
+ label: String? = null,
+ placeholder: String? = null,
+ supportingText: String? = null,
+ isError: Boolean = false,
+ enabled: Boolean = true,
+ leadingIcon: ImageVector? = null,
+ trailingIcon: @Composable (() -> Unit)? = null,
+ keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
+ keyboardActions: KeyboardActions = KeyboardActions.Default,
+) {
+ OutlinedTextField(
+ value = value,
+ onValueChange = onValueChange,
+ modifier = modifier.fillMaxWidth(),
+ enabled = enabled,
+ singleLine = true,
+ shape = AbsoluteSmoothCornerShape(18.dp, 60),
+ textStyle = MaterialTheme.typography.bodyLarge.copy(fontFamily = GoogleSansRounded),
+ label = label?.let { { Text(it, fontFamily = GoogleSansRounded) } },
+ placeholder = placeholder?.let { { Text(it, fontFamily = GoogleSansRounded, maxLines = 1) } },
+ supportingText = supportingText?.let { { Text(it, fontFamily = GoogleSansRounded) } },
+ isError = isError,
+ leadingIcon = leadingIcon?.let {
+ { Icon(it, contentDescription = null, tint = MaterialTheme.colorScheme.primary) }
+ },
+ trailingIcon = trailingIcon?.let { content -> { Box { content() } } },
+ keyboardOptions = keyboardOptions,
+ keyboardActions = keyboardActions,
+ colors = OutlinedTextFieldDefaults.colors(
+ focusedContainerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
+ unfocusedContainerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
+ disabledContainerColor = MaterialTheme.colorScheme.surfaceContainer,
+ focusedBorderColor = MaterialTheme.colorScheme.primary,
+ unfocusedBorderColor = Color.Transparent,
+ disabledBorderColor = Color.Transparent,
+ ),
+ )
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/gdrive/auth/GDriveLoginActivity.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/gdrive/auth/GDriveLoginActivity.kt
index 64dcbc5035..8d6428753f 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/gdrive/auth/GDriveLoginActivity.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/gdrive/auth/GDriveLoginActivity.kt
@@ -1,5 +1,6 @@
package com.theveloper.pixelplay.presentation.gdrive.auth
+import android.content.Context
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
@@ -46,9 +47,15 @@ import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.compose.ui.res.stringResource
import com.theveloper.pixelplay.R
+import com.theveloper.pixelplay.utils.AppLocaleManager
@AndroidEntryPoint
class GDriveLoginActivity : ComponentActivity() {
+
+ override fun attachBaseContext(newBase: Context) {
+ super.attachBaseContext(AppLocaleManager.wrapContext(newBase))
+ }
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/jellyfin/auth/JellyfinLoginActivity.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/jellyfin/auth/JellyfinLoginActivity.kt
index 596e3d7dd5..1088c6125e 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/jellyfin/auth/JellyfinLoginActivity.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/jellyfin/auth/JellyfinLoginActivity.kt
@@ -1,5 +1,6 @@
package com.theveloper.pixelplay.presentation.jellyfin.auth
+import android.content.Context
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
@@ -75,12 +76,18 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.theveloper.pixelplay.R
import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
import com.theveloper.pixelplay.ui.theme.PixelPlayTheme
+import com.theveloper.pixelplay.utils.AppLocaleManager
import dagger.hilt.android.AndroidEntryPoint
import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
@AndroidEntryPoint
class JellyfinLoginActivity : ComponentActivity() {
+ override fun attachBaseContext(newBase: Context) {
+ super.attachBaseContext(AppLocaleManager.wrapContext(newBase))
+ }
+
+
override fun onCreate(savedInstanceState: android.os.Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/navidrome/auth/NavidromeLoginActivity.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/navidrome/auth/NavidromeLoginActivity.kt
index f7453547d6..d0648f2836 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/navidrome/auth/NavidromeLoginActivity.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/navidrome/auth/NavidromeLoginActivity.kt
@@ -1,5 +1,6 @@
package com.theveloper.pixelplay.presentation.navidrome.auth
+import android.content.Context
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
@@ -75,12 +76,18 @@ import androidx.compose.ui.res.vectorResource
import com.theveloper.pixelplay.R
import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
import com.theveloper.pixelplay.ui.theme.PixelPlayTheme
+import com.theveloper.pixelplay.utils.AppLocaleManager
import dagger.hilt.android.AndroidEntryPoint
import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
@AndroidEntryPoint
class NavidromeLoginActivity : ComponentActivity() {
+ override fun attachBaseContext(newBase: Context) {
+ super.attachBaseContext(AppLocaleManager.wrapContext(newBase))
+ }
+
+
override fun onCreate(savedInstanceState: android.os.Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/navigation/AppNavigation.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/navigation/AppNavigation.kt
index 7e55cceb8d..540b531ef7 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/navigation/AppNavigation.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/navigation/AppNavigation.kt
@@ -235,6 +235,9 @@ fun AppNavigation(
},
onOpenJellyfinDashboard = {
navController.navigateSafely(Screen.JellyfinDashboard.route)
+ },
+ onOpenS3Dashboard = {
+ navController.navigateSafely(Screen.S3Dashboard.route)
}
)
}
@@ -504,6 +507,34 @@ fun AppNavigation(
)
}
}
+ composable(
+ Screen.S3Dashboard.route,
+ ) {
+ ScreenWrapper(navController = navController, playerViewModel = playerViewModel, animatedVisibilityScope = this) {
+ com.theveloper.pixelplay.presentation.s3.dashboard.S3DashboardScreen(
+ onBack = { navController.popBackStack() }
+ )
+ }
+ }
+ composable(
+ Screen.Download.route,
+ ) {
+ ScreenWrapper(navController = navController, playerViewModel = playerViewModel, animatedVisibilityScope = this) {
+ com.theveloper.pixelplay.presentation.download.DownloadScreen(
+ onNavigateBack = { navController.popBackStack() },
+ onOpenExtensions = { navController.navigateSafely(Screen.Extensions.route) }
+ )
+ }
+ }
+ composable(
+ Screen.Extensions.route,
+ ) {
+ ScreenWrapper(navController = navController, playerViewModel = playerViewModel, animatedVisibilityScope = this) {
+ com.theveloper.pixelplay.presentation.download.ExtensionsScreen(
+ onNavigateBack = { navController.popBackStack() }
+ )
+ }
+ }
}
}
}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/navigation/Screen.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/navigation/Screen.kt
index e079695893..6d6820531d 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/navigation/Screen.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/navigation/Screen.kt
@@ -55,5 +55,8 @@ sealed class Screen(val route: String) {
object QqMusicDashboard : Screen("qqmusic_dashboard")
object NavidromeDashboard : Screen("navidrome_dashboard")
object JellyfinDashboard : Screen("jellyfin_dashboard")
+ object S3Dashboard : Screen("s3_dashboard")
+ object Download : Screen("download")
+ object Extensions : Screen("download_extensions")
}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/netease/auth/NeteaseLoginActivity.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/netease/auth/NeteaseLoginActivity.kt
index 5a780b0849..c52466f5c4 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/netease/auth/NeteaseLoginActivity.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/netease/auth/NeteaseLoginActivity.kt
@@ -77,6 +77,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.theveloper.pixelplay.R
import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
import com.theveloper.pixelplay.ui.theme.PixelPlayTheme
+import com.theveloper.pixelplay.utils.AppLocaleManager
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.delay
import org.json.JSONObject
@@ -87,6 +88,11 @@ import androidx.compose.ui.text.style.TextOverflow
@AndroidEntryPoint
class NeteaseLoginActivity : ComponentActivity() {
+ override fun attachBaseContext(newBase: Context) {
+ super.attachBaseContext(AppLocaleManager.wrapContext(newBase))
+ }
+
+
companion object {
const val TARGET_URL = "https://music.163.com/"
const val DESKTOP_UA =
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/qqmusic/auth/QqMusicLoginActivity.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/qqmusic/auth/QqMusicLoginActivity.kt
index ae12ff15d3..dd2be421a3 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/qqmusic/auth/QqMusicLoginActivity.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/qqmusic/auth/QqMusicLoginActivity.kt
@@ -77,6 +77,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.theveloper.pixelplay.R
import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
import com.theveloper.pixelplay.ui.theme.PixelPlayTheme
+import com.theveloper.pixelplay.utils.AppLocaleManager
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.delay
import org.json.JSONObject
@@ -86,6 +87,11 @@ import androidx.compose.ui.text.style.TextOverflow
@AndroidEntryPoint
class QqMusicLoginActivity : ComponentActivity() {
+
+ override fun attachBaseContext(newBase: Context) {
+ super.attachBaseContext(AppLocaleManager.wrapContext(newBase))
+ }
+
companion object {
const val TARGET_URL = "https://y.qq.com/"
const val DESKTOP_UA =
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/s3/auth/S3LoginActivity.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/s3/auth/S3LoginActivity.kt
new file mode 100644
index 0000000000..40ebbb8c03
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/s3/auth/S3LoginActivity.kt
@@ -0,0 +1,664 @@
+package com.theveloper.pixelplay.presentation.s3.auth
+
+import android.widget.Toast
+import android.content.Context
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import androidx.activity.enableEdgeToEdge
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.imePadding
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.automirrored.rounded.ArrowBack
+import androidx.compose.material.icons.rounded.CloudQueue
+import androidx.compose.material.icons.rounded.Folder
+import androidx.compose.material.icons.rounded.Lock
+import androidx.compose.material.icons.rounded.Person
+import androidx.compose.material.icons.rounded.Visibility
+import androidx.compose.material.icons.rounded.VisibilityOff
+import androidx.compose.material3.Button
+import androidx.compose.material3.Card
+import androidx.compose.material3.CardDefaults
+import androidx.compose.material3.CircularProgressIndicator
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
+import androidx.compose.material3.FilledIconButton
+import androidx.compose.material3.FilledTonalButton
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.IconButtonDefaults
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedTextField
+import androidx.compose.material3.OutlinedTextFieldDefaults
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.SnackbarHost
+import androidx.compose.material3.SnackbarHostState
+import androidx.compose.material3.Surface
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.material3.TopAppBar
+import androidx.compose.material3.TopAppBarDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.focus.FocusDirection
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.platform.LocalFocusManager
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.text.input.PasswordVisualTransformation
+import androidx.compose.ui.text.input.VisualTransformation
+import androidx.compose.ui.unit.dp
+import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import com.theveloper.pixelplay.R
+import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
+import com.theveloper.pixelplay.ui.theme.PixelPlayTheme
+import com.theveloper.pixelplay.utils.AppLocaleManager
+import dagger.hilt.android.AndroidEntryPoint
+import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
+
+@AndroidEntryPoint
+class S3LoginActivity : ComponentActivity() {
+
+ override fun attachBaseContext(newBase: Context) {
+ super.attachBaseContext(AppLocaleManager.wrapContext(newBase))
+ }
+
+
+ companion object {
+ const val EXTRA_EDIT_MODE = "edit_mode"
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ enableEdgeToEdge()
+ val editMode = intent.getBooleanExtra(EXTRA_EDIT_MODE, false)
+ setContent {
+ PixelPlayTheme {
+ S3LoginScreen(editMode = editMode, onClose = { finish() })
+ }
+ }
+ }
+}
+
+@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
+@Composable
+fun S3LoginScreen(
+ viewModel: S3LoginViewModel = hiltViewModel(),
+ editMode: Boolean = false,
+ onClose: () -> Unit
+) {
+ val context = LocalContext.current
+ val loginState by viewModel.state.collectAsStateWithLifecycle()
+ val snackbarHostState = remember { SnackbarHostState() }
+ val focusManager = LocalFocusManager.current
+
+ var endpoint by remember { mutableStateOf("") }
+ var region by remember { mutableStateOf("") }
+ var bucket by remember { mutableStateOf("") }
+ var accessKey by remember { mutableStateOf("") }
+ var secretKey by remember { mutableStateOf("") }
+ var prefix by remember { mutableStateOf("") }
+ var secretVisible by remember { mutableStateOf(false) }
+
+ LaunchedEffect(editMode) {
+ if (editMode) {
+ viewModel.getExistingConnection()?.let { c ->
+ endpoint = c.endpoint
+ region = c.region
+ bucket = c.bucket
+ accessKey = c.accessKey
+ secretKey = c.secretKey
+ prefix = c.prefix.trimEnd('/')
+ }
+ }
+ }
+
+ LaunchedEffect(loginState) {
+ when (val state = loginState) {
+ is S3LoginState.Success -> {
+ Toast.makeText(
+ context,
+ context.getString(R.string.auth_s3_connected_toast),
+ Toast.LENGTH_SHORT
+ ).show()
+ onClose()
+ }
+ is S3LoginState.Error -> {
+ snackbarHostState.showSnackbar(state.message)
+ viewModel.clearError()
+ }
+ else -> Unit
+ }
+ }
+
+ val isLoading = loginState is S3LoginState.Connecting
+ val isFolderSetup = loginState is S3LoginState.FolderSetup
+ val inputShape = AbsoluteSmoothCornerShape(18.dp, 60)
+
+ Scaffold(
+ snackbarHost = { SnackbarHost(snackbarHostState) },
+ topBar = {
+ TopAppBar(
+ title = {
+ Text(
+ text = stringResource(R.string.auth_s3_title),
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.SemiBold
+ )
+ },
+ navigationIcon = {
+ FilledIconButton(
+ modifier = Modifier.padding(start = 6.dp),
+ onClick = onClose,
+ enabled = !isLoading,
+ colors = IconButtonDefaults.filledIconButtonColors(
+ containerColor = MaterialTheme.colorScheme.surfaceContainerLowest,
+ contentColor = MaterialTheme.colorScheme.onSurface
+ )
+ ) {
+ Icon(
+ imageVector = Icons.AutoMirrored.Rounded.ArrowBack,
+ contentDescription = stringResource(R.string.common_back)
+ )
+ }
+ },
+ colors = TopAppBarDefaults.topAppBarColors(
+ containerColor = MaterialTheme.colorScheme.surfaceContainerHigh
+ )
+ )
+ }
+ ) { paddingValues ->
+ if (isFolderSetup) {
+ val setup = loginState as S3LoginState.FolderSetup
+ S3FolderPickerContent(
+ setup = setup,
+ paddingValues = paddingValues,
+ isLoading = isLoading,
+ onOpenFolder = { viewModel.browse(it) },
+ onSelectFolder = { viewModel.selectFolder(it) },
+ onSelectCurrent = { viewModel.selectCurrentFolder() }
+ )
+ return@Scaffold
+ }
+
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(paddingValues)
+ .imePadding()
+ .verticalScroll(rememberScrollState())
+ .padding(horizontal = 20.dp),
+ horizontalAlignment = Alignment.CenterHorizontally
+ ) {
+ Spacer(modifier = Modifier.height(24.dp))
+
+ Surface(
+ shape = CircleShape,
+ color = MaterialTheme.colorScheme.secondaryContainer,
+ modifier = Modifier.size(64.dp)
+ ) {
+ Box(contentAlignment = Alignment.Center) {
+ Icon(
+ imageVector = Icons.Rounded.CloudQueue,
+ contentDescription = stringResource(R.string.auth_s3_title),
+ tint = MaterialTheme.colorScheme.onSecondaryContainer,
+ modifier = Modifier.size(36.dp)
+ )
+ }
+ }
+
+ Spacer(modifier = Modifier.height(16.dp))
+
+ Text(
+ text = stringResource(R.string.auth_s3_title),
+ style = MaterialTheme.typography.headlineSmall,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold,
+ color = MaterialTheme.colorScheme.onSurface
+ )
+
+ Text(
+ text = stringResource(R.string.auth_s3_subtitle),
+ style = MaterialTheme.typography.bodyMedium,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+
+ Spacer(modifier = Modifier.height(24.dp))
+
+ Card(
+ shape = AbsoluteSmoothCornerShape(20.dp, 60),
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceContainerHigh
+ ),
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Text(
+ text = stringResource(R.string.auth_s3_info_msg),
+ modifier = Modifier.padding(16.dp),
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ fontFamily = GoogleSansRounded
+ )
+ }
+
+ Spacer(modifier = Modifier.height(24.dp))
+
+ Card(
+ modifier = Modifier.fillMaxWidth(),
+ shape = AbsoluteSmoothCornerShape(28.dp, 60),
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceContainerLow
+ )
+ ) {
+ Column(
+ modifier = Modifier.padding(18.dp)
+ ) {
+ Text(
+ text = stringResource(R.string.auth_details_title),
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold
+ )
+
+ Spacer(modifier = Modifier.height(18.dp))
+
+ S3LoginField(
+ value = endpoint,
+ onValueChange = { endpoint = it },
+ label = stringResource(R.string.auth_s3_endpoint_label),
+ placeholder = stringResource(R.string.auth_s3_endpoint_placeholder),
+ supportingText = stringResource(R.string.auth_s3_endpoint_hint),
+ leadingIcon = Icons.Rounded.CloudQueue,
+ enabled = !isLoading,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Uri,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = { focusManager.moveFocus(FocusDirection.Down) }
+ ),
+ shape = inputShape
+ )
+
+ Spacer(modifier = Modifier.height(14.dp))
+
+ S3LoginField(
+ value = region,
+ onValueChange = { region = it },
+ label = stringResource(R.string.auth_s3_region_label),
+ placeholder = stringResource(R.string.auth_s3_region_placeholder),
+ supportingText = stringResource(R.string.auth_s3_region_hint),
+ leadingIcon = Icons.Rounded.CloudQueue,
+ enabled = !isLoading,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = { focusManager.moveFocus(FocusDirection.Down) }
+ ),
+ shape = inputShape
+ )
+
+ Spacer(modifier = Modifier.height(14.dp))
+
+ S3LoginField(
+ value = bucket,
+ onValueChange = { bucket = it },
+ label = stringResource(R.string.auth_s3_bucket_label),
+ placeholder = stringResource(R.string.auth_s3_bucket_placeholder),
+ supportingText = stringResource(R.string.auth_s3_bucket_hint),
+ leadingIcon = Icons.Rounded.Folder,
+ enabled = !isLoading,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = { focusManager.moveFocus(FocusDirection.Down) }
+ ),
+ shape = inputShape
+ )
+
+ Spacer(modifier = Modifier.height(14.dp))
+
+ S3LoginField(
+ value = accessKey,
+ onValueChange = { accessKey = it },
+ label = stringResource(R.string.auth_s3_access_key_label),
+ placeholder = stringResource(R.string.auth_s3_access_key_placeholder),
+ supportingText = stringResource(R.string.auth_s3_access_key_hint),
+ leadingIcon = Icons.Rounded.Person,
+ enabled = !isLoading,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = { focusManager.moveFocus(FocusDirection.Down) }
+ ),
+ shape = inputShape
+ )
+
+ Spacer(modifier = Modifier.height(14.dp))
+
+ S3LoginField(
+ value = secretKey,
+ onValueChange = { secretKey = it },
+ label = stringResource(R.string.auth_s3_secret_key_label),
+ placeholder = stringResource(R.string.auth_s3_secret_key_placeholder),
+ supportingText = stringResource(R.string.auth_s3_secret_key_hint),
+ leadingIcon = Icons.Rounded.Lock,
+ enabled = !isLoading,
+ visualTransformation = if (secretVisible) {
+ VisualTransformation.None
+ } else {
+ PasswordVisualTransformation()
+ },
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Password,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = { focusManager.moveFocus(FocusDirection.Down) }
+ ),
+ trailingContent = {
+ IconButton(
+ onClick = { secretVisible = !secretVisible },
+ enabled = !isLoading
+ ) {
+ Icon(
+ imageVector = if (secretVisible) Icons.Rounded.VisibilityOff else Icons.Rounded.Visibility,
+ contentDescription = stringResource(
+ if (secretVisible) R.string.auth_hide_pwd_action else R.string.auth_show_pwd_action
+ )
+ )
+ }
+ },
+ shape = inputShape
+ )
+
+ Spacer(modifier = Modifier.height(14.dp))
+
+ S3LoginField(
+ value = prefix,
+ onValueChange = { prefix = it },
+ label = stringResource(R.string.auth_s3_prefix_label),
+ placeholder = stringResource(R.string.auth_s3_prefix_placeholder),
+ supportingText = stringResource(R.string.auth_s3_prefix_hint),
+ leadingIcon = Icons.Rounded.Folder,
+ enabled = !isLoading,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Done
+ ),
+ keyboardActions = KeyboardActions(
+ onDone = { focusManager.clearFocus() }
+ ),
+ shape = inputShape
+ )
+ }
+ }
+
+ Spacer(modifier = Modifier.height(24.dp))
+
+ val canConnect = endpoint.isNotBlank() && bucket.isNotBlank() &&
+ accessKey.isNotBlank() && secretKey.isNotBlank()
+
+ Button(
+ onClick = {
+ focusManager.clearFocus()
+ viewModel.connect(
+ endpoint = endpoint,
+ region = region,
+ bucket = bucket,
+ accessKey = accessKey,
+ secretKey = secretKey,
+ prefix = prefix
+ )
+ },
+ enabled = !isLoading && canConnect,
+ shape = AbsoluteSmoothCornerShape(18.dp, 60),
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(52.dp)
+ ) {
+ if (isLoading) {
+ CircularProgressIndicator(
+ modifier = Modifier.size(20.dp),
+ strokeWidth = 2.dp,
+ color = MaterialTheme.colorScheme.onPrimary
+ )
+ Spacer(modifier = Modifier.width(8.dp))
+ Text(stringResource(R.string.auth_connecting_msg), fontFamily = GoogleSansRounded)
+ } else {
+ Text(stringResource(R.string.auth_connect_action), fontFamily = GoogleSansRounded, fontWeight = FontWeight.SemiBold)
+ }
+ }
+
+ Spacer(modifier = Modifier.height(16.dp))
+
+ Text(
+ text = stringResource(R.string.auth_s3_footer_msg),
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ fontFamily = GoogleSansRounded
+ )
+
+ Spacer(modifier = Modifier.height(32.dp))
+ }
+ }
+}
+
+@Composable
+private fun S3FolderPickerContent(
+ setup: S3LoginState.FolderSetup,
+ paddingValues: PaddingValues,
+ isLoading: Boolean,
+ onOpenFolder: (String) -> Unit,
+ onSelectFolder: (String) -> Unit,
+ onSelectCurrent: () -> Unit
+) {
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(paddingValues)
+ .padding(horizontal = 20.dp)
+ ) {
+ Spacer(modifier = Modifier.height(16.dp))
+
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Text(
+ text = stringResource(R.string.auth_s3_pick_folder_title),
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold,
+ modifier = Modifier.weight(1f)
+ )
+ if (!isLoading) {
+ TextButton(onClick = onSelectCurrent) {
+ Text(
+ text = stringResource(R.string.auth_s3_add_current_action),
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Medium
+ )
+ }
+ }
+ }
+ if (setup.folders.isEmpty() && !isLoading) {
+ Text(
+ text = stringResource(R.string.auth_s3_pick_folder_empty),
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ fontFamily = GoogleSansRounded
+ )
+ }
+
+ if (isLoading) {
+ Box(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(32.dp),
+ contentAlignment = Alignment.Center
+ ) {
+ CircularProgressIndicator(modifier = Modifier.size(28.dp), strokeWidth = 2.dp)
+ }
+ } else {
+ Spacer(modifier = Modifier.height(12.dp))
+
+ LazyColumn(
+ verticalArrangement = Arrangement.spacedBy(8.dp),
+ contentPadding = PaddingValues(bottom = 24.dp)
+ ) {
+ items(items = setup.folders, key = { it.prefix }) { folder ->
+ Card(
+ onClick = { onOpenFolder(folder.prefix) },
+ shape = AbsoluteSmoothCornerShape(20.dp, 60),
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceContainer
+ ),
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Row(
+ modifier = Modifier
+ .padding(12.dp)
+ .fillMaxWidth(),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Box(
+ modifier = Modifier.size(44.dp),
+ contentAlignment = Alignment.Center
+ ) {
+ Icon(
+ Icons.Rounded.Folder,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.secondary
+ )
+ }
+ Spacer(Modifier.width(12.dp))
+ Text(
+ text = folder.name,
+ style = MaterialTheme.typography.titleSmall,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.SemiBold,
+ maxLines = 1,
+ modifier = Modifier.weight(1f)
+ )
+ FilledTonalButton(
+ onClick = { onSelectFolder(folder.prefix) },
+ enabled = true,
+ shape = AbsoluteSmoothCornerShape(14.dp, 60),
+ contentPadding = PaddingValues(horizontal = 14.dp, vertical = 8.dp)
+ ) {
+ Text(
+ text = stringResource(R.string.auth_s3_add_action),
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Medium
+ )
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+@Composable
+private fun S3LoginField(
+ value: String,
+ onValueChange: (String) -> Unit,
+ label: String,
+ placeholder: String,
+ supportingText: String,
+ leadingIcon: ImageVector,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ visualTransformation: VisualTransformation = VisualTransformation.None,
+ keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
+ keyboardActions: KeyboardActions = KeyboardActions.Default,
+ trailingContent: @Composable (() -> Unit)? = null,
+ shape: AbsoluteSmoothCornerShape
+) {
+ OutlinedTextField(
+ value = value,
+ onValueChange = onValueChange,
+ modifier = modifier.fillMaxWidth(),
+ enabled = enabled,
+ singleLine = true,
+ shape = shape,
+ textStyle = MaterialTheme.typography.bodyLarge.copy(
+ fontFamily = GoogleSansRounded
+ ),
+ label = {
+ Text(
+ text = label,
+ fontFamily = GoogleSansRounded
+ )
+ },
+ placeholder = {
+ Text(
+ text = placeholder,
+ fontFamily = GoogleSansRounded
+ )
+ },
+ supportingText = {
+ Text(
+ text = supportingText,
+ fontFamily = GoogleSansRounded
+ )
+ },
+ leadingIcon = {
+ Icon(
+ imageVector = leadingIcon,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.primary
+ )
+ },
+ trailingIcon = trailingContent,
+ visualTransformation = visualTransformation,
+ keyboardOptions = keyboardOptions,
+ keyboardActions = keyboardActions,
+ colors = OutlinedTextFieldDefaults.colors(
+ focusedContainerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
+ unfocusedContainerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
+ disabledContainerColor = MaterialTheme.colorScheme.surfaceContainer,
+ focusedBorderColor = MaterialTheme.colorScheme.primary,
+ unfocusedBorderColor = Color.Transparent,
+ disabledBorderColor = Color.Transparent
+ )
+ )
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/s3/auth/S3LoginViewModel.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/s3/auth/S3LoginViewModel.kt
new file mode 100644
index 0000000000..6c51dea293
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/s3/auth/S3LoginViewModel.kt
@@ -0,0 +1,111 @@
+package com.theveloper.pixelplay.presentation.s3.auth
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import com.theveloper.pixelplay.data.s3.S3Repository
+import dagger.hilt.android.lifecycle.HiltViewModel
+import javax.inject.Inject
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.launch
+
+data class S3FolderItem(val prefix: String, val name: String)
+
+sealed interface S3LoginState {
+ data object Idle : S3LoginState
+ data object Connecting : S3LoginState
+ /** Credentials accepted; user picks a folder to sync. */
+ data class FolderSetup(
+ val path: String,
+ val folders: List
+ ) : S3LoginState
+ data object Success : S3LoginState
+ data class Error(val message: String) : S3LoginState
+}
+
+@HiltViewModel
+class S3LoginViewModel @Inject constructor(
+ private val repository: S3Repository
+) : ViewModel() {
+
+ private val _state = MutableStateFlow(S3LoginState.Idle)
+ val state: StateFlow = _state.asStateFlow()
+
+ private var rootPrefix: String = ""
+ private var currentRelativePath: String = ""
+
+ fun getExistingConnection() = repository.getConnection()
+
+ fun connect(
+ endpoint: String,
+ region: String,
+ bucket: String,
+ accessKey: String,
+ secretKey: String,
+ prefix: String
+ ) {
+ if (_state.value is S3LoginState.Connecting) return
+
+ viewModelScope.launch {
+ _state.value = S3LoginState.Connecting
+ val result = repository.connect(endpoint, region, bucket, accessKey, secretKey, prefix)
+ result.fold(
+ onSuccess = {
+ rootPrefix = repository.getConnection()?.prefix.orEmpty()
+ browse(rootPrefix)
+ },
+ onFailure = {
+ _state.value = S3LoginState.Error(it.message ?: "Connection failed")
+ }
+ )
+ }
+ }
+
+ /** Navigates the folder browser to a sub-path relative to the configured root prefix. */
+ fun browse(relativePath: String) {
+ currentRelativePath = relativePath
+ viewModelScope.launch {
+ repository.browseFolders(rootPrefix + relativePath).fold(
+ onSuccess = { entries ->
+ _state.value = S3LoginState.FolderSetup(
+ path = relativePath,
+ folders = entries
+ .filter { it.prefix != rootPrefix + relativePath }
+ .map { entry ->
+ S3FolderItem(
+ prefix = entry.prefix,
+ name = entry.prefix.trimEnd('/').substringAfterLast('/').ifBlank { entry.prefix }
+ )
+ }
+ )
+ },
+ onFailure = {
+ _state.value = S3LoginState.Error(it.message ?: "Failed to list folders")
+ }
+ )
+ }
+ }
+
+ /** Adds the folder currently being browsed (root prefix + relative path). */
+ fun selectCurrentFolder() {
+ selectFolder(rootPrefix + currentRelativePath)
+ }
+
+ fun selectFolder(prefix: String) {
+ if (_state.value is S3LoginState.Connecting) return
+ viewModelScope.launch {
+ _state.value = S3LoginState.Connecting
+ repository.addFolder(prefix).fold(
+ onSuccess = { _state.value = S3LoginState.Success },
+ onFailure = { _state.value = S3LoginState.Error(it.message ?: "Sync failed") }
+ )
+ }
+ }
+
+ fun clearError() {
+ if (_state.value is S3LoginState.Error) {
+ _state.value = S3LoginState.Idle
+ }
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/s3/dashboard/S3DashboardScreen.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/s3/dashboard/S3DashboardScreen.kt
new file mode 100644
index 0000000000..54677cc789
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/s3/dashboard/S3DashboardScreen.kt
@@ -0,0 +1,435 @@
+package com.theveloper.pixelplay.presentation.s3.dashboard
+
+import android.content.Intent
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.animation.core.Spring
+import androidx.compose.animation.core.spring
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.fadeOut
+import androidx.compose.animation.slideInVertically
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.*
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.automirrored.rounded.ArrowBack
+import androidx.compose.material.icons.automirrored.rounded.Logout
+import androidx.compose.material.icons.rounded.Add
+import androidx.compose.material.icons.rounded.CloudQueue
+import androidx.compose.material.icons.rounded.CloudSync
+import androidx.compose.material.icons.rounded.Delete
+import androidx.compose.material.icons.rounded.Edit
+import androidx.compose.material.icons.rounded.Folder
+import androidx.compose.material.icons.rounded.Sync
+import androidx.compose.material3.*
+import androidx.compose.runtime.*
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.unit.dp
+import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import com.theveloper.pixelplay.R
+import com.theveloper.pixelplay.data.database.S3FolderEntity
+import com.theveloper.pixelplay.presentation.s3.auth.S3LoginActivity
+import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
+import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
+
+@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
+@Composable
+fun S3DashboardScreen(
+ viewModel: S3DashboardViewModel = hiltViewModel(),
+ onBack: () -> Unit
+) {
+ val context = LocalContext.current
+ val folders by viewModel.folders.collectAsStateWithLifecycle()
+ val isSyncing by viewModel.isSyncing.collectAsStateWithLifecycle()
+ val syncMessage by viewModel.syncMessage.collectAsStateWithLifecycle()
+ val probeQueue by viewModel.probeQueue.collectAsStateWithLifecycle()
+
+ val cardShape = AbsoluteSmoothCornerShape(
+ cornerRadiusTR = 20.dp, cornerRadiusTL = 20.dp,
+ cornerRadiusBR = 20.dp, cornerRadiusBL = 20.dp,
+ smoothnessAsPercentTR = 60, smoothnessAsPercentTL = 60,
+ smoothnessAsPercentBR = 60, smoothnessAsPercentBL = 60
+ )
+
+ Scaffold(
+ topBar = {
+ TopAppBar(
+ title = {
+ Text(
+ stringResource(R.string.auth_s3_title),
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold
+ )
+ },
+ navigationIcon = {
+ IconButton(onClick = onBack) {
+ Icon(Icons.AutoMirrored.Rounded.ArrowBack, contentDescription = stringResource(R.string.common_back))
+ }
+ },
+ actions = {
+ // Edit connection button
+ IconButton(onClick = {
+ context.startActivity(
+ Intent(context, S3LoginActivity::class.java)
+ .putExtra(S3LoginActivity.EXTRA_EDIT_MODE, true)
+ )
+ }) {
+ Icon(
+ Icons.Rounded.Edit,
+ contentDescription = stringResource(R.string.s3_cd_edit_connection),
+ tint = MaterialTheme.colorScheme.secondary
+ )
+ }
+ // Add folder button
+ IconButton(onClick = {
+ context.startActivity(Intent(context, S3LoginActivity::class.java))
+ }) {
+ Icon(
+ Icons.Rounded.Add,
+ contentDescription = stringResource(R.string.s3_cd_add_folder),
+ tint = MaterialTheme.colorScheme.secondary
+ )
+ }
+ // Sync button
+ IconButton(
+ onClick = { viewModel.syncAllFoldersAndSongs() },
+ enabled = !isSyncing
+ ) {
+ Icon(
+ Icons.Rounded.CloudSync,
+ contentDescription = stringResource(R.string.cloud_cd_sync_all),
+ tint = MaterialTheme.colorScheme.secondary
+ )
+ }
+ // Logout button
+ IconButton(onClick = {
+ viewModel.logout()
+ onBack()
+ }) {
+ Icon(
+ Icons.AutoMirrored.Rounded.Logout,
+ contentDescription = stringResource(R.string.cloud_cd_logout)
+ )
+ }
+ }
+ )
+ }
+ ) { paddingValues ->
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(paddingValues)
+ ) {
+ // Sync status banner
+ AnimatedVisibility(
+ visible = syncMessage != null,
+ enter = slideInVertically(
+ animationSpec = spring(stiffness = Spring.StiffnessMedium)
+ ) + fadeIn(),
+ exit = fadeOut()
+ ) {
+ syncMessage?.let { message ->
+ Card(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(horizontal = 16.dp, vertical = 8.dp),
+ shape = cardShape,
+ colors = CardDefaults.cardColors(
+ containerColor = if (message.contains("failed"))
+ MaterialTheme.colorScheme.errorContainer
+ else
+ MaterialTheme.colorScheme.secondaryContainer
+ )
+ ) {
+ Row(
+ modifier = Modifier.padding(16.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ if (isSyncing) {
+ CircularProgressIndicator(
+ modifier = Modifier.size(20.dp),
+ strokeWidth = 2.dp,
+ color = MaterialTheme.colorScheme.secondary
+ )
+ Spacer(Modifier.width(12.dp))
+ }
+ Text(
+ text = message,
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded
+ )
+ }
+ }
+ }
+ }
+
+ // Metadata probe queue banner
+ AnimatedVisibility(
+ visible = probeQueue.isRunning,
+ enter = slideInVertically(
+ animationSpec = spring(stiffness = Spring.StiffnessMedium)
+ ) + fadeIn(),
+ exit = fadeOut()
+ ) {
+ Card(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(horizontal = 16.dp, vertical = 8.dp),
+ shape = cardShape,
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.tertiaryContainer
+ )
+ ) {
+ Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp)) {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Icon(
+ Icons.Rounded.CloudSync,
+ contentDescription = null,
+ modifier = Modifier.size(18.dp),
+ tint = MaterialTheme.colorScheme.onTertiaryContainer
+ )
+ Spacer(Modifier.width(12.dp))
+ Text(
+ text = if (probeQueue.remaining > 0)
+ stringResource(R.string.s3_probe_queue_running, probeQueue.remaining)
+ else
+ stringResource(R.string.s3_probe_queue_finishing),
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onTertiaryContainer
+ )
+ }
+ Spacer(Modifier.height(8.dp))
+ LinearProgressIndicator(
+ modifier = Modifier.fillMaxWidth(),
+ color = MaterialTheme.colorScheme.tertiary,
+ trackColor = MaterialTheme.colorScheme.tertiaryContainer
+ )
+ }
+ }
+ }
+
+ // Connection info header
+ viewModel.bucketLabel?.let { label ->
+ Card(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(horizontal = 16.dp, vertical = 8.dp),
+ shape = cardShape,
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceContainerHigh
+ )
+ ) {
+ Row(
+ modifier = Modifier.padding(16.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Box(
+ modifier = Modifier
+ .size(48.dp)
+ .clip(CircleShape)
+ .background(MaterialTheme.colorScheme.secondary),
+ contentAlignment = Alignment.Center
+ ) {
+ Icon(
+ Icons.Rounded.CloudQueue,
+ contentDescription = null,
+ modifier = Modifier.size(24.dp),
+ tint = MaterialTheme.colorScheme.onSecondary
+ )
+ }
+ Spacer(Modifier.width(16.dp))
+ Column {
+ Text(
+ text = label,
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis
+ )
+ Text(
+ text = stringResource(R.string.s3_dashboard_folders_synced_count, folders.size),
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ }
+ }
+ }
+ }
+
+ Spacer(modifier = Modifier.height(8.dp))
+
+ // Folders header
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(horizontal = 24.dp, vertical = 8.dp),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Text(
+ text = stringResource(R.string.s3_dashboard_music_folders),
+ style = MaterialTheme.typography.titleMedium,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.Bold
+ )
+ if (folders.isEmpty()) {
+ TextButton(onClick = { viewModel.syncAllFoldersAndSongs() }) {
+ Icon(
+ Icons.Rounded.Sync,
+ contentDescription = null,
+ modifier = Modifier.size(18.dp)
+ )
+ Spacer(Modifier.width(4.dp))
+ Text(stringResource(R.string.cloud_dashboard_action_sync), fontFamily = GoogleSansRounded, maxLines = 1, overflow = TextOverflow.Ellipsis)
+ }
+ }
+ }
+
+ // Folder list
+ if (folders.isEmpty() && !isSyncing) {
+ Box(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(32.dp),
+ contentAlignment = Alignment.Center
+ ) {
+ Column(
+ horizontalAlignment = Alignment.CenterHorizontally
+ ) {
+ Icon(
+ Icons.Rounded.Folder,
+ contentDescription = null,
+ modifier = Modifier.size(64.dp),
+ tint = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.4f)
+ )
+ Spacer(Modifier.height(16.dp))
+ Text(
+ text = stringResource(R.string.s3_dashboard_no_folders_yet),
+ style = MaterialTheme.typography.bodyLarge,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ Spacer(Modifier.height(8.dp))
+ Text(
+ text = stringResource(R.string.s3_dashboard_add_folder_hint),
+ style = MaterialTheme.typography.bodyMedium,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.6f)
+ )
+ }
+ }
+ } else {
+ LazyColumn(
+ contentPadding = PaddingValues(horizontal = 16.dp, vertical = 4.dp),
+ verticalArrangement = Arrangement.spacedBy(8.dp)
+ ) {
+ items(
+ items = folders,
+ key = { it.id }
+ ) { folder ->
+ S3FolderCard(
+ folder = folder,
+ onSyncClick = { viewModel.syncFolder(folder.id) },
+ onDeleteClick = { viewModel.removeFolder(folder.id) },
+ cardShape = cardShape,
+ isSyncing = isSyncing
+ )
+ }
+ }
+ }
+ }
+ }
+}
+
+@Composable
+private fun S3FolderCard(
+ folder: S3FolderEntity,
+ onSyncClick: () -> Unit,
+ onDeleteClick: () -> Unit,
+ cardShape: AbsoluteSmoothCornerShape,
+ isSyncing: Boolean
+) {
+ Card(
+ modifier = Modifier.fillMaxWidth(),
+ shape = cardShape,
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceContainer
+ )
+ ) {
+ Row(
+ modifier = Modifier
+ .padding(12.dp)
+ .fillMaxWidth(),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Box(
+ modifier = Modifier
+ .size(56.dp)
+ .clip(RoundedCornerShape(12.dp))
+ .background(MaterialTheme.colorScheme.secondaryContainer),
+ contentAlignment = Alignment.Center
+ ) {
+ Icon(
+ Icons.Rounded.Folder,
+ contentDescription = null,
+ modifier = Modifier.size(24.dp),
+ tint = MaterialTheme.colorScheme.onSecondaryContainer
+ )
+ }
+
+ Spacer(Modifier.width(12.dp))
+
+ Column(modifier = Modifier.weight(1f)) {
+ Text(
+ text = folder.name,
+ style = MaterialTheme.typography.titleSmall,
+ fontFamily = GoogleSansRounded,
+ fontWeight = FontWeight.SemiBold,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis
+ )
+ Text(
+ text = stringResource(R.string.cloud_dashboard_song_count, folder.songCount),
+ style = MaterialTheme.typography.bodySmall,
+ fontFamily = GoogleSansRounded,
+ color = MaterialTheme.colorScheme.onSurfaceVariant
+ )
+ }
+
+ // Sync button
+ IconButton(
+ onClick = onSyncClick,
+ enabled = !isSyncing
+ ) {
+ Icon(
+ Icons.Rounded.Sync,
+ contentDescription = stringResource(R.string.cloud_cd_sync),
+ tint = MaterialTheme.colorScheme.secondary,
+ modifier = Modifier.size(20.dp)
+ )
+ }
+
+ // Delete button
+ IconButton(onClick = onDeleteClick) {
+ Icon(
+ Icons.Rounded.Delete,
+ contentDescription = stringResource(R.string.common_remove),
+ tint = MaterialTheme.colorScheme.error.copy(alpha = 0.7f),
+ modifier = Modifier.size(20.dp)
+ )
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/s3/dashboard/S3DashboardViewModel.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/s3/dashboard/S3DashboardViewModel.kt
new file mode 100644
index 0000000000..1fbef9c2d1
--- /dev/null
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/s3/dashboard/S3DashboardViewModel.kt
@@ -0,0 +1,89 @@
+package com.theveloper.pixelplay.presentation.s3.dashboard
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import com.theveloper.pixelplay.data.database.S3FolderEntity
+import com.theveloper.pixelplay.data.s3.S3Repository
+import com.theveloper.pixelplay.di.AppScope
+import dagger.hilt.android.lifecycle.HiltViewModel
+import javax.inject.Inject
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.SharingStarted
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.flow.stateIn
+import kotlinx.coroutines.launch
+
+@HiltViewModel
+class S3DashboardViewModel @Inject constructor(
+ private val repository: S3Repository,
+ // Sync must outlive this screen: leaving the dashboard must not cancel it.
+ @AppScope private val appScope: CoroutineScope,
+) : ViewModel() {
+
+ val folders: StateFlow> = repository.getFolders()
+ .stateIn(viewModelScope, SharingStarted.Lazily, emptyList())
+
+ private val _isSyncing = MutableStateFlow(false)
+ val isSyncing: StateFlow = _isSyncing.asStateFlow()
+
+ private val _syncMessage = MutableStateFlow(null)
+ val syncMessage: StateFlow = _syncMessage.asStateFlow()
+
+ val probeQueue: StateFlow = repository.probeQueueFlow
+ .stateIn(viewModelScope, SharingStarted.Lazily, S3Repository.ProbeQueueState(isRunning = false, remaining = 0))
+
+ val bucketLabel: String? get() = repository.userBucketLabel()
+ val isLoggedIn: StateFlow = repository.isLoggedInFlow
+
+ init {
+ // Auto-sync only folders that were never synced; re-syncing finished folders on every
+ // open (this VM is also created by Home) is left to the manual sync buttons.
+ viewModelScope.launch {
+ if (repository.getFolders().first().any { it.lastSyncTime == 0L }) syncAllFoldersAndSongs()
+ }
+ }
+
+ fun syncAllFoldersAndSongs() {
+ if (_isSyncing.value) return
+ appScope.launch {
+ _isSyncing.value = true
+ _syncMessage.value = "Syncing all folders..."
+ val result = repository.syncAllFoldersAndSongs()
+ _syncMessage.value = when {
+ result.folderCount == 0 -> "No folders to sync"
+ result.failedFolderCount > 0 ->
+ "Synced ${result.folderCount - result.failedFolderCount}/${result.folderCount} folders (some failed)"
+ else -> "Synced ${result.folderCount} folders"
+ }
+ _isSyncing.value = false
+ }
+ }
+
+ fun syncFolder(folderId: String) {
+ if (_isSyncing.value) return
+ appScope.launch {
+ _isSyncing.value = true
+ _syncMessage.value = "Syncing folder..."
+ repository.syncFolder(folderId).fold(
+ onSuccess = { count -> _syncMessage.value = "Synced $count songs" },
+ onFailure = { _syncMessage.value = "Sync failed: ${it.message}" }
+ )
+ _isSyncing.value = false
+ }
+ }
+
+ fun removeFolder(folderId: String) {
+ viewModelScope.launch {
+ repository.removeFolder(folderId)
+ }
+ }
+
+ fun logout() {
+ viewModelScope.launch {
+ repository.logout()
+ }
+ }
+}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/screens/AccountsScreen.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/screens/AccountsScreen.kt
index b5aeee48aa..302473cd1a 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/screens/AccountsScreen.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/screens/AccountsScreen.kt
@@ -98,6 +98,7 @@ fun AccountsScreen(
onOpenQqMusicDashboard: () -> Unit = {},
onOpenNavidromeDashboard: () -> Unit = {},
onOpenJellyfinDashboard: () -> Unit = {},
+ onOpenS3Dashboard: () -> Unit = {},
viewModel: AccountsViewModel = hiltViewModel()
) {
val context = LocalContext.current
@@ -213,6 +214,7 @@ fun AccountsScreen(
onOpenQqMusicDashboard = onOpenQqMusicDashboard,
onOpenNavidromeDashboard = onOpenNavidromeDashboard,
onOpenJellyfinDashboard = onOpenJellyfinDashboard,
+ onOpenS3Dashboard = onOpenS3Dashboard,
preferNeteaseDashboard = true
)
},
@@ -242,6 +244,7 @@ fun AccountsScreen(
onOpenQqMusicDashboard = onOpenQqMusicDashboard,
onOpenNavidromeDashboard = onOpenNavidromeDashboard,
onOpenJellyfinDashboard = onOpenJellyfinDashboard,
+ onOpenS3Dashboard = onOpenS3Dashboard,
preferNeteaseDashboard = false
)
}
@@ -563,6 +566,7 @@ private fun EmptyAccountsCard(
ExternalServiceAccount.GOOGLE_DRIVE -> painterResource(R.drawable.rounded_drive_export_24)
ExternalServiceAccount.JELLYFIN -> painterResource(R.drawable.ic_jellyfin)
ExternalServiceAccount.NAVIDROME -> painterResource(R.drawable.ic_navidrome_md3)
+ ExternalServiceAccount.S3 -> painterResource(R.drawable.rounded_storage_24)
}
FilledTonalButton(
onClick = { if (!isComingSoon) onConnect(service) },
@@ -655,6 +659,14 @@ private fun servicePalette(service: ExternalServiceAccount): ServicePalette {
primaryActionContainer = Color(0xFFE3F2FD),
primaryActionTint = Color(0xFF1565C0)
)
+ ExternalServiceAccount.S3 -> ServicePalette(
+ iconContainer = MaterialTheme.colorScheme.tertiaryContainer,
+ iconTint = MaterialTheme.colorScheme.onTertiaryContainer,
+ statusContainer = Color(0xFFE8F5E9),
+ statusTint = Color(0xFF2E7D32),
+ primaryActionContainer = MaterialTheme.colorScheme.tertiaryContainer,
+ primaryActionTint = MaterialTheme.colorScheme.onTertiaryContainer
+ )
}
}
@@ -666,6 +678,7 @@ private fun accountIcon(service: ExternalServiceAccount): ImageVector {
ExternalServiceAccount.QQ_MUSIC -> Icons.Rounded.MusicNote
ExternalServiceAccount.NAVIDROME -> Icons.Rounded.CloudQueue
ExternalServiceAccount.JELLYFIN -> Icons.Rounded.CloudQueue
+ ExternalServiceAccount.S3 -> Icons.Rounded.CloudQueue
}
}
@@ -721,6 +734,7 @@ private fun serviceDisplayName(service: ExternalServiceAccount): String {
ExternalServiceAccount.QQ_MUSIC -> stringResource(R.string.auth_qq_title)
ExternalServiceAccount.NAVIDROME -> stringResource(R.string.auth_subsonic_title)
ExternalServiceAccount.JELLYFIN -> stringResource(R.string.auth_jellyfin_title)
+ ExternalServiceAccount.S3 -> stringResource(R.string.auth_s3_title)
}
}
@@ -731,6 +745,7 @@ private fun openService(
onOpenQqMusicDashboard: () -> Unit,
onOpenNavidromeDashboard: () -> Unit,
onOpenJellyfinDashboard: () -> Unit,
+ onOpenS3Dashboard: () -> Unit,
preferNeteaseDashboard: Boolean
) {
when (service) {
@@ -783,6 +798,16 @@ private fun openService(
)
}
}
+ ExternalServiceAccount.S3 -> {
+ if (preferNeteaseDashboard) {
+ onOpenS3Dashboard()
+ } else {
+ safeStartActivity(
+ context = context,
+ intent = Intent(context, com.theveloper.pixelplay.presentation.s3.auth.S3LoginActivity::class.java)
+ )
+ }
+ }
}
}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/screens/HomeScreen.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/screens/HomeScreen.kt
index ba622628f7..2a53d17f45 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/screens/HomeScreen.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/screens/HomeScreen.kt
@@ -135,6 +135,7 @@ fun HomeScreen(
qqMusicViewModel: QqMusicDashboardViewModel = hiltViewModel(),
navidromeViewModel: NavidromeDashboardViewModel = hiltViewModel(),
jellyfinViewModel: JellyfinDashboardViewModel = hiltViewModel(),
+ s3ViewModel: com.theveloper.pixelplay.presentation.s3.dashboard.S3DashboardViewModel = hiltViewModel(),
onOpenSidebar: () -> Unit
) {
val context = LocalContext.current
@@ -553,6 +554,7 @@ fun HomeScreen(
val isQqMusicLoggedIn by qqMusicViewModel.isLoggedIn.collectAsStateWithLifecycle()
val isNavidromeLoggedIn by navidromeViewModel.isLoggedIn.collectAsStateWithLifecycle()
val isJellyfinLoggedIn by jellyfinViewModel.isLoggedIn.collectAsStateWithLifecycle()
+ val isS3LoggedIn by s3ViewModel.isLoggedIn.collectAsStateWithLifecycle()
StreamingProviderSheet(
onDismissRequest = { showStreamingProviderSheet = false },
isNeteaseLoggedIn = isNeteaseLoggedIn,
@@ -570,6 +572,13 @@ fun HomeScreen(
isJellyfinLoggedIn = isJellyfinLoggedIn,
onNavigateToJellyfinDashboard = {
navController.navigateSafely(Screen.JellyfinDashboard.route)
+ },
+ isS3LoggedIn = isS3LoggedIn,
+ onNavigateToS3Dashboard = {
+ navController.navigateSafely(Screen.S3Dashboard.route)
+ },
+ onOpenDownload = {
+ navController.navigateSafely(Screen.Download.route)
}
)
}
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/telegram/auth/TelegramLoginActivity.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/telegram/auth/TelegramLoginActivity.kt
index 596cfb62c6..7f5fb41048 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/telegram/auth/TelegramLoginActivity.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/telegram/auth/TelegramLoginActivity.kt
@@ -108,6 +108,7 @@ import com.theveloper.pixelplay.presentation.telegram.channel.TelegramChannelSea
import com.theveloper.pixelplay.presentation.telegram.dashboard.TelegramDashboardScreen
import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
import com.theveloper.pixelplay.ui.theme.PixelPlayTheme
+import com.theveloper.pixelplay.utils.AppLocaleManager
import dagger.hilt.android.AndroidEntryPoint
import org.drinkless.tdlib.TdApi
import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
@@ -117,6 +118,11 @@ import androidx.compose.ui.text.style.TextOverflow
@AndroidEntryPoint
class TelegramLoginActivity : ComponentActivity() {
+
+ override fun attachBaseContext(newBase: Context) {
+ super.attachBaseContext(AppLocaleManager.wrapContext(newBase))
+ }
+
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/AccountsViewModel.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/AccountsViewModel.kt
index 354d929875..b6605b5be2 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/AccountsViewModel.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/AccountsViewModel.kt
@@ -28,7 +28,8 @@ enum class ExternalServiceAccount {
NETEASE,
QQ_MUSIC,
NAVIDROME,
- JELLYFIN
+ JELLYFIN,
+ S3
}
data class ExternalAccountUiModel(
@@ -52,7 +53,8 @@ class AccountsViewModel @Inject constructor(
private val neteaseRepository: NeteaseRepository,
private val qqMusicRepository: QqMusicRepository,
private val navidromeRepository: NavidromeRepository,
- private val jellyfinRepository: JellyfinRepository
+ private val jellyfinRepository: JellyfinRepository,
+ private val s3Repository: com.theveloper.pixelplay.data.s3.S3Repository
) : ViewModel() {
private val loggingOutServices = MutableStateFlow>(emptySet())
@@ -101,6 +103,13 @@ class AccountsViewModel @Inject constructor(
connected to playlistCount
}
+ private val s3StateFlow = combine(
+ s3Repository.isLoggedInFlow,
+ s3Repository.getFolders().map { it.size }
+ ) { connected, folderCount ->
+ connected to folderCount
+ }
+
val uiState: StateFlow = combine(
combine(
listOf(
@@ -109,7 +118,8 @@ class AccountsViewModel @Inject constructor(
neteaseStateFlow,
qqMusicStateFlow,
navidromeStateFlow,
- jellyfinStateFlow
+ jellyfinStateFlow,
+ s3StateFlow
)
) { it.toList() },
loggingOutServices
@@ -120,6 +130,7 @@ class AccountsViewModel @Inject constructor(
val (qqConnected, qqPlaylistCount) = states[3] as Pair
val (navidromeConnected, navidromePlaylistCount) = states[4] as Pair
val (jellyfinConnected, jellyfinPlaylistCount) = states[5] as Pair
+ val (s3Connected, s3FolderCount) = states[6] as Pair
val connectedAccounts = buildList {
if (telegramConnected) {
@@ -224,6 +235,23 @@ class AccountsViewModel @Inject constructor(
)
)
}
+ if (s3Connected) {
+ add(
+ ExternalAccountUiModel(
+ service = ExternalServiceAccount.S3,
+ title = "S3 Storage",
+ accountLabel = s3Repository.userBucketLabel()
+ ?.takeIf { it.isNotBlank() }
+ ?: "S3 bucket connected",
+ syncedContentLabel = formatCount(
+ count = s3FolderCount,
+ singular = "synced folder",
+ plural = "synced folders"
+ ),
+ isLoggingOut = ExternalServiceAccount.S3 in activeLogouts
+ )
+ )
+ }
}
val disconnectedServices = buildList {
@@ -233,6 +261,7 @@ class AccountsViewModel @Inject constructor(
if (!qqConnected) add(ExternalServiceAccount.QQ_MUSIC)
if (!navidromeConnected) add(ExternalServiceAccount.NAVIDROME)
if (!jellyfinConnected) add(ExternalServiceAccount.JELLYFIN)
+ if (!s3Connected) add(ExternalServiceAccount.S3)
}
AccountsUiState(
@@ -259,6 +288,7 @@ class AccountsViewModel @Inject constructor(
ExternalServiceAccount.QQ_MUSIC -> qqMusicRepository.logout()
ExternalServiceAccount.NAVIDROME -> navidromeRepository.logout()
ExternalServiceAccount.JELLYFIN -> jellyfinRepository.logout()
+ ExternalServiceAccount.S3 -> s3Repository.logout()
}
}
} finally {
diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/PlaybackDispatchStateHolder.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/PlaybackDispatchStateHolder.kt
index 8e346ebc43..7ca8800335 100644
--- a/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/PlaybackDispatchStateHolder.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/PlaybackDispatchStateHolder.kt
@@ -916,7 +916,8 @@ class PlaybackDispatchStateHolder @Inject constructor(
scheme != "qqmusic" &&
scheme != "navidrome" &&
scheme != "jellyfin" &&
- scheme != "gdrive"
+ scheme != "gdrive" &&
+ scheme != "s3"
) {
return mediaItem
}
diff --git a/app/src/main/java/com/theveloper/pixelplay/utils/MediaItemBuilder.kt b/app/src/main/java/com/theveloper/pixelplay/utils/MediaItemBuilder.kt
index 48a8e1bcea..1c3e058b20 100644
--- a/app/src/main/java/com/theveloper/pixelplay/utils/MediaItemBuilder.kt
+++ b/app/src/main/java/com/theveloper/pixelplay/utils/MediaItemBuilder.kt
@@ -87,6 +87,8 @@ object MediaItemBuilder {
const val EXTERNAL_EXTRA_ALBUM = EXTERNAL_EXTRA_PREFIX + "ALBUM"
const val EXTERNAL_EXTRA_DURATION = EXTERNAL_EXTRA_PREFIX + "DURATION"
const val EXTERNAL_EXTRA_CONTENT_URI = EXTERNAL_EXTRA_PREFIX + "CONTENT_URI"
+ /** Original cloud URI (e.g. s3://, gdrive://) of a resolved item — never the loopback proxy URL. */
+ const val ORIGINAL_CONTENT_URI = EXTERNAL_EXTRA_PREFIX + "ORIGINAL_URI"
const val EXTERNAL_EXTRA_ALBUM_ART = EXTERNAL_EXTRA_PREFIX + "ALBUM_ART"
const val EXTERNAL_EXTRA_GENRE = EXTERNAL_EXTRA_PREFIX + "GENRE"
const val EXTERNAL_EXTRA_TRACK = EXTERNAL_EXTRA_PREFIX + "TRACK"
diff --git a/app/src/main/res/drawable/rounded_storage_24.xml b/app/src/main/res/drawable/rounded_storage_24.xml
new file mode 100644
index 0000000000..894c29c6d5
--- /dev/null
+++ b/app/src/main/res/drawable/rounded_storage_24.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/app/src/main/res/values-de/strings_cloud_services.xml b/app/src/main/res/values-de/strings_cloud_services.xml
index 3c923fff67..9ada90b98a 100644
--- a/app/src/main/res/values-de/strings_cloud_services.xml
+++ b/app/src/main/res/values-de/strings_cloud_services.xml
@@ -225,4 +225,115 @@
Bei QQ Music anmelden
Dein Passwort wird nur auf QQ Music-Seiten eingegeben. PixelPlayer speichert nur Session-Cookies zur Bibliothekssynchronisierung.
QQ Music
+ S3-Speicher
+ Streame Musik aus jedem S3-kompatiblen Bucket: AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi…
+ Musikdateien werden direkt aus dem Bucket gestreamt. Deine Zugangsschlüssel werden verschlüsselt auf diesem Gerät gespeichert und verlassen es nie.
+ Endpunkt
+ HTTPS-Endpunkt des S3-kompatiblen Dienstes
+ Region
+ Region des Buckets (z. B. us-east-1, auto für R2)
+ Bucket
+ Name des Buckets mit deiner Musik
+ Zugriffsschlüssel-ID
+ Zugriffsschlüssel aus der Konsole des Anbieters
+ Geheimer Zugriffsschlüssel
+ Geheimer Zugriffsschlüssel
+ Wird verschlüsselt auf diesem Gerät gespeichert
+ Ordnerpräfix (optional)
+ Durchsuchen auf dieses Schlüsselpräfix beschränken
+ Tipp: Bei Dateien namens \"Künstler - Titel.ext\" werden Künstler und Titel automatisch erkannt. HTTPS ist erforderlich.
+ S3 verbunden!
+ Musikordner auswählen
+ Keine Unterordner vorhanden
+ Hinzufügen
+ Diesen Ordner hinzufügen
+ Musikordner
+ Tippe auf +, um einen Bucket-Ordner hinzuzufügen
+ Noch keine Ordner hinzugefügt
+ %1$d Ordner synchronisiert
+ Ordner hinzufügen
+ Verbindung bearbeiten
+ Tags werden gelesen… noch %1$d Songs
+ Wird abgeschlossen…
+ Downloads
+ Von externen Anbietern suchen und herunterladen
+ Titel suchen…
+ Suchen
+ Herunterladen
+ Erweiterungen verwalten
+ Keine Ergebnisse. Installiere und aktiviere zuerst eine Erweiterung.
+ Wähle zuerst einen Download-Ordner
+ Wähle einen Download-Ordner, damit fertige Titel in deiner Bibliothek gespeichert werden.
+ Ordner wählen
+ Download-Warteschlange
+ Abbrechen
+ Erneut versuchen
+ Verwerfen
+ In Warteschlange
+ Wird heruntergeladen
+ Abgeschlossen
+ Fehlgeschlagen
+ Abgebrochen
+ Verifizierung erforderlich
+ Öffne %1$s im Browser und schließe die Prüfung ab. PixelPlay setzt den Download automatisch fort, wenn der Browser zurückkehrt. Falls du stattdessen einen Code erhalten hast, gib ihn unten ein.
+ Bestätigungscode
+ Senden
+ Abbrechen
+ Erweiterungen
+ Aus Datei installieren
+ Erweiterung entfernen
+ Erweiterungen enthalten Code von Drittanbietern, der auf deinem Gerät ausgeführt wird. Installiere nur Erweiterungen, denen du vertraust.
+ Installiere eine Erweiterung, um Downloads zu aktivieren.
+ Erweiterung konnte nicht installiert werden
+ Aktiviert
+ Deaktiviert
+ Fehler
+ Installiert
+ Repository
+ Installiert
+ Repository wird geladen…
+ Repository konnte nicht geladen werden
+ Gib die URL der Erweiterungs-Registry ein
+ Registry-URL
+ Laden
+ Registry-URL ändern
+ Registry-URL entfernen
+ Mit Erweiterung herunterladen
+ Download-Erweiterung
+ Audioqualität
+ Keine Download-Erweiterung installiert. Installiere eine im Tab Erweiterungen.
+ Herunterladen
+ Die installierten Erweiterungen sind keine Download-Anbieter. Installiere eine Download-Erweiterung (z. B. Amazon Music) im Tab Erweiterungen.
+ Browser öffnen
+ Verifizierung abgeschlossen – Downloads werden erneut versucht
+ Verifizierung fehlgeschlagen – versuche es erneut
+ Metadaten
+ Download
+ Songtexte
+ So erhältst du eine Registry-URL
+ Eine Registry ist ein registry.json-Manifest mit einer Liste von Erweiterungen (id, name, version, download_url, sha256). Frage den Autor der Erweiterung oder die Community nach dem Link.
+ GitHub-Repository: Füge den Repo-Link ein, z. B. https://github.com/owner/repo – registry.json wird aus dem Standard-Branch gelesen.
+ Direkter Link: Füge die Raw-JSON-URL ein, z. B. https://raw.githubusercontent.com/owner/repo/main/registry.json oder eine andere https-URL, die JSON liefert.
+ Prüfe, dass sie im Browser als JSON und nicht als Webseite geöffnet wird. Füge nur vertrauenswürdige Registries hinzu: Erweiterungen führen Code auf deinem Gerät aus.
+ Werkzeug
+ Integration
+ Musik-Downloads
+ Download wird gestartet…
+ %1$s wird entschlüsselt…
+ %1$s wird heruntergeladen · %2$d%%
+ Kein Download-Ordner ausgewählt
+ Download fehlgeschlagen
+ Das Backend hat keine Datei zurückgegeben
+ Verschlüsselter Stream konnte nicht entschlüsselt werden
+ Download-Ordner nicht verfügbar – wähle ihn erneut
+ Datei im Download-Ordner konnte nicht erstellt werden
+ Zieldatei konnte nicht geöffnet werden
+ Datei konnte nicht gespeichert werden
+ Kompatibel sind die SpotiFLAC-Erweiterungen, die hier aufgelistet sind:
+ Album
+ Künstler
+ Playlist
+ Suchquelle
+ Top-Titel
+ Alle herunterladen (%1$d)
\ No newline at end of file
diff --git a/app/src/main/res/values-es/strings_cloud_services.xml b/app/src/main/res/values-es/strings_cloud_services.xml
index 281b73b7a9..2b38ccae22 100644
--- a/app/src/main/res/values-es/strings_cloud_services.xml
+++ b/app/src/main/res/values-es/strings_cloud_services.xml
@@ -225,4 +225,115 @@
Iniciar sesión en QQ Music
Nota de seguridad: tu contraseña solo se introduce en las páginas web de QQ Music. PixelPlayer guarda las cookies de sesión para sincronizar tu biblioteca.
QQ Music
+ Almacenamiento S3
+ Reproduce música desde cualquier bucket compatible con S3: AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi…
+ Los archivos de música se reproducen directamente desde el bucket. Tus claves de acceso se guardan cifradas en este dispositivo y nunca salen de él.
+ Endpoint
+ Endpoint HTTPS del servicio compatible con S3
+ Región
+ Región del bucket (p. ej., us-east-1, auto para R2)
+ Bucket
+ Nombre del bucket que contiene tu música
+ ID de clave de acceso
+ Clave de acceso de la consola del proveedor
+ Clave de acceso secreta
+ Clave de acceso secreta
+ Se guarda cifrada en este dispositivo
+ Prefijo de carpeta (opcional)
+ Limitar la exploración a este prefijo
+ Consejo: en los archivos llamados \"Artista - Título.ext\" el artista y el título se detectan automáticamente. Se requiere HTTPS.
+ ¡S3 conectado!
+ Elige una carpeta de música
+ No hay subcarpetas aquí
+ Añadir
+ Añadir esta carpeta
+ Carpetas de música
+ Toca + para añadir una carpeta del bucket
+ Aún no se han añadido carpetas
+ %1$d carpetas sincronizadas
+ Añadir carpeta
+ Editar conexión
+ Leyendo etiquetas… quedan %1$d canciones
+ Finalizando…
+ Descargas
+ Busca y descarga desde proveedores externos
+ Buscar canciones…
+ Buscar
+ Descargar
+ Gestionar extensiones
+ Sin resultados. Instala y activa primero una extensión.
+ Elige primero una carpeta de descargas
+ Elige una carpeta de descargas para guardar las canciones terminadas en tu biblioteca.
+ Elegir carpeta
+ Cola de descargas
+ Cancelar
+ Reintentar
+ Descartar
+ En cola
+ Descargando
+ Completada
+ Fallida
+ Cancelada
+ Verificación necesaria
+ Abre %1$s en tu navegador y completa la verificación. PixelPlay continúa la descarga automáticamente al volver del navegador; si recibiste un código, introdúcelo abajo.
+ Código de verificación
+ Enviar
+ Cancelar
+ Extensiones
+ Instalar desde archivo
+ Eliminar extensión
+ Las extensiones contienen código de terceros que se ejecuta en tu dispositivo. Instala solo extensiones de confianza.
+ Instala una extensión para habilitar las descargas.
+ No se pudo instalar la extensión
+ Activada
+ Desactivada
+ Error
+ Instaladas
+ Repositorio
+ Instalada
+ Cargando repositorio…
+ No se pudo cargar el repositorio
+ Introduce la URL del registro de extensiones
+ URL del registro
+ Cargar
+ Cambiar URL del registro
+ Quitar URL del registro
+ Descargar con extensión
+ Extensión de descarga
+ Calidad de audio
+ No hay ninguna extensión de descarga instalada. Instala una desde la pestaña Extensiones.
+ Descargar
+ Las extensiones instaladas no son proveedores de descarga. Instala una extensión de descarga (p. ej., Amazon Music) desde la pestaña Extensiones.
+ Abrir navegador
+ Verificación completada: reintentando descargas
+ La verificación falló; inténtalo de nuevo
+ Metadatos
+ Descarga
+ Letras
+ Cómo obtener una URL de registro
+ Un registro es un manifiesto registry.json con la lista de extensiones (id, name, version, download_url, sha256). Pide el enlace al autor de la extensión o a la comunidad.
+ Repositorio de GitHub: pega el enlace del repo, p. ej., https://github.com/owner/repo; registry.json se lee de su rama predeterminada.
+ Enlace directo: pega la URL del JSON sin procesar, p. ej., https://raw.githubusercontent.com/owner/repo/main/registry.json o cualquier URL https que devuelva JSON.
+ Comprueba que se abre como JSON en el navegador y no como página web. Añade solo registros de confianza: las extensiones ejecutan código en tu dispositivo.
+ Utilidad
+ Integración
+ Descargas de música
+ Iniciando descarga…
+ Descifrando %1$s…
+ Descargando %1$s · %2$d%%
+ No se ha elegido una carpeta de descargas
+ La descarga falló
+ El backend no devolvió ningún archivo
+ No se pudo descifrar el stream cifrado
+ Carpeta de descargas no disponible: vuelve a elegirla
+ No se pudo crear el archivo en la carpeta de descargas
+ No se pudo abrir el archivo de destino
+ No se pudo guardar el archivo
+ Las extensiones compatibles son las extensiones de SpotiFLAC que aparecen en:
+ Álbum
+ Artista
+ Lista
+ Fuente de búsqueda
+ Canciones populares
+ Descargar todo (%1$d)
\ No newline at end of file
diff --git a/app/src/main/res/values-fr/strings_cloud_services.xml b/app/src/main/res/values-fr/strings_cloud_services.xml
index b19f0e66b7..6c2b91deec 100644
--- a/app/src/main/res/values-fr/strings_cloud_services.xml
+++ b/app/src/main/res/values-fr/strings_cloud_services.xml
@@ -225,4 +225,115 @@
Connexion à QQ Music
Note de sécurité : votre mot de passe est saisi uniquement dans les pages web de QQ Music. PixelPlayer stocke les cookies de session pour synchroniser votre bibliothèque.
QQ Music
+ Stockage S3
+ Écoutez de la musique depuis n\'importe quel bucket compatible S3 : AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi…
+ Les fichiers musicaux sont diffusés directement depuis le bucket. Vos clés d\'accès sont chiffrées sur cet appareil et ne le quittent jamais.
+ Point de terminaison
+ Point de terminaison HTTPS du service compatible S3
+ Région
+ Région du bucket (ex. us-east-1, auto pour R2)
+ Bucket
+ Nom du bucket contenant votre musique
+ ID de clé d\'accès
+ Clé d\'accès fournie par la console du fournisseur
+ Clé d\'accès secrète
+ Clé d\'accès secrète
+ Conservée chiffrée sur cet appareil
+ Préfixe de dossier (facultatif)
+ Limiter la navigation à ce préfixe
+ Astuce : pour les fichiers nommés \"Artiste - Titre.ext\", l\'artiste et le titre sont détectés automatiquement. HTTPS est requis.
+ S3 connecté !
+ Choisir un dossier de musique
+ Aucun sous-dossier ici
+ Ajouter
+ Ajouter ce dossier
+ Dossiers de musique
+ Appuyez sur + pour ajouter un dossier du bucket
+ Aucun dossier ajouté pour l\'instant
+ %1$d dossiers synchronisés
+ Ajouter un dossier
+ Modifier la connexion
+ Lecture des tags… %1$d titres restants
+ Finalisation…
+ Téléchargements
+ Rechercher et télécharger depuis des fournisseurs externes
+ Rechercher des titres…
+ Rechercher
+ Télécharger
+ Gérer les extensions
+ Aucun résultat. Installez et activez d\'abord une extension.
+ Choisissez d\'abord un dossier de téléchargement
+ Choisissez un dossier de téléchargement pour que les titres terminés soient ajoutés à votre bibliothèque.
+ Choisir un dossier
+ File de téléchargement
+ Annuler
+ Réessayer
+ Ignorer
+ En attente
+ Téléchargement
+ Terminé
+ Échec
+ Annulé
+ Vérification requise
+ Ouvrez %1$s dans votre navigateur et terminez la vérification. PixelPlay reprend le téléchargement automatiquement au retour du navigateur ; si vous avez reçu un code, saisissez-le ci-dessous.
+ Code de vérification
+ Envoyer
+ Annuler
+ Extensions
+ Installer depuis un fichier
+ Supprimer l\'extension
+ Les extensions contiennent du code tiers exécuté sur votre appareil. N\'installez que des extensions de confiance.
+ Installez une extension pour activer les téléchargements.
+ Impossible d\'installer l\'extension
+ Activée
+ Désactivée
+ Erreur
+ Installées
+ Dépôt
+ Installée
+ Chargement du dépôt…
+ Impossible de charger le dépôt
+ Saisissez l\'URL du registre d\'extensions
+ URL du registre
+ Charger
+ Modifier l\'URL du registre
+ Supprimer l\'URL du registre
+ Télécharger avec une extension
+ Extension de téléchargement
+ Qualité audio
+ Aucune extension de téléchargement installée. Installez-en une depuis l\'onglet Extensions.
+ Télécharger
+ Les extensions installées ne sont pas des fournisseurs de téléchargement. Installez une extension de téléchargement (ex. Amazon Music) depuis l\'onglet Extensions.
+ Ouvrir le navigateur
+ Vérification terminée — nouvelle tentative des téléchargements
+ Échec de la vérification — réessayez
+ Métadonnées
+ Téléchargement
+ Paroles
+ Comment obtenir une URL de registre
+ Un registre est un manifeste registry.json qui liste des extensions (id, name, version, download_url, sha256). Demandez le lien à l\'auteur de l\'extension ou à la communauté.
+ Dépôt GitHub : collez le lien du dépôt, ex. https://github.com/owner/repo — registry.json est lu depuis sa branche par défaut.
+ Lien direct : collez l\'URL du JSON brut, ex. https://raw.githubusercontent.com/owner/repo/main/registry.json ou toute URL https qui renvoie du JSON.
+ Vérifiez qu\'elle s\'ouvre en JSON dans le navigateur et non comme une page web. N\'ajoutez que des registres de confiance : les extensions exécutent du code sur votre appareil.
+ Utilitaire
+ Intégration
+ Téléchargements de musique
+ Démarrage du téléchargement…
+ Déchiffrement de %1$s…
+ Téléchargement de %1$s · %2$d%%
+ Aucun dossier de téléchargement sélectionné
+ Échec du téléchargement
+ Le backend n\'a renvoyé aucun fichier
+ Impossible de déchiffrer le flux chiffré
+ Dossier de téléchargement indisponible — sélectionnez-le à nouveau
+ Impossible de créer le fichier dans le dossier de téléchargement
+ Impossible d\'ouvrir le fichier de destination
+ Impossible d\'enregistrer le fichier
+ Les extensions compatibles sont les extensions SpotiFLAC répertoriées sur :
+ Album
+ Artiste
+ Playlist
+ Source de recherche
+ Titres populaires
+ Tout télécharger (%1$d)
\ No newline at end of file
diff --git a/app/src/main/res/values-in/strings_cloud_services.xml b/app/src/main/res/values-in/strings_cloud_services.xml
index b71bab87e9..70435595af 100644
--- a/app/src/main/res/values-in/strings_cloud_services.xml
+++ b/app/src/main/res/values-in/strings_cloud_services.xml
@@ -225,4 +225,127 @@
Login ke QQ Music
Catatan keamanan: kata sandi Anda hanya dimasukkan di halaman web QQ Music. PixelPlayer menyimpan cookie sesi untuk menyinkronkan pustaka Anda.
QQ Music
-
\ No newline at end of file
+ Membaca tag… %1$d lagu tersisa
+ Menyelesaikan…
+
+
+ Unduhan
+ Cari dan unduh dari penyedia eksternal
+ Cari lagu…
+ Cari
+ Unduh
+ Kelola ekstensi
+ Tidak ada hasil. Instal dan aktifkan ekstensi terlebih dahulu.
+ Pilih folder unduhan terlebih dahulu
+ Pilih folder unduhan agar lagu yang selesai tersimpan ke pustaka Anda.
+ Pilih folder
+ Antrean unduhan
+ Batal
+ Coba lagi
+ Tutup
+ Antre
+ Mengunduh
+ Selesai
+ Gagal
+ Dibatalkan
+ %1$s — %2$s
+ Verifikasi diperlukan
+ Buka %1$s di browser dan selesaikan verifikasi. PixelPlay melanjutkan unduhan otomatis saat browser kembali; jika Anda menerima kode, masukkan di bawah.
+ Kode verifikasi
+ Kirim
+ Batal
+
+
+ Ekstensi
+ Instal dari file
+ Hapus ekstensi
+ Ekstensi berisi kode pihak ketiga yang berjalan di perangkat Anda. Hanya instal ekstensi yang Anda percaya.
+ Instal ekstensi untuk mengaktifkan unduhan.
+ Tidak dapat menginstal ekstensi
+ Aktif
+ Nonaktif
+ Gagal
+ Terpasang
+ Repositori
+ Terpasang
+ Memuat repositori…
+ Gagal memuat repositori
+ Masukkan URL registry ekstensi untuk melihat daftar
+ URL Registry
+ https://example.com/registry.json
+ Muat
+ Ganti URL registry
+ Hapus URL registry
+
+ Access key dari console penyedia layanan
+ Access Key ID
+ AKIA…
+ Tambah
+ Tambah folder ini
+ Nama bucket tempat musikmu disimpan
+ Bucket
+ musik-saya
+ S3 terhubung!
+ Endpoint HTTPS layanan S3-compatible
+ Endpoint
+ https://s3.us-east-1.amazonaws.com
+ Tips: file bernama \u0022Artis - Judul.ext\u0022 artist dan judul terdeteksi otomatis. HTTPS wajib.
+ File musik diputar langsung dari bucket. Access key tersimpan terenkripsi di perangkat ini dan tidak pernah keluar dari sana.
+ Tidak ada sub-folder di sini
+ Pilih folder musik
+ Batasi penjelajahan ke prefix key ini
+ Prefix folder (opsional)
+ musik/
+ Region bucket (mis. us-east-1, auto untuk R2)
+ Region
+ us-east-1
+ Tersimpan terenkripsi di perangkat ini
+ Secret Access Key
+ Secret access key
+ Streaming musik dari bucket S3-compatible apa pun: AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi…
+ Penyimpanan S3
+ Tambah folder
+ Edit koneksi
+ Ketuk + untuk menambah folder bucket
+ %1$d folder tersinkron
+ Folder musik
+ Belum ada folder
+ Unduh dengan extension
+ Extension pengunduh
+ Kualitas audio
+ Belum ada extension pengunduh terpasang. Instal dari tab Extensions.
+ Unduh
+ Extension terpasang bukan extension pengunduh. Pasang extension pengunduh (mis. Amazon Music) dari tab Extensions.
+ Buka browser
+ Verifikasi selesai — mengulang unduhan
+ Verifikasi gagal — coba lagi
+ Metadata
+ Unduhan
+ Lirik
+ Cara mendapatkan URL registry
+ Registry adalah manifest registry.json berisi daftar ekstensi (id, name, version, download_url, sha256). Minta tautannya dari pembuat ekstensi atau komunitas.
+ Repositori GitHub: tempel tautan repo, mis. https://github.com/owner/repo — registry.json dibaca dari branch default.
+ Tautan langsung: tempel URL JSON mentah, mis. https://raw.githubusercontent.com/owner/repo/main/registry.json atau URL https lain yang mengembalikan JSON.
+ Pastikan URL terbuka sebagai JSON di browser, bukan halaman web. Hanya tambahkan registry tepercaya: ekstensi menjalankan kode di perangkat Anda.
+ Utilitas
+ Integrasi
+ Unduhan musik
+ Memulai unduhan…
+ Mendekripsi %1$s…
+ Mengunduh %1$s · %2$d%%
+ Folder unduhan belum dipilih
+ Unduhan gagal
+ Backend tidak mengembalikan file
+ Gagal mendekripsi stream terenkripsi
+ Folder unduhan tidak tersedia — pilih ulang
+ Tidak dapat membuat file di folder unduhan
+ Tidak dapat membuka file tujuan
+ Gagal menyimpan file
+ Ekstensi yang kompatibel adalah ekstensi SpotiFLAC dari:
+ Album
+ Artis
+ Playlist
+ Sumber pencarian
+ Lagu teratas
+ Unduh semua (%1$d)
+
diff --git a/app/src/main/res/values-it/strings_cloud_services.xml b/app/src/main/res/values-it/strings_cloud_services.xml
index b1c202a7b4..e43e2a3b41 100644
--- a/app/src/main/res/values-it/strings_cloud_services.xml
+++ b/app/src/main/res/values-it/strings_cloud_services.xml
@@ -225,4 +225,115 @@
Accedi a QQ Music
Nota sulla sicurezza: la tua password viene inserita solo nelle pagine web di QQ Music. PixelPlayer memorizza i cookie di sessione per sincronizzare la tua libreria.
QQ Music
+ Archiviazione S3
+ Ascolta musica da qualsiasi bucket compatibile con S3: AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi…
+ I file musicali vengono riprodotti direttamente dal bucket. Le tue chiavi di accesso sono salvate crittografate su questo dispositivo e non lo lasciano mai.
+ Endpoint
+ Endpoint HTTPS del servizio compatibile con S3
+ Regione
+ Regione del bucket (es. us-east-1, auto per R2)
+ Bucket
+ Nome del bucket che contiene la tua musica
+ ID chiave di accesso
+ Chiave di accesso dalla console del provider
+ Chiave di accesso segreta
+ Chiave di accesso segreta
+ Conservata crittografata su questo dispositivo
+ Prefisso cartella (facoltativo)
+ Limita la navigazione a questo prefisso
+ Suggerimento: per i file chiamati \"Artista - Titolo.ext\" artista e titolo vengono riconosciuti automaticamente. È richiesto HTTPS.
+ S3 connesso!
+ Scegli una cartella musicale
+ Nessuna sottocartella qui
+ Aggiungi
+ Aggiungi questa cartella
+ Cartelle musicali
+ Tocca + per aggiungere una cartella del bucket
+ Nessuna cartella aggiunta
+ %1$d cartelle sincronizzate
+ Aggiungi cartella
+ Modifica connessione
+ Lettura dei tag… %1$d brani rimanenti
+ Completamento…
+ Download
+ Cerca e scarica da provider esterni
+ Cerca brani…
+ Cerca
+ Scarica
+ Gestisci estensioni
+ Nessun risultato. Installa e attiva prima un\'estensione.
+ Scegli prima una cartella di download
+ Scegli una cartella di download per salvare i brani completati nella tua libreria.
+ Scegli cartella
+ Coda di download
+ Annulla
+ Riprova
+ Ignora
+ In coda
+ Download in corso
+ Completato
+ Non riuscito
+ Annullato
+ Verifica richiesta
+ Apri %1$s nel browser e completa la verifica. PixelPlay riprende il download automaticamente al ritorno dal browser; se invece hai ricevuto un codice, inseriscilo qui sotto.
+ Codice di verifica
+ Invia
+ Annulla
+ Estensioni
+ Installa da file
+ Rimuovi estensione
+ Le estensioni contengono codice di terze parti eseguito sul tuo dispositivo. Installa solo estensioni di cui ti fidi.
+ Installa un\'estensione per abilitare i download.
+ Impossibile installare l\'estensione
+ Attivata
+ Disattivata
+ Errore
+ Installate
+ Repository
+ Installata
+ Caricamento repository…
+ Impossibile caricare il repository
+ Inserisci l\'URL del registro delle estensioni
+ URL del registro
+ Carica
+ Cambia URL del registro
+ Rimuovi URL del registro
+ Scarica con estensione
+ Estensione di download
+ Qualità audio
+ Nessuna estensione di download installata. Installane una dalla scheda Estensioni.
+ Scarica
+ Le estensioni installate non sono provider di download. Installa un\'estensione di download (es. Amazon Music) dalla scheda Estensioni.
+ Apri browser
+ Verifica completata — nuovo tentativo dei download
+ Verifica non riuscita — riprova
+ Metadati
+ Download
+ Testi
+ Come ottenere un URL del registro
+ Un registro è un manifest registry.json che elenca le estensioni (id, name, version, download_url, sha256). Chiedi il link all\'autore dell\'estensione o alla community.
+ Repository GitHub: incolla il link del repo, es. https://github.com/owner/repo — registry.json viene letto dal branch predefinito.
+ Link diretto: incolla l\'URL del JSON grezzo, es. https://raw.githubusercontent.com/owner/repo/main/registry.json o qualsiasi URL https che restituisce JSON.
+ Assicurati che nel browser si apra come JSON e non come pagina web. Aggiungi solo registri attendibili: le estensioni eseguono codice sul tuo dispositivo.
+ Utilità
+ Integrazione
+ Download musicali
+ Avvio del download…
+ Decrittografia di %1$s…
+ Download di %1$s · %2$d%%
+ Nessuna cartella di download selezionata
+ Download non riuscito
+ Il backend non ha restituito alcun file
+ Impossibile decrittografare lo stream crittografato
+ Cartella di download non disponibile — selezionala di nuovo
+ Impossibile creare il file nella cartella di download
+ Impossibile aprire il file di destinazione
+ Impossibile salvare il file
+ Le estensioni compatibili sono le estensioni SpotiFLAC elencate su:
+ Album
+ Artista
+ Playlist
+ Fonte di ricerca
+ Brani popolari
+ Scarica tutto (%1$d)
\ No newline at end of file
diff --git a/app/src/main/res/values-ko/strings_cloud_services.xml b/app/src/main/res/values-ko/strings_cloud_services.xml
index 0fcfb72ec1..ed0cc369ce 100644
--- a/app/src/main/res/values-ko/strings_cloud_services.xml
+++ b/app/src/main/res/values-ko/strings_cloud_services.xml
@@ -223,4 +223,115 @@
QQ Music 로그인
보안 안내: 비밀번호는 QQ Music 웹 페이지 내에서만 입력됩니다. PixelPlayer는 라이브러리 동기화를 위해 세션 쿠키를 저장합니다.
QQ Music
+ S3 스토리지
+ S3 호환 버킷에서 음악을 스트리밍하세요: AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi…
+ 음악 파일은 버킷에서 바로 스트리밍됩니다. 액세스 키는 이 기기에 암호화되어 저장되며 외부로 전송되지 않습니다.
+ 엔드포인트
+ S3 호환 서비스의 HTTPS 엔드포인트
+ 리전
+ 버킷 리전 (예: us-east-1, R2는 auto)
+ 버킷
+ 음악이 저장된 버킷 이름
+ 액세스 키 ID
+ 제공업체 콘솔의 액세스 키
+ 비밀 액세스 키
+ 비밀 액세스 키
+ 이 기기에 암호화되어 저장됩니다
+ 폴더 접두사 (선택 사항)
+ 이 키 접두사로 탐색 범위 제한
+ 팁: \"아티스트 - 제목.ext\" 형식의 파일은 아티스트와 제목이 자동으로 인식됩니다. HTTPS가 필요합니다.
+ S3에 연결되었습니다!
+ 음악 폴더 선택
+ 하위 폴더가 없습니다
+ 추가
+ 이 폴더 추가
+ 음악 폴더
+ +를 눌러 버킷 폴더를 추가하세요
+ 아직 추가된 폴더가 없습니다
+ 폴더 %1$d개 동기화됨
+ 폴더 추가
+ 연결 편집
+ 태그 읽는 중… %1$d곡 남음
+ 마무리 중…
+ 다운로드
+ 외부 제공업체에서 검색 및 다운로드
+ 곡 검색…
+ 검색
+ 다운로드
+ 확장 프로그램 관리
+ 결과가 없습니다. 먼저 확장 프로그램을 설치하고 활성화하세요.
+ 먼저 다운로드 폴더를 선택하세요
+ 완료된 곡이 라이브러리에 저장되도록 다운로드 폴더를 선택하세요.
+ 폴더 선택
+ 다운로드 대기열
+ 취소
+ 다시 시도
+ 닫기
+ 대기 중
+ 다운로드 중
+ 완료
+ 실패
+ 취소됨
+ 인증 필요
+ 브라우저에서 %1$s을(를) 열고 확인을 완료하세요. 브라우저에서 돌아오면 PixelPlay가 자동으로 다운로드를 계속합니다. 코드를 받았다면 아래에 입력하세요.
+ 인증 코드
+ 제출
+ 취소
+ 확장 프로그램
+ 파일에서 설치
+ 확장 프로그램 제거
+ 확장 프로그램에는 기기에서 실행되는 타사 코드가 포함되어 있습니다. 신뢰할 수 있는 확장 프로그램만 설치하세요.
+ 다운로드를 사용하려면 확장 프로그램을 설치하세요.
+ 확장 프로그램을 설치할 수 없습니다
+ 사용 중
+ 사용 안 함
+ 오류
+ 설치됨
+ 저장소
+ 설치됨
+ 저장소 불러오는 중…
+ 저장소를 불러오지 못했습니다
+ 확장 프로그램 레지스트리 URL을 입력하세요
+ 레지스트리 URL
+ 불러오기
+ 레지스트리 URL 변경
+ 레지스트리 URL 삭제
+ 확장 프로그램으로 다운로드
+ 다운로드 확장 프로그램
+ 오디오 품질
+ 설치된 다운로드 확장 프로그램이 없습니다. 확장 프로그램 탭에서 설치하세요.
+ 다운로드
+ 설치된 확장 프로그램은 다운로드 제공자가 아닙니다. 확장 프로그램 탭에서 다운로드 확장 프로그램(예: Amazon Music)을 설치하세요.
+ 브라우저 열기
+ 인증 완료 — 다운로드를 다시 시도합니다
+ 인증 실패 — 다시 시도하세요
+ 메타데이터
+ 다운로드
+ 가사
+ 레지스트리 URL을 얻는 방법
+ 레지스트리는 확장 프로그램 목록(id, name, version, download_url, sha256)이 담긴 registry.json 매니페스트입니다. 확장 프로그램 제작자나 커뮤니티에 링크를 요청하세요.
+ GitHub 저장소: 저장소 링크를 붙여넣으세요 (예: https://github.com/owner/repo). registry.json은 기본 브랜치에서 읽습니다.
+ 직접 링크: 원본 JSON URL을 붙여넣으세요 (예: https://raw.githubusercontent.com/owner/repo/main/registry.json 또는 JSON을 반환하는 https URL).
+ 브라우저에서 웹 페이지가 아닌 JSON으로 열리는지 확인하세요. 신뢰할 수 있는 레지스트리만 추가하세요. 확장 프로그램은 기기에서 코드를 실행합니다.
+ 유틸리티
+ 연동
+ 음악 다운로드
+ 다운로드 시작 중…
+ %1$s 복호화 중…
+ %1$s 다운로드 중 · %2$d%%
+ 다운로드 폴더가 선택되지 않았습니다
+ 다운로드 실패
+ 백엔드가 파일을 반환하지 않았습니다
+ 암호화된 스트림을 복호화하지 못했습니다
+ 다운로드 폴더를 사용할 수 없습니다 — 다시 선택하세요
+ 다운로드 폴더에 파일을 만들 수 없습니다
+ 대상 파일을 열 수 없습니다
+ 파일을 저장하지 못했습니다
+ 호환되는 확장 프로그램은 다음에 등록된 SpotiFLAC 확장 프로그램입니다:
+ 앨범
+ 아티스트
+ 플레이리스트
+ 검색 소스
+ 인기 곡
+ 모두 다운로드 (%1$d)
\ No newline at end of file
diff --git a/app/src/main/res/values-nb/strings_cloud_services.xml b/app/src/main/res/values-nb/strings_cloud_services.xml
index 283383cf00..114fc89a31 100644
--- a/app/src/main/res/values-nb/strings_cloud_services.xml
+++ b/app/src/main/res/values-nb/strings_cloud_services.xml
@@ -225,4 +225,115 @@
Logg inn på QQ Music
Sikkerhetsmerknad: passordet ditt tastes kun inn på QQ Musics nettsider. PixelPlayer lagrer sesjonsinformasjon for å synkronisere biblioteket ditt.
QQ Music
+ S3-lagring
+ Strøm musikk fra hvilken som helst S3-kompatibel bucket: AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi…
+ Musikkfiler strømmes direkte fra bucketen. Tilgangsnøklene dine lagres kryptert på denne enheten og forlater den aldri.
+ Endepunkt
+ HTTPS-endepunkt for den S3-kompatible tjenesten
+ Region
+ Bucketens region (f.eks. us-east-1, auto for R2)
+ Bucket
+ Navnet på bucketen som inneholder musikken din
+ Tilgangsnøkkel-ID
+ Tilgangsnøkkel fra leverandørens konsoll
+ Hemmelig tilgangsnøkkel
+ Hemmelig tilgangsnøkkel
+ Lagres kryptert på denne enheten
+ Mappeprefiks (valgfritt)
+ Begrens blaing til dette nøkkelprefikset
+ Tips: Filer med navn som \"Artist - Tittel.ext\" får artist og tittel gjenkjent automatisk. HTTPS er påkrevd.
+ S3 tilkoblet!
+ Velg en musikkmappe
+ Ingen undermapper her
+ Legg til
+ Legg til denne mappen
+ Musikkmapper
+ Trykk på + for å legge til en bucket-mappe
+ Ingen mapper lagt til ennå
+ %1$d mapper synkronisert
+ Legg til mappe
+ Rediger tilkobling
+ Leser tagger… %1$d sanger gjenstår
+ Fullfører…
+ Nedlastinger
+ Søk og last ned fra eksterne leverandører
+ Søk etter spor…
+ Søk
+ Last ned
+ Administrer utvidelser
+ Ingen resultater. Installer og aktiver en utvidelse først.
+ Velg en nedlastingsmappe først
+ Velg en nedlastingsmappe slik at ferdige spor lagres i biblioteket ditt.
+ Velg mappe
+ Nedlastingskø
+ Avbryt
+ Prøv igjen
+ Fjern
+ I kø
+ Laster ned
+ Fullført
+ Mislyktes
+ Avbrutt
+ Bekreftelse kreves
+ Åpne %1$s i nettleseren og fullfør kontrollen. PixelPlay fortsetter nedlastingen automatisk når nettleseren går tilbake. Hvis du fikk en kode i stedet, skriver du den inn nedenfor.
+ Bekreftelseskode
+ Send
+ Avbryt
+ Utvidelser
+ Installer fra fil
+ Fjern utvidelse
+ Utvidelser inneholder tredjepartskode som kjører på enheten din. Installer bare utvidelser du stoler på.
+ Installer en utvidelse for å aktivere nedlastinger.
+ Kunne ikke installere utvidelsen
+ Aktivert
+ Deaktivert
+ Feil
+ Installert
+ Repository
+ Installert
+ Laster inn repository…
+ Kunne ikke laste inn repository
+ Skriv inn URL-en til utvidelsesregisteret
+ Register-URL
+ Last inn
+ Endre register-URL
+ Fjern register-URL
+ Last ned med utvidelse
+ Nedlastingsutvidelse
+ Lydkvalitet
+ Ingen nedlastingsutvidelse er installert. Installer en fra fanen Utvidelser.
+ Last ned
+ De installerte utvidelsene er ikke nedlastingsleverandører. Installer en nedlastingsutvidelse (f.eks. Amazon Music) fra fanen Utvidelser.
+ Åpne nettleser
+ Bekreftelse fullført – prøver nedlastingene på nytt
+ Bekreftelsen mislyktes – prøv igjen
+ Metadata
+ Nedlasting
+ Sangtekster
+ Slik får du en register-URL
+ Et register er et registry.json-manifest som lister opp utvidelser (id, name, version, download_url, sha256). Be utvikleren av utvidelsen eller fellesskapet om lenken.
+ GitHub-repository: lim inn lenken til repoet, f.eks. https://github.com/owner/repo – registry.json leses fra standardgrenen.
+ Direkte lenke: lim inn URL-en til rå JSON, f.eks. https://raw.githubusercontent.com/owner/repo/main/registry.json eller en annen https-URL som returnerer JSON.
+ Sjekk at den åpnes som JSON i nettleseren, ikke som en nettside. Legg bare til registre du stoler på: utvidelser kjører kode på enheten din.
+ Verktøy
+ Integrasjon
+ Musikknedlastinger
+ Starter nedlasting…
+ Dekrypterer %1$s…
+ Laster ned %1$s · %2$d%%
+ Ingen nedlastingsmappe er valgt
+ Nedlastingen mislyktes
+ Backend returnerte ingen fil
+ Kunne ikke dekryptere den krypterte strømmen
+ Nedlastingsmappen er utilgjengelig – velg den på nytt
+ Kunne ikke opprette fil i nedlastingsmappen
+ Kunne ikke åpne målfilen
+ Kunne ikke lagre filen
+ Kompatible utvidelser er SpotiFLAC-utvidelsene som er oppført på:
+ Album
+ Artist
+ Spilleliste
+ Søkekilde
+ Populære spor
+ Last ned alle (%1$d)
\ No newline at end of file
diff --git a/app/src/main/res/values-ru/strings_cloud_services.xml b/app/src/main/res/values-ru/strings_cloud_services.xml
index f3e12a39e3..76a992f41a 100644
--- a/app/src/main/res/values-ru/strings_cloud_services.xml
+++ b/app/src/main/res/values-ru/strings_cloud_services.xml
@@ -230,4 +230,115 @@
Вход в QQ Music
Примечание по безопасности: ваш пароль вводится только на страницах QQ Music. PixelPlayer сохраняет cookies сессии для синхронизации вашей медиатеки.
QQ Music
+ Хранилище S3
+ Слушайте музыку из любого S3-совместимого бакета: AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi…
+ Музыкальные файлы воспроизводятся прямо из бакета. Ваши ключи доступа хранятся на этом устройстве в зашифрованном виде и никуда не передаются.
+ Эндпоинт
+ HTTPS-эндпоинт S3-совместимого сервиса
+ Регион
+ Регион бакета (например, us-east-1, auto для R2)
+ Бакет
+ Имя бакета с вашей музыкой
+ ID ключа доступа
+ Ключ доступа из консоли провайдера
+ Секретный ключ доступа
+ Секретный ключ доступа
+ Хранится на устройстве в зашифрованном виде
+ Префикс папки (необязательно)
+ Ограничить просмотр этим префиксом
+ Совет: для файлов с именем \"Исполнитель - Название.ext\" исполнитель и название определяются автоматически. Требуется HTTPS.
+ S3 подключено!
+ Выберите папку с музыкой
+ Здесь нет вложенных папок
+ Добавить
+ Добавить эту папку
+ Папки с музыкой
+ Нажмите +, чтобы добавить папку бакета
+ Папки ещё не добавлены
+ Синхронизировано папок: %1$d
+ Добавить папку
+ Изменить подключение
+ Чтение тегов… осталось треков: %1$d
+ Завершение…
+ Загрузки
+ Поиск и загрузка из внешних источников
+ Поиск треков…
+ Поиск
+ Скачать
+ Управление расширениями
+ Ничего не найдено. Сначала установите и включите расширение.
+ Сначала выберите папку для загрузок
+ Выберите папку для загрузок, чтобы готовые треки сохранялись в медиатеку.
+ Выбрать папку
+ Очередь загрузок
+ Отмена
+ Повторить
+ Скрыть
+ В очереди
+ Загрузка
+ Завершено
+ Ошибка
+ Отменено
+ Требуется проверка
+ Откройте %1$s в браузере и пройдите проверку. PixelPlay автоматически продолжит загрузку после возврата из браузера; если вы получили код, введите его ниже.
+ Код подтверждения
+ Отправить
+ Отмена
+ Расширения
+ Установить из файла
+ Удалить расширение
+ Расширения содержат сторонний код, который выполняется на вашем устройстве. Устанавливайте только расширения, которым доверяете.
+ Установите расширение, чтобы включить загрузки.
+ Не удалось установить расширение
+ Включено
+ Отключено
+ Ошибка
+ Установленные
+ Репозиторий
+ Установлено
+ Загрузка репозитория…
+ Не удалось загрузить репозиторий
+ Введите URL реестра расширений
+ URL реестра
+ Загрузить
+ Изменить URL реестра
+ Удалить URL реестра
+ Скачать с помощью расширения
+ Расширение для загрузки
+ Качество звука
+ Расширение для загрузки не установлено. Установите его на вкладке «Расширения».
+ Скачать
+ Установленные расширения не являются источниками загрузки. Установите расширение для загрузки (например, Amazon Music) на вкладке «Расширения».
+ Открыть браузер
+ Проверка пройдена — повторяем загрузки
+ Проверка не пройдена — попробуйте ещё раз
+ Метаданные
+ Загрузка
+ Тексты песен
+ Как получить URL реестра
+ Реестр — это манифест registry.json со списком расширений (id, name, version, download_url, sha256). Попросите ссылку у автора расширения или у сообщества.
+ Репозиторий GitHub: вставьте ссылку на репозиторий, например https://github.com/owner/repo — registry.json читается из основной ветки.
+ Прямая ссылка: вставьте URL необработанного JSON, например https://raw.githubusercontent.com/owner/repo/main/registry.json, или любой https-URL, возвращающий JSON.
+ Убедитесь, что в браузере открывается JSON, а не веб-страница. Добавляйте только надёжные реестры: расширения выполняют код на вашем устройстве.
+ Утилиты
+ Интеграция
+ Загрузки музыки
+ Начало загрузки…
+ Расшифровка: %1$s…
+ Загрузка: %1$s · %2$d%%
+ Папка для загрузок не выбрана
+ Ошибка загрузки
+ Бэкенд не вернул файл
+ Не удалось расшифровать зашифрованный поток
+ Папка для загрузок недоступна — выберите её снова
+ Не удалось создать файл в папке для загрузок
+ Не удалось открыть целевой файл
+ Не удалось сохранить файл
+ Совместимые расширения — это расширения SpotiFLAC из списка на сайте:
+ Альбом
+ Исполнитель
+ Плейлист
+ Источник поиска
+ Популярные треки
+ Скачать все (%1$d)
\ No newline at end of file
diff --git a/app/src/main/res/values-tr/strings_cloud_services.xml b/app/src/main/res/values-tr/strings_cloud_services.xml
index 5fc3acdbd3..02a51ec8d2 100644
--- a/app/src/main/res/values-tr/strings_cloud_services.xml
+++ b/app/src/main/res/values-tr/strings_cloud_services.xml
@@ -225,4 +225,115 @@
QQ Music Girişi
Güvenlik notu: Şifreniz yalnızca QQ Music web sayfalarına girilir. PixelPlayer, kütüphanenizi senkronize etmek için oturum çerezlerini saklar.
QQ Music
+ S3 Depolama
+ S3 uyumlu herhangi bir bucket\'tan müzik dinleyin: AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi…
+ Müzik dosyaları doğrudan bucket\'tan akışla oynatılır. Erişim anahtarlarınız bu cihazda şifreli olarak saklanır ve asla cihazdan çıkmaz.
+ Uç nokta
+ S3 uyumlu hizmetin HTTPS uç noktası
+ Bölge
+ Bucket bölgesi (ör. us-east-1, R2 için auto)
+ Bucket
+ Müziğinizin bulunduğu bucket\'ın adı
+ Erişim Anahtarı Kimliği
+ Sağlayıcı konsolundaki erişim anahtarı
+ Gizli Erişim Anahtarı
+ Gizli erişim anahtarı
+ Bu cihazda şifreli olarak saklanır
+ Klasör öneki (isteğe bağlı)
+ Göz atmayı bu önekle sınırla
+ İpucu: \"Sanatçı - Başlık.ext\" adlı dosyalarda sanatçı ve başlık otomatik olarak algılanır. HTTPS gereklidir.
+ S3 bağlandı!
+ Müzik klasörü seçin
+ Burada alt klasör yok
+ Ekle
+ Bu klasörü ekle
+ Müzik klasörleri
+ Bucket klasörü eklemek için + simgesine dokunun
+ Henüz klasör eklenmedi
+ %1$d klasör senkronize edildi
+ Klasör ekle
+ Bağlantıyı düzenle
+ Etiketler okunuyor… %1$d şarkı kaldı
+ Tamamlanıyor…
+ İndirmeler
+ Harici sağlayıcılardan ara ve indir
+ Parça ara…
+ Ara
+ İndir
+ Uzantıları yönet
+ Sonuç yok. Önce bir uzantı yükleyip etkinleştirin.
+ Önce bir indirme klasörü seçin
+ Tamamlanan parçaların kitaplığınıza kaydedilmesi için bir indirme klasörü seçin.
+ Klasör seç
+ İndirme kuyruğu
+ İptal
+ Yeniden dene
+ Kapat
+ Sırada
+ İndiriliyor
+ Tamamlandı
+ Başarısız
+ İptal edildi
+ Doğrulama gerekli
+ %1$s sayfasını tarayıcınızda açıp doğrulamayı tamamlayın. Tarayıcıdan dönüldüğünde PixelPlay indirmeye otomatik olarak devam eder; bunun yerine bir kod aldıysanız aşağıya girin.
+ Doğrulama kodu
+ Gönder
+ İptal
+ Uzantılar
+ Dosyadan yükle
+ Uzantıyı kaldır
+ Uzantılar, cihazınızda çalışan üçüncü taraf kodu içerir. Yalnızca güvendiğiniz uzantıları yükleyin.
+ İndirmeleri etkinleştirmek için bir uzantı yükleyin.
+ Uzantı yüklenemedi
+ Etkin
+ Devre dışı
+ Hata
+ Yüklü
+ Depo
+ Yüklendi
+ Depo yükleniyor…
+ Depo yüklenemedi
+ Uzantı kayıt defteri URL\'sini girin
+ Kayıt defteri URL\'si
+ Yükle
+ Kayıt defteri URL\'sini değiştir
+ Kayıt defteri URL\'sini kaldır
+ Uzantıyla indir
+ İndirme uzantısı
+ Ses kalitesi
+ Yüklü indirme uzantısı yok. Uzantılar sekmesinden bir tane yükleyin.
+ İndir
+ Yüklü uzantılar indirme sağlayıcısı değil. Uzantılar sekmesinden bir indirme uzantısı (ör. Amazon Music) yükleyin.
+ Tarayıcıyı aç
+ Doğrulama tamamlandı — indirmeler yeniden deneniyor
+ Doğrulama başarısız — tekrar deneyin
+ Meta veri
+ İndirme
+ Şarkı sözleri
+ Kayıt defteri URL\'si nasıl alınır
+ Kayıt defteri, uzantıları (id, name, version, download_url, sha256) listeleyen bir registry.json manifestidir. Bağlantıyı uzantının yazarından veya topluluktan isteyin.
+ GitHub deposu: depo bağlantısını yapıştırın, ör. https://github.com/owner/repo — registry.json varsayılan daldan okunur.
+ Doğrudan bağlantı: ham JSON URL\'sini yapıştırın, ör. https://raw.githubusercontent.com/owner/repo/main/registry.json veya JSON döndüren herhangi bir https URL\'si.
+ Tarayıcıda web sayfası olarak değil JSON olarak açıldığından emin olun. Yalnızca güvendiğiniz kayıt defterlerini ekleyin: uzantılar cihazınızda kod çalıştırır.
+ Yardımcı
+ Entegrasyon
+ Müzik indirmeleri
+ İndirme başlatılıyor…
+ %1$s şifresi çözülüyor…
+ %1$s indiriliyor · %%%2$d
+ İndirme klasörü seçilmedi
+ İndirme başarısız
+ Arka uç dosya döndürmedi
+ Şifreli akışın şifresi çözülemedi
+ İndirme klasörü kullanılamıyor — yeniden seçin
+ İndirme klasöründe dosya oluşturulamadı
+ Hedef dosya açılamadı
+ Dosya kaydedilemedi
+ Uyumlu uzantılar, şu adreste listelenen SpotiFLAC uzantılarıdır:
+ Albüm
+ Sanatçı
+ Çalma listesi
+ Arama kaynağı
+ Popüler parçalar
+ Tümünü indir (%1$d)
\ No newline at end of file
diff --git a/app/src/main/res/values-zh-rCN/strings_cloud_services.xml b/app/src/main/res/values-zh-rCN/strings_cloud_services.xml
index 13dd260f70..210d14dc9d 100644
--- a/app/src/main/res/values-zh-rCN/strings_cloud_services.xml
+++ b/app/src/main/res/values-zh-rCN/strings_cloud_services.xml
@@ -225,4 +225,115 @@
登录 QQ 音乐
安全提示:您的密码仅在 QQ 音乐网页中输入。PixelPlayer 仅存储会话 Cookie 以同步您的媒体库。
QQ 音乐
+ S3 存储
+ 从任何兼容 S3 的存储桶串流音乐:AWS S3、Cloudflare R2、Backblaze B2、MinIO、Wasabi…
+ 音乐文件直接从存储桶串流播放。你的访问密钥加密保存在本设备上,绝不会离开设备。
+ 端点
+ 兼容 S3 服务的 HTTPS 端点
+ 区域
+ 存储桶所在区域(例如 us-east-1,R2 使用 auto)
+ 存储桶
+ 存放音乐的存储桶名称
+ 访问密钥 ID
+ 服务商控制台中的访问密钥
+ 私有访问密钥
+ 私有访问密钥
+ 加密保存在本设备上
+ 文件夹前缀(可选)
+ 仅浏览此前缀下的内容
+ 提示:名为“艺术家 - 标题.ext”的文件会自动识别艺术家和标题。需要使用 HTTPS。
+ S3 已连接!
+ 选择音乐文件夹
+ 此处没有子文件夹
+ 添加
+ 添加此文件夹
+ 音乐文件夹
+ 点按 + 添加存储桶文件夹
+ 尚未添加文件夹
+ 已同步 %1$d 个文件夹
+ 添加文件夹
+ 编辑连接
+ 正在读取标签… 剩余 %1$d 首
+ 即将完成…
+ 下载
+ 从外部来源搜索并下载
+ 搜索歌曲…
+ 搜索
+ 下载
+ 管理扩展
+ 没有结果。请先安装并启用扩展。
+ 请先选择下载文件夹
+ 选择下载文件夹,以便将下载完成的歌曲保存到你的音乐库。
+ 选择文件夹
+ 下载队列
+ 取消
+ 重试
+ 关闭
+ 排队中
+ 下载中
+ 已完成
+ 失败
+ 已取消
+ 需要验证
+ 请在浏览器中打开 %1$s 并完成验证。返回应用后 PixelPlay 会自动继续下载;如果你收到的是验证码,请在下方输入。
+ 验证码
+ 提交
+ 取消
+ 扩展
+ 从文件安装
+ 移除扩展
+ 扩展包含在你的设备上运行的第三方代码。请只安装你信任的扩展。
+ 安装扩展以启用下载功能。
+ 无法安装扩展
+ 已启用
+ 已停用
+ 错误
+ 已安装
+ 仓库
+ 已安装
+ 正在加载仓库…
+ 无法加载仓库
+ 输入扩展注册表 URL 以浏览
+ 注册表 URL
+ 加载
+ 更改注册表 URL
+ 移除注册表 URL
+ 使用扩展下载
+ 下载扩展
+ 音质
+ 未安装下载扩展。请在“扩展”标签页中安装。
+ 下载
+ 已安装的扩展不是下载来源。请在“扩展”标签页中安装下载扩展(例如 Amazon Music)。
+ 打开浏览器
+ 验证完成 — 正在重试下载
+ 验证失败 — 请重试
+ 元数据
+ 下载
+ 歌词
+ 如何获取注册表 URL
+ 注册表是一个列出扩展(id、name、version、download_url、sha256)的 registry.json 清单。请向扩展作者或社区索取链接。
+ GitHub 仓库:粘贴仓库链接,例如 https://github.com/owner/repo — 将从默认分支读取 registry.json。
+ 直接链接:粘贴原始 JSON 的 URL,例如 https://raw.githubusercontent.com/owner/repo/main/registry.json,或任何返回 JSON 的 https URL。
+ 请确认它在浏览器中显示为 JSON,而不是网页。只添加你信任的注册表:扩展会在你的设备上运行代码。
+ 工具
+ 集成
+ 音乐下载
+ 正在开始下载…
+ 正在解密 %1$s…
+ 正在下载 %1$s · %2$d%%
+ 未选择下载文件夹
+ 下载失败
+ 后端未返回文件
+ 无法解密加密的音频流
+ 下载文件夹不可用 — 请重新选择
+ 无法在下载文件夹中创建文件
+ 无法打开目标文件
+ 无法保存文件
+ 兼容的扩展是以下网址列出的 SpotiFLAC 扩展:
+ 专辑
+ 艺术家
+ 播放列表
+ 搜索来源
+ 热门歌曲
+ 全部下载(%1$d)
\ No newline at end of file
diff --git a/app/src/main/res/values/strings_cloud_services.xml b/app/src/main/res/values/strings_cloud_services.xml
index df633dab6a..5a48922f0e 100644
--- a/app/src/main/res/values/strings_cloud_services.xml
+++ b/app/src/main/res/values/strings_cloud_services.xml
@@ -225,4 +225,128 @@
Login to QQ Music
Security note: your password is entered only in QQ Music web pages. PixelPlayer stores session cookies to sync your library.
QQ Music
+
+
+ S3 Storage
+ Stream music from any S3-compatible bucket: AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi…
+ Music files are streamed directly from the bucket. Your access keys are stored encrypted on this device and never leave it.
+ Endpoint
+ https://s3.us-east-1.amazonaws.com
+ HTTPS endpoint of the S3-compatible service
+ Region
+ us-east-1
+ Region of the bucket (e.g. us-east-1, auto for R2)
+ Bucket
+ my-music
+ Name of the bucket that holds your music
+ Access Key ID
+ AKIA…
+ Access key from the provider console
+ Secret Access Key
+ Secret access key
+ Kept encrypted on this device
+ Folder prefix (optional)
+ music/
+ Restrict browsing to this key prefix
+ Tip: files named \u0022Artist - Title.ext\u0022 get artist and title parsed automatically. HTTPS is required.
+ S3 connected!
+ Pick a music folder
+ No sub-folders here
+ Add
+ Add this folder
+ Music folders
+ Tap + to add a bucket folder
+ No folders added yet
+ %1$d folders synced
+ Add folder
+ Edit connection
+ Reading tags… %1$d songs remaining
+ Finishing up…
+
+
+ Downloads
+ Search and download from external providers
+ Search tracks…
+ Search
+ Download
+ Manage extensions
+ No results. Install and enable an extension first.
+ Pick a download folder first
+ Choose a download folder so finished tracks are saved to your library.
+ Choose folder
+ Download queue
+ Cancel
+ Retry
+ Dismiss
+ Queued
+ Downloading
+ Completed
+ Failed
+ Cancelled
+ %1$s — %2$s
+ Verification required
+ Open %1$s in your browser and complete the check. PixelPlay continues the download automatically when the browser returns; if you received a code instead, enter it below.
+ Verification code
+ Submit
+ Cancel
+
+
+ Extensions
+ Install from file
+ Remove extension
+ Extensions contain third-party code that runs on your device. Only install extensions you trust.
+ Install an extension to enable downloads.
+ Couldn\'t install extension
+ Enabled
+ Disabled
+ Error
+ Installed
+ Repository
+ Installed
+ Loading repository…
+ Failed to load repository
+ Enter the extension registry URL to browse
+ Registry URL
+ https://example.com/registry.json
+ Load
+ Change registry URL
+ Remove registry URL
+ Download with extension
+ Download extension
+ Audio quality
+ No download extension installed. Install one from the Extensions tab.
+ Download
+ Installed extensions are not download providers. Install a download extension (e.g. Amazon Music) from the Extensions tab.
+ Open browser
+ Verification complete — retrying downloads
+ Verification failed — try again
+ Metadata
+ Download
+ Lyrics
+ How to get a registry URL
+ A registry is a registry.json manifest listing extensions (id, name, version, download_url, sha256). Ask the extension author or community for its link.
+ GitHub repository: paste the repo link, e.g. https://github.com/owner/repo — registry.json is read from its default branch.
+ Direct link: paste the raw JSON URL, e.g. https://raw.githubusercontent.com/owner/repo/main/registry.json or any https URL that returns JSON.
+ Make sure it opens as JSON in a browser, not a web page. Only add registries you trust: extensions run code on your device.
+ Utility
+ Integration
+ Music downloads
+ Starting download…
+ Decrypting %1$s…
+ Downloading %1$s · %2$d%%
+ No download folder selected
+ Download failed
+ Backend returned no file
+ Failed to decrypt encrypted stream
+ Download folder unavailable — reselect it
+ Could not create file in download folder
+ Could not open target file
+ Failed to save file
+ Compatible extensions are the SpotiFLAC extensions listed at:
+ Album
+ Artist
+ Playlist
+ Search source
+ Top tracks
+ Download all (%1$d)
\ No newline at end of file
diff --git a/app/src/test/java/com/theveloper/pixelplay/data/download/DownloadModelsTest.kt b/app/src/test/java/com/theveloper/pixelplay/data/download/DownloadModelsTest.kt
new file mode 100644
index 0000000000..60ea20a0fd
--- /dev/null
+++ b/app/src/test/java/com/theveloper/pixelplay/data/download/DownloadModelsTest.kt
@@ -0,0 +1,100 @@
+package com.theveloper.pixelplay.data.download
+
+import kotlinx.serialization.encodeToString
+import kotlinx.serialization.json.Json
+import kotlinx.serialization.json.boolean
+import kotlinx.serialization.json.jsonObject
+import kotlinx.serialization.json.jsonPrimitive
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Test
+
+class DownloadModelsTest {
+
+ private val json = Json { ignoreUnknownKeys = true; encodeDefaults = true }
+
+ @Test
+ fun `download request serializes required fields`() {
+ val req = DownloadRequest(
+ service = "spotify",
+ trackName = "Song",
+ artistName = "Artist",
+ albumName = "Album",
+ coverUrl = "https://example/cover.jpg",
+ outputPath = "/tmp/work.flac",
+ quality = "flac",
+ embedMetadata = true,
+ itemId = "item-1",
+ durationMs = 200_000,
+ trackNumber = 3,
+ discNumber = 1,
+ totalTracks = 12,
+ totalDiscs = 1,
+ releaseDate = "2020-01-01",
+ isrc = "ISRC123",
+ )
+ val tree = json.parseToJsonElement(json.encodeToString(req)).jsonObject
+ assertTrue(tree["use_extensions"]!!.jsonPrimitive.boolean) // always true, spec-mandated
+ assertEquals("item-1", tree["item_id"]!!.jsonPrimitive.content)
+ assertEquals("flac", tree["quality"]!!.jsonPrimitive.content)
+ assertEquals("/tmp/work.flac", tree["output_path"]!!.jsonPrimitive.content)
+ assertFalse(tree.toString().contains("output_fd"))
+ }
+
+ @Test
+ fun `download response parses file_path and actual_extension`() {
+ val resp = json.decodeFromString(
+ """{"success":true,"file_path":"/tmp/x.flac","actual_extension":"flac",
+ "service":"spotify","title":"Song","artist":"Artist"}"""
+ )
+ assertTrue(resp.success)
+ assertEquals("/tmp/x.flac", resp.filePath)
+ assertEquals("flac", resp.actualExtension)
+ }
+
+ @Test
+ fun `download response parses error`() {
+ val resp = json.decodeFromString(
+ """{"success":false,"error":"Verification required before download","error_type":"verification_required","service":"qobuz"}"""
+ )
+ assertFalse(resp.success)
+ assertEquals("verification_required", resp.errorType)
+ }
+
+ @Test
+ fun `progress delta parses items and removed`() {
+ val delta = json.decodeFromString(
+ """{"seq":7,"items":{"i1":{"item_id":"i1","bytes_total":100,"bytes_received":50,
+ "progress":0.5,"speed_mbps":1.2,"is_downloading":true,"status":"downloading","stage":"audio"}},
+ "removed":["i0"]}"""
+ )
+ assertEquals(7L, delta.seq)
+ assertEquals(0.5f, delta.items["i1"]!!.progress)
+ assertEquals(listOf("i0"), delta.removed)
+ }
+
+ @Test
+ fun `search results parse`() {
+ val tracks = json.decodeFromString>(
+ """[{"id":"t1","name":"Song","artists":"Artist","album_name":"Album",
+ "duration_ms":180000,"cover_url":"https://c/1.jpg","provider_id":"spotify-metadata",
+ "isrc":"X","track_number":2,"disc_number":1,"total_tracks":10,"total_discs":1,
+ "release_date":"2019-05-01","spotify_id":"sp1"}]"""
+ )
+ assertEquals(1, tracks.size)
+ assertEquals("Song", tracks[0].name)
+ assertEquals("sp1", tracks[0].spotifyId)
+ }
+
+ @Test
+ fun `installed extensions parse`() {
+ val exts = json.decodeFromString>(
+ """[{"id":"qobuz-ext","manifest":{"name":"qobuz","display_name":"Qobuz","version":"1.2.0"},
+ "enabled":true,"status":"ok"}]"""
+ )
+ assertEquals("qobuz-ext", exts[0].id)
+ assertEquals("Qobuz", exts[0].displayName)
+ assertEquals("1.2.0", exts[0].version)
+ }
+}
diff --git a/app/src/test/java/com/theveloper/pixelplay/data/download/DownloadRepositoryTest.kt b/app/src/test/java/com/theveloper/pixelplay/data/download/DownloadRepositoryTest.kt
new file mode 100644
index 0000000000..9d37e8e2ad
--- /dev/null
+++ b/app/src/test/java/com/theveloper/pixelplay/data/download/DownloadRepositoryTest.kt
@@ -0,0 +1,72 @@
+package com.theveloper.pixelplay.data.download
+
+import kotlinx.coroutines.test.runTest
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNull
+import org.junit.Test
+
+class DownloadRepositoryTest {
+
+ private fun repo() = DownloadRepository()
+
+ @Test
+ fun `enqueue adds queued job`() = runTest {
+ val r = repo()
+ r.enqueue(ExtTrack(id = "t1", name = "Song", artists = "A"), quality = "flac")
+ val jobs = r.jobs.value
+ assertEquals(1, jobs.size)
+ assertEquals(JobStatus.QUEUED, jobs[0].status)
+ assertEquals("Song", jobs[0].title)
+ }
+
+ @Test
+ fun `applyDelta updates progress and completion`() = runTest {
+ val r = repo()
+ r.enqueue(ExtTrack(id = "t1", name = "Song", artists = "A"), quality = "flac")
+ val itemId = r.jobs.value[0].itemId
+ r.applyDelta(
+ ProgressDelta(seq = 1, items = mapOf(itemId to ItemProgress(itemId, bytesTotal = 100, bytesReceived = 40, progress = 0.4f, isDownloading = true, status = "downloading"))),
+ )
+ assertEquals(JobStatus.DOWNLOADING, r.jobs.value[0].status)
+ assertEquals(0.4f, r.jobs.value[0].progress)
+ r.applyDelta(
+ ProgressDelta(seq = 2, items = mapOf(itemId to ItemProgress(itemId, progress = 1f, isDownloading = false, status = "completed"))),
+ )
+ assertEquals(JobStatus.COMPLETED, r.jobs.value[0].status)
+ }
+
+ @Test
+ fun `applyDelta removes and marks failed`() = runTest {
+ val r = repo()
+ r.enqueue(ExtTrack(id = "t1", name = "Song", artists = "A"), quality = "flac")
+ val itemId = r.jobs.value[0].itemId
+ r.markFailed(itemId, error = "boom", errorType = "http_403")
+ assertEquals(JobStatus.FAILED, r.jobs.value[0].status)
+ assertEquals("boom", r.jobs.value[0].error)
+ // removed item disappears from active list but stays in history
+ r.applyDelta(ProgressDelta(seq = 3, removed = listOf(itemId)))
+ assertEquals(1, r.jobs.value.size) // history kept
+ assertNull(r.claimNextQueued()) // failed not re-claimed
+ }
+
+ @Test
+ fun `claimNextQueued returns oldest queued`() = runTest {
+ val r = repo()
+ r.enqueue(ExtTrack(id = "t1", name = "S1", artists = "A"), quality = "flac")
+ r.enqueue(ExtTrack(id = "t2", name = "S2", artists = "A"), quality = "flac")
+ assertEquals("S1", r.claimNextQueued()?.title)
+ assertEquals("S2", r.claimNextQueued()?.title)
+ assertNull(r.claimNextQueued())
+ }
+
+ @Test
+ fun `retry resets failed job`() = runTest {
+ val r = repo()
+ r.enqueue(ExtTrack(id = "t1", name = "Song", artists = "A"), quality = "flac")
+ val id = r.jobs.value[0].itemId
+ r.markFailed(id, "err", "x")
+ r.retry(id)
+ assertEquals(JobStatus.QUEUED, r.jobs.value[0].status)
+ assertNull(r.jobs.value[0].error)
+ }
+}
diff --git a/app/src/test/java/com/theveloper/pixelplay/data/s3/S3SigV4Test.kt b/app/src/test/java/com/theveloper/pixelplay/data/s3/S3SigV4Test.kt
new file mode 100644
index 0000000000..c16c1a9a9a
--- /dev/null
+++ b/app/src/test/java/com/theveloper/pixelplay/data/s3/S3SigV4Test.kt
@@ -0,0 +1,101 @@
+package com.theveloper.pixelplay.data.s3
+
+import com.google.common.truth.Truth.assertThat
+import kotlinx.coroutines.runBlocking
+import org.junit.Test
+
+/**
+ * Verifies the SigV4 signer against the official AWS "Authenticating Requests
+ * (AWS Signature Version 4)" documentation example (examplebucket / test.txt).
+ */
+class S3SigV4Test {
+
+ // Values from the AWS docs example.
+ private val accessKey = "AKIAIOSFODNN7EXAMPLE"
+ private val secretKey = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
+ private val region = "us-east-1"
+ private val dateStamp = "20130524"
+
+ @Test
+ fun `signature matches AWS documentation example`() {
+ // Canonical request exactly as documented for the GET Object header example.
+ val canonicalRequest = listOf(
+ "GET",
+ "/test.txt",
+ "",
+ "host:examplebucket.s3.amazonaws.com\n" +
+ "range:bytes=0-9\n" +
+ "x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\n" +
+ "x-amz-date:20130524T000000Z\n",
+ "host;range;x-amz-content-sha256;x-amz-date",
+ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+ ).joinToString("\n")
+
+ val signature = S3SigV4.signForTest(secretKey, dateStamp, region, canonicalRequest)
+
+ assertThat(signature)
+ .isEqualTo("f0e8bdb87c964420e857bd35b5d6ed310bd44f0170aba48dd91039c6036bdb41")
+ }
+
+ @Test
+ fun `presigned URL signature matches AWS query-string example`() {
+ // Same canonical request shape as the "Using Query Parameters" docs example.
+ val canonicalRequest = listOf(
+ "GET",
+ "/test.txt",
+ "X-Amz-Algorithm=AWS4-HMAC-SHA256" +
+ "&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20130524%2Fus-east-1%2Fs3%2Faws4_request" +
+ "&X-Amz-Date=20130524T000000Z" +
+ "&X-Amz-Expires=86400" +
+ "&X-Amz-SignedHeaders=host",
+ "host:examplebucket.s3.amazonaws.com\n",
+ "host",
+ "UNSIGNED-PAYLOAD"
+ ).joinToString("\n")
+
+ val signature = S3SigV4.signForTest(secretKey, dateStamp, region, canonicalRequest)
+
+ assertThat(signature)
+ .isEqualTo("aeeed9bbccd4d02ee5c0109b86d86835f995330da4c265957d157751f604d404")
+ }
+
+ @Test
+ fun `uriEncode follows strict AWS rules`() {
+ assertThat(S3SigV4.uriEncode("music/my song+1.mp3")).isEqualTo("music%2Fmy%20song%2B1.mp3")
+ assertThat(S3SigV4.uriEncode("music/my song+1.mp3", encodeSlash = false))
+ .isEqualTo("music/my%20song%2B1.mp3")
+ assertThat(S3SigV4.uriEncode("a~b-c_d.e")).isEqualTo("a~b-c_d.e")
+ assertThat(S3SigV4.uriEncode("café")).isEqualTo("caf%C3%A9")
+ }
+
+ @Test
+ fun `canonicalUri preserves slashes and trims edges`() {
+ assertThat(S3SigV4.canonicalUri("/Music/01 song.mp3")).isEqualTo("/Music/01%20song.mp3")
+ assertThat(S3SigV4.canonicalUri("")).isEqualTo("/")
+ // Empty path segments are legal object keys and must be preserved verbatim.
+ assertThat(S3SigV4.canonicalUri("a//b")).isEqualTo("/a//b")
+ }
+
+ @Test
+ fun `amzDate formats correctly`() {
+ val date = S3SigV4.amzDate(1_369_975_200_000L) // 2013-05-31T04:40:00Z
+ assertThat(date.dateStamp).isEqualTo("20130531")
+ assertThat(date.amzDate).isEqualTo("20130531T044000Z")
+ }
+
+ @Test
+ fun `presigned URL is path-style with exactly one bucket segment`() = runBlocking {
+ val url = S3SigV4.presignGetUrl(
+ endpoint = "https://s3.example.com",
+ bucket = "mybucket",
+ objectKey = "u1/33x - Perunggu.flac",
+ accessKey = accessKey,
+ secretKey = secretKey,
+ region = region,
+ expiresInSeconds = 3600,
+ nowMillis = 0L
+ )
+ assertThat(url).startsWith("https://s3.example.com/mybucket/u1/33x%20-%20Perunggu.flac?")
+ assertThat(url).doesNotContain("mybucket/mybucket")
+ }
+}
diff --git a/docs/plans/2026-10-17-external-download.md b/docs/plans/2026-10-17-external-download.md
new file mode 100644
index 0000000000..fbf10a4277
--- /dev/null
+++ b/docs/plans/2026-10-17-external-download.md
@@ -0,0 +1,1027 @@
+# External Download (Extension-Based) Implementation Plan
+
+> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
+
+**Goal:** Add in-app music downloads from external providers by embedding SpotiFLAC-Mobile's MIT Go backend (`gobackend.aar`) and its `.spotiflac-ext` extension system.
+
+**Architecture:** A prebuilt gomobile AAR exposes a JSON-string API. A thin `DownloadBackend` wraps it, `DownloadRepository` owns queue state, a `@HiltWorker` foreground worker runs downloads and publishes files to a user-chosen SAF folder, then triggers a local library scan. Two Compose screens: search/download and extension management.
+
+**Tech Stack:** Kotlin, Compose, Hilt, WorkManager, kotlinx-serialization-json (already in project), gomobile AAR (arm64).
+
+**Spec:** `docs/superpowers/specs/2026-10-17-external-download-design.md` — read it first. Key facts verified against SpotiFLAC source:
+- `DownloadByStrategy(requestJSON)` requires `use_extensions: true`, `item_id`, `service`, `quality`; pass `output_path` (local file), NEVER `output_fd`. Result file comes back as `resp.file_path` with `resp.actual_extension`.
+- Tagging: request sets `"embed_metadata": true` + title/artist/album/cover fields; embedding is FLAC-only.
+- Progress: poll `GetAllDownloadProgressDelta(seq)` → `{"seq":N,"items":{id:{item_id,bytes_total,bytes_received,progress,speed_mbps,is_downloading,status,stage}},"removed":[...]}`; statuses: preparing/downloading/finalizing/completed.
+- Search: `SearchTracksWithMetadataProvidersJSON(query, limit, true)` → `[ExtTrackMetadata]` (`id,name,artists,album_name,duration_ms,cover_url,provider_id,isrc,spotify_id,track_number,disc_number,total_tracks,total_discs,release_date,...`).
+- Extensions: `GetInstalledExtensions()` → `[{id,manifest:{name,display_name,version,...},enabled,error,...}]`; install via `LoadExtensionFromPath` (refuses downgrades); `RemoveExtensionByID`, `SetExtensionEnabledByID`.
+- Auth: `error_type == "verification_required"` → `GetExtensionPendingAuthJSON(extId)` → prompt → `SetExtensionAuthCodeByID(extId, code)`.
+
+---
+
+### Task 1: Build and wire `gobackend.aar`
+
+**Files:**
+- Create: `app/libs/gobackend.aar` (built artifact, committed)
+- Modify: `app/build.gradle.kts` (dependencies block)
+- Create: `scripts/build_gobackend_aar.sh`
+
+**Step 1: Build the AAR**
+
+```bash
+export ANDROID_NDK_HOME=$HOME/Android/Sdk/ndk/ # ls ~/Android/Sdk/ndk first
+export CGO_ENABLED=1
+cd /home/kurob/code/music/SpotiFLAC-Mobile/go_backend
+git rev-parse HEAD # record this SHA
+go mod download
+go install golang.org/x/mobile/cmd/gomobile
+gomobile init
+mkdir -p /home/kurob/code/music/PixelPlayer/app/libs
+gomobile bind -target=android/arm64 -androidapi 24 \
+ -o /home/kurob/code/music/PixelPlayer/app/libs/gobackend.aar .
+```
+
+Expected: `gobackend.aar` exists (expect 30–60 MB). If `gomobile bind` fails on ARM-only cross-compile, check `go.mod` toolchain (`go 1.26.6`) matches installed Go.
+
+**Step 2: Create build script** `scripts/build_gobackend_aar.sh`:
+
+```bash
+#!/usr/bin/env bash
+# Rebuilds app/libs/gobackend.aar from SpotiFLAC-Mobile go_backend.
+# Usage: SPOTIFLAC_DIR=/path/to/SpotiFLAC-Mobile ./scripts/build_gobackend_aar.sh
+set -euo pipefail
+: "${SPOTIFLAC_DIR:?Set SPOTIFLAC_DIR}"
+: "${ANDROID_NDK_HOME:?Set ANDROID_NDK_HOME}"
+export CGO_ENABLED=1
+cd "$SPOTIFLAC_DIR/go_backend"
+echo "Pinning SpotiFLAC commit: $(git rev-parse HEAD)"
+go mod download
+command -v gomobile >/dev/null || go install golang.org/x/mobile/cmd/gomobile
+gomobile init
+mkdir -p "$(dirname "$0")/../app/libs"
+gomobile bind -target=android/arm64 -androidapi 24 -o "$(dirname "$0")/../app/libs/gobackend.aar" .
+echo "OK"
+```
+
+Then: `chmod +x scripts/build_gobackend_aar.sh`
+
+**Step 3: Wire gradle** — in `app/build.gradle.kts` dependencies block add:
+
+```kotlin
+implementation(files("libs/gobackend.aar"))
+```
+
+**Step 4: Verify compile** — temporary smoke: add to any existing file (do NOT commit this step):
+
+```kotlin
+private val smoke = gobackend.Gobackend::class
+```
+
+Run: `./gradlew :app:compileArm64DebugKotlin 2>&1 | tail -3` (or default debug variant). Expected: BUILD SUCCESSFUL. Remove the smoke line.
+
+**Step 5: Commit**
+
+```bash
+git add app/libs/gobackend.aar app/build.gradle.kts scripts/build_gobackend_aar.sh
+git commit -m "Add gobackend AAR from SpotiFLAC-Mobile (MIT) for extension downloads"
+```
+
+Also update `docs/superpowers/specs/2026-10-17-external-download-design.md` AAR Provenance `` placeholders with the recorded SHA, date, and commit — include in this commit.
+
+---
+
+### Task 2: Download models (`DownloadModels.kt`) + JSON tests
+
+**Files:**
+- Create: `app/src/main/java/com/theveloper/pixelplay/data/download/DownloadModels.kt`
+- Test: `app/src/test/java/com/theveloper/pixelplay/data/download/DownloadModelsTest.kt`
+
+**Step 1: Write the failing test**
+
+```kotlin
+package com.theveloper.pixelplay.data.download
+
+import kotlinx.serialization.json.Json
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Test
+
+class DownloadModelsTest {
+
+ private val json = Json { ignoreUnknownKeys = true; encodeDefaults = true }
+
+ @Test
+ fun `download request serializes required fields`() {
+ val req = DownloadRequest(
+ service = "spotify",
+ trackName = "Song",
+ artistName = "Artist",
+ albumName = "Album",
+ coverUrl = "https://example/cover.jpg",
+ outputPath = "/tmp/work.flac",
+ quality = "flac",
+ embedMetadata = true,
+ itemId = "item-1",
+ durationMs = 200_000,
+ trackNumber = 3,
+ discNumber = 1,
+ totalTracks = 12,
+ totalDiscs = 1,
+ releaseDate = "2020-01-01",
+ isrc = "ISRC123",
+ )
+ val tree = json.parseToJsonElement(json.encodeToString(req)).jsonObject
+ assertTrue(tree["use_extensions"]!!.jsonPrimitive.boolean) // always true, spec-mandated
+ assertEquals("item-1", tree["item_id"]!!.jsonPrimitive.content)
+ assertEquals("flac", tree["quality"]!!.jsonPrimitive.content)
+ assertEquals("/tmp/work.flac", tree["output_path"]!!.jsonPrimitive.content)
+ assertFalse(tree.toString().contains("output_fd"))
+ }
+
+ @Test
+ fun `download response parses file_path and actual_extension`() {
+ val resp = json.decodeFromString(
+ """{"success":true,"file_path":"/tmp/x.flac","actual_extension":"flac",
+ "service":"spotify","title":"Song","artist":"Artist"}"""
+ )
+ assertTrue(resp.success)
+ assertEquals("/tmp/x.flac", resp.filePath)
+ assertEquals("flac", resp.actualExtension)
+ }
+
+ @Test
+ fun `download response parses error`() {
+ val resp = json.decodeFromString(
+ """{"success":false,"error":"Verification required before download","error_type":"verification_required","service":"qobuz"}"""
+ )
+ assertFalse(resp.success)
+ assertEquals("verification_required", resp.errorType)
+ }
+
+ @Test
+ fun `progress delta parses items and removed`() {
+ val delta = json.decodeFromString(
+ """{"seq":7,"items":{"i1":{"item_id":"i1","bytes_total":100,"bytes_received":50,
+ "progress":0.5,"speed_mbps":1.2,"is_downloading":true,"status":"downloading","stage":"audio"}},
+ "removed":["i0"]}"""
+ )
+ assertEquals(7L, delta.seq)
+ assertEquals(0.5f, delta.items["i1"]!!.progress)
+ assertEquals(listOf("i0"), delta.removed)
+ }
+
+ @Test
+ fun `search results parse`() {
+ val tracks = json.decodeFromString>(
+ """[{"id":"t1","name":"Song","artists":"Artist","album_name":"Album",
+ "duration_ms":180000,"cover_url":"https://c/1.jpg","provider_id":"spotify-metadata",
+ "isrc":"X","track_number":2,"disc_number":1,"total_tracks":10,"total_discs":1,
+ "release_date":"2019-05-01","spotify_id":"sp1"}]"""
+ )
+ assertEquals(1, tracks.size)
+ assertEquals("Song", tracks[0].name)
+ assertEquals("sp1", tracks[0].spotifyId)
+ }
+
+ @Test
+ fun `installed extensions parse`() {
+ val exts = json.decodeFromString>(
+ """[{"id":"qobuz-ext","manifest":{"name":"qobuz","display_name":"Qobuz","version":"1.2.0"},
+ "enabled":true,"status":"ok"}]"""
+ )
+ assertEquals("qobuz-ext", exts[0].id)
+ assertEquals("Qobuz", exts[0].displayName)
+ assertEquals("1.2.0", exts[0].version)
+ }
+}
+```
+
+**Step 2: Run to verify it fails**
+
+Run: `./gradlew :app:testDebugUnitTest --tests "com.theveloper.pixelplay.data.download.DownloadModelsTest" 2>&1 | tail -5`
+Expected: FAIL — unresolved references.
+
+**Step 3: Implement models**
+
+```kotlin
+package com.theveloper.pixelplay.data.download
+
+import kotlinx.serialization.SerialName
+import kotlinx.serialization.Serializable
+import kotlinx.serialization.json.Json
+
+/**
+ * Wire models for the gobackend JSON API. Field names MUST match the Go
+ * structs in SpotiFLAC-Mobile's go_backend (exports_download.go,
+ * extension_provider_types.go, progress.go, extension_manager.go).
+ */
+@Serializable
+data class DownloadRequest(
+ val service: String,
+ @SerialName("track_name") val trackName: String,
+ @SerialName("artist_name") val artistName: String,
+ @SerialName("album_name") val albumName: String,
+ @SerialName("album_artist") val albumArtist: String = "",
+ @SerialName("cover_url") val coverUrl: String = "",
+ @SerialName("output_path") val outputPath: String,
+ @SerialName("output_ext") val outputExt: String = "",
+ @SerialName("filename_format") val filenameFormat: String = "{tracknumber} - {artist} - {title}",
+ val quality: String,
+ @SerialName("embed_metadata") val embedMetadata: Boolean = true,
+ @SerialName("item_id") val itemId: String,
+ @SerialName("duration_ms") val durationMs: Int = 0,
+ @SerialName("track_number") val trackNumber: Int = 0,
+ @SerialName("disc_number") val discNumber: Int = 0,
+ @SerialName("total_tracks") val totalTracks: Int = 0,
+ @SerialName("total_discs") val totalDiscs: Int = 0,
+ @SerialName("release_date") val releaseDate: String = "",
+ val isrc: String = "",
+ @SerialName("spotify_id") val spotifyId: String = "",
+ @SerialName("provider_track_id") val providerTrackId: String = "",
+ @SerialName("download_provider") val downloadProvider: String = "",
+ // Spec: built-in providers are retired; extension mode is mandatory.
+ @SerialName("use_extensions") val useExtensions: Boolean = true,
+ @SerialName("use_fallback") val useFallback: Boolean = false,
+)
+
+@Serializable
+data class DownloadResponse(
+ val success: Boolean = false,
+ val message: String = "",
+ @SerialName("file_path") val filePath: String? = null,
+ @SerialName("resolved_file_name") val resolvedFileName: String? = null,
+ val error: String? = null,
+ @SerialName("error_type") val errorType: String? = null,
+ @SerialName("retry_after_seconds") val retryAfterSeconds: Int = 0,
+ @SerialName("already_exists") val alreadyExists: Boolean = false,
+ @SerialName("actual_extension") val actualExtension: String? = null,
+ val service: String? = null,
+ val title: String? = null,
+ val artist: String? = null,
+ val album: String? = null,
+)
+
+@Serializable
+data class ItemProgress(
+ @SerialName("item_id") val itemId: String,
+ @SerialName("bytes_total") val bytesTotal: Long = 0,
+ @SerialName("bytes_received") val bytesReceived: Long = 0,
+ val progress: Float = 0f,
+ @SerialName("speed_mbps") val speedMbps: Float = 0f,
+ @SerialName("is_downloading") val isDownloading: Boolean = false,
+ val status: String = "",
+ val stage: String? = null,
+)
+
+@Serializable
+data class ProgressDelta(
+ val seq: Long,
+ val reset: Boolean = false,
+ val items: Map = emptyMap(),
+ val removed: List = emptyList(),
+)
+
+@Serializable
+data class ExtTrack(
+ val id: String,
+ val name: String,
+ val artists: String = "",
+ @SerialName("album_name") val albumName: String = "",
+ @SerialName("album_artist") val albumArtist: String = "",
+ @SerialName("duration_ms") val durationMs: Int = 0,
+ @SerialName("cover_url") val coverUrl: String? = null,
+ @SerialName("provider_id") val providerId: String = "",
+ val isrc: String? = null,
+ @SerialName("spotify_id") val spotifyId: String? = null,
+ @SerialName("provider_track_id") val providerTrackId: String? = null,
+ @SerialName("track_number") val trackNumber: Int = 0,
+ @SerialName("disc_number") val discNumber: Int = 0,
+ @SerialName("total_tracks") val totalTracks: Int = 0,
+ @SerialName("total_discs") val totalDiscs: Int = 0,
+ @SerialName("release_date") val releaseDate: String? = null,
+ val genre: String? = null,
+ @SerialName("album_type") val albumType: String? = null,
+ val explicit: Boolean = false,
+)
+
+@Serializable
+data class ExtensionManifest(
+ val name: String = "",
+ @SerialName("display_name") val displayName: String = "",
+ val version: String = "",
+ val description: String? = null,
+)
+
+@Serializable
+data class InstalledExtension(
+ val id: String,
+ val manifest: ExtensionManifest = ExtensionManifest(),
+ val enabled: Boolean = false,
+ val status: String = "",
+ val error: String? = null,
+) {
+ val displayName: String get() = manifest.displayName.ifEmpty { manifest.name.ifEmpty { id } }
+ val version: String get() = manifest.version
+}
+
+val DownloadJson: Json = Json { ignoreUnknownKeys = true; encodeDefaults = true }
+```
+
+**Step 4: Run tests**
+
+Run: `./gradlew :app:testDebugUnitTest --tests "com.theveloper.pixelplay.data.download.DownloadModelsTest" 2>&1 | tail -3`
+Expected: PASS (6 tests). Failures are read from `app/build/test-results/testDebugUnitTest/TEST-*.xml`.
+
+**Step 5: Commit**
+
+```bash
+git add app/src/main/java/com/theveloper/pixelplay/data/download/DownloadModels.kt app/src/test/java/com/theveloper/pixelplay/data/download/DownloadModelsTest.kt
+git commit -m "Add gobackend download wire models"
+```
+
+---
+
+### Task 3: `DownloadBackend` wrapper + `DownloadSettings`
+
+**Files:**
+- Create: `app/src/main/java/com/theveloper/pixelplay/data/download/DownloadBackend.kt`
+- Create: `app/src/main/java/com/theveloper/pixelplay/data/download/DownloadSettings.kt`
+- Create: `app/src/main/java/com/theveloper/pixelplay/di/DownloadModule.kt`
+
+**Design:** interface `DownloadBackendApi` (fake-able in tests) + `GobackendDownloadBackend` impl calling the static `gobackend.Gobackend.*` methods. Init is lazy + guarded.
+
+**Step 1: Write `DownloadBackend.kt`**
+
+```kotlin
+package com.theveloper.pixelplay.data.download
+
+import java.io.File
+import javax.inject.Inject
+import javax.inject.Singleton
+
+/** Search result bundle */
+data class SearchResult(val tracks: List)
+
+sealed interface BackendResult {
+ data class Ok(val value: T) : BackendResult
+ data class Failed(val response: DownloadResponse) : BackendResult
+}
+
+interface DownloadBackendApi {
+ fun initIfNeeded()
+ fun listInstalled(): List
+ fun installFromFile(path: String): BackendResult
+ fun remove(id: String)
+ fun setEnabled(id: String, enabled: Boolean)
+ fun search(query: String, limit: Int = 30): List
+ fun download(request: DownloadRequest): BackendResult
+ fun progressDelta(sinceSeq: Long): ProgressDelta
+ fun waitProgressDelta(sinceSeq: Long, timeoutMs: Long): ProgressDelta
+ fun cancel(itemId: String)
+ fun pendingAuth(extensionId: String): String
+ fun submitAuthCode(extensionId: String, code: String)
+}
+
+@Singleton
+class GobackendDownloadBackend @Inject constructor(
+ private val settings: DownloadSettings,
+) : DownloadBackendApi {
+
+ private val lock = Any()
+ private var initialized = false
+
+ override fun initIfNeeded() {
+ synchronized(lock) {
+ if (initialized) return
+ val extDir = File(settings.rootDir, "extensions")
+ val dataDir = File(settings.rootDir, "download_data")
+ extDir.mkdirs(); dataDir.mkdirs()
+ gobackend.Gobackend.initExtensionSystem(extDir.absolutePath, dataDir.absolutePath)
+ gobackend.Gobackend.loadExtensionsFromDir(extDir.absolutePath)
+ initialized = true
+ }
+ }
+
+ override fun listInstalled(): List {
+ initIfNeeded()
+ val raw = gobackend.Gobackend.getInstalledExtensions()
+ return DownloadJson.decodeFromString(raw.ifEmpty { "[]" })
+ }
+
+ override fun installFromFile(path: String): BackendResult {
+ initIfNeeded()
+ return runCatching {
+ gobackend.Gobackend.loadExtensionFromPath(path)
+ }.fold(
+ onSuccess = { raw ->
+ val id = DownloadJson.decodeFromString(raw.ifEmpty { "{}" })
+ BackendResult.Ok(DownloadResponse(success = true).let { null }
+ ?: listInstalled().firstOrNull { it.id == id.name })
+ },
+ onFailure = { BackendResult.Failed(DownloadResponse(success = false, error = it.message, errorType = "install_failed")) },
+ )
+ }
+
+ override fun remove(id: String) { initIfNeeded(); gobackend.Gobackend.removeExtensionByID(id) }
+
+ override fun setEnabled(id: String, enabled: Boolean) {
+ initIfNeeded(); gobackend.Gobackend.setExtensionEnabledByID(id, enabled)
+ }
+
+ override fun search(query: String, limit: Int): List {
+ initIfNeeded()
+ val raw = gobackend.Gobackend.searchTracksWithMetadataProvidersJSON(query, limit, true)
+ return runCatching { DownloadJson.decodeFromString>(raw) }.getOrDefault(emptyList())
+ }
+
+ override fun download(request: DownloadRequest): BackendResult {
+ initIfNeeded()
+ return runCatching {
+ val raw = gobackend.Gobackend.downloadByStrategy(DownloadJson.encodeToString(request))
+ DownloadJson.decodeFromString(raw)
+ }.fold(
+ onSuccess = { resp -> if (resp.success) BackendResult.Ok(resp) else BackendResult.Failed(resp) },
+ onFailure = { BackendResult.Failed(DownloadResponse(success = false, error = it.message, errorType = "backend_crash")) },
+ )
+ }
+
+ override fun progressDelta(sinceSeq: Long): ProgressDelta {
+ val raw = gobackend.Gobackend.getAllDownloadProgressDelta(sinceSeq)
+ return runCatching { DownloadJson.decodeFromString(raw) }
+ .getOrDefault(ProgressDelta(seq = sinceSeq))
+ }
+
+ override fun waitProgressDelta(sinceSeq: Long, timeoutMs: Long): ProgressDelta {
+ val raw = gobackend.Gobackend.waitForAllDownloadProgressDelta(sinceSeq, timeoutMs)
+ return runCatching { DownloadJson.decodeFromString(raw) }
+ .getOrDefault(ProgressDelta(seq = sinceSeq))
+ }
+
+ override fun cancel(itemId: String) { gobackend.Gobackend.cancelDownload(itemId) }
+
+ override fun pendingAuth(extensionId: String): String {
+ return runCatching { gobackend.Gobackend.getExtensionPendingAuthJSON(extensionId) }.getOrDefault("{}")
+ }
+
+ override fun submitAuthCode(extensionId: String, code: String) {
+ gobackend.Gobackend.setExtensionAuthCodeByID(extensionId, code)
+ }
+}
+
+@Serializable
+private data class InstallResult(val name: String = "", val success: Boolean = false, val error: String? = null)
+```
+
+NOTES for implementer:
+- gomobile lower-cases Go method names: `InitExtensionSystem` → `initExtensionSystem`. Verify exact generated names with: `unzip -p app/libs/gobackend.aar classes.jar > /tmp/c.jar && unzip -l /tmp/c.jar | grep -i gobackend` then `javap -classpath gobackend.Gobackend | grep -i 'initExtension\|downloadBy\|searchTracks\|getInstalled\|loadExtension\|removeExtension\|setExtension\|progressDelta\|cancel\|PendingAuth\|AuthCode'`. Adjust call names accordingly — this is the ONLY place names are fragile.
+- `installFromFile` messy line above: simplify during implementation to
+ `val id = DownloadJson.decodeFromString(raw.ifEmpty { "{}" }); BackendResult.Ok(listInstalled().firstOrNull { it.id == id.name })`.
+
+**Step 2: Write `DownloadSettings.kt`**
+
+```kotlin
+package com.theveloper.pixelplay.data.download
+
+import android.content.Context
+import dagger.hilt.android.qualifiers.ApplicationContext
+import java.io.File
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class DownloadSettings @Inject constructor(@ApplicationContext context: Context) {
+ private val prefs = context.getSharedPreferences("download_prefs", Context.MODE_PRIVATE)
+ val rootDir: File get() = File(context.filesDir, "downloads").apply { mkdirs() }
+
+ /** SAF tree URI of the user-chosen destination folder; null until picked. */
+ var safTreeUri: String?
+ get() = prefs.getString(KEY_TREE_URI, null)
+ set(value) = prefs.edit().putString(KEY_TREE_URI, value).apply()
+
+ var defaultQuality: String
+ get() = prefs.getString(KEY_QUALITY, "flac") ?: "flac"
+ set(value) = prefs.edit().putString(KEY_QUALITY, value).apply()
+
+ fun clearSafTree() = prefs.edit().remove(KEY_TREE_URI).apply()
+
+ private companion object {
+ const val KEY_TREE_URI = "saf_tree_uri"
+ const val KEY_QUALITY = "default_quality"
+ }
+}
+```
+
+**Step 3: DI module** `app/src/main/java/com/theveloper/pixelplay/di/DownloadModule.kt`:
+
+```kotlin
+package com.theveloper.pixelplay.di
+
+import com.theveloper.pixelplay.data.download.DownloadBackendApi
+import com.theveloper.pixelplay.data.download.GobackendDownloadBackend
+import dagger.Binds
+import dagger.Module
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+
+@Module
+@InstallIn(SingletonComponent::class)
+abstract class DownloadModule {
+ @Binds @Singleton
+ abstract fun bindDownloadBackend(impl: GobackendDownloadBackend): DownloadBackendApi
+}
+```
+
+**Step 4: Verify build**
+
+Run: `./gradlew :app:compileArm64DebugKotlin 2>&1 | tail -3` — Expected: SUCCESS (fix any gomobile name mismatches found via javap in Step 1 notes).
+
+**Step 5: Commit**
+
+```bash
+git add app/src/main/java/com/theveloper/pixelplay/data/download/ app/src/main/java/com/theveloper/pixelplay/di/DownloadModule.kt
+git commit -m "Add download backend wrapper and settings"
+```
+
+---
+
+### Task 4: `DownloadRepository` (queue state) + tests
+
+**Files:**
+- Create: `app/src/main/java/com/theveloper/pixelplay/data/download/DownloadRepository.kt`
+- Test: `app/src/test/java/com/theveloper/pixelplay/data/download/DownloadRepositoryTest.kt`
+
+**Step 1: Write the failing test**
+
+```kotlin
+package com.theveloper.pixelplay.data.download
+
+import kotlinx.coroutines.test.runTest
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNull
+import org.junit.Test
+
+class DownloadRepositoryTest {
+
+ private fun repo() = DownloadRepository()
+
+ @Test
+ fun `enqueue adds queued job`() = runTest {
+ val r = repo()
+ r.enqueue(ExtTrack(id = "t1", name = "Song", artists = "A"), quality = "flac")
+ val jobs = r.jobs.value
+ assertEquals(1, jobs.size)
+ assertEquals(JobStatus.QUEUED, jobs[0].status)
+ assertEquals("Song", jobs[0].title)
+ }
+
+ @Test
+ fun `applyDelta updates progress and completion`() = runTest {
+ val r = repo()
+ r.enqueue(ExtTrack(id = "t1", name = "Song", artists = "A"), quality = "flac")
+ val itemId = r.jobs.value[0].itemId
+ r.applyDelta(
+ ProgressDelta(seq = 1, items = mapOf(itemId to ItemProgress(itemId, bytesTotal = 100, bytesReceived = 40, progress = 0.4f, isDownloading = true, status = "downloading"))),
+ )
+ assertEquals(JobStatus.DOWNLOADING, r.jobs.value[0].status)
+ assertEquals(0.4f, r.jobs.value[0].progress)
+ r.applyDelta(
+ ProgressDelta(seq = 2, items = mapOf(itemId to ItemProgress(itemId, progress = 1f, isDownloading = false, status = "completed"))),
+ )
+ assertEquals(JobStatus.COMPLETED, r.jobs.value[0].status)
+ }
+
+ @Test
+ fun `applyDelta removes and marks failed`() = runTest {
+ val r = repo()
+ r.enqueue(ExtTrack(id = "t1", name = "Song", artists = "A"), quality = "flac")
+ val itemId = r.jobs.value[0].itemId
+ r.markFailed(itemId, error = "boom", errorType = "http_403")
+ assertEquals(JobStatus.FAILED, r.jobs.value[0].status)
+ assertEquals("boom", r.jobs.value[0].error)
+ // removed item disappears from active list but stays in history
+ r.applyDelta(ProgressDelta(seq = 3, removed = listOf(itemId)))
+ assertEquals(1, r.jobs.value.size) // history kept
+ assertNull(r.claimNextQueued()) // failed not re-claimed
+ }
+
+ @Test
+ fun `claimNextQueued returns oldest queued`() = runTest {
+ val r = repo()
+ r.enqueue(ExtTrack(id = "t1", name = "S1", artists = "A"), quality = "flac")
+ r.enqueue(ExtTrack(id = "t2", name = "S2", artists = "A"), quality = "flac")
+ assertEquals("S1", r.claimNextQueued()?.title)
+ assertEquals("S2", r.claimNextQueued()?.title)
+ assertNull(r.claimNextQueued())
+ }
+
+ @Test
+ fun `retry resets failed job`() = runTest {
+ val r = repo()
+ r.enqueue(ExtTrack(id = "t1", name = "Song", artists = "A"), quality = "flac")
+ val id = r.jobs.value[0].itemId
+ r.markFailed(id, "err", "x")
+ r.retry(id)
+ assertEquals(JobStatus.QUEUED, r.jobs.value[0].status)
+ assertNull(r.jobs.value[0].error)
+ }
+}
+```
+
+**Step 2: Run to verify failure** — `./gradlew :app:testDebugUnitTest --tests "*DownloadRepositoryTest*" 2>&1 | tail -3`. Expected: FAIL (unresolved).
+
+**Step 3: Implement `DownloadRepository.kt`**
+
+```kotlin
+package com.theveloper.pixelplay.data.download
+
+import java.util.UUID
+import java.util.concurrent.ConcurrentHashMap
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.update
+import javax.inject.Inject
+import javax.inject.Singleton
+
+enum class JobStatus { QUEUED, DOWNLOADING, COMPLETED, FAILED, CANCELLED }
+
+data class DownloadJob(
+ val itemId: String = UUID.randomUUID().toString(),
+ val track: ExtTrack,
+ val quality: String,
+ val status: JobStatus = JobStatus.QUEUED,
+ val progress: Float = 0f,
+ val bytesReceived: Long = 0,
+ val bytesTotal: Long = 0,
+ val error: String? = null,
+ val errorType: String? = null,
+ val resultFilePath: String? = null,
+ val actualExtension: String? = null,
+ val published: Boolean = false,
+)
+
+@Singleton
+class DownloadRepository @Inject constructor() {
+
+ private val _jobs = MutableStateFlow>(emptyList())
+ val jobs: StateFlow> = _jobs.asStateFlow()
+
+ fun enqueue(track: ExtTrack, quality: String): String {
+ val job = DownloadJob(track = track, quality = quality)
+ _jobs.update { list -> list + job }
+ return job.itemId
+ }
+
+ fun claimNextQueued(): DownloadJob? =
+ _jobs.value.firstOrNull { it.status == JobStatus.QUEUED }?.also { job ->
+ _jobs.update { list -> list.map { if (it.itemId == job.itemId) it.copy(status = JobStatus.DOWNLOADING) else it } }
+ }
+
+ fun applyDelta(delta: ProgressDelta) {
+ _jobs.update { list ->
+ list.map { job ->
+ val p = delta.items[job.itemId] ?: return@map job
+ job.copy(
+ progress = p.progress.coerceIn(0f, 1f),
+ bytesReceived = p.bytesReceived,
+ bytesTotal = p.bytesTotal,
+ status = when (p.status) {
+ "completed" -> JobStatus.COMPLETED
+ else -> if (job.status == JobStatus.COMPLETED) job.status else JobStatus.DOWNLOADING
+ },
+ )
+ }
+ }
+ }
+
+ fun markCompleted(itemId: String, filePath: String, actualExtension: String?) {
+ _jobs.update { list -> list.map { if (it.itemId == itemId) it.copy(status = JobStatus.COMPLETED, progress = 1f, resultFilePath = filePath, actualExtension = actualExtension) else it } }
+ }
+
+ fun markPublished(itemId: String) {
+ _jobs.update { list -> list.map { if (it.itemId == itemId) it.copy(published = true) else it } }
+ }
+
+ fun markFailed(itemId: String, error: String, errorType: String?) {
+ _jobs.update { list -> list.map { if (it.itemId == itemId) it.copy(status = JobStatus.FAILED, error = error, errorType = errorType) else it } }
+ }
+
+ fun markCancelled(itemId: String) {
+ _jobs.update { list -> list.map { if (it.itemId == itemId) it.copy(status = JobStatus.CANCELLED) else it } }
+ }
+
+ fun retry(itemId: String) {
+ _jobs.update { list -> list.map { if (it.itemId == itemId) it.copy(status = JobStatus.QUEUED, error = null, errorType = null, progress = 0f) else it } }
+ }
+
+ fun dismiss(itemId: String) {
+ _jobs.update { list -> list.filterNot { it.itemId == itemId } }
+ }
+}
+```
+
+(ConcurrentHashMap import is unused — drop it. Implementer: keep imports minimal.)
+
+**Step 4: Run tests** — Expected: PASS (5 tests).
+
+**Step 5: Commit**
+
+```bash
+git add app/src/main/java/com/theveloper/pixelplay/data/download/DownloadRepository.kt app/src/test/java/com/theveloper/pixelplay/data/download/DownloadRepositoryTest.kt
+git commit -m "Add download queue repository"
+```
+
+---
+
+### Task 5: `DownloadWorker` (foreground, SAF publish, library scan)
+
+**Files:**
+- Create: `app/src/main/java/com/theveloper/pixelplay/data/download/DownloadWorker.kt`
+- Modify: `AndroidManifest.xml` (add `REQUEST_INSTALL_PACKAGES` NOT needed; nothing new required — SAF + WorkManager already declared)
+
+**Behavior:** one worker pass processes the queue serially until empty. Foreground notification shows current item progress. On `verification_required`, sets job FAILED with `errorType` (UI offers auth dialog then retry).
+
+```kotlin
+package com.theveloper.pixelplay.data.download
+
+import android.content.Context
+import android.content.Intent
+import android.media.MediaScannerConnection
+import android.net.Uri
+import androidx.core.app.NotificationCompat
+import androidx.core.app.NotificationManagerCompat
+import androidx.documentfile.provider.DocumentFile
+import androidx.hilt.work.HiltWorker
+import androidx.work.CoroutineWorker
+import androidx.work.ForegroundInfo
+import androidx.work.WorkerParameters
+import dagger.assisted.Assisted
+import dagger.assisted.AssistedInject
+import java.io.File
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
+
+@HiltWorker
+class DownloadWorker @AssistedInject constructor(
+ @Assisted appContext: Context,
+ @Assisted params: WorkerParameters,
+ private val backend: DownloadBackendApi,
+ private val repository: DownloadRepository,
+ private val settings: DownloadSettings,
+) : CoroutineWorker(appContext, params) {
+
+ override suspend fun doWork(): Result = withContext(Dispatchers.IO) {
+ setForeground(createForegroundInfo(null))
+ while (true) {
+ val job = repository.claimNextQueued() ?: break
+ val treeUri = settings.safTreeUri
+ ?: run { repository.markFailed(job.itemId, "No download folder selected", "no_folder"); continue }
+ process(job, treeUri)
+ }
+ Result.success()
+ }
+
+ private suspend fun process(job: DownloadJob, treeUri: String) {
+ val workFile = File(File(applicationContext.cacheDir, "downloads").apply { mkdirs() }, "${job.itemId}.work")
+ val request = DownloadRequest(
+ service = "spotify",
+ trackName = job.track.name,
+ artistName = job.track.artists,
+ albumName = job.track.albumName,
+ albumArtist = job.track.albumArtist,
+ coverUrl = job.track.coverUrl.orEmpty(),
+ outputPath = workFile.absolutePath,
+ outputExt = if (job.quality == "flac") "flac" else "",
+ quality = job.quality,
+ embedMetadata = true,
+ itemId = job.itemId,
+ durationMs = job.track.durationMs,
+ trackNumber = job.track.trackNumber,
+ discNumber = job.track.discNumber,
+ totalTracks = job.track.totalTracks,
+ totalDiscs = job.track.totalDiscs,
+ releaseDate = job.track.releaseDate.orEmpty(),
+ isrc = job.track.isrc.orEmpty(),
+ spotifyId = job.track.spotifyId.orEmpty(),
+ providerTrackId = job.track.providerTrackId.orEmpty(),
+ )
+ var seq = 0L
+ val poller = launch { while (true) { val d = backend.waitProgressDelta(seq, 400); seq = d.seq; repository.applyDelta(d); updateNotification(job, d) } }
+ val result = backend.download(request)
+ poller.cancel()
+ workFile.delete() // gobackend may leave it behind on failure
+
+ when (result) {
+ is BackendResult.Failed -> {
+ repository.markFailed(job.itemId, result.response.error ?: "Download failed", result.response.errorType)
+ return
+ }
+ is BackendResult.Ok -> {
+ val src = File(result.value.filePath ?: return repository.markFailed(job.itemId, "No file path", "no_file"))
+ val ext = (result.value.actualExtension ?: job.quality).trimStart('.')
+ publish(src, treeUri, job, ext)
+ src.delete()
+ repository.markPublished(job.itemId)
+ }
+ }
+ }
+
+ private suspend fun publish(src: File, treeUri: String, job: DownloadJob, ext: String) {
+ val dir = DocumentFile.fromTreeUri(applicationContext, Uri.parse(treeUri))
+ ?: return repository.markFailed(job.itemId, "Download folder unavailable — reselect it", "no_folder")
+ val base = sanitize("${job.track.artists.ifEmpty { "Unknown" }} - ${job.track.name}")
+ var name = "$base.$ext"
+ var doc = dir.findFile(name)
+ var n = 1
+ while (doc != null && doc.exists()) { name = "$base (${n++}).$ext"; doc = dir.findFile(name) }
+ val target = dir.createFile(mimeFor(ext), name)
+ ?: return repository.markFailed(job.itemId, "Could not create file in folder", "saf_error")
+ applicationContext.contentResolver.openOutputStream(target.uri)?.use { out ->
+ src.inputStream().use { it.copyTo(out, DEFAULT_BUFFER_SIZE * 8) }
+ } ?: return repository.markFailed(job.itemId, "Could not open target file", "saf_error")
+ repository.markCompleted(job.itemId, target.uri.toString(), ext)
+ MediaScannerConnection.scanFile(applicationContext, arrayOf(target.uri.toString()), arrayOf(mimeFor(ext)), null)
+ }
+
+ private fun sanitize(s: String) = s.replace(Regex("[\\\\/:*?\"<>|]"), "_").trim().take(150)
+
+ private fun mimeFor(ext: String) = when (ext) {
+ "flac" -> "audio/flac"; "mp3" -> "audio/mpeg"; "m4a" -> "audio/mp4"
+ "ogg", "opus" -> "audio/ogg"; else -> "audio/*"
+ }
+
+ private fun updateNotification(job: DownloadJob, d: ProgressDelta) {
+ val p = d.items[job.itemId] ?: return
+ NotificationManagerCompat.from(applicationContext).notify(
+ NOTIF_ID,
+ buildNotification("${p.status} ${p.percentText}"),
+ )
+ }
+
+ private fun createForegroundInfo(title: String?) = ForegroundInfo(NOTIF_ID, buildNotification(title ?: "Download"))
+
+ private fun buildNotification(text: String): android.app.Notification {
+ val cancel = android.app.PendingIntent.getBroadcast(
+ applicationContext, 0,
+ Intent(applicationContext, DownloadCancelReceiver::class.java),
+ android.app.PendingIntent.FLAG_IMMUTABLE or android.app.PendingIntent.FLAG_UPDATE_CURRENT,
+ )
+ return NotificationCompat.Builder(applicationContext, CHANNEL_ID)
+ .setSmallIcon(android.R.drawable.stat_sys_download)
+ .setContentTitle("Downloading music")
+ .setContentText(text)
+ .setOngoing(true)
+ .addAction(0, "Cancel", cancel)
+ .build()
+ }
+
+ companion object {
+ const val CHANNEL_ID = "download_channel"
+ const val NOTIF_ID = 4001
+ const val UNIQUE_WORK = "external_download"
+ }
+}
+```
+
+Implementer notes:
+- `launch { }` inside CoroutineWorker: use `coroutineScope { launch { ... } }` around the download call — keep the poller scoped so cancellation propagates.
+- Create `DownloadCancelReceiver` (small BroadcastReceiver calling `repository`… can't inject easily; simplest: it reads all current DOWNLOADING job ids from a static holder in `DownloadRepository` — add `fun cancelAllActive()` calling `backend.cancel(itemId)` — wire via `EntryPoint` or make the receiver use `ApplicationContext` + Hilt `@AndroidEntryPoint`). Simplest compliant approach: skip the receiver; instead set the notification's deleteIntent/Cancel action via `WorkManager.cancelUniqueWork(UNIQUE_WORK)` from the UI, and drop the addAction in v1. (ponytail: notification cancel action is UI sugar; the queue screen has cancel buttons. Add receiver later if missed.)
+- Notification channel: create in a small `DownloadNotifications` helper called from `Application.onCreate` (find the existing Application class — PixelPlayer has one; grep `class .*Application` — add channel creation there, pattern already used for other channels).
+- Enqueue pattern (same as S3MetadataWorker): `WorkManager.getInstance(context).enqueueUniqueWork(DownloadWorker.UNIQUE_WORK, ExistingWorkPolicy.APPEND_OR_REPLACE, OneTimeWorkRequestBuilder().build())`.
+
+**Step 1:** Implement per above; fix compile errors.
+**Step 2:** `./gradlew :app:compileArm64DebugKotlin 2>&1 | tail -3` — Expected: SUCCESS.
+**Step 3:** Commit: `git commit -m "Add download worker with SAF publish and library scan"`.
+
+---
+
+### Task 6: `DownloadViewModel` + `DownloadScreen`
+
+**Files:**
+- Create: `app/src/main/java/com/theveloper/pixelplay/presentation/download/DownloadViewModel.kt`
+- Create: `app/src/main/java/com/theveloper/pixelplay/presentation/download/DownloadScreen.kt`
+- Modify: `app/src/main/res/values/strings_cloud_services.xml`, `values-in/strings_cloud_services.xml`
+
+**ViewModel** (follow `S3DashboardViewModel` patterns):
+
+```kotlin
+@HiltViewModel
+class DownloadViewModel @Inject constructor(
+ private val backend: DownloadBackendApi,
+ private val repository: DownloadRepository,
+ private val settings: DownloadSettings,
+ private val workManager: // inject via @ApplicationContext + WorkManager.getInstance
+) : ViewModel() {
+
+ data class UiState(
+ val query: String = "",
+ val results: List = emptyList(),
+ val searching: Boolean = false,
+ val error: String? = null,
+ val jobs: List = emptyList(),
+ val safFolderSet: Boolean = false,
+ val authRequestId: String? = null, // extension id awaiting auth code
+ val authPrompt: String? = null,
+ )
+
+ private val _ui = MutableStateFlow(UiState())
+ val ui: StateFlow = _ui.asStateFlow()
+
+ init {
+ viewModelScope.launch {
+ repository.jobs.collect { jobs -> _ui.update { it.copy(jobs = jobs, safFolderSet = settings.safTreeUri != null) } }
+ }
+ }
+
+ fun search(query: String) = viewModelScope.launch(Dispatchers.IO) {
+ _ui.update { it.copy(query = query, searching = true) }
+ val tracks = runCatching { backend.search(query) }.getOrElse { emptyList() }
+ _ui.update { it.copy(results = tracks, searching = false, error = if (tracks.isEmpty()) "No results / no extensions installed" else null) }
+ }
+
+ fun enqueue(track: ExtTrack) {
+ if (settings.safTreeUri == null) { _ui.update { it.copy(error = "Pick a download folder first") }; return }
+ repository.enqueue(track, settings.defaultQuality)
+ WorkManager.getInstance(context).enqueueUniqueWork(DownloadWorker.UNIQUE_WORK, ExistingWorkPolicy.APPEND_OR_REPLACE, OneTimeWorkRequestBuilder().build())
+ }
+
+ fun cancel(itemId: String) { backend.cancel(itemId); repository.markCancelled(itemId) }
+ fun retry(itemId: String) { repository.retry(itemId); reEnqueueWorker() }
+ fun dismiss(itemId: String) = repository.dismiss(itemId)
+ fun submitAuthCode(code: String) { val id = _ui.value.authRequestId ?: return; backend.submitAuthCode(id, code); _ui.update { it.copy(authRequestId = null, authPrompt = null) } }
+}
+```
+
+**Screen:** single scaffold:
+- Top: search TextField + search action
+- Middle: results LazyColumn (AsyncImage cover, name, artists, album; trailing download IconButton) — reuse Coil `AsyncImage` already used across the app
+- Bottom section: active queue LazyRow/LazyColumn from `ui.jobs` (LinearProgressIndicator(progress), status text, cancel/retry/dismiss buttons)
+- If `safFolderSet == false`: banner with "Choose folder" → `ActivityResultContracts.OpenDocumentTree` persisted with `takePersistableUriPermission`, then `settings.safTreeUri = uri.toString()` via ViewModel callback `onFolderPicked(uri)`
+- Auth dialog when `authRequestId != null`: TextField + submit → `submitAuthCode`
+- Strings: add `download_title`, `download_search_hint`, `download_pick_folder`, `download_no_folder`, `download_queue`, etc. to BOTH `values/strings_cloud_services.xml` (EN) and `values-in/` (ID) — follow existing key naming in those files.
+
+**Steps:** implement → `./gradlew :app:compileArm64DebugKotlin` SUCCESS → commit `git commit -m "Add download screen and view model"`.
+
+---
+
+### Task 7: `ExtensionsViewModel` + `ExtensionsScreen`
+
+**Files:**
+- Create: `app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionsViewModel.kt`
+- Create: `app/src/main/java/com/theveloper/pixelplay/presentation/download/ExtensionsScreen.kt`
+
+ViewModel: `listInstalled()` → StateFlow; `install(uri)` — copy picked document to cacheDir temp file (`.spotiflac-ext` may have opaque MIME; always copy bytes then call `backend.installFromFile(tempPath)`), refresh list, surface error string on failure (e.g. downgrade refusal); `remove(id)`, `toggle(id, enabled)`.
+
+Screen: LazyColumn of installed extensions (name, version, enabled Switch, remove IconButton), top app bar with "Install from file" (`ActivityResultContracts.OpenDocument`), Material3 card footer disclaimer string `extensions_disclaimer` (EN: "Extensions contain third-party code that runs on your device. Only install extensions you trust."; ID: translate). Empty state → "Install an extension to enable downloads."
+
+**Steps:** implement → compile SUCCESS → commit `git commit -m "Add extensions management screen"`.
+
+---
+
+### Task 8: Navigation + entry points + strings
+
+**Files:**
+- Modify: `app/src/main/java/com/theveloper/pixelplay/presentation/navigation/Screen.kt` — add:
+
+```kotlin
+object Download : Screen("download")
+object Extensions : Screen("download_extensions")
+```
+
+- Modify: `app/src/main/java/com/theveloper/pixelplay/presentation/navigation/AppNavigation.kt` — add two `composable(...)` routes following the existing pattern (hiltViewModel, navigateSafely). Extensions reachable from Download screen top bar action.
+- Modify: `app/src/main/java/com/theveloper/pixelplay/presentation/components/StreamingProviderSheet.kt` — add a "Download music" row (icon `Icons.Outlined.Download`) navigating to `Screen.Download`, same pattern as the S3/Drive rows (see how `onOpenS3Dashboard` is threaded in AppNavigation.kt:239-245).
+- Optional: a row in Settings → Accounts style screen if pattern demands; keep to StreamingProviderSheet only in v1 (YAGNI).
+
+**Steps:** implement → compile → install on device (`adb -s RR8N205B17Y install -r app/build/outputs/apk/arm64/debug/app-arm64-v8a-debug.apk` or release per current variant) → verify both screens open → commit `git commit -m "Wire download screens into navigation"`.
+
+---
+
+### Task 9: End-to-end verification on device
+
+Prerequisites: at least one working `.spotiflac-ext` file (obtain from the SpotiFLAC community repo listed in its README extensions docs; save to device Downloads).
+
+Checklist (manual, on device RR8N205B17Y):
+1. Open Download screen → Extensions → install the `.spotiflac-ext` → appears in list, enabled
+2. Back to search → type a known track → results appear with provider chips
+3. Tap download → folder picker (first time) → choose e.g. `Music/` → download starts
+4. Notification progress → completion
+5. Verify file in folder via Files app: plays, has embedded cover+tags (check with a tag viewer or re-import)
+6. Song appears in PixelPlayer local library after scan
+7. Cancel mid-download works; retry after airplane-mode failure works
+8. Duplicate download → ` (1)` file created, no crash
+
+If `verification_required` error appears: dialog shows, entering the extension's auth code clears it (provider-dependent).
+
+**Step:** fix any findings → final `./gradlew :app:assembleRelease` → `adb -s RR8N205B17Y install -r app/build/outputs/apk/release/app-arm64-v8a-release.apk` → re-run checklist quickly → commit any fixes.
+
+---
+
+## Risk register
+
+| Risk | Mitigation |
+|---|---|
+| gomobile method name casing differs from expected | `javap` the AAR classes first (Task 3 notes) — single point of adjustment |
+| AAR bloats APK 30–60 MB | Accepted in spec; arm64-only |
+| Extension pipelines vary (auth, region) | `verification_required` + auth dialog path covered; per-provider quirks are extension's problem |
+| `searchTracksWithMetadataProvidersJSON` slow (blocking) | All calls on Dispatchers.IO; progress polling on separate coroutine |
diff --git a/docs/superpowers/specs/2026-10-17-external-download-design.md b/docs/superpowers/specs/2026-10-17-external-download-design.md
new file mode 100644
index 0000000000..7104a8c7ce
--- /dev/null
+++ b/docs/superpowers/specs/2026-10-17-external-download-design.md
@@ -0,0 +1,170 @@
+# Design: External Download (Extension-Based)
+
+Date: 2026-10-17
+Status: Approved (design), pending implementation plan
+
+## Goal
+
+Add in-app music downloads from external streaming providers, mirroring
+SpotiFLAC-Mobile's extension system. Users search a track, pick a quality,
+and the file (FLAC with embedded metadata + cover art; other formats keep
+provider tags) is saved into a user-chosen SAF folder and shows up in
+PixelPlayer's local library.
+
+Reference project: `/home/kurob/code/music/SpotiFLAC-Mobile` (MIT).
+Reuse its Go backend (`go_backend/`, 183 files) as a prebuilt AAR instead of
+reimplementing provider resolution, download pipeline, and tagging.
+
+## Non-Goals
+
+- No new Go code; the AAR is consumed as-is from SpotiFLAC-Mobile.
+- No streaming from external providers — download only.
+- No extension marketplace beyond local `.spotiflac-ext` file install
+ (system file picker). Repository-URL browsing/install is deferred to a
+ later slice — gobackend already ships the repo exports
+ (`InitExtensionRepoJSON`, `SetRepoRegistryURLJSON`, `GetRepoExtensionsJSON`,
+ `SearchRepoExtensionsJSON`, `DownloadRepoExtensionJSON` in
+ `exports_repo.go`), so adding it later is additive.
+- No download from PixelPlayer's own sources (S3, Telegram, etc.) — that is a
+ separate, later feature.
+
+## Architecture
+
+```
+app/libs/gobackend.aar gomobile bind of SpotiFLAC go_backend (arm64)
+data/download/
+ DownloadBackend.kt thin JSON wrapper over gobackend API
+ DownloadRepository.kt orchestration: search → download → postprocess → SAF publish
+ DownloadWorker.kt WorkManager long-running worker + foreground notification
+presentation/download/
+ DownloadScreen.kt search bar, results, active queue
+ ExtensionsScreen.kt install/manage .spotiflac-ext packages
+```
+
+Wiring: Hilt modules provide `DownloadBackend` (singleton) and
+`DownloadRepository`. UI reachable from Home (new entry, same pattern as the
+S3/Google Drive provider entries in `StreamingProviderSheet`).
+
+## gobackend API Surface Used
+
+All calls are JSON-string based (gomobile bindings):
+
+| Function | Purpose |
+|---|---|
+| `InitExtensionSystem(extensionsDir, dataDir)` | once per app start |
+| `LoadExtensionsFromDir(dir)` | load installed extensions |
+| `LoadExtensionFromPath(path)` | install/upgrade a `.spotiflac-ext` (ZIP + manifest) |
+| `GetInstalledExtensions()` | list for Extensions screen |
+| `RemoveExtensionByID(id)` / `SetExtensionEnabledByID(id, enabled)` | management |
+| `SearchTracksWithMetadataProvidersJSON(query, limit, includeExtensions)` | cross-provider search |
+| `DownloadByStrategy(requestJSON)` | download; request must set `use_extensions: true` (else hard error: built-in providers are retired), `item_id` (keys progress + cancel), `service` (provider id), `quality`; optional `output_ext`, `filename_format`; and `"embed_metadata": true` plus title/artist/album/cover fields — the pipeline embeds tags+cover into the staged FLAC file (`extension_fallback_output.go`). Pass a local `output_path` (cacheDir work file), NOT an `output_fd`: with
+`output_path` set the pipeline writes and embeds into that exact file and
+returns the path in the response (`resp.file_path`) |
+| `GetAllDownloadProgressDelta(seq)` / `WaitForAllDownloadProgressDelta(seq, timeoutMs)` | progress polling |
+| `CancelDownload(itemID)` | cancel |
+| `GetExtensionPendingAuthJSON(extId)` / `SetExtensionAuthCodeByID(extId, code)` | extension auth flows |
+
+Note: `RunPostProcessingV2JSON` exists but only runs extension-declared
+post-process hooks (returns `NewFilePath`); it does NOT write tags and is not
+needed for the basic flow. Metadata embedding happens inside the download
+pipeline via the `embed_metadata` request field (same as the SpotiFLAC app,
+see its `lib/services/download_request_payload.dart`). Embedding is
+FLAC-only (go-flac/vorbis); MP3 downloads keep provider tags, with optional
+post-download retagging via `EditFileMetadata` if ever needed.
+Embedding also requires the output to be a real local absolute file —
+satisfied naturally by the `output_path` model.
+
+`.spotiflac-ext` = ZIP with a JSON manifest; gobackend handles validation,
+staging, version compare (refuses downgrade), and per-extension data dirs.
+
+## Data Flow
+
+1. Lazy init, guarded by a mutex, on first open of the Download or
+ Extensions screen: `InitExtensionSystem` with `filesDir/extensions` and
+ `filesDir/download_data`; then `LoadExtensionsFromDir`.
+2. Download screen: `SearchTracksWithMetadataProvidersJSON(query, limit, true)`
+ → list of tracks with provider, quality options.
+3. User taps download, optionally picks quality (default FLAC):
+ enqueue `DownloadWorker` (unique work, `ExistingWorkPolicy.APPEND`).
+4. Worker: create a work file under `cacheDir/downloads/` and pass its
+ absolute path as `output_path` (no `output_fd`). gobackend stages the
+ download and embeds metadata into that file.
+5. Poll progress deltas (~500 ms) → update notification and UI state
+ (`DownloadRepository` exposes `StateFlow>`).
+6. On success the output file already carries embedded tags: the download
+ request set `"embed_metadata": true` with title/artist/album/cover
+ fields. (No separate tagging step.)
+7. SAF publish: resolve user's chosen tree URI via `DocumentFile`, copy
+ `resp.file_path` (the finished, tagged file) → final name derived from
+ title/artist AND `resp.actual_extension` (a provider may return MP3
+ despite a FLAC request — never hardcode `.flac`), then delete the work
+ file. Name collisions get ` (1)` suffixes (DocumentFile `createFile`
+ semantics).
+8. Trigger local library scan so the new file appears under "Local".
+
+## UI
+
+- **DownloadScreen**: search field, results list (art, title, artist,
+ provider chip, quality), active queue section with progress bars and
+ cancel buttons.
+- **ExtensionsScreen**: list installed extensions (name, version, enabled
+ toggle), install via system file picker (`.spotiflac-ext`), remove,
+ reinstall a newer version via file picker (no automatic update checking
+ in v1 — repository browsing is deferred). Includes third-party-code
+ disclaimer.
+- **Settings**: download folder (SAF picker, persisted tree URI), default
+ quality.
+- Download notification: progress bar, cancel action; foreground service via
+ WorkManager `setForeground`.
+
+## Error Handling
+
+- Per-track failure → error state in queue + notification, manual retry.
+- `verification_required` response → dialog prompting for the extension's
+ auth code (`GetExtensionPendingAuthJSON` → `SetExtensionAuthCodeByID`).
+- Process death → WorkManager retries the worker.
+- No extensions installed → empty state with "Install extension" button.
+- SAF folder revoked → clear stored tree URI, prompt to re-pick on next
+ download.
+
+## Security Notes
+
+- Extensions are third-party JS run inside gobackend's Goja VM — sandboxing
+ is gobackend's responsibility (SpotiFLAC ships extensive security tests);
+ PixelPlayer adds a visible disclaimer on the Extensions screen.
+- Downloaded files land only in the user-chosen SAF folder; no path
+ traversal from provider-supplied filenames (sanitized by DocumentFile
+ display-name rules).
+
+## Testing
+
+- Unit (plain JVM): `DownloadBackend` JSON request/response parsing, queue
+ state reduction in `DownloadRepository` (fake backend).
+- Manual on device: install a community extension → search → download FLAC →
+ verify file exists in chosen folder, tags/cover embedded, appears in local
+ library.
+
+## Effort
+
+- AAR build + `DownloadBackend` + repository + worker: ~2 sessions
+- UI (search, extensions, settings, notifications): ~2 sessions
+
+## AAR Provenance
+
+- Built from SpotiFLAC-Mobile at pinned commit:
+ `a34e2935442e7ec661c539ab3c2df8fc0b23b1ff`.
+- Built on: `2026-10-17` · AAR committed at: `87d4a84005603623a9ef9479e15cc2b662b56d46`.
+- Command (needs `ANDROID_NDK_HOME`, `CGO_ENABLED=1`):
+
+ ```bash
+ cd go_backend && go mod download # go.mod requires Go >= 1.26.6
+ go install golang.org/x/mobile/cmd/gomobile && gomobile init
+ gomobile bind -target=android/arm64 -androidapi 24 -o ../app/libs/gobackend.aar .
+ ```
+
+ (Upstream CI also binds `android/arm`; we ship arm64 only — release
+ devices are arm64. Known limitation: x86_64 emulators cannot run the
+ download feature.)
+- Rebuild the AAR only when we deliberately upgrade the pinned SpotiFLAC
+ commit; the AAR is committed to `app/libs/` so app builds stay
+ Go-toolchain-free.
diff --git a/docs/superpowers/specs/s3-storage-source.md b/docs/superpowers/specs/s3-storage-source.md
new file mode 100644
index 0000000000..b12def52b7
--- /dev/null
+++ b/docs/superpowers/specs/s3-storage-source.md
@@ -0,0 +1,34 @@
+# S3-Compatible Storage Source
+
+## Summary
+New cloud music source: any S3-compatible object storage (AWS S3, Cloudflare R2, Backblaze B2, MinIO, Wasabi). Pure REST over existing OkHttp — no new dependencies. Follows the existing cloud-source pattern (GDrive/Navidrome/Jellyfin).
+
+## Auth & API
+- **SigV4** (`data/s3/S3SigV4.kt`): header-signed `ListObjectsV2` + query-string presigned GET (`UNSIGNED-PAYLOAD`, 1h TTL). Verified against official AWS doc vectors (`S3SigV4Test`).
+- **API** (`data/s3/S3ApiService.kt`): `listObjects` (delimiter=`/`, continuation token), `listAllObjects`, `ping` (maxKeys=1), `presignGetUrl` (validates object key via `CloudStreamSecurity.validateS3ObjectKey`).
+- Endpoint must be `https://` (cleartext blocked by network config). Region optional (defaults `us-east-1`); R2 uses `auto`.
+- Credentials in `EncryptedSharedPreferences("s3_prefs")`. Single connection per app.
+
+## Sync model (GDrive-style)
+User connects (ping) → picks folder(s) in bucket via browser → folders stored in Room (`s3_folders`), songs in `s3_songs` + unified `songs` table. Re-sync = diff object listing vs DB, add/remove songs; unified library updated via ID diff. Per-folder sync + sync-all (`Mutex`). Failed folders don't abort the batch.
+
+## IDs & identity
+- `SourceType.S3 = 7`; URI scheme `s3://{objectKey}`.
+- ID offsets: songs `15e12`, albums `16e12`, artists `17e12` (3–14e12 taken by Netease/QQ/Navidrome/Jellyfin).
+- Artist/title parsed from `Artist - Title.ext`; album = first path segment under folder prefix, else `S3`; genre `S3`; duration 0 (unknown).
+
+## Streaming
+- `S3StreamProxy` extends `CloudStreamProxy`; route `/s3/{key}`, key URL-encoded with `Uri.encode(id, "")` (URLEncoder breaks spaces→`+`).
+- Presigned URL cached 55 min (inside 1h TTL). `DualPlayerEngine` resolves `s3://` when online.
+- Presigned URLs exempt from private-IP block in `isSafeRemoteStreamUrl` (self-hosted MinIO/NAS); `X-Amz-Signature` in query is the marker.
+
+## UI
+- `S3LoginActivity`: endpoint/region/bucket/accessKey/secretKey/prefix form → folder picker (browse common prefixes, "Add this folder" for current level).
+- `S3DashboardScreen`: folder list w/ per-folder sync/delete, sync-all, logout, bucket label.
+- Wiring: `AccountsScreen` (S3 palette/icon/disconnect), `Screen.S3Dashboard`, `AppNavigation`, manifest.
+
+## DB
+Version 42→43, `MIGRATION_42_43` creates `s3_folders` + `s3_songs` (+3 indices). Schema JSON exported at `app/schemas/.../43.json`.
+
+## Out of scope (deliberate)
+Multi-account, multipart upload, offline downloads, per-file browse UI, XML `EncodingType=url` handling.
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 6196203923..0d7d6a9d01 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -56,6 +56,7 @@ roomRuntime = "2.8.4"
accompanist = "0.37.3"
checkerframework = "4.2.0" # O la versión más reciente que encuentres
taglib = "1.0.6"
+ffmpegKit = "2.2.1"
jaudiotagger = "3.0.1"
vorbisjava = "0.8"
datastore = "1.2.1"
@@ -211,6 +212,7 @@ timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }
wavy-slider = { module = "ir.mahozad.multiplatform:wavy-slider", version.ref = "wavySlider" }
checker-qual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerframework" }
taglib = { group = "io.github.kyant0", name = "taglib", version.ref = "taglib" }
+ffmpeg-kit-min = { group = "com.antonkarpenko", name = "ffmpeg-kit-min", version.ref = "ffmpegKit" }
jaudiotagger = { group = "net.jthink", name = "jaudiotagger", version.ref = "jaudiotagger" }
vorbisjava-core = { group = "org.gagravarr", name = "vorbis-java-core", version.ref = "vorbisjava" }
reorderables = { group = "sh.calvin.reorderable", name = "reorderable", version.ref = "reorderables" }
diff --git a/scripts/build_gobackend_aar.sh b/scripts/build_gobackend_aar.sh
new file mode 100755
index 0000000000..c492c91d59
--- /dev/null
+++ b/scripts/build_gobackend_aar.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+# Rebuilds app/libs/gobackend.aar from SpotiFLAC-Mobile go_backend.
+# Usage: SPOTIFLAC_DIR=/path/to/SpotiFLAC-Mobile ./scripts/build_gobackend_aar.sh
+set -euo pipefail
+: "${SPOTIFLAC_DIR:?Set SPOTIFLAC_DIR}"
+: "${ANDROID_NDK_HOME:?Set ANDROID_NDK_HOME}"
+export CGO_ENABLED=1
+cd "$SPOTIFLAC_DIR/go_backend"
+echo "Pinning SpotiFLAC commit: $(git rev-parse HEAD)"
+go mod download
+command -v gomobile >/dev/null || go install golang.org/x/mobile/cmd/gomobile
+gomobile init
+mkdir -p "$(dirname "$0")/../app/libs"
+gomobile bind -target=android/arm64 -androidapi 24 -o "$(dirname "$0")/../app/libs/gobackend.aar" .
+echo "OK"