mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
feat(settings): add setting to customize downloaded song file name format
* Added a new setting that customizes the file name format of downloaded songs. The two options are "Title - Artists" or "Artists - Title". The default option is "Title - Artists", which matches the current implementation. * Updated the way existing songs are searched for in the song downloads folder. Instead of searching by name, song metadata is checked.
This commit is contained in:
parent
d3edf07ac9
commit
fd8e356e2f
1
drift_schemas/app_db/drift_schema_v6.json
Normal file
1
drift_schemas/app_db/drift_schema_v6.json
Normal file
File diff suppressed because one or more lines are too long
@ -108,6 +108,7 @@
|
||||
"always_on_top": "Always on top",
|
||||
"exit_mini_player": "Exit Mini player",
|
||||
"download_location": "Download location",
|
||||
"file_name_format": "File name format",
|
||||
"local_library": "Local library",
|
||||
"add_library_location": "Add to library",
|
||||
"remove_library_location": "Remove from library",
|
||||
|
@ -803,6 +803,12 @@ abstract class AppLocalizations {
|
||||
/// **'Download location'**
|
||||
String get download_location;
|
||||
|
||||
/// No description provided for @file_name_format.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'File name format'**
|
||||
String get file_name_format;
|
||||
|
||||
/// No description provided for @local_library.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsAr extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'تنزيل الموقع';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'المكتبة المحلية';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsBn extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'ডাউনলোড স্থান';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'স্থানীয় লাইব্রেরি';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsCa extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Ubicació de descàrregues';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Biblioteca local';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsCs extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Umístění stahování';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Místní knihovna';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Download-Speicherort';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Lokale Bibliothek';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Download location';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Local library';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Ubicación de descargas';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Biblioteca local';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsEu extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Deskargen kokapena';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Liburutegi lokala';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsFa extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'محل بارگیری';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'کتابخانه محلی';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsFi extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Lataus sijainti';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Paikallinen kirjasto';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Emplacement de téléchargement';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Bibliothèque locale';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsHi extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'डाउनलोड स्थान';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'स्थानीय पुस्तकालय';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsId extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Lokasi unduhan';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Perpustakaan lokal';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Cartella di scarico';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Biblioteca locale';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'ダウンロード先';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'ローカルライブラリ';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsKa extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'ჩამოტვირთვის მდებარეობა';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'ადგილობრივი ბიბლიოთეკა';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => '다운로드 경로';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => '로컬 도서관';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsNe extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'डाउनलोड स्थान';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'स्थानिय पुस्तकालय';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsNl extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Downloadlocatie';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Lokale bibliotheek';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsPl extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Zmień lokalizację';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Biblioteka lokalna';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Local de download';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Biblioteca local';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Место загрузки';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Локальная библиотека';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsTa extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'பதிவிறக்க இடம்';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'உள்ளூர் நூலகம்';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsTh extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'ตำแหน่งดาวน์โหลด';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'ห้องสมุดท้องถิ่น';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsTl extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Lokasyon ng pag-download';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Lokal na silid-aklatan';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsTr extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'İndirme konumu';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Yerel kütüphane';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsUk extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Шлях завантаження';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Місцева бібліотека';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsVi extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => 'Vị trí tải xuống';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => 'Thư viện địa phương';
|
||||
|
||||
|
@ -367,6 +367,9 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
@override
|
||||
String get download_location => '下载路径';
|
||||
|
||||
@override
|
||||
String get file_name_format => 'File name format';
|
||||
|
||||
@override
|
||||
String get local_library => '本地图书馆';
|
||||
|
||||
|
@ -62,7 +62,7 @@ class AppDatabase extends _$AppDatabase {
|
||||
AppDatabase() : super(_openConnection());
|
||||
|
||||
@override
|
||||
int get schemaVersion => 5;
|
||||
int get schemaVersion => 6;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration {
|
||||
@ -114,6 +114,12 @@ class AppDatabase extends _$AppDatabase {
|
||||
"SET $columnName = 'Orange:0xFFf97315' WHERE $columnName = 'Blue:0xFF2196F3'",
|
||||
);
|
||||
},
|
||||
from5To6: (m, schema) async {
|
||||
await m.addColumn(
|
||||
schema.preferencesTable,
|
||||
schema.preferencesTable.fileNameFormat,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -647,6 +647,17 @@ class $PreferencesTableTable extends PreferencesTable
|
||||
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
||||
'CHECK ("skip_non_music" IN (0, 1))'),
|
||||
defaultValue: const Constant(false));
|
||||
static const VerificationMeta _fileNameFormatMeta =
|
||||
const VerificationMeta('fileNameFormat');
|
||||
@override
|
||||
late final GeneratedColumnWithTypeConverter<FileNameFormat, String>
|
||||
fileNameFormat = GeneratedColumn<String>(
|
||||
'file_name_format', aliasedName, false,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
defaultValue: Constant(FileNameFormat.titleArtists.name))
|
||||
.withConverter<FileNameFormat>(
|
||||
$PreferencesTableTable.$converterfileNameFormat);
|
||||
static const VerificationMeta _closeBehaviorMeta =
|
||||
const VerificationMeta('closeBehavior');
|
||||
@override
|
||||
@ -844,6 +855,7 @@ class $PreferencesTableTable extends PreferencesTable
|
||||
showSystemTrayIcon,
|
||||
systemTitleBar,
|
||||
skipNonMusic,
|
||||
fileNameFormat,
|
||||
closeBehavior,
|
||||
accentColorScheme,
|
||||
layoutMode,
|
||||
@ -921,6 +933,7 @@ class $PreferencesTableTable extends PreferencesTable
|
||||
skipNonMusic.isAcceptableOrUnknown(
|
||||
data['skip_non_music']!, _skipNonMusicMeta));
|
||||
}
|
||||
context.handle(_fileNameFormatMeta, const VerificationResult.success());
|
||||
context.handle(_closeBehaviorMeta, const VerificationResult.success());
|
||||
context.handle(_accentColorSchemeMeta, const VerificationResult.success());
|
||||
context.handle(_layoutModeMeta, const VerificationResult.success());
|
||||
@ -1005,6 +1018,9 @@ class $PreferencesTableTable extends PreferencesTable
|
||||
.read(DriftSqlType.bool, data['${effectivePrefix}system_title_bar'])!,
|
||||
skipNonMusic: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.bool, data['${effectivePrefix}skip_non_music'])!,
|
||||
fileNameFormat: $PreferencesTableTable.$converterfileNameFormat.fromSql(
|
||||
attachedDatabase.typeMapping.read(DriftSqlType.string,
|
||||
data['${effectivePrefix}file_name_format'])!),
|
||||
closeBehavior: $PreferencesTableTable.$convertercloseBehavior.fromSql(
|
||||
attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string, data['${effectivePrefix}close_behavior'])!),
|
||||
@ -1067,6 +1083,9 @@ class $PreferencesTableTable extends PreferencesTable
|
||||
static JsonTypeConverter2<SourceQualities, String, String>
|
||||
$converteraudioQuality =
|
||||
const EnumNameConverter<SourceQualities>(SourceQualities.values);
|
||||
static JsonTypeConverter2<FileNameFormat, String, String>
|
||||
$converterfileNameFormat =
|
||||
const EnumNameConverter<FileNameFormat>(FileNameFormat.values);
|
||||
static JsonTypeConverter2<CloseBehavior, String, String>
|
||||
$convertercloseBehavior =
|
||||
const EnumNameConverter<CloseBehavior>(CloseBehavior.values);
|
||||
@ -1108,6 +1127,7 @@ class PreferencesTableData extends DataClass
|
||||
final bool showSystemTrayIcon;
|
||||
final bool systemTitleBar;
|
||||
final bool skipNonMusic;
|
||||
final FileNameFormat fileNameFormat;
|
||||
final CloseBehavior closeBehavior;
|
||||
final SpotubeColor accentColorScheme;
|
||||
final LayoutMode layoutMode;
|
||||
@ -1137,6 +1157,7 @@ class PreferencesTableData extends DataClass
|
||||
required this.showSystemTrayIcon,
|
||||
required this.systemTitleBar,
|
||||
required this.skipNonMusic,
|
||||
required this.fileNameFormat,
|
||||
required this.closeBehavior,
|
||||
required this.accentColorScheme,
|
||||
required this.layoutMode,
|
||||
@ -1171,6 +1192,11 @@ class PreferencesTableData extends DataClass
|
||||
map['show_system_tray_icon'] = Variable<bool>(showSystemTrayIcon);
|
||||
map['system_title_bar'] = Variable<bool>(systemTitleBar);
|
||||
map['skip_non_music'] = Variable<bool>(skipNonMusic);
|
||||
{
|
||||
map['file_name_format'] = Variable<String>($PreferencesTableTable
|
||||
.$converterfileNameFormat
|
||||
.toSql(fileNameFormat));
|
||||
}
|
||||
{
|
||||
map['close_behavior'] = Variable<String>(
|
||||
$PreferencesTableTable.$convertercloseBehavior.toSql(closeBehavior));
|
||||
@ -1245,6 +1271,7 @@ class PreferencesTableData extends DataClass
|
||||
showSystemTrayIcon: Value(showSystemTrayIcon),
|
||||
systemTitleBar: Value(systemTitleBar),
|
||||
skipNonMusic: Value(skipNonMusic),
|
||||
fileNameFormat: Value(fileNameFormat),
|
||||
closeBehavior: Value(closeBehavior),
|
||||
accentColorScheme: Value(accentColorScheme),
|
||||
layoutMode: Value(layoutMode),
|
||||
@ -1281,6 +1308,8 @@ class PreferencesTableData extends DataClass
|
||||
showSystemTrayIcon: serializer.fromJson<bool>(json['showSystemTrayIcon']),
|
||||
systemTitleBar: serializer.fromJson<bool>(json['systemTitleBar']),
|
||||
skipNonMusic: serializer.fromJson<bool>(json['skipNonMusic']),
|
||||
fileNameFormat: $PreferencesTableTable.$converterfileNameFormat
|
||||
.fromJson(serializer.fromJson<String>(json['fileNameFormat'])),
|
||||
closeBehavior: $PreferencesTableTable.$convertercloseBehavior
|
||||
.fromJson(serializer.fromJson<String>(json['closeBehavior'])),
|
||||
accentColorScheme:
|
||||
@ -1327,6 +1356,9 @@ class PreferencesTableData extends DataClass
|
||||
'showSystemTrayIcon': serializer.toJson<bool>(showSystemTrayIcon),
|
||||
'systemTitleBar': serializer.toJson<bool>(systemTitleBar),
|
||||
'skipNonMusic': serializer.toJson<bool>(skipNonMusic),
|
||||
'fileNameFormat': serializer.toJson<String>($PreferencesTableTable
|
||||
.$converterfileNameFormat
|
||||
.toJson(fileNameFormat)),
|
||||
'closeBehavior': serializer.toJson<String>(
|
||||
$PreferencesTableTable.$convertercloseBehavior.toJson(closeBehavior)),
|
||||
'accentColorScheme': serializer.toJson<SpotubeColor>(accentColorScheme),
|
||||
@ -1372,6 +1404,7 @@ class PreferencesTableData extends DataClass
|
||||
bool? showSystemTrayIcon,
|
||||
bool? systemTitleBar,
|
||||
bool? skipNonMusic,
|
||||
FileNameFormat? fileNameFormat,
|
||||
CloseBehavior? closeBehavior,
|
||||
SpotubeColor? accentColorScheme,
|
||||
LayoutMode? layoutMode,
|
||||
@ -1401,6 +1434,7 @@ class PreferencesTableData extends DataClass
|
||||
showSystemTrayIcon: showSystemTrayIcon ?? this.showSystemTrayIcon,
|
||||
systemTitleBar: systemTitleBar ?? this.systemTitleBar,
|
||||
skipNonMusic: skipNonMusic ?? this.skipNonMusic,
|
||||
fileNameFormat: fileNameFormat ?? this.fileNameFormat,
|
||||
closeBehavior: closeBehavior ?? this.closeBehavior,
|
||||
accentColorScheme: accentColorScheme ?? this.accentColorScheme,
|
||||
layoutMode: layoutMode ?? this.layoutMode,
|
||||
@ -1447,6 +1481,9 @@ class PreferencesTableData extends DataClass
|
||||
skipNonMusic: data.skipNonMusic.present
|
||||
? data.skipNonMusic.value
|
||||
: this.skipNonMusic,
|
||||
fileNameFormat: data.fileNameFormat.present
|
||||
? data.fileNameFormat.value
|
||||
: this.fileNameFormat,
|
||||
closeBehavior: data.closeBehavior.present
|
||||
? data.closeBehavior.value
|
||||
: this.closeBehavior,
|
||||
@ -1509,6 +1546,7 @@ class PreferencesTableData extends DataClass
|
||||
..write('showSystemTrayIcon: $showSystemTrayIcon, ')
|
||||
..write('systemTitleBar: $systemTitleBar, ')
|
||||
..write('skipNonMusic: $skipNonMusic, ')
|
||||
..write('fileNameFormat: $fileNameFormat, ')
|
||||
..write('closeBehavior: $closeBehavior, ')
|
||||
..write('accentColorScheme: $accentColorScheme, ')
|
||||
..write('layoutMode: $layoutMode, ')
|
||||
@ -1543,6 +1581,7 @@ class PreferencesTableData extends DataClass
|
||||
showSystemTrayIcon,
|
||||
systemTitleBar,
|
||||
skipNonMusic,
|
||||
fileNameFormat,
|
||||
closeBehavior,
|
||||
accentColorScheme,
|
||||
layoutMode,
|
||||
@ -1576,6 +1615,7 @@ class PreferencesTableData extends DataClass
|
||||
other.showSystemTrayIcon == this.showSystemTrayIcon &&
|
||||
other.systemTitleBar == this.systemTitleBar &&
|
||||
other.skipNonMusic == this.skipNonMusic &&
|
||||
other.fileNameFormat == this.fileNameFormat &&
|
||||
other.closeBehavior == this.closeBehavior &&
|
||||
other.accentColorScheme == this.accentColorScheme &&
|
||||
other.layoutMode == this.layoutMode &&
|
||||
@ -1607,6 +1647,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
|
||||
final Value<bool> showSystemTrayIcon;
|
||||
final Value<bool> systemTitleBar;
|
||||
final Value<bool> skipNonMusic;
|
||||
final Value<FileNameFormat> fileNameFormat;
|
||||
final Value<CloseBehavior> closeBehavior;
|
||||
final Value<SpotubeColor> accentColorScheme;
|
||||
final Value<LayoutMode> layoutMode;
|
||||
@ -1636,6 +1677,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
|
||||
this.showSystemTrayIcon = const Value.absent(),
|
||||
this.systemTitleBar = const Value.absent(),
|
||||
this.skipNonMusic = const Value.absent(),
|
||||
this.fileNameFormat = const Value.absent(),
|
||||
this.closeBehavior = const Value.absent(),
|
||||
this.accentColorScheme = const Value.absent(),
|
||||
this.layoutMode = const Value.absent(),
|
||||
@ -1666,6 +1708,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
|
||||
this.showSystemTrayIcon = const Value.absent(),
|
||||
this.systemTitleBar = const Value.absent(),
|
||||
this.skipNonMusic = const Value.absent(),
|
||||
this.fileNameFormat = const Value.absent(),
|
||||
this.closeBehavior = const Value.absent(),
|
||||
this.accentColorScheme = const Value.absent(),
|
||||
this.layoutMode = const Value.absent(),
|
||||
@ -1696,6 +1739,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
|
||||
Expression<bool>? showSystemTrayIcon,
|
||||
Expression<bool>? systemTitleBar,
|
||||
Expression<bool>? skipNonMusic,
|
||||
Expression<String>? fileNameFormat,
|
||||
Expression<String>? closeBehavior,
|
||||
Expression<String>? accentColorScheme,
|
||||
Expression<String>? layoutMode,
|
||||
@ -1727,6 +1771,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
|
||||
'show_system_tray_icon': showSystemTrayIcon,
|
||||
if (systemTitleBar != null) 'system_title_bar': systemTitleBar,
|
||||
if (skipNonMusic != null) 'skip_non_music': skipNonMusic,
|
||||
if (fileNameFormat != null) 'file_name_format': fileNameFormat,
|
||||
if (closeBehavior != null) 'close_behavior': closeBehavior,
|
||||
if (accentColorScheme != null) 'accent_color_scheme': accentColorScheme,
|
||||
if (layoutMode != null) 'layout_mode': layoutMode,
|
||||
@ -1762,6 +1807,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
|
||||
Value<bool>? showSystemTrayIcon,
|
||||
Value<bool>? systemTitleBar,
|
||||
Value<bool>? skipNonMusic,
|
||||
Value<FileNameFormat>? fileNameFormat,
|
||||
Value<CloseBehavior>? closeBehavior,
|
||||
Value<SpotubeColor>? accentColorScheme,
|
||||
Value<LayoutMode>? layoutMode,
|
||||
@ -1791,6 +1837,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
|
||||
showSystemTrayIcon: showSystemTrayIcon ?? this.showSystemTrayIcon,
|
||||
systemTitleBar: systemTitleBar ?? this.systemTitleBar,
|
||||
skipNonMusic: skipNonMusic ?? this.skipNonMusic,
|
||||
fileNameFormat: fileNameFormat ?? this.fileNameFormat,
|
||||
closeBehavior: closeBehavior ?? this.closeBehavior,
|
||||
accentColorScheme: accentColorScheme ?? this.accentColorScheme,
|
||||
layoutMode: layoutMode ?? this.layoutMode,
|
||||
@ -1845,6 +1892,11 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
|
||||
if (skipNonMusic.present) {
|
||||
map['skip_non_music'] = Variable<bool>(skipNonMusic.value);
|
||||
}
|
||||
if (fileNameFormat.present) {
|
||||
map['file_name_format'] = Variable<String>($PreferencesTableTable
|
||||
.$converterfileNameFormat
|
||||
.toSql(fileNameFormat.value));
|
||||
}
|
||||
if (closeBehavior.present) {
|
||||
map['close_behavior'] = Variable<String>($PreferencesTableTable
|
||||
.$convertercloseBehavior
|
||||
@ -1936,6 +1988,7 @@ class PreferencesTableCompanion extends UpdateCompanion<PreferencesTableData> {
|
||||
..write('showSystemTrayIcon: $showSystemTrayIcon, ')
|
||||
..write('systemTitleBar: $systemTitleBar, ')
|
||||
..write('skipNonMusic: $skipNonMusic, ')
|
||||
..write('fileNameFormat: $fileNameFormat, ')
|
||||
..write('closeBehavior: $closeBehavior, ')
|
||||
..write('accentColorScheme: $accentColorScheme, ')
|
||||
..write('layoutMode: $layoutMode, ')
|
||||
@ -4608,6 +4661,7 @@ typedef $$PreferencesTableTableCreateCompanionBuilder
|
||||
Value<bool> showSystemTrayIcon,
|
||||
Value<bool> systemTitleBar,
|
||||
Value<bool> skipNonMusic,
|
||||
Value<FileNameFormat> fileNameFormat,
|
||||
Value<CloseBehavior> closeBehavior,
|
||||
Value<SpotubeColor> accentColorScheme,
|
||||
Value<LayoutMode> layoutMode,
|
||||
@ -4639,6 +4693,7 @@ typedef $$PreferencesTableTableUpdateCompanionBuilder
|
||||
Value<bool> showSystemTrayIcon,
|
||||
Value<bool> systemTitleBar,
|
||||
Value<bool> skipNonMusic,
|
||||
Value<FileNameFormat> fileNameFormat,
|
||||
Value<CloseBehavior> closeBehavior,
|
||||
Value<SpotubeColor> accentColorScheme,
|
||||
Value<LayoutMode> layoutMode,
|
||||
@ -4703,6 +4758,11 @@ class $$PreferencesTableTableFilterComposer
|
||||
ColumnFilters<bool> get skipNonMusic => $composableBuilder(
|
||||
column: $table.skipNonMusic, builder: (column) => ColumnFilters(column));
|
||||
|
||||
ColumnWithTypeConverterFilters<FileNameFormat, FileNameFormat, String>
|
||||
get fileNameFormat => $composableBuilder(
|
||||
column: $table.fileNameFormat,
|
||||
builder: (column) => ColumnWithTypeConverterFilters(column));
|
||||
|
||||
ColumnWithTypeConverterFilters<CloseBehavior, CloseBehavior, String>
|
||||
get closeBehavior => $composableBuilder(
|
||||
column: $table.closeBehavior,
|
||||
@ -4833,6 +4893,10 @@ class $$PreferencesTableTableOrderingComposer
|
||||
column: $table.skipNonMusic,
|
||||
builder: (column) => ColumnOrderings(column));
|
||||
|
||||
ColumnOrderings<String> get fileNameFormat => $composableBuilder(
|
||||
column: $table.fileNameFormat,
|
||||
builder: (column) => ColumnOrderings(column));
|
||||
|
||||
ColumnOrderings<String> get closeBehavior => $composableBuilder(
|
||||
column: $table.closeBehavior,
|
||||
builder: (column) => ColumnOrderings(column));
|
||||
@ -4940,6 +5004,10 @@ class $$PreferencesTableTableAnnotationComposer
|
||||
GeneratedColumn<bool> get skipNonMusic => $composableBuilder(
|
||||
column: $table.skipNonMusic, builder: (column) => column);
|
||||
|
||||
GeneratedColumnWithTypeConverter<FileNameFormat, String> get fileNameFormat =>
|
||||
$composableBuilder(
|
||||
column: $table.fileNameFormat, builder: (column) => column);
|
||||
|
||||
GeneratedColumnWithTypeConverter<CloseBehavior, String> get closeBehavior =>
|
||||
$composableBuilder(
|
||||
column: $table.closeBehavior, builder: (column) => column);
|
||||
@ -5044,6 +5112,7 @@ class $$PreferencesTableTableTableManager extends RootTableManager<
|
||||
Value<bool> showSystemTrayIcon = const Value.absent(),
|
||||
Value<bool> systemTitleBar = const Value.absent(),
|
||||
Value<bool> skipNonMusic = const Value.absent(),
|
||||
Value<FileNameFormat> fileNameFormat = const Value.absent(),
|
||||
Value<CloseBehavior> closeBehavior = const Value.absent(),
|
||||
Value<SpotubeColor> accentColorScheme = const Value.absent(),
|
||||
Value<LayoutMode> layoutMode = const Value.absent(),
|
||||
@ -5075,6 +5144,7 @@ class $$PreferencesTableTableTableManager extends RootTableManager<
|
||||
showSystemTrayIcon: showSystemTrayIcon,
|
||||
systemTitleBar: systemTitleBar,
|
||||
skipNonMusic: skipNonMusic,
|
||||
fileNameFormat: fileNameFormat,
|
||||
closeBehavior: closeBehavior,
|
||||
accentColorScheme: accentColorScheme,
|
||||
layoutMode: layoutMode,
|
||||
@ -5105,6 +5175,7 @@ class $$PreferencesTableTableTableManager extends RootTableManager<
|
||||
Value<bool> showSystemTrayIcon = const Value.absent(),
|
||||
Value<bool> systemTitleBar = const Value.absent(),
|
||||
Value<bool> skipNonMusic = const Value.absent(),
|
||||
Value<FileNameFormat> fileNameFormat = const Value.absent(),
|
||||
Value<CloseBehavior> closeBehavior = const Value.absent(),
|
||||
Value<SpotubeColor> accentColorScheme = const Value.absent(),
|
||||
Value<LayoutMode> layoutMode = const Value.absent(),
|
||||
@ -5136,6 +5207,7 @@ class $$PreferencesTableTableTableManager extends RootTableManager<
|
||||
showSystemTrayIcon: showSystemTrayIcon,
|
||||
systemTitleBar: systemTitleBar,
|
||||
skipNonMusic: skipNonMusic,
|
||||
fileNameFormat: fileNameFormat,
|
||||
closeBehavior: closeBehavior,
|
||||
accentColorScheme: accentColorScheme,
|
||||
layoutMode: layoutMode,
|
||||
|
@ -1409,11 +1409,296 @@ i1.GeneratedColumn<String> _column_55(String aliasedName) =>
|
||||
i1.GeneratedColumn<String>('accent_color_scheme', aliasedName, false,
|
||||
type: i1.DriftSqlType.string,
|
||||
defaultValue: const Constant("Orange:0xFFf97315"));
|
||||
|
||||
final class Schema6 extends i0.VersionedSchema {
|
||||
Schema6({required super.database}) : super(version: 6);
|
||||
@override
|
||||
late final List<i1.DatabaseSchemaEntity> entities = [
|
||||
authenticationTable,
|
||||
blacklistTable,
|
||||
preferencesTable,
|
||||
scrobblerTable,
|
||||
skipSegmentTable,
|
||||
sourceMatchTable,
|
||||
audioPlayerStateTable,
|
||||
playlistTable,
|
||||
playlistMediaTable,
|
||||
historyTable,
|
||||
lyricsTable,
|
||||
uniqueBlacklist,
|
||||
uniqTrackMatch,
|
||||
];
|
||||
late final Shape0 authenticationTable = Shape0(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'authentication_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_1,
|
||||
_column_2,
|
||||
_column_3,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape1 blacklistTable = Shape1(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'blacklist_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_4,
|
||||
_column_5,
|
||||
_column_6,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape13 preferencesTable = Shape13(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'preferences_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_7,
|
||||
_column_8,
|
||||
_column_9,
|
||||
_column_10,
|
||||
_column_11,
|
||||
_column_12,
|
||||
_column_13,
|
||||
_column_14,
|
||||
_column_56,
|
||||
_column_15,
|
||||
_column_55,
|
||||
_column_17,
|
||||
_column_18,
|
||||
_column_19,
|
||||
_column_20,
|
||||
_column_21,
|
||||
_column_22,
|
||||
_column_23,
|
||||
_column_24,
|
||||
_column_25,
|
||||
_column_26,
|
||||
_column_54,
|
||||
_column_27,
|
||||
_column_28,
|
||||
_column_29,
|
||||
_column_30,
|
||||
_column_31,
|
||||
_column_53,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape3 scrobblerTable = Shape3(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'scrobbler_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_32,
|
||||
_column_33,
|
||||
_column_34,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape4 skipSegmentTable = Shape4(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'skip_segment_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_35,
|
||||
_column_36,
|
||||
_column_37,
|
||||
_column_32,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape5 sourceMatchTable = Shape5(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'source_match_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_37,
|
||||
_column_38,
|
||||
_column_39,
|
||||
_column_32,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape6 audioPlayerStateTable = Shape6(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'audio_player_state_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_40,
|
||||
_column_41,
|
||||
_column_42,
|
||||
_column_43,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape7 playlistTable = Shape7(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'playlist_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_44,
|
||||
_column_45,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape8 playlistMediaTable = Shape8(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'playlist_media_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_46,
|
||||
_column_47,
|
||||
_column_48,
|
||||
_column_49,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape9 historyTable = Shape9(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'history_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_32,
|
||||
_column_50,
|
||||
_column_51,
|
||||
_column_52,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
late final Shape10 lyricsTable = Shape10(
|
||||
source: i0.VersionedTable(
|
||||
entityName: 'lyrics_table',
|
||||
withoutRowId: false,
|
||||
isStrict: false,
|
||||
tableConstraints: [],
|
||||
columns: [
|
||||
_column_0,
|
||||
_column_37,
|
||||
_column_52,
|
||||
],
|
||||
attachedDatabase: database,
|
||||
),
|
||||
alias: null);
|
||||
final i1.Index uniqueBlacklist = i1.Index('unique_blacklist',
|
||||
'CREATE UNIQUE INDEX unique_blacklist ON blacklist_table (element_type, element_id)');
|
||||
final i1.Index uniqTrackMatch = i1.Index('uniq_track_match',
|
||||
'CREATE UNIQUE INDEX uniq_track_match ON source_match_table (track_id, source_id, source_type)');
|
||||
}
|
||||
|
||||
class Shape13 extends i0.VersionedTable {
|
||||
Shape13({required super.source, required super.alias}) : super.aliased();
|
||||
i1.GeneratedColumn<int> get id =>
|
||||
columnsByName['id']! as i1.GeneratedColumn<int>;
|
||||
i1.GeneratedColumn<String> get audioQuality =>
|
||||
columnsByName['audio_quality']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<bool> get albumColorSync =>
|
||||
columnsByName['album_color_sync']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get amoledDarkTheme =>
|
||||
columnsByName['amoled_dark_theme']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get checkUpdate =>
|
||||
columnsByName['check_update']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get normalizeAudio =>
|
||||
columnsByName['normalize_audio']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get showSystemTrayIcon =>
|
||||
columnsByName['show_system_tray_icon']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get systemTitleBar =>
|
||||
columnsByName['system_title_bar']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get skipNonMusic =>
|
||||
columnsByName['skip_non_music']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<String> get fileNameFormat =>
|
||||
columnsByName['file_name_format']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get closeBehavior =>
|
||||
columnsByName['close_behavior']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get accentColorScheme =>
|
||||
columnsByName['accent_color_scheme']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get layoutMode =>
|
||||
columnsByName['layout_mode']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get locale =>
|
||||
columnsByName['locale']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get market =>
|
||||
columnsByName['market']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get searchMode =>
|
||||
columnsByName['search_mode']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get downloadLocation =>
|
||||
columnsByName['download_location']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get localLibraryLocation =>
|
||||
columnsByName['local_library_location']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get pipedInstance =>
|
||||
columnsByName['piped_instance']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get invidiousInstance =>
|
||||
columnsByName['invidious_instance']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get themeMode =>
|
||||
columnsByName['theme_mode']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get audioSource =>
|
||||
columnsByName['audio_source']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get youtubeClientEngine =>
|
||||
columnsByName['youtube_client_engine']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get streamMusicCodec =>
|
||||
columnsByName['stream_music_codec']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<String> get downloadMusicCodec =>
|
||||
columnsByName['download_music_codec']! as i1.GeneratedColumn<String>;
|
||||
i1.GeneratedColumn<bool> get discordPresence =>
|
||||
columnsByName['discord_presence']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get endlessPlayback =>
|
||||
columnsByName['endless_playback']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get enableConnect =>
|
||||
columnsByName['enable_connect']! as i1.GeneratedColumn<bool>;
|
||||
i1.GeneratedColumn<bool> get cacheMusic =>
|
||||
columnsByName['cache_music']! as i1.GeneratedColumn<bool>;
|
||||
}
|
||||
|
||||
i1.GeneratedColumn<String> _column_56(String aliasedName) =>
|
||||
i1.GeneratedColumn<String>('file_name_format', aliasedName, false,
|
||||
type: i1.DriftSqlType.string,
|
||||
defaultValue: Constant(FileNameFormat.titleArtists.name));
|
||||
i0.MigrationStepWithVersion migrationSteps({
|
||||
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
||||
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
||||
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
||||
required Future<void> Function(i1.Migrator m, Schema5 schema) from4To5,
|
||||
required Future<void> Function(i1.Migrator m, Schema6 schema) from5To6,
|
||||
}) {
|
||||
return (currentVersion, database) async {
|
||||
switch (currentVersion) {
|
||||
@ -1437,6 +1722,11 @@ i0.MigrationStepWithVersion migrationSteps({
|
||||
final migrator = i1.Migrator(database, schema);
|
||||
await from4To5(migrator, schema);
|
||||
return 5;
|
||||
case 5:
|
||||
final schema = Schema6(database: database);
|
||||
final migrator = i1.Migrator(database, schema);
|
||||
await from5To6(migrator, schema);
|
||||
return 6;
|
||||
default:
|
||||
throw ArgumentError.value('Unknown migration from $currentVersion');
|
||||
}
|
||||
@ -1448,6 +1738,7 @@ i1.OnUpgrade stepByStep({
|
||||
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
||||
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
||||
required Future<void> Function(i1.Migrator m, Schema5 schema) from4To5,
|
||||
required Future<void> Function(i1.Migrator m, Schema6 schema) from5To6,
|
||||
}) =>
|
||||
i0.VersionedSchema.stepByStepHelper(
|
||||
step: migrationSteps(
|
||||
@ -1455,4 +1746,5 @@ i1.OnUpgrade stepByStep({
|
||||
from2To3: from2To3,
|
||||
from3To4: from3To4,
|
||||
from4To5: from4To5,
|
||||
from5To6: from5To6,
|
||||
));
|
||||
|
@ -6,6 +6,11 @@ enum LayoutMode {
|
||||
adaptive,
|
||||
}
|
||||
|
||||
enum FileNameFormat {
|
||||
titleArtists,
|
||||
artistsTitle,
|
||||
}
|
||||
|
||||
enum CloseBehavior {
|
||||
minimizeToTray,
|
||||
close,
|
||||
@ -76,6 +81,8 @@ class PreferencesTable extends Table {
|
||||
BoolColumn get systemTitleBar =>
|
||||
boolean().withDefault(const Constant(false))();
|
||||
BoolColumn get skipNonMusic => boolean().withDefault(const Constant(false))();
|
||||
TextColumn get fileNameFormat => textEnum<FileNameFormat>()
|
||||
.withDefault(Constant(FileNameFormat.titleArtists.name))();
|
||||
TextColumn get closeBehavior => textEnum<CloseBehavior>()
|
||||
.withDefault(Constant(CloseBehavior.close.name))();
|
||||
TextColumn get accentColorScheme => text()
|
||||
@ -129,6 +136,7 @@ class PreferencesTable extends Table {
|
||||
showSystemTrayIcon: false,
|
||||
systemTitleBar: false,
|
||||
skipNonMusic: false,
|
||||
fileNameFormat: FileNameFormat.titleArtists,
|
||||
closeBehavior: CloseBehavior.close,
|
||||
accentColorScheme: SpotubeColor(Colors.orange.value, name: "Orange"),
|
||||
layoutMode: LayoutMode.adaptive,
|
||||
|
@ -10,6 +10,9 @@ import 'package:spotube/extensions/context.dart';
|
||||
import 'package:spotube/provider/user_preferences/user_preferences_provider.dart';
|
||||
import 'package:spotube/utils/platform.dart';
|
||||
|
||||
import '../../../components/adaptive/adaptive_select_tile.dart';
|
||||
import '../../../models/database/database.dart';
|
||||
|
||||
class SettingsDownloadsSection extends HookConsumerWidget {
|
||||
const SettingsDownloadsSection({super.key});
|
||||
|
||||
@ -47,6 +50,26 @@ class SettingsDownloadsSection extends HookConsumerWidget {
|
||||
),
|
||||
onTap: pickDownloadLocation,
|
||||
),
|
||||
AdaptiveSelectTile<FileNameFormat>(
|
||||
secondary: const Icon(SpotubeIcons.file),
|
||||
title: Text(context.l10n.file_name_format),
|
||||
value: preferences.fileNameFormat,
|
||||
options: [
|
||||
SelectItemButton(
|
||||
value: FileNameFormat.titleArtists,
|
||||
child: Text("${context.l10n.title} - ${context.l10n.artists}"),
|
||||
),
|
||||
SelectItemButton(
|
||||
value: FileNameFormat.artistsTitle,
|
||||
child: Text("${context.l10n.artists} - ${context.l10n.title}"),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
preferencesNotifier.setFileNameFormat(value);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ import 'package:spotube/services/sourced_track/sourced_track.dart';
|
||||
import 'package:spotube/utils/primitive_utils.dart';
|
||||
import 'package:spotube/utils/service_utils.dart';
|
||||
|
||||
import '../models/database/database.dart';
|
||||
|
||||
class DownloadManagerProvider extends ChangeNotifier {
|
||||
DownloadManagerProvider({required this.ref})
|
||||
: $history = <SourcedTrack>{},
|
||||
@ -82,6 +84,8 @@ class DownloadManagerProvider extends ChangeNotifier {
|
||||
|
||||
String get downloadDirectory =>
|
||||
ref.read(userPreferencesProvider.select((s) => s.downloadLocation));
|
||||
FileNameFormat get fileNameFormat =>
|
||||
ref.read(userPreferencesProvider.select((s) => s.fileNameFormat));
|
||||
SourceCodecs get downloadCodec =>
|
||||
ref.read(userPreferencesProvider.select((s) => s.downloadMusicCodec));
|
||||
|
||||
@ -101,8 +105,16 @@ class DownloadManagerProvider extends ChangeNotifier {
|
||||
final DownloadManager dl;
|
||||
|
||||
String getTrackFileUrl(Track track) {
|
||||
final name =
|
||||
"${track.name} - ${track.artists?.asString() ?? ""}.${downloadCodec.name}";
|
||||
final String name;
|
||||
|
||||
if (fileNameFormat == FileNameFormat.titleArtists) {
|
||||
name =
|
||||
"${track.name} - ${track.artists?.asString() ?? ""}.${downloadCodec.name}";
|
||||
} else {
|
||||
name =
|
||||
"${track.artists?.asString() ?? ""} - ${track.name}.${downloadCodec.name}";
|
||||
}
|
||||
|
||||
return join(downloadDirectory, PrimitiveUtils.toSafeFileName(name));
|
||||
}
|
||||
|
||||
@ -129,13 +141,35 @@ class DownloadManagerProvider extends ChangeNotifier {
|
||||
Future<void> addToQueue(Track track) async {
|
||||
final savePath = getTrackFileUrl(track);
|
||||
|
||||
final oldFile = File(savePath);
|
||||
if (await oldFile.exists() && !await onFileExists(track)) {
|
||||
final downloads = await Directory(downloadDirectory).list().toList();
|
||||
File? oldFile;
|
||||
|
||||
for (final element in downloads) {
|
||||
if (element is File) {
|
||||
final Metadata metadata;
|
||||
|
||||
try {
|
||||
metadata = await MetadataGod.readMetadata(file: element.path);
|
||||
} catch (exception) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final artist = metadata.artist;
|
||||
final title = metadata.title;
|
||||
|
||||
if (artist == track.artists?.asString() && title == track.name) {
|
||||
oldFile = element;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((await oldFile?.exists() == true) && !await onFileExists(track)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (await oldFile.exists()) {
|
||||
await oldFile.rename("$savePath.old");
|
||||
if ((await oldFile?.exists()) == true) {
|
||||
await oldFile!.rename("$savePath.old");
|
||||
}
|
||||
|
||||
if (track is SourcedTrack && track.codec == downloadCodec) {
|
||||
|
@ -175,6 +175,10 @@ class UserPreferencesNotifier extends Notifier<PreferencesTableData> {
|
||||
setData(PreferencesTableCompanion(layoutMode: Value(mode)));
|
||||
}
|
||||
|
||||
void setFileNameFormat(FileNameFormat format) {
|
||||
setData(PreferencesTableCompanion(fileNameFormat: Value(format)));
|
||||
}
|
||||
|
||||
void setCloseBehavior(CloseBehavior behavior) {
|
||||
setData(PreferencesTableCompanion(closeBehavior: Value(behavior)));
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import 'schema_v5.dart' as v5;
|
||||
import 'schema_v1.dart' as v1;
|
||||
import 'schema_v2.dart' as v2;
|
||||
import 'schema_v4.dart' as v4;
|
||||
import 'schema_v6.dart' as v6;
|
||||
|
||||
class GeneratedHelper implements SchemaInstantiationHelper {
|
||||
@override
|
||||
@ -17,6 +18,8 @@ class GeneratedHelper implements SchemaInstantiationHelper {
|
||||
return v3.DatabaseAtV3(db);
|
||||
case 5:
|
||||
return v5.DatabaseAtV5(db);
|
||||
case 6:
|
||||
return v6.DatabaseAtV6(db);
|
||||
case 1:
|
||||
return v1.DatabaseAtV1(db);
|
||||
case 2:
|
||||
@ -28,5 +31,5 @@ class GeneratedHelper implements SchemaInstantiationHelper {
|
||||
}
|
||||
}
|
||||
|
||||
static const versions = const [1, 2, 3, 4, 5];
|
||||
static const versions = const [1, 2, 3, 4, 5, 6];
|
||||
}
|
||||
|
3466
test/drift/app_db/generated/schema_v6.dart
Normal file
3466
test/drift/app_db/generated/schema_v6.dart
Normal file
File diff suppressed because it is too large
Load Diff
@ -1 +1,113 @@
|
||||
{}
|
||||
{
|
||||
"ar": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"bn": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"ca": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"cs": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"de": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"es": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"eu": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"fa": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"fi": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"fr": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"hi": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"id": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"it": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"ja": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"ka": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"ko": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"ne": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"nl": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"pl": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"pt": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"ru": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"ta": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"th": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"tl": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"tr": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"uk": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"vi": [
|
||||
"file_name_format"
|
||||
],
|
||||
|
||||
"zh": [
|
||||
"file_name_format"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user