diff --git a/.github/workflows/spotube-publish-binary.yml b/.github/workflows/spotube-publish-binary.yml index f88e618c..e682dbdd 100644 --- a/.github/workflows/spotube-publish-binary.yml +++ b/.github/workflows/spotube-publish-binary.yml @@ -12,10 +12,10 @@ on: type: boolean default: true jobs: - description: Jobs to run (flathub,aur,winget,chocolatey,playstore) + description: Jobs to run (flathub,aur,winget,chocolatey) required: true type: string - default: "flathub,aur,winget,chocolatey,playstore" + default: "flathub,aur,winget,chocolatey" jobs: flathub: @@ -112,26 +112,26 @@ jobs: - name: Tagname (workflow dispatch) run: echo 'TAG_NAME=${{inputs.version}}' >> $GITHUB_ENV - - uses: robinraju/release-downloader@main - with: - repository: KRTirtho/spotube - tag: v${{ env.TAG_NAME }} - tarBall: false - zipBall: false - out-file-path: dist - fileName: "Spotube-playstore-all-arch.aab" + # - uses: robinraju/release-downloader@main + # with: + # repository: KRTirtho/spotube + # tag: v${{ env.TAG_NAME }} + # tarBall: false + # zipBall: false + # out-file-path: dist + # fileName: "Spotube-playstore-all-arch.aab" - - name: Create service-account.json - run: | - echo "${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_BASE64 }}" | base64 -d > service-account.json + # - name: Create service-account.json + # run: | + # echo "${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_BASE64 }}" | base64 -d > service-account.json - - name: Upload Android Release to Play Store - if: ${{!inputs.dry_run}} - uses: r0adkll/upload-google-play@v1 - with: - serviceAccountJson: ./service-account.json - releaseFiles: ./dist/Spotube-playstore-all-arch.aab - packageName: oss.krtirtho.spotube - track: production - status: draft - releaseName: ${{ env.TAG_NAME }} + # - name: Upload Android Release to Play Store + # if: ${{!inputs.dry_run}} + # uses: r0adkll/upload-google-play@v1 + # with: + # serviceAccountJson: ./service-account.json + # releaseFiles: ./dist/Spotube-playstore-all-arch.aab + # packageName: oss.krtirtho.spotube + # track: production + # status: draft + # releaseName: ${{ env.TAG_NAME }} diff --git a/.github/workflows/spotube-release-binary.yml b/.github/workflows/spotube-release-binary.yml index 4f2cff34..449165e6 100644 --- a/.github/workflows/spotube-release-binary.yml +++ b/.github/workflows/spotube-release-binary.yml @@ -49,7 +49,6 @@ jobs: arch: all files: | build/Spotube-android-all-arch.apk - build/Spotube-playstore-all-arch.aab - os: windows-latest platform: windows arch: x86 @@ -77,6 +76,14 @@ jobs: cache: true git-source: https://github.com/flutter/flutter.git + - name: free disk space + if: ${{ matrix.platform == 'android' }} + run: | + sudo swapoff -a + sudo rm -f /swapfile + sudo apt clean + docker rmi $(docker image ls -aq) + df -h - name: Setup Java if: ${{matrix.platform == 'android'}} uses: actions/setup-java@v4 diff --git a/README.md b/README.md index 4c5c1f1c..153832ea 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,6 @@ If you are curious, you can [read the reason of choosing this license](https://d 1. [Invidious](https://invidious.io/) - Invidious is an open source alternative front-end to YouTube. 1. [yt-dlp](https://github.com/yt-dlp/yt-dlp) - A feature-rich command-line audio/video downloader. 1. [NewPipeExtractor](https://github.com/TeamNewPipe/NewPipeExtractor) - NewPipe's core library for extracting data from streaming sites. -1. [SongLink](https://song.link) - SongLink is a free smart link service that helps you share music with your audience. It's a one-stop-shop for creating smart links for music, podcasts, and other audio content 1. [LRCLib](https://lrclib.net/) - A public synced lyric API. 1. [Linux](https://www.linux.org) - Linux is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged in a Linux distribution 1. [AUR](https://aur.archlinux.org) - AUR stands for Arch User Repository. It is a community-driven repository for Arch-based Linux distributions users diff --git a/android/.gitignore b/android/.gitignore index 6f568019..2391a77e 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -11,3 +11,4 @@ GeneratedPluginRegistrant.java key.properties **/*.keystore **/*.jks +.kotlin \ No newline at end of file diff --git a/assets/images/logos/songlink-transparent.png b/assets/images/logos/songlink-transparent.png deleted file mode 100644 index fc4ae541..00000000 Binary files a/assets/images/logos/songlink-transparent.png and /dev/null differ diff --git a/assets/plugins/spotube-plugin-musicbrainz-listenbrainz/plugin.smplug b/assets/plugins/spotube-plugin-musicbrainz-listenbrainz/plugin.smplug new file mode 100644 index 00000000..41be05a4 Binary files /dev/null and b/assets/plugins/spotube-plugin-musicbrainz-listenbrainz/plugin.smplug differ diff --git a/assets/plugins/spotube-plugin-youtube-audio/plugin.smplug b/assets/plugins/spotube-plugin-youtube-audio/plugin.smplug new file mode 100644 index 00000000..4b93b31b Binary files /dev/null and b/assets/plugins/spotube-plugin-youtube-audio/plugin.smplug differ diff --git a/cli/commands/build/android.dart b/cli/commands/build/android.dart index 4216553a..b9edeb84 100644 --- a/cli/commands/build/android.dart +++ b/cli/commands/build/android.dart @@ -2,9 +2,7 @@ import 'dart:async'; import 'dart:io'; import 'package:args/command_runner.dart'; -import 'package:collection/collection.dart'; import 'package:path/path.dart'; -import 'package:xml/xml.dart'; import '../../core/env.dart'; import 'common.dart'; @@ -24,39 +22,6 @@ class AndroidBuildCommand extends Command with BuildCommandCommonSteps { "flutter build apk --flavor ${CliEnv.channel.name}", ); - await dotEnvFile.writeAsString( - "\nENABLE_UPDATE_CHECK=0" - "\nHIDE_DONATIONS=1", - mode: FileMode.append, - ); - - final androidManifestFile = File( - join(cwd.path, "android", "app", "src", "main", "AndroidManifest.xml")); - - final androidManifestXml = - XmlDocument.parse(await androidManifestFile.readAsString()); - - final deletingElement = - androidManifestXml.findAllElements("meta-data").firstWhereOrNull( - (el) => - el.getAttribute("android:name") == - "com.google.android.gms.car.application", - ); - - deletingElement?.parent?.children.remove(deletingElement); - - await androidManifestFile.writeAsString( - androidManifestXml.toXmlString(pretty: true), - ); - - await shell.run( - """ - dart run build_runner clean - dart run build_runner build --delete-conflicting-outputs - flutter build appbundle --flavor ${CliEnv.channel.name} - """, - ); - final ogApkFile = File( join( "build", @@ -71,22 +36,6 @@ class AndroidBuildCommand extends Command with BuildCommandCommonSteps { join(cwd.path, "build", "Spotube-android-all-arch.apk"), ); - final ogAppbundleFile = File( - join( - cwd.path, - "build", - "app", - "outputs", - "bundle", - "${CliEnv.channel.name}Release", - "app-${CliEnv.channel.name}-release.aab", - ), - ); - - await ogAppbundleFile.copy( - join(cwd.path, "build", "Spotube-playstore-all-arch.aab"), - ); - stdout.writeln("✅ Built Android Apk and Appbundle"); } } diff --git a/drift_schemas/app_db/drift_schema_v10.json b/drift_schemas/app_db/drift_schema_v10.json new file mode 100644 index 00000000..5fb86d25 --- /dev/null +++ b/drift_schemas/app_db/drift_schema_v10.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"authentication_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"cookie","getter_name":"cookie","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"EncryptedTextConverter()","dart_type_name":"DecryptedText"}},{"name":"access_token","getter_name":"accessToken","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"EncryptedTextConverter()","dart_type_name":"DecryptedText"}},{"name":"expiration","getter_name":"expiration","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"blacklist_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"element_type","getter_name":"elementType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(BlacklistedType.values)","dart_type_name":"BlacklistedType"}},{"name":"element_id","getter_name":"elementId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[],"type":"table","data":{"name":"preferences_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"album_color_sync","getter_name":"albumColorSync","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"album_color_sync\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"album_color_sync\" IN (0, 1))"},"default_dart":"const Constant(true)","default_client_dart":null,"dsl_features":[]},{"name":"amoled_dark_theme","getter_name":"amoledDarkTheme","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"amoled_dark_theme\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"amoled_dark_theme\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"check_update","getter_name":"checkUpdate","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"check_update\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"check_update\" IN (0, 1))"},"default_dart":"const Constant(true)","default_client_dart":null,"dsl_features":[]},{"name":"normalize_audio","getter_name":"normalizeAudio","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"normalize_audio\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"normalize_audio\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"show_system_tray_icon","getter_name":"showSystemTrayIcon","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"show_system_tray_icon\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"show_system_tray_icon\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"system_title_bar","getter_name":"systemTitleBar","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"system_title_bar\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"system_title_bar\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"skip_non_music","getter_name":"skipNonMusic","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"skip_non_music\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"skip_non_music\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"close_behavior","getter_name":"closeBehavior","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(CloseBehavior.close.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(CloseBehavior.values)","dart_type_name":"CloseBehavior"}},{"name":"accent_color_scheme","getter_name":"accentColorScheme","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"Slate:0xff64748b\")","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const SpotubeColorConverter()","dart_type_name":"SpotubeColor"}},{"name":"layout_mode","getter_name":"layoutMode","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(LayoutMode.adaptive.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(LayoutMode.values)","dart_type_name":"LayoutMode"}},{"name":"locale","getter_name":"locale","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant('{\"languageCode\":\"system\",\"countryCode\":\"system\"}')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const LocaleConverter()","dart_type_name":"Locale"}},{"name":"market","getter_name":"market","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(Market.US.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(Market.values)","dart_type_name":"Market"}},{"name":"search_mode","getter_name":"searchMode","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(SearchMode.youtube.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SearchMode.values)","dart_type_name":"SearchMode"}},{"name":"download_location","getter_name":"downloadLocation","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"\")","default_client_dart":null,"dsl_features":[]},{"name":"local_library_location","getter_name":"localLibraryLocation","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"\")","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"theme_mode","getter_name":"themeMode","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(ThemeMode.system.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ThemeMode.values)","dart_type_name":"ThemeMode"}},{"name":"audio_source_id","getter_name":"audioSourceId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"youtube_client_engine","getter_name":"youtubeClientEngine","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(YoutubeClientEngine.youtubeExplode.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(YoutubeClientEngine.values)","dart_type_name":"YoutubeClientEngine"}},{"name":"discord_presence","getter_name":"discordPresence","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"discord_presence\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"discord_presence\" IN (0, 1))"},"default_dart":"const Constant(true)","default_client_dart":null,"dsl_features":[]},{"name":"endless_playback","getter_name":"endlessPlayback","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"endless_playback\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"endless_playback\" IN (0, 1))"},"default_dart":"const Constant(true)","default_client_dart":null,"dsl_features":[]},{"name":"enable_connect","getter_name":"enableConnect","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"enable_connect\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"enable_connect\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"connect_port","getter_name":"connectPort","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":"const Constant(-1)","default_client_dart":null,"dsl_features":[]},{"name":"cache_music","getter_name":"cacheMusic","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"cache_music\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"cache_music\" IN (0, 1))"},"default_dart":"const Constant(true)","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"scrobbler_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"currentDateAndTime","default_client_dart":null,"dsl_features":[]},{"name":"username","getter_name":"username","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"password_hash","getter_name":"passwordHash","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"EncryptedTextConverter()","dart_type_name":"DecryptedText"}}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[],"type":"table","data":{"name":"skip_segment_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"start","getter_name":"start","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"end","getter_name":"end","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"track_id","getter_name":"trackId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"currentDateAndTime","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"source_match_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"track_id","getter_name":"trackId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"source_info","getter_name":"sourceInfo","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"{}\")","default_client_dart":null,"dsl_features":[]},{"name":"source_type","getter_name":"sourceType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"currentDateAndTime","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[],"type":"table","data":{"name":"audio_player_state_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"playing","getter_name":"playing","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"playing\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"playing\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"loop_mode","getter_name":"loopMode","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(PlaylistMode.values)","dart_type_name":"PlaylistMode"}},{"name":"shuffled","getter_name":"shuffled","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"shuffled\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"shuffled\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"collections","getter_name":"collections","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"tracks","getter_name":"tracks","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"[]\")","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const SpotubeTrackObjectListConverter()","dart_type_name":"List"}},{"name":"current_index","getter_name":"currentIndex","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":"const Constant(0)","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":7,"references":[],"type":"table","data":{"name":"history_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"currentDateAndTime","default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(HistoryEntryType.values)","dart_type_name":"HistoryEntryType"}},{"name":"item_id","getter_name":"itemId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"data","getter_name":"data","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const MapTypeConverter()","dart_type_name":"Map"}}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":8,"references":[],"type":"table","data":{"name":"lyrics_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"track_id","getter_name":"trackId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"data","getter_name":"data","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"SubtitleTypeConverter()","dart_type_name":"SubtitleSimple"}}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":9,"references":[],"type":"table","data":{"name":"plugins_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":50}}]},{"name":"description","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"version","getter_name":"version","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"author","getter_name":"author","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"entry_point","getter_name":"entryPoint","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"apis","getter_name":"apis","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"abilities","getter_name":"abilities","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"selected_for_metadata","getter_name":"selectedForMetadata","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"selected_for_metadata\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"selected_for_metadata\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"selected_for_audio_source","getter_name":"selectedForAudioSource","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"selected_for_audio_source\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"selected_for_audio_source\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"repository","getter_name":"repository","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"plugin_api_version","getter_name":"pluginApiVersion","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant('2.0.0')","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":10,"references":[1],"type":"index","data":{"on":1,"name":"unique_blacklist","sql":null,"unique":true,"columns":["element_type","element_id"]}},{"id":11,"references":[5],"type":"index","data":{"on":5,"name":"uniq_track_match","sql":null,"unique":true,"columns":["track_id","source_info","source_type"]}}]} \ No newline at end of file diff --git a/drift_schemas/app_db/drift_schema_v9.json b/drift_schemas/app_db/drift_schema_v9.json new file mode 100644 index 00000000..73af2588 --- /dev/null +++ b/drift_schemas/app_db/drift_schema_v9.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"authentication_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"cookie","getter_name":"cookie","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"EncryptedTextConverter()","dart_type_name":"DecryptedText"}},{"name":"access_token","getter_name":"accessToken","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"EncryptedTextConverter()","dart_type_name":"DecryptedText"}},{"name":"expiration","getter_name":"expiration","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":1,"references":[],"type":"table","data":{"name":"blacklist_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"element_type","getter_name":"elementType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(BlacklistedType.values)","dart_type_name":"BlacklistedType"}},{"name":"element_id","getter_name":"elementId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":2,"references":[],"type":"table","data":{"name":"preferences_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"audio_quality","getter_name":"audioQuality","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(SourceQualities.high.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SourceQualities.values)","dart_type_name":"SourceQualities"}},{"name":"album_color_sync","getter_name":"albumColorSync","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"album_color_sync\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"album_color_sync\" IN (0, 1))"},"default_dart":"const Constant(true)","default_client_dart":null,"dsl_features":[]},{"name":"amoled_dark_theme","getter_name":"amoledDarkTheme","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"amoled_dark_theme\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"amoled_dark_theme\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"check_update","getter_name":"checkUpdate","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"check_update\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"check_update\" IN (0, 1))"},"default_dart":"const Constant(true)","default_client_dart":null,"dsl_features":[]},{"name":"normalize_audio","getter_name":"normalizeAudio","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"normalize_audio\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"normalize_audio\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"show_system_tray_icon","getter_name":"showSystemTrayIcon","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"show_system_tray_icon\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"show_system_tray_icon\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"system_title_bar","getter_name":"systemTitleBar","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"system_title_bar\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"system_title_bar\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"skip_non_music","getter_name":"skipNonMusic","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"skip_non_music\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"skip_non_music\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"close_behavior","getter_name":"closeBehavior","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(CloseBehavior.close.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(CloseBehavior.values)","dart_type_name":"CloseBehavior"}},{"name":"accent_color_scheme","getter_name":"accentColorScheme","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"Slate:0xff64748b\")","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const SpotubeColorConverter()","dart_type_name":"SpotubeColor"}},{"name":"layout_mode","getter_name":"layoutMode","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(LayoutMode.adaptive.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(LayoutMode.values)","dart_type_name":"LayoutMode"}},{"name":"locale","getter_name":"locale","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant('{\"languageCode\":\"system\",\"countryCode\":\"system\"}')","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const LocaleConverter()","dart_type_name":"Locale"}},{"name":"market","getter_name":"market","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(Market.US.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(Market.values)","dart_type_name":"Market"}},{"name":"search_mode","getter_name":"searchMode","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(SearchMode.youtube.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SearchMode.values)","dart_type_name":"SearchMode"}},{"name":"download_location","getter_name":"downloadLocation","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"\")","default_client_dart":null,"dsl_features":[]},{"name":"local_library_location","getter_name":"localLibraryLocation","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"\")","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"piped_instance","getter_name":"pipedInstance","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"https://pipedapi.kavin.rocks\")","default_client_dart":null,"dsl_features":[]},{"name":"invidious_instance","getter_name":"invidiousInstance","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"https://inv.nadeko.net\")","default_client_dart":null,"dsl_features":[]},{"name":"theme_mode","getter_name":"themeMode","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(ThemeMode.system.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(ThemeMode.values)","dart_type_name":"ThemeMode"}},{"name":"audio_source","getter_name":"audioSource","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(AudioSource.youtube.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(AudioSource.values)","dart_type_name":"AudioSource"}},{"name":"youtube_client_engine","getter_name":"youtubeClientEngine","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(YoutubeClientEngine.youtubeExplode.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(YoutubeClientEngine.values)","dart_type_name":"YoutubeClientEngine"}},{"name":"stream_music_codec","getter_name":"streamMusicCodec","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(SourceCodecs.weba.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SourceCodecs.values)","dart_type_name":"SourceCodecs"}},{"name":"download_music_codec","getter_name":"downloadMusicCodec","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(SourceCodecs.m4a.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SourceCodecs.values)","dart_type_name":"SourceCodecs"}},{"name":"discord_presence","getter_name":"discordPresence","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"discord_presence\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"discord_presence\" IN (0, 1))"},"default_dart":"const Constant(true)","default_client_dart":null,"dsl_features":[]},{"name":"endless_playback","getter_name":"endlessPlayback","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"endless_playback\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"endless_playback\" IN (0, 1))"},"default_dart":"const Constant(true)","default_client_dart":null,"dsl_features":[]},{"name":"enable_connect","getter_name":"enableConnect","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"enable_connect\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"enable_connect\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"connect_port","getter_name":"connectPort","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":"const Constant(-1)","default_client_dart":null,"dsl_features":[]},{"name":"cache_music","getter_name":"cacheMusic","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"cache_music\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"cache_music\" IN (0, 1))"},"default_dart":"const Constant(true)","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"scrobbler_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"currentDateAndTime","default_client_dart":null,"dsl_features":[]},{"name":"username","getter_name":"username","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"password_hash","getter_name":"passwordHash","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"EncryptedTextConverter()","dart_type_name":"DecryptedText"}}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[],"type":"table","data":{"name":"skip_segment_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"start","getter_name":"start","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"end","getter_name":"end","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"track_id","getter_name":"trackId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"currentDateAndTime","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"source_match_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"track_id","getter_name":"trackId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"source_id","getter_name":"sourceId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"source_type","getter_name":"sourceType","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"Constant(SourceType.youtube.name)","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(SourceType.values)","dart_type_name":"SourceType"}},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"currentDateAndTime","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[],"type":"table","data":{"name":"audio_player_state_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"playing","getter_name":"playing","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"playing\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"playing\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"loop_mode","getter_name":"loopMode","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(PlaylistMode.values)","dart_type_name":"PlaylistMode"}},{"name":"shuffled","getter_name":"shuffled","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"shuffled\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"shuffled\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"collections","getter_name":"collections","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"tracks","getter_name":"tracks","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant(\"[]\")","default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const SpotubeTrackObjectListConverter()","dart_type_name":"List"}},{"name":"current_index","getter_name":"currentIndex","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":"const Constant(0)","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":7,"references":[],"type":"table","data":{"name":"history_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":"currentDateAndTime","default_client_dart":null,"dsl_features":[]},{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(HistoryEntryType.values)","dart_type_name":"HistoryEntryType"}},{"name":"item_id","getter_name":"itemId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"data","getter_name":"data","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const MapTypeConverter()","dart_type_name":"Map"}}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":8,"references":[],"type":"table","data":{"name":"lyrics_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"track_id","getter_name":"trackId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"data","getter_name":"data","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"SubtitleTypeConverter()","dart_type_name":"SubtitleSimple"}}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":9,"references":[],"type":"table","data":{"name":"plugins_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[{"allowed-lengths":{"min":1,"max":50}}]},{"name":"description","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"version","getter_name":"version","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"author","getter_name":"author","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"entry_point","getter_name":"entryPoint","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"apis","getter_name":"apis","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"abilities","getter_name":"abilities","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"selected_for_metadata","getter_name":"selectedForMetadata","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"selected_for_metadata\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"selected_for_metadata\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"selected_for_audio_source","getter_name":"selectedForAudioSource","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"selected_for_audio_source\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"selected_for_audio_source\" IN (0, 1))"},"default_dart":"const Constant(false)","default_client_dart":null,"dsl_features":[]},{"name":"repository","getter_name":"repository","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"plugin_api_version","getter_name":"pluginApiVersion","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":"const Constant('2.0.0')","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":10,"references":[1],"type":"index","data":{"on":1,"name":"unique_blacklist","sql":null,"unique":true,"columns":["element_type","element_id"]}},{"id":11,"references":[5],"type":"index","data":{"on":5,"name":"uniq_track_match","sql":null,"unique":true,"columns":["track_id","source_id","source_type"]}}]} \ No newline at end of file diff --git a/lib/collections/assets.gen.dart b/lib/collections/assets.gen.dart index 7fa75e1d..7ab0ad03 100644 --- a/lib/collections/assets.gen.dart +++ b/lib/collections/assets.gen.dart @@ -66,6 +66,19 @@ class $AssetsImagesGen { ]; } +class $AssetsPluginsGen { + const $AssetsPluginsGen(); + + /// Directory path: assets/plugins/spotube-plugin-musicbrainz-listenbrainz + $AssetsPluginsSpotubePluginMusicbrainzListenbrainzGen + get spotubePluginMusicbrainzListenbrainz => + const $AssetsPluginsSpotubePluginMusicbrainzListenbrainzGen(); + + /// Directory path: assets/plugins/spotube-plugin-youtube-audio + $AssetsPluginsSpotubePluginYoutubeAudioGen get spotubePluginYoutubeAudio => + const $AssetsPluginsSpotubePluginYoutubeAudioGen(); +} + class $AssetsImagesLogosGen { const $AssetsImagesLogosGen(); @@ -81,13 +94,30 @@ class $AssetsImagesLogosGen { AssetGenImage get jiosaavn => const AssetGenImage('assets/images/logos/jiosaavn.png'); - /// File path: assets/images/logos/songlink-transparent.png - AssetGenImage get songlinkTransparent => - const AssetGenImage('assets/images/logos/songlink-transparent.png'); + /// List of all assets + List get values => [dabMusic, invidious, jiosaavn]; +} + +class $AssetsPluginsSpotubePluginMusicbrainzListenbrainzGen { + const $AssetsPluginsSpotubePluginMusicbrainzListenbrainzGen(); + + /// File path: assets/plugins/spotube-plugin-musicbrainz-listenbrainz/plugin.smplug + String get plugin => + 'assets/plugins/spotube-plugin-musicbrainz-listenbrainz/plugin.smplug'; /// List of all assets - List get values => - [dabMusic, invidious, jiosaavn, songlinkTransparent]; + List get values => [plugin]; +} + +class $AssetsPluginsSpotubePluginYoutubeAudioGen { + const $AssetsPluginsSpotubePluginYoutubeAudioGen(); + + /// File path: assets/plugins/spotube-plugin-youtube-audio/plugin.smplug + String get plugin => + 'assets/plugins/spotube-plugin-youtube-audio/plugin.smplug'; + + /// List of all assets + List get values => [plugin]; } class Assets { @@ -96,6 +126,7 @@ class Assets { static const String license = 'LICENSE'; static const $AssetsBrandingGen branding = $AssetsBrandingGen(); static const $AssetsImagesGen images = $AssetsImagesGen(); + static const $AssetsPluginsGen plugins = $AssetsPluginsGen(); /// List of all assets static List get values => [license]; diff --git a/lib/collections/spotube_icons.dart b/lib/collections/spotube_icons.dart index 21cf4176..99d9ff74 100644 --- a/lib/collections/spotube_icons.dart +++ b/lib/collections/spotube_icons.dart @@ -135,7 +135,7 @@ abstract class SpotubeIcons { static const list = FeatherIcons.list; static const device = FeatherIcons.smartphone; static const engine = FeatherIcons.server; - static const extensions = FeatherIcons.package; + static const extensions = Icons.extension_rounded; static const message = FeatherIcons.send; static const upload = FeatherIcons.uploadCloud; static const plugin = Icons.extension_outlined; diff --git a/lib/components/dialogs/track_details_dialog.dart b/lib/components/dialogs/track_details_dialog.dart index 3d3fd7e9..9d35a6fb 100644 --- a/lib/components/dialogs/track_details_dialog.dart +++ b/lib/components/dialogs/track_details_dialog.dart @@ -7,8 +7,7 @@ import 'package:spotube/extensions/constrains.dart'; import 'package:spotube/extensions/context.dart'; import 'package:spotube/extensions/duration.dart'; import 'package:spotube/models/metadata/metadata.dart'; -import 'package:spotube/models/playback/track_sources.dart'; -import 'package:spotube/provider/server/track_sources.dart'; +import 'package:spotube/provider/server/sourced_track_provider.dart'; class TrackDetailsDialog extends HookConsumerWidget { final SpotubeFullTrackObject track; @@ -21,8 +20,7 @@ class TrackDetailsDialog extends HookConsumerWidget { Widget build(BuildContext context, ref) { final theme = Theme.of(context); final mediaQuery = MediaQuery.of(context); - final sourcedTrack = - ref.read(trackSourcesProvider(TrackSourceQuery.fromTrack(track))); + final sourcedTrack = ref.read(sourcedTrackProvider(track)); final detailsMap = { context.l10n.title: track.name, @@ -39,8 +37,7 @@ class TrackDetailsDialog extends HookConsumerWidget { // style: const TextStyle(color: Colors.blue), // ), context.l10n.duration: sourcedTrack.asData != null - ? Duration(milliseconds: sourcedTrack.asData!.value.info.durationMs) - .toHumanReadableString() + ? sourcedTrack.asData!.value.info.duration.toHumanReadableString() : Duration(milliseconds: track.durationMs).toHumanReadableString(), if (track.album.releaseDate != null) context.l10n.released: track.album.releaseDate, @@ -57,7 +54,7 @@ class TrackDetailsDialog extends HookConsumerWidget { maxLines: 2, overflow: TextOverflow.ellipsis, ), - context.l10n.channel: Text(sourceInfo.artists), + context.l10n.channel: Text(sourceInfo.artists.join(", ")), if (sourcedTrack.asData?.value.url != null) context.l10n.streamUrl: Hyperlink( sourcedTrack.asData!.value.url ?? "", diff --git a/lib/components/track_presentation/presentation_actions.dart b/lib/components/track_presentation/presentation_actions.dart index 735a4514..54aa3428 100644 --- a/lib/components/track_presentation/presentation_actions.dart +++ b/lib/components/track_presentation/presentation_actions.dart @@ -8,12 +8,10 @@ import 'package:spotube/components/dialogs/playlist_add_track_dialog.dart'; import 'package:spotube/components/track_presentation/presentation_props.dart'; import 'package:spotube/components/track_presentation/presentation_state.dart'; import 'package:spotube/extensions/context.dart'; -import 'package:spotube/models/database/database.dart'; import 'package:spotube/models/metadata/metadata.dart'; import 'package:spotube/provider/download_manager_provider.dart'; import 'package:spotube/provider/history/history.dart'; import 'package:spotube/provider/audio_player/audio_player.dart'; -import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; ToastOverlay showToastForAction( BuildContext context, @@ -70,8 +68,6 @@ class TrackPresentationActionsSection extends HookConsumerWidget { final downloader = ref.watch(downloadManagerProvider.notifier); final playlistNotifier = ref.watch(audioPlayerProvider.notifier); final historyNotifier = ref.watch(playbackHistoryActionsProvider); - final audioSource = - ref.watch(userPreferencesProvider.select((s) => s.audioSource)); final state = ref.watch(presentationStateProvider(options.collection)); final notifier = @@ -85,14 +81,13 @@ class TrackPresentationActionsSection extends HookConsumerWidget { }) async { final fullTrackObjects = tracks.whereType().toList(); - final confirmed = audioSource == AudioSource.piped || - (await showDialog( - context: context, - builder: (context) { - return const ConfirmDownloadDialog(); - }, - ) ?? - false); + final confirmed = await showDialog( + context: context, + builder: (context) { + return const ConfirmDownloadDialog(); + }, + ) ?? + false; if (confirmed != true) return; downloader.batchAddToQueue(fullTrackObjects); notifier.deselectAllTracks(); diff --git a/lib/components/track_tile/track_options.dart b/lib/components/track_tile/track_options.dart index 6124abf0..61b47968 100644 --- a/lib/components/track_tile/track_options.dart +++ b/lib/components/track_tile/track_options.dart @@ -4,7 +4,6 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:shadcn_flutter/shadcn_flutter.dart'; import 'package:shadcn_flutter/shadcn_flutter_extension.dart'; -import 'package:spotube/collections/assets.gen.dart'; import 'package:spotube/collections/routes.dart'; import 'package:spotube/collections/spotube_icons.dart'; import 'package:spotube/components/ui/button_tile.dart'; @@ -36,7 +35,6 @@ class TrackOptions extends HookConsumerWidget { @override Widget build(BuildContext context, ref) { final mediaQuery = MediaQuery.of(context); - final ThemeData(:colorScheme) = Theme.of(context); final trackOptionActions = ref.watch(trackOptionActionsProvider(track)); final ( @@ -260,24 +258,6 @@ class TrackOptions extends HookConsumerWidget { leading: const Icon(SpotubeIcons.share), title: Text(context.l10n.share), ), - if (!isLocalTrack) - ButtonTile( - style: ButtonVariance.menu, - onPressed: () async { - await trackOptionActions.action( - rootNavigatorKey.currentContext!, - TrackOptionValue.songlink, - playlistId, - ); - onTapItem?.call(); - }, - leading: Assets.images.logos.songlinkTransparent.image( - width: 22, - height: 22, - color: colorScheme.foreground.withValues(alpha: 0.5), - ), - title: Text(context.l10n.song_link), - ), if (!isLocalTrack) ButtonTile( style: ButtonVariance.menu, diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 833fa724..a292105d 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -434,7 +434,10 @@ "update_available": "Update available", "supports_scrobbling": "Supports scrobbling", "plugin_scrobbling_info": "This plugin scrobbles your music to generate your listening history.", - "default_plugin": "Default", + "default_metadata_source": "Default metadata source", + "set_default_metadata_source": "Set default metadata source", + "default_audio_source": "Default audio source", + "set_default_audio_source": "Set default audio source", "set_default": "Set default", "support": "Support", "support_plugin_development": "Support plugin development", @@ -452,14 +455,14 @@ "disclaimer": "Disclaimer", "third_party_plugin_dmca_notice": "The Spotube team does not hold any responsibility (including legal) for any \"Third-party\" plugins.\nPlease use them at your own risk. For any bugs/issues, please report them to the plugin repository.\n\nIf any \"Third-party\" plugin is breaking ToS/DMCA of any service/legal entity, please ask the \"Third-party\" plugin author or the hosting platform .e.g GitHub/Codeberg to take action. Above listed (\"Third-party\" labelled) are all public/community maintained plugins. We're not curating them, so we cannot take any action on them.\n\n", "input_does_not_match_format": "Input doesn't match the required format", - "metadata_provider_plugins": "Metadata Provider Plugins", + "plugins": "Plugins", "paste_plugin_download_url": "Paste download url or GitHub/Codeberg repo url or direct link to .smplug file", "download_and_install_plugin_from_url": "Download and install plugin from url", "failed_to_add_plugin_error": "Failed to add plugin: {error}", "upload_plugin_from_file": "Upload plugin from file", "installed": "Installed", "available_plugins": "Available plugins", - "configure_your_own_metadata_plugin": "Configure your own playlist/album/artist/feed metadata provider", + "configure_plugins": "Configure your own metadata provider and audio source plugins", "audio_scrobblers": "Audio Scrobblers", "scrobbling": "Scrobbling", "source": "Source: ", diff --git a/lib/l10n/generated/app_localizations.dart b/lib/l10n/generated/app_localizations.dart index d3124728..0ffcffff 100644 --- a/lib/l10n/generated/app_localizations.dart +++ b/lib/l10n/generated/app_localizations.dart @@ -2763,11 +2763,29 @@ abstract class AppLocalizations { /// **'This plugin scrobbles your music to generate your listening history.'** String get plugin_scrobbling_info; - /// No description provided for @default_plugin. + /// No description provided for @default_metadata_source. /// /// In en, this message translates to: - /// **'Default'** - String get default_plugin; + /// **'Default metadata source'** + String get default_metadata_source; + + /// No description provided for @set_default_metadata_source. + /// + /// In en, this message translates to: + /// **'Set default metadata source'** + String get set_default_metadata_source; + + /// No description provided for @default_audio_source. + /// + /// In en, this message translates to: + /// **'Default audio source'** + String get default_audio_source; + + /// No description provided for @set_default_audio_source. + /// + /// In en, this message translates to: + /// **'Set default audio source'** + String get set_default_audio_source; /// No description provided for @set_default. /// @@ -2871,11 +2889,11 @@ abstract class AppLocalizations { /// **'Input doesn\'t match the required format'** String get input_does_not_match_format; - /// No description provided for @metadata_provider_plugins. + /// No description provided for @plugins. /// /// In en, this message translates to: - /// **'Metadata Provider Plugins'** - String get metadata_provider_plugins; + /// **'Plugins'** + String get plugins; /// No description provided for @paste_plugin_download_url. /// @@ -2913,11 +2931,11 @@ abstract class AppLocalizations { /// **'Available plugins'** String get available_plugins; - /// No description provided for @configure_your_own_metadata_plugin. + /// No description provided for @configure_plugins. /// /// In en, this message translates to: - /// **'Configure your own playlist/album/artist/feed metadata provider'** - String get configure_your_own_metadata_plugin; + /// **'Configure your own metadata provider and audio source plugins'** + String get configure_plugins; /// No description provided for @audio_scrobblers. /// diff --git a/lib/l10n/generated/app_localizations_ar.dart b/lib/l10n/generated/app_localizations_ar.dart index b974d2e4..05da9c97 100644 --- a/lib/l10n/generated/app_localizations_ar.dart +++ b/lib/l10n/generated/app_localizations_ar.dart @@ -1443,7 +1443,16 @@ class AppLocalizationsAr extends AppLocalizations { 'تقوم هذه الإضافة بتتبع مقاطعك الموسيقية لإنشاء سجل الاستماع الخاص بك.'; @override - String get default_plugin => 'الافتراضي'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'تعيين كافتراضي'; @@ -1504,7 +1513,7 @@ class AppLocalizationsAr extends AppLocalizations { 'المدخل لا يتوافق مع التنسيق المطلوب'; @override - String get metadata_provider_plugins => 'إضافات مزود البيانات'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1529,8 +1538,8 @@ class AppLocalizationsAr extends AppLocalizations { String get available_plugins => 'الإضافات المتوفّرة'; @override - String get configure_your_own_metadata_plugin => - 'تهيئة مزوّد بيانات للقائمة/الألبوم/الفنان/المصدر خاص بك'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'أجهزة تتبع الصوت'; diff --git a/lib/l10n/generated/app_localizations_bn.dart b/lib/l10n/generated/app_localizations_bn.dart index a193c26f..b11a9f2f 100644 --- a/lib/l10n/generated/app_localizations_bn.dart +++ b/lib/l10n/generated/app_localizations_bn.dart @@ -1443,7 +1443,16 @@ class AppLocalizationsBn extends AppLocalizations { 'এই প্লাগইনটি আপনার সঙ্গীত স্ক্রোব্বল করে আপনার শোনা ইতিহাস তৈরি করে।'; @override - String get default_plugin => 'ডিফল্ট'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'ডিফল্ট হিসাবে নির্ধারণ করুন'; @@ -1505,7 +1514,7 @@ class AppLocalizationsBn extends AppLocalizations { 'ইনপুট প্রয়োজনীয় ফরম্যাটের সাথে মেলে না'; @override - String get metadata_provider_plugins => 'মেটাডেটা প্রদানকারী প্লাগইনসমূহ'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1530,8 +1539,8 @@ class AppLocalizationsBn extends AppLocalizations { String get available_plugins => 'উপলব্ধ প্লাগইনগুলো'; @override - String get configure_your_own_metadata_plugin => - 'নিজস্ব প্লেলিস্ট/অ্যালবাম/শিল্পী/ফিড মেটাডেটা প্রদানকারী কনফিগার করুন'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'অডিও স্ক্রোব্বলার্স'; diff --git a/lib/l10n/generated/app_localizations_ca.dart b/lib/l10n/generated/app_localizations_ca.dart index 694aa2c7..a18d8c38 100644 --- a/lib/l10n/generated/app_localizations_ca.dart +++ b/lib/l10n/generated/app_localizations_ca.dart @@ -1450,7 +1450,16 @@ class AppLocalizationsCa extends AppLocalizations { 'Aquest complement fa scrobbling de la teva música per generar l’historial d’escoltes.'; @override - String get default_plugin => 'Predeterminat'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Establir com a predeterminat'; @@ -1514,8 +1523,7 @@ class AppLocalizationsCa extends AppLocalizations { 'L’entrada no coincideix amb el format requerit'; @override - String get metadata_provider_plugins => - 'Complements de proveïdor de metadades'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1540,8 +1548,8 @@ class AppLocalizationsCa extends AppLocalizations { String get available_plugins => 'Complements disponibles'; @override - String get configure_your_own_metadata_plugin => - 'Configura el teu propi proveïdor de metadades per llistes/reproduccions àlbum/artista/flux'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Scrobblers d’àudio'; diff --git a/lib/l10n/generated/app_localizations_cs.dart b/lib/l10n/generated/app_localizations_cs.dart index 8ef0e6a9..ce5785d4 100644 --- a/lib/l10n/generated/app_localizations_cs.dart +++ b/lib/l10n/generated/app_localizations_cs.dart @@ -1442,7 +1442,16 @@ class AppLocalizationsCs extends AppLocalizations { 'Tento plugin scrobbles vaši hudbu pro vytvoření historie poslechů.'; @override - String get default_plugin => 'Výchozí'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Nastavit jako výchozí'; @@ -1505,7 +1514,7 @@ class AppLocalizationsCs extends AppLocalizations { 'Vstup neodpovídá požadovanému formátu'; @override - String get metadata_provider_plugins => 'Pluginy poskytovatelů metadat'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1530,8 +1539,8 @@ class AppLocalizationsCs extends AppLocalizations { String get available_plugins => 'Dostupné pluginy'; @override - String get configure_your_own_metadata_plugin => - 'Nakonfigurujte si vlastního poskytovatele metadat pro playlist/album/umělec/fid'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Audio scrobblers'; diff --git a/lib/l10n/generated/app_localizations_de.dart b/lib/l10n/generated/app_localizations_de.dart index 870dd76d..81a67861 100644 --- a/lib/l10n/generated/app_localizations_de.dart +++ b/lib/l10n/generated/app_localizations_de.dart @@ -1455,7 +1455,16 @@ class AppLocalizationsDe extends AppLocalizations { 'Dieses Plugin scrobbelt Ihre Musik, um Ihre Hörhistorie zu erstellen.'; @override - String get default_plugin => 'Standard'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Als Standard festlegen'; @@ -1517,7 +1526,7 @@ class AppLocalizationsDe extends AppLocalizations { 'Eingabe entspricht nicht dem geforderten Format'; @override - String get metadata_provider_plugins => 'Plugins für Metadatenanbieter'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1542,8 +1551,8 @@ class AppLocalizationsDe extends AppLocalizations { String get available_plugins => 'Verfügbare Plugins'; @override - String get configure_your_own_metadata_plugin => - 'Eigenen Anbieter für Playlist-/Album-/Künstler-/Feed-Metadaten konfigurieren'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Audio-Scrobbler'; diff --git a/lib/l10n/generated/app_localizations_en.dart b/lib/l10n/generated/app_localizations_en.dart index 23d379c7..513daa77 100644 --- a/lib/l10n/generated/app_localizations_en.dart +++ b/lib/l10n/generated/app_localizations_en.dart @@ -1442,7 +1442,16 @@ class AppLocalizationsEn extends AppLocalizations { 'This plugin scrobbles your music to generate your listening history.'; @override - String get default_plugin => 'Default'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Set default'; @@ -1503,7 +1512,7 @@ class AppLocalizationsEn extends AppLocalizations { 'Input doesn\'t match the required format'; @override - String get metadata_provider_plugins => 'Metadata Provider Plugins'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1528,8 +1537,8 @@ class AppLocalizationsEn extends AppLocalizations { String get available_plugins => 'Available plugins'; @override - String get configure_your_own_metadata_plugin => - 'Configure your own playlist/album/artist/feed metadata provider'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Audio Scrobblers'; diff --git a/lib/l10n/generated/app_localizations_es.dart b/lib/l10n/generated/app_localizations_es.dart index f06c9399..08426481 100644 --- a/lib/l10n/generated/app_localizations_es.dart +++ b/lib/l10n/generated/app_localizations_es.dart @@ -1452,7 +1452,16 @@ class AppLocalizationsEs extends AppLocalizations { 'Este complemento scrobblea tu música para generar tu historial de reproducción.'; @override - String get default_plugin => 'Predeterminado'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Establecer como predeterminado'; @@ -1517,8 +1526,7 @@ class AppLocalizationsEs extends AppLocalizations { 'La entrada no coincide con el formato requerido'; @override - String get metadata_provider_plugins => - 'Complementos de proveedor de metadatos'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1543,8 +1551,8 @@ class AppLocalizationsEs extends AppLocalizations { String get available_plugins => 'Complementos disponibles'; @override - String get configure_your_own_metadata_plugin => - 'Configura tu propio proveedor de metadatos para listas/álbum/artista/feeds'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Scrobblers de audio'; diff --git a/lib/l10n/generated/app_localizations_eu.dart b/lib/l10n/generated/app_localizations_eu.dart index 296c50ed..14b8e01f 100644 --- a/lib/l10n/generated/app_localizations_eu.dart +++ b/lib/l10n/generated/app_localizations_eu.dart @@ -1451,7 +1451,16 @@ class AppLocalizationsEu extends AppLocalizations { 'Plugin honek zure musika scrobbled egiten du zure entzuteen historia sortzeko.'; @override - String get default_plugin => 'Lehenetsia'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Lehenetsi gisa ezarri'; @@ -1515,7 +1524,7 @@ class AppLocalizationsEu extends AppLocalizations { 'Sarrera ezin da beharrezko formatutik desberdina izan'; @override - String get metadata_provider_plugins => 'Metadaten hornitzailearen pluginak'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1540,8 +1549,8 @@ class AppLocalizationsEu extends AppLocalizations { String get available_plugins => 'Eskaintzen diren pluginak'; @override - String get configure_your_own_metadata_plugin => - 'Konfiguratu zureko playlists-/album-/artista-/feed-metadaten hornitzailea'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Audio scrobbler-ak'; diff --git a/lib/l10n/generated/app_localizations_fa.dart b/lib/l10n/generated/app_localizations_fa.dart index a1203c57..d0f73246 100644 --- a/lib/l10n/generated/app_localizations_fa.dart +++ b/lib/l10n/generated/app_localizations_fa.dart @@ -1441,7 +1441,16 @@ class AppLocalizationsFa extends AppLocalizations { 'این افزونه موسیقی شما را اسکراب می‌کند تا تاریخچهٔ شنیداری‌تان را تولید کند.'; @override - String get default_plugin => 'پیش‌فرض'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'تنظیم به عنوان پیش‌فرض'; @@ -1503,7 +1512,7 @@ class AppLocalizationsFa extends AppLocalizations { 'ورودی با قالب مورد نیاز تطابق ندارد'; @override - String get metadata_provider_plugins => 'افزونه‌های ارائه‌دهندهٔ متادیتا'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1528,8 +1537,8 @@ class AppLocalizationsFa extends AppLocalizations { String get available_plugins => 'افزونه‌های موجود'; @override - String get configure_your_own_metadata_plugin => - 'پیکربندی ارائه‌دهندهٔ متادیتا برای پلی‌لیست/آلبوم/هنرمند/فید به‌صورت سفارشی'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'اسکراب‌بلرهای صوتی'; diff --git a/lib/l10n/generated/app_localizations_fi.dart b/lib/l10n/generated/app_localizations_fi.dart index b9ee4de6..751eb0c1 100644 --- a/lib/l10n/generated/app_localizations_fi.dart +++ b/lib/l10n/generated/app_localizations_fi.dart @@ -1443,7 +1443,16 @@ class AppLocalizationsFi extends AppLocalizations { 'Tämä lisäosa scrobblaa musiikkisi luodakseen kuunteluhistoriasi.'; @override - String get default_plugin => 'Oletus'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Aseta oletukseksi'; @@ -1503,7 +1512,7 @@ class AppLocalizationsFi extends AppLocalizations { String get input_does_not_match_format => 'Syöte ei vastaa vaadittua muotoa'; @override - String get metadata_provider_plugins => 'Metatietojen tarjoajan lisäosat'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1528,8 +1537,8 @@ class AppLocalizationsFi extends AppLocalizations { String get available_plugins => 'Saatavilla olevat lisäosat'; @override - String get configure_your_own_metadata_plugin => - 'Määritä oma soittolistan/albumin/artistin/syötteen metatietojen tarjoaja'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Äänen scrobblerit'; diff --git a/lib/l10n/generated/app_localizations_fr.dart b/lib/l10n/generated/app_localizations_fr.dart index daee5667..068701cc 100644 --- a/lib/l10n/generated/app_localizations_fr.dart +++ b/lib/l10n/generated/app_localizations_fr.dart @@ -1457,7 +1457,16 @@ class AppLocalizationsFr extends AppLocalizations { 'Ce plugin scrobble votre musique pour générer votre historique d\'écoute.'; @override - String get default_plugin => 'Par défaut'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Définir par défaut'; @@ -1521,8 +1530,7 @@ class AppLocalizationsFr extends AppLocalizations { 'L\'entrée ne correspond pas au format requis'; @override - String get metadata_provider_plugins => - 'Plugins de fournisseur de métadonnées'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1548,8 +1556,8 @@ class AppLocalizationsFr extends AppLocalizations { String get available_plugins => 'Plugins disponibles'; @override - String get configure_your_own_metadata_plugin => - 'Configurer votre propre fournisseur de métadonnées de playlist/album/artiste/flux'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Scrobblers audio'; diff --git a/lib/l10n/generated/app_localizations_hi.dart b/lib/l10n/generated/app_localizations_hi.dart index 65279d70..3c16bdfc 100644 --- a/lib/l10n/generated/app_localizations_hi.dart +++ b/lib/l10n/generated/app_localizations_hi.dart @@ -1448,7 +1448,16 @@ class AppLocalizationsHi extends AppLocalizations { 'यह प्लगइन आपके सुनने के इतिहास को उत्पन्न करने के लिए आपके संगीत को स्क्रॉबल करता है।'; @override - String get default_plugin => 'डिफ़ॉल्ट'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'डिफ़ॉल्ट सेट करें'; @@ -1509,7 +1518,7 @@ class AppLocalizationsHi extends AppLocalizations { 'इनपुट आवश्यक प्रारूप से मेल नहीं खाता है'; @override - String get metadata_provider_plugins => 'मेटाडेटा प्रदाता प्लगइन'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1534,8 +1543,8 @@ class AppLocalizationsHi extends AppLocalizations { String get available_plugins => 'उपलब्ध प्लगइन'; @override - String get configure_your_own_metadata_plugin => - 'अपनी खुद की प्लेलिस्ट/एल्बम/कलाकार/फ़ीड मेटाडेटा प्रदाता कॉन्फ़िगर करें'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'ऑडियो स्क्रॉबलर्स'; diff --git a/lib/l10n/generated/app_localizations_id.dart b/lib/l10n/generated/app_localizations_id.dart index 1e0b9f9f..f1231523 100644 --- a/lib/l10n/generated/app_localizations_id.dart +++ b/lib/l10n/generated/app_localizations_id.dart @@ -1449,7 +1449,16 @@ class AppLocalizationsId extends AppLocalizations { 'Plugin ini scrobble musik Anda untuk menghasilkan riwayat mendengarkan Anda.'; @override - String get default_plugin => 'Bawaan'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Atur sebagai bawaan'; @@ -1511,7 +1520,7 @@ class AppLocalizationsId extends AppLocalizations { 'Masukan tidak cocok dengan format yang diperlukan'; @override - String get metadata_provider_plugins => 'Plugin Penyedia Metadata'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1536,8 +1545,8 @@ class AppLocalizationsId extends AppLocalizations { String get available_plugins => 'Plugin yang tersedia'; @override - String get configure_your_own_metadata_plugin => - 'Konfigurasi penyedia metadata playlist/album/artis/feed Anda sendiri'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Scrobblers Audio'; diff --git a/lib/l10n/generated/app_localizations_it.dart b/lib/l10n/generated/app_localizations_it.dart index f92eae63..c781bd31 100644 --- a/lib/l10n/generated/app_localizations_it.dart +++ b/lib/l10n/generated/app_localizations_it.dart @@ -1448,7 +1448,16 @@ class AppLocalizationsIt extends AppLocalizations { 'Questo plugin scrobbla la tua musica per generare la tua cronologia di ascolti.'; @override - String get default_plugin => 'Predefinito'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Imposta come predefinito'; @@ -1510,7 +1519,7 @@ class AppLocalizationsIt extends AppLocalizations { 'L\'input non corrisponde al formato richiesto'; @override - String get metadata_provider_plugins => 'Plugin del provider di metadati'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1535,8 +1544,8 @@ class AppLocalizationsIt extends AppLocalizations { String get available_plugins => 'Plugin disponibili'; @override - String get configure_your_own_metadata_plugin => - 'Configura il tuo provider di metadati per playlist/album/artista/feed'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Scrobbler audio'; diff --git a/lib/l10n/generated/app_localizations_ja.dart b/lib/l10n/generated/app_localizations_ja.dart index 0e3d98ab..525e6c66 100644 --- a/lib/l10n/generated/app_localizations_ja.dart +++ b/lib/l10n/generated/app_localizations_ja.dart @@ -1416,7 +1416,16 @@ class AppLocalizationsJa extends AppLocalizations { String get plugin_scrobbling_info => 'このプラグインは、あなたの音楽をscrobbleして視聴履歴を生成します。'; @override - String get default_plugin => 'デフォルト'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'デフォルトに設定'; @@ -1474,7 +1483,7 @@ class AppLocalizationsJa extends AppLocalizations { String get input_does_not_match_format => '入力が必須フォーマットと一致しません'; @override - String get metadata_provider_plugins => 'メタデータプロバイダープラグイン'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1499,8 +1508,8 @@ class AppLocalizationsJa extends AppLocalizations { String get available_plugins => '利用可能なプラグイン'; @override - String get configure_your_own_metadata_plugin => - '独自のプレイリスト/アルバム/アーティスト/フィードのメタデータプロバイダーを構成'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'オーディオスクロッブラー'; diff --git a/lib/l10n/generated/app_localizations_ka.dart b/lib/l10n/generated/app_localizations_ka.dart index 22d3246f..3d960d7e 100644 --- a/lib/l10n/generated/app_localizations_ka.dart +++ b/lib/l10n/generated/app_localizations_ka.dart @@ -1448,7 +1448,16 @@ class AppLocalizationsKa extends AppLocalizations { 'ეს პლაგინი აწარმოებს თქვენი მუსიკის სქრობლინგს, რათა შექმნას თქვენი მოსმენის ისტორია.'; @override - String get default_plugin => 'ნაგულისხმევი'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'ნაგულისხმევად დაყენება'; @@ -1511,8 +1520,7 @@ class AppLocalizationsKa extends AppLocalizations { 'შეყვანა არ ემთხვევა საჭირო ფორმატს'; @override - String get metadata_provider_plugins => - 'მეტამონაცემების პროვაიდერების პლაგინები'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1537,8 +1545,8 @@ class AppLocalizationsKa extends AppLocalizations { String get available_plugins => 'ხელმისაწვდომი პლაგინები'; @override - String get configure_your_own_metadata_plugin => - 'დააყენეთ თქვენი საკუთარი პლეილისტის/ალბომის/არტისტის/ფიდის მეტამონაცემების პროვაიდერი'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'აუდიო სქრობლერები'; diff --git a/lib/l10n/generated/app_localizations_ko.dart b/lib/l10n/generated/app_localizations_ko.dart index 19b7e544..12a3a5e3 100644 --- a/lib/l10n/generated/app_localizations_ko.dart +++ b/lib/l10n/generated/app_localizations_ko.dart @@ -1421,7 +1421,16 @@ class AppLocalizationsKo extends AppLocalizations { String get plugin_scrobbling_info => '이 플러그인은 음악을 스크로블하여 청취 기록을 생성합니다.'; @override - String get default_plugin => '기본'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => '기본값으로 설정'; @@ -1479,7 +1488,7 @@ class AppLocalizationsKo extends AppLocalizations { String get input_does_not_match_format => '입력이 필요한 형식과 일치하지 않습니다'; @override - String get metadata_provider_plugins => '메타데이터 제공자 플러그인'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1503,8 +1512,8 @@ class AppLocalizationsKo extends AppLocalizations { String get available_plugins => '사용 가능한 플러그인'; @override - String get configure_your_own_metadata_plugin => - '자신만의 플레이리스트/앨범/아티스트/피드 메타데이터 제공자 구성'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => '오디오 스크로블러'; diff --git a/lib/l10n/generated/app_localizations_ne.dart b/lib/l10n/generated/app_localizations_ne.dart index 53bcb184..64b3311e 100644 --- a/lib/l10n/generated/app_localizations_ne.dart +++ b/lib/l10n/generated/app_localizations_ne.dart @@ -1454,7 +1454,16 @@ class AppLocalizationsNe extends AppLocalizations { 'यो प्लगइनले तपाईंको सुन्ने इतिहास उत्पन्न गर्न तपाईंको संगीतलाई स्क्रब्बल गर्दछ।'; @override - String get default_plugin => 'पूर्वनिर्धारित'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'पूर्वनिर्धारित सेट गर्नुहोस्'; @@ -1515,7 +1524,7 @@ class AppLocalizationsNe extends AppLocalizations { String get input_does_not_match_format => 'इनपुट आवश्यक ढाँचासँग मेल खाँदैन'; @override - String get metadata_provider_plugins => 'मेटाडेटा प्रदायक प्लगइनहरू'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1540,8 +1549,8 @@ class AppLocalizationsNe extends AppLocalizations { String get available_plugins => 'उपलब्ध प्लगइनहरू'; @override - String get configure_your_own_metadata_plugin => - 'तपाईंको आफ्नै प्लेलिस्ट/एल्बम/कलाकार/फिड मेटाडेटा प्रदायक कन्फिगर गर्नुहोस्'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'अडियो स्क्रब्बलरहरू'; diff --git a/lib/l10n/generated/app_localizations_nl.dart b/lib/l10n/generated/app_localizations_nl.dart index dd73f907..78d34a27 100644 --- a/lib/l10n/generated/app_localizations_nl.dart +++ b/lib/l10n/generated/app_localizations_nl.dart @@ -1446,7 +1446,16 @@ class AppLocalizationsNl extends AppLocalizations { 'Deze plugin scrobblet uw muziek om uw luistergeschiedenis te genereren.'; @override - String get default_plugin => 'Standaard'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Instellen als standaard'; @@ -1509,7 +1518,7 @@ class AppLocalizationsNl extends AppLocalizations { 'Invoer komt niet overeen met het vereiste formaat'; @override - String get metadata_provider_plugins => 'Metadata-aanbieder Plugins'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1534,8 +1543,8 @@ class AppLocalizationsNl extends AppLocalizations { String get available_plugins => 'Beschikbare plugins'; @override - String get configure_your_own_metadata_plugin => - 'Configureer uw eigen metadata-aanbieder voor afspeellijst/album/artiest/feed'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Audioscrobblers'; diff --git a/lib/l10n/generated/app_localizations_pl.dart b/lib/l10n/generated/app_localizations_pl.dart index 095242bc..afe29fca 100644 --- a/lib/l10n/generated/app_localizations_pl.dart +++ b/lib/l10n/generated/app_localizations_pl.dart @@ -1449,7 +1449,16 @@ class AppLocalizationsPl extends AppLocalizations { 'Ta wtyczka scrobbluje Twoją muzykę, aby wygenerować historię odsłuchań.'; @override - String get default_plugin => 'Domyślna'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Ustaw jako domyślną'; @@ -1511,7 +1520,7 @@ class AppLocalizationsPl extends AppLocalizations { 'Wprowadzony tekst nie pasuje do wymaganego formatu'; @override - String get metadata_provider_plugins => 'Wtyczki dostawców metadanych'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1536,8 +1545,8 @@ class AppLocalizationsPl extends AppLocalizations { String get available_plugins => 'Dostępne wtyczki'; @override - String get configure_your_own_metadata_plugin => - 'Skonfiguruj własnego dostawcę metadanych dla playlisty/albumu/artysty/kanału'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Scrobblery audio'; diff --git a/lib/l10n/generated/app_localizations_pt.dart b/lib/l10n/generated/app_localizations_pt.dart index 4b1fd2bc..74ead955 100644 --- a/lib/l10n/generated/app_localizations_pt.dart +++ b/lib/l10n/generated/app_localizations_pt.dart @@ -1446,7 +1446,16 @@ class AppLocalizationsPt extends AppLocalizations { 'Este plugin faz o scrobbling de sua música para gerar seu histórico de audição.'; @override - String get default_plugin => 'Padrão'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Definir como padrão'; @@ -1508,7 +1517,7 @@ class AppLocalizationsPt extends AppLocalizations { 'A entrada não corresponde ao formato exigido'; @override - String get metadata_provider_plugins => 'Plugins do provedor de metadados'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1533,8 +1542,8 @@ class AppLocalizationsPt extends AppLocalizations { String get available_plugins => 'Plugins disponíveis'; @override - String get configure_your_own_metadata_plugin => - 'Configure seu próprio provedor de metadados de playlist/álbum/artista/feed'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Scrobblers de áudio'; diff --git a/lib/l10n/generated/app_localizations_ru.dart b/lib/l10n/generated/app_localizations_ru.dart index 9cd091e7..f6ad081e 100644 --- a/lib/l10n/generated/app_localizations_ru.dart +++ b/lib/l10n/generated/app_localizations_ru.dart @@ -1448,7 +1448,16 @@ class AppLocalizationsRu extends AppLocalizations { 'Этот плагин скробблит вашу музыку для создания вашей истории прослушиваний.'; @override - String get default_plugin => 'По умолчанию'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Установить по умолчанию'; @@ -1511,7 +1520,7 @@ class AppLocalizationsRu extends AppLocalizations { 'Введенные данные не соответствуют требуемому формату'; @override - String get metadata_provider_plugins => 'Плагины поставщика метаданных'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1536,8 +1545,8 @@ class AppLocalizationsRu extends AppLocalizations { String get available_plugins => 'Доступные плагины'; @override - String get configure_your_own_metadata_plugin => - 'Настройте свой собственный поставщик метаданных для плейлиста/альбома/артиста/ленты'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Аудио скробблеры'; diff --git a/lib/l10n/generated/app_localizations_ta.dart b/lib/l10n/generated/app_localizations_ta.dart index 204832b2..94719207 100644 --- a/lib/l10n/generated/app_localizations_ta.dart +++ b/lib/l10n/generated/app_localizations_ta.dart @@ -1455,7 +1455,16 @@ class AppLocalizationsTa extends AppLocalizations { 'இந்த பிளகின் உங்கள் கேட்பதின் வரலாற்றை உருவாக்க உங்கள் இசையை ஸ்க்ரோப்ள் செய்கிறது.'; @override - String get default_plugin => 'இயல்புநிலை'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'இயல்புநிலையாக அமைக்கவும்'; @@ -1517,7 +1526,7 @@ class AppLocalizationsTa extends AppLocalizations { 'உள்ளீடு தேவையான வடிவத்துடன் பொருந்தவில்லை'; @override - String get metadata_provider_plugins => 'மெட்டாடேட்டா வழங்குநர் பிளகின்கள்'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1542,8 +1551,8 @@ class AppLocalizationsTa extends AppLocalizations { String get available_plugins => 'கிடைக்கக்கூடிய பிளகின்கள்'; @override - String get configure_your_own_metadata_plugin => - 'உங்கள் சொந்த பிளேலிஸ்ட்/ஆல்பம்/கலைஞர்/ஊட்ட மெட்டாடேட்டா வழங்குநரை உள்ளமைக்கவும்'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'ஆடியோ ஸ்க்ரோப்ளர்கள்'; diff --git a/lib/l10n/generated/app_localizations_th.dart b/lib/l10n/generated/app_localizations_th.dart index 5ea104a7..11d82dd6 100644 --- a/lib/l10n/generated/app_localizations_th.dart +++ b/lib/l10n/generated/app_localizations_th.dart @@ -1440,7 +1440,16 @@ class AppLocalizationsTh extends AppLocalizations { 'ปลั๊กอินนี้จะ scrobble เพลงของคุณเพื่อสร้างประวัติการฟังของคุณ'; @override - String get default_plugin => 'ค่าเริ่มต้น'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'ตั้งค่าเริ่มต้น'; @@ -1500,7 +1509,7 @@ class AppLocalizationsTh extends AppLocalizations { String get input_does_not_match_format => 'อินพุตไม่ตรงกับรูปแบบที่ต้องการ'; @override - String get metadata_provider_plugins => 'ปลั๊กอินผู้ให้บริการเมตาดาต้า'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1525,8 +1534,8 @@ class AppLocalizationsTh extends AppLocalizations { String get available_plugins => 'ปลั๊กอินที่มีอยู่'; @override - String get configure_your_own_metadata_plugin => - 'กำหนดค่าผู้ให้บริการเมตาดาต้าเพลย์ลิสต์/อัลบั้ม/ศิลปิน/ฟีดของคุณเอง'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'เครื่อง scrobbler เสียง'; diff --git a/lib/l10n/generated/app_localizations_tl.dart b/lib/l10n/generated/app_localizations_tl.dart index de1916e5..ac8415f5 100644 --- a/lib/l10n/generated/app_localizations_tl.dart +++ b/lib/l10n/generated/app_localizations_tl.dart @@ -1456,7 +1456,16 @@ class AppLocalizationsTl extends AppLocalizations { 'Sinis-scrobble ng plugin na ito ang iyong musika upang mabuo ang iyong kasaysayan ng pakikinig.'; @override - String get default_plugin => 'Default'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Itakda bilang default'; @@ -1518,7 +1527,7 @@ class AppLocalizationsTl extends AppLocalizations { 'Ang input ay hindi tumutugma sa kinakailangang format'; @override - String get metadata_provider_plugins => 'Mga Plugin ng Metadata Provider'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1543,8 +1552,8 @@ class AppLocalizationsTl extends AppLocalizations { String get available_plugins => 'Mga available na plugin'; @override - String get configure_your_own_metadata_plugin => - 'I-configure ang iyong sariling playlist/album/artist/feed metadata provider'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Mga Audio Scrobbler'; diff --git a/lib/l10n/generated/app_localizations_tr.dart b/lib/l10n/generated/app_localizations_tr.dart index e6740bb3..cd4f7122 100644 --- a/lib/l10n/generated/app_localizations_tr.dart +++ b/lib/l10n/generated/app_localizations_tr.dart @@ -1450,7 +1450,16 @@ class AppLocalizationsTr extends AppLocalizations { 'Bu eklenti, dinleme geçmişinizi oluşturmak için müziğinizi scrobble eder.'; @override - String get default_plugin => 'Varsayılan'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Varsayılan olarak ayarla'; @@ -1511,7 +1520,7 @@ class AppLocalizationsTr extends AppLocalizations { String get input_does_not_match_format => 'Girdi, gerekli biçimle eşleşmiyor'; @override - String get metadata_provider_plugins => 'Meta Veri Sağlayıcısı Eklentileri'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1536,8 +1545,8 @@ class AppLocalizationsTr extends AppLocalizations { String get available_plugins => 'Mevcut eklentiler'; @override - String get configure_your_own_metadata_plugin => - 'Kendi çalma listenizi/albümünüzü/sanatçınızı/akış meta veri sağlayıcınızı yapılandırın'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Ses Scrobbler\'lar'; diff --git a/lib/l10n/generated/app_localizations_uk.dart b/lib/l10n/generated/app_localizations_uk.dart index aba38ac3..a6297b1e 100644 --- a/lib/l10n/generated/app_localizations_uk.dart +++ b/lib/l10n/generated/app_localizations_uk.dart @@ -1446,7 +1446,16 @@ class AppLocalizationsUk extends AppLocalizations { 'Цей плагін скроббить вашу музику, щоб створити вашу історію прослуховувань.'; @override - String get default_plugin => 'За замовчуванням'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Встановити за замовчуванням'; @@ -1507,7 +1516,7 @@ class AppLocalizationsUk extends AppLocalizations { 'Введені дані не відповідають необхідному формату'; @override - String get metadata_provider_plugins => 'Плагіни провайдера метаданих'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1532,8 +1541,8 @@ class AppLocalizationsUk extends AppLocalizations { String get available_plugins => 'Доступні плагіни'; @override - String get configure_your_own_metadata_plugin => - 'Налаштуйте свій власний провайдер метаданих для плейлиста/альбому/виконавця/стрічки'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Аудіо скробблери'; diff --git a/lib/l10n/generated/app_localizations_vi.dart b/lib/l10n/generated/app_localizations_vi.dart index ec449549..1421c907 100644 --- a/lib/l10n/generated/app_localizations_vi.dart +++ b/lib/l10n/generated/app_localizations_vi.dart @@ -1450,7 +1450,16 @@ class AppLocalizationsVi extends AppLocalizations { 'Plugin này scrobble nhạc của bạn để tạo lịch sử nghe của bạn.'; @override - String get default_plugin => 'Mặc định'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => 'Đặt làm mặc định'; @@ -1513,7 +1522,7 @@ class AppLocalizationsVi extends AppLocalizations { 'Đầu vào không khớp với định dạng yêu cầu'; @override - String get metadata_provider_plugins => 'Plugin Nhà cung cấp siêu dữ liệu'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1538,8 +1547,8 @@ class AppLocalizationsVi extends AppLocalizations { String get available_plugins => 'Các plugin có sẵn'; @override - String get configure_your_own_metadata_plugin => - 'Cấu hình nhà cung cấp siêu dữ liệu danh sách phát/album/nghệ sĩ/nguồn cấp dữ liệu của riêng bạn'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => 'Bộ scrobbler âm thanh'; diff --git a/lib/l10n/generated/app_localizations_zh.dart b/lib/l10n/generated/app_localizations_zh.dart index c9e18e72..6232965a 100644 --- a/lib/l10n/generated/app_localizations_zh.dart +++ b/lib/l10n/generated/app_localizations_zh.dart @@ -1412,7 +1412,16 @@ class AppLocalizationsZh extends AppLocalizations { String get plugin_scrobbling_info => '此插件会 scrobble 您的音乐以生成您的收听历史记录。'; @override - String get default_plugin => '默认'; + String get default_metadata_source => 'Default metadata source'; + + @override + String get set_default_metadata_source => 'Set default metadata source'; + + @override + String get default_audio_source => 'Default audio source'; + + @override + String get set_default_audio_source => 'Set default audio source'; @override String get set_default => '设为默认'; @@ -1469,7 +1478,7 @@ class AppLocalizationsZh extends AppLocalizations { String get input_does_not_match_format => '输入与所需格式不匹配'; @override - String get metadata_provider_plugins => '元数据提供者插件'; + String get plugins => 'Plugins'; @override String get paste_plugin_download_url => @@ -1493,7 +1502,8 @@ class AppLocalizationsZh extends AppLocalizations { String get available_plugins => '可用插件'; @override - String get configure_your_own_metadata_plugin => '配置您自己的播放列表/专辑/艺人/订阅元数据提供者'; + String get configure_plugins => + 'Configure your own metadata provider and audio source plugins'; @override String get audio_scrobblers => '音频 Scrobblers'; @@ -2919,9 +2929,6 @@ class AppLocalizationsZhTw extends AppLocalizationsZh { @override String get plugin_scrobbling_info => '此外掛程式會 Scrobble 您的音樂以產生您的收聽記錄。'; - @override - String get default_plugin => '預設'; - @override String get set_default => '設為預設'; @@ -2976,9 +2983,6 @@ class AppLocalizationsZhTw extends AppLocalizationsZh { @override String get input_does_not_match_format => '輸入不符合所需格式'; - @override - String get metadata_provider_plugins => '中繼資料供應商外掛程式'; - @override String get paste_plugin_download_url => '貼上下載網址、GitHub/Codeberg 儲存庫網址或 .smplug 檔案的直接連結'; @@ -3000,9 +3004,6 @@ class AppLocalizationsZhTw extends AppLocalizationsZh { @override String get available_plugins => '可用的外掛程式'; - @override - String get configure_your_own_metadata_plugin => '設定您自己的播放清單/專輯/藝人/動態中繼資料供應商'; - @override String get audio_scrobblers => '音訊 Scrobblers'; diff --git a/lib/main.dart b/lib/main.dart index b5789d6f..ecf7148d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -83,6 +83,8 @@ Future main(List rawArgs) async { // force High Refresh Rate on some Android devices (like One Plus) if (kIsAndroid) { await FlutterDisplayMode.setHighRefreshRate(); + } + if (kIsAndroid || kIsDesktop) { await NewPipeExtractor.init(); } @@ -150,11 +152,13 @@ class Spotube extends HookConsumerWidget { ref.listen(audioPlayerStreamListenersProvider, (_, __) {}); ref.listen(bonsoirProvider, (_, __) {}); ref.listen(connectClientsProvider, (_, __) {}); - ref.listen(metadataPluginsProvider, (_, __) {}); - ref.listen(metadataPluginProvider, (_, __) {}); ref.listen(serverProvider, (_, __) {}); ref.listen(trayManagerProvider, (_, __) {}); + ref.listen(metadataPluginsProvider, (_, __) {}); + ref.listen(metadataPluginProvider, (_, __) {}); + ref.listen(audioSourcePluginProvider, (_, __) {}); ref.listen(metadataPluginUpdateCheckerProvider, (_, __) {}); + ref.listen(audioSourcePluginUpdateCheckerProvider, (_, __) {}); useFixWindowStretching(); useDisableBatteryOptimizations(); diff --git a/lib/models/database/database.dart b/lib/models/database/database.dart index bc30627d..8df70968 100644 --- a/lib/models/database/database.dart +++ b/lib/models/database/database.dart @@ -16,13 +16,13 @@ import 'package:spotube/models/metadata/market.dart'; import 'package:spotube/models/metadata/metadata.dart'; import 'package:spotube/services/kv_store/encrypted_kv_store.dart'; import 'package:spotube/services/kv_store/kv_store.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; import 'package:flutter/widgets.dart' hide Table, Key, View; import 'package:spotube/modules/settings/color_scheme_picker_dialog.dart'; import 'package:drift/native.dart'; import 'package:spotube/services/youtube_engine/newpipe_engine.dart'; import 'package:spotube/services/youtube_engine/youtube_explode_engine.dart'; import 'package:spotube/services/youtube_engine/yt_dlp_engine.dart'; +import 'package:spotube/utils/platform.dart'; import 'package:sqlite3/sqlite3.dart'; import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart'; @@ -58,14 +58,14 @@ part 'typeconverters/subtitle.dart'; AudioPlayerStateTable, HistoryTable, LyricsTable, - MetadataPluginsTable, + PluginsTable, ], ) class AppDatabase extends _$AppDatabase { AppDatabase() : super(_openConnection()); @override - int get schemaVersion => 8; + int get schemaVersion => 10; @override MigrationStrategy get migration { @@ -199,6 +199,28 @@ class AppDatabase extends _$AppDatabase { } }); }, + from8To9: (m, schema) async { + await m.renameTable(schema.pluginsTable, "metadata_plugins_table"); + await m.renameColumn( + schema.pluginsTable, + "selected", + pluginsTable.selectedForMetadata, + ); + await m.addColumn( + schema.pluginsTable, + pluginsTable.selectedForAudioSource, + ); + }, + from9To10: (m, schema) async { + await m.dropColumn(schema.preferencesTable, "piped_instance"); + await m.dropColumn(schema.preferencesTable, "invidious_instance"); + await m.addColumn( + schema.sourceMatchTable, + sourceMatchTable.sourceInfo, + ); + await customStatement("DROP INDEX IF EXISTS uniq_track_match;"); + await m.dropColumn(schema.sourceMatchTable, "source_id"); + }, ), ); } diff --git a/lib/models/database/database.g.dart b/lib/models/database/database.g.dart index 8c4def7c..8aa14899 100644 --- a/lib/models/database/database.g.dart +++ b/lib/models/database/database.g.dart @@ -558,15 +558,6 @@ class $PreferencesTableTable extends PreferencesTable requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); - @override - late final GeneratedColumnWithTypeConverter - audioQuality = GeneratedColumn( - 'audio_quality', aliasedName, false, - type: DriftSqlType.string, - requiredDuringInsert: false, - defaultValue: Constant(SourceQualities.high.name)) - .withConverter( - $PreferencesTableTable.$converteraudioQuality); static const VerificationMeta _albumColorSyncMeta = const VerificationMeta('albumColorSync'); @override @@ -703,22 +694,6 @@ class $PreferencesTableTable extends PreferencesTable defaultValue: const Constant("")) .withConverter>( $PreferencesTableTable.$converterlocalLibraryLocation); - static const VerificationMeta _pipedInstanceMeta = - const VerificationMeta('pipedInstance'); - @override - late final GeneratedColumn pipedInstance = GeneratedColumn( - 'piped_instance', aliasedName, false, - type: DriftSqlType.string, - requiredDuringInsert: false, - defaultValue: const Constant("https://pipedapi.kavin.rocks")); - static const VerificationMeta _invidiousInstanceMeta = - const VerificationMeta('invidiousInstance'); - @override - late final GeneratedColumn invidiousInstance = - GeneratedColumn('invidious_instance', aliasedName, false, - type: DriftSqlType.string, - requiredDuringInsert: false, - defaultValue: const Constant("https://inv.nadeko.net")); @override late final GeneratedColumnWithTypeConverter themeMode = GeneratedColumn('theme_mode', aliasedName, false, @@ -726,14 +701,12 @@ class $PreferencesTableTable extends PreferencesTable requiredDuringInsert: false, defaultValue: Constant(ThemeMode.system.name)) .withConverter($PreferencesTableTable.$converterthemeMode); + static const VerificationMeta _audioSourceIdMeta = + const VerificationMeta('audioSourceId'); @override - late final GeneratedColumnWithTypeConverter audioSource = - GeneratedColumn('audio_source', aliasedName, false, - type: DriftSqlType.string, - requiredDuringInsert: false, - defaultValue: Constant(AudioSource.youtube.name)) - .withConverter( - $PreferencesTableTable.$converteraudioSource); + late final GeneratedColumn audioSourceId = GeneratedColumn( + 'audio_source_id', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); @override late final GeneratedColumnWithTypeConverter youtubeClientEngine = GeneratedColumn( @@ -743,24 +716,6 @@ class $PreferencesTableTable extends PreferencesTable defaultValue: Constant(YoutubeClientEngine.youtubeExplode.name)) .withConverter( $PreferencesTableTable.$converteryoutubeClientEngine); - @override - late final GeneratedColumnWithTypeConverter - streamMusicCodec = GeneratedColumn( - 'stream_music_codec', aliasedName, false, - type: DriftSqlType.string, - requiredDuringInsert: false, - defaultValue: Constant(SourceCodecs.weba.name)) - .withConverter( - $PreferencesTableTable.$converterstreamMusicCodec); - @override - late final GeneratedColumnWithTypeConverter - downloadMusicCodec = GeneratedColumn( - 'download_music_codec', aliasedName, false, - type: DriftSqlType.string, - requiredDuringInsert: false, - defaultValue: Constant(SourceCodecs.m4a.name)) - .withConverter( - $PreferencesTableTable.$converterdownloadMusicCodec); static const VerificationMeta _discordPresenceMeta = const VerificationMeta('discordPresence'); @override @@ -812,7 +767,6 @@ class $PreferencesTableTable extends PreferencesTable @override List get $columns => [ id, - audioQuality, albumColorSync, amoledDarkTheme, checkUpdate, @@ -828,13 +782,9 @@ class $PreferencesTableTable extends PreferencesTable searchMode, downloadLocation, localLibraryLocation, - pipedInstance, - invidiousInstance, themeMode, - audioSource, + audioSourceId, youtubeClientEngine, - streamMusicCodec, - downloadMusicCodec, discordPresence, endlessPlayback, enableConnect, @@ -903,17 +853,11 @@ class $PreferencesTableTable extends PreferencesTable downloadLocation.isAcceptableOrUnknown( data['download_location']!, _downloadLocationMeta)); } - if (data.containsKey('piped_instance')) { + if (data.containsKey('audio_source_id')) { context.handle( - _pipedInstanceMeta, - pipedInstance.isAcceptableOrUnknown( - data['piped_instance']!, _pipedInstanceMeta)); - } - if (data.containsKey('invidious_instance')) { - context.handle( - _invidiousInstanceMeta, - invidiousInstance.isAcceptableOrUnknown( - data['invidious_instance']!, _invidiousInstanceMeta)); + _audioSourceIdMeta, + audioSourceId.isAcceptableOrUnknown( + data['audio_source_id']!, _audioSourceIdMeta)); } if (data.containsKey('discord_presence')) { context.handle( @@ -956,9 +900,6 @@ class $PreferencesTableTable extends PreferencesTable return PreferencesTableData( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, - audioQuality: $PreferencesTableTable.$converteraudioQuality.fromSql( - attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}audio_quality'])!), albumColorSync: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}album_color_sync'])!, amoledDarkTheme: attachedDatabase.typeMapping.read( @@ -997,25 +938,14 @@ class $PreferencesTableTable extends PreferencesTable .$converterlocalLibraryLocation .fromSql(attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}local_library_location'])!), - pipedInstance: attachedDatabase.typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}piped_instance'])!, - invidiousInstance: attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}invidious_instance'])!, themeMode: $PreferencesTableTable.$converterthemeMode.fromSql( attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}theme_mode'])!), - audioSource: $PreferencesTableTable.$converteraudioSource.fromSql( - attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}audio_source'])!), + audioSourceId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}audio_source_id']), youtubeClientEngine: $PreferencesTableTable.$converteryoutubeClientEngine .fromSql(attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}youtube_client_engine'])!), - streamMusicCodec: $PreferencesTableTable.$converterstreamMusicCodec - .fromSql(attachedDatabase.typeMapping.read(DriftSqlType.string, - data['${effectivePrefix}stream_music_codec'])!), - downloadMusicCodec: $PreferencesTableTable.$converterdownloadMusicCodec - .fromSql(attachedDatabase.typeMapping.read(DriftSqlType.string, - data['${effectivePrefix}download_music_codec'])!), discordPresence: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}discord_presence'])!, endlessPlayback: attachedDatabase.typeMapping @@ -1034,9 +964,6 @@ class $PreferencesTableTable extends PreferencesTable return $PreferencesTableTable(attachedDatabase, alias); } - static JsonTypeConverter2 - $converteraudioQuality = - const EnumNameConverter(SourceQualities.values); static JsonTypeConverter2 $convertercloseBehavior = const EnumNameConverter(CloseBehavior.values); @@ -1054,23 +981,14 @@ class $PreferencesTableTable extends PreferencesTable const StringListConverter(); static JsonTypeConverter2 $converterthemeMode = const EnumNameConverter(ThemeMode.values); - static JsonTypeConverter2 $converteraudioSource = - const EnumNameConverter(AudioSource.values); static JsonTypeConverter2 $converteryoutubeClientEngine = const EnumNameConverter(YoutubeClientEngine.values); - static JsonTypeConverter2 - $converterstreamMusicCodec = - const EnumNameConverter(SourceCodecs.values); - static JsonTypeConverter2 - $converterdownloadMusicCodec = - const EnumNameConverter(SourceCodecs.values); } class PreferencesTableData extends DataClass implements Insertable { final int id; - final SourceQualities audioQuality; final bool albumColorSync; final bool amoledDarkTheme; final bool checkUpdate; @@ -1086,13 +1004,9 @@ class PreferencesTableData extends DataClass final SearchMode searchMode; final String downloadLocation; final List localLibraryLocation; - final String pipedInstance; - final String invidiousInstance; final ThemeMode themeMode; - final AudioSource audioSource; + final String? audioSourceId; final YoutubeClientEngine youtubeClientEngine; - final SourceCodecs streamMusicCodec; - final SourceCodecs downloadMusicCodec; final bool discordPresence; final bool endlessPlayback; final bool enableConnect; @@ -1100,7 +1014,6 @@ class PreferencesTableData extends DataClass final bool cacheMusic; const PreferencesTableData( {required this.id, - required this.audioQuality, required this.albumColorSync, required this.amoledDarkTheme, required this.checkUpdate, @@ -1116,13 +1029,9 @@ class PreferencesTableData extends DataClass required this.searchMode, required this.downloadLocation, required this.localLibraryLocation, - required this.pipedInstance, - required this.invidiousInstance, required this.themeMode, - required this.audioSource, + this.audioSourceId, required this.youtubeClientEngine, - required this.streamMusicCodec, - required this.downloadMusicCodec, required this.discordPresence, required this.endlessPlayback, required this.enableConnect, @@ -1132,10 +1041,6 @@ class PreferencesTableData extends DataClass Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); - { - map['audio_quality'] = Variable( - $PreferencesTableTable.$converteraudioQuality.toSql(audioQuality)); - } map['album_color_sync'] = Variable(albumColorSync); map['amoled_dark_theme'] = Variable(amoledDarkTheme); map['check_update'] = Variable(checkUpdate); @@ -1174,31 +1079,18 @@ class PreferencesTableData extends DataClass .$converterlocalLibraryLocation .toSql(localLibraryLocation)); } - map['piped_instance'] = Variable(pipedInstance); - map['invidious_instance'] = Variable(invidiousInstance); { map['theme_mode'] = Variable( $PreferencesTableTable.$converterthemeMode.toSql(themeMode)); } - { - map['audio_source'] = Variable( - $PreferencesTableTable.$converteraudioSource.toSql(audioSource)); + if (!nullToAbsent || audioSourceId != null) { + map['audio_source_id'] = Variable(audioSourceId); } { map['youtube_client_engine'] = Variable($PreferencesTableTable .$converteryoutubeClientEngine .toSql(youtubeClientEngine)); } - { - map['stream_music_codec'] = Variable($PreferencesTableTable - .$converterstreamMusicCodec - .toSql(streamMusicCodec)); - } - { - map['download_music_codec'] = Variable($PreferencesTableTable - .$converterdownloadMusicCodec - .toSql(downloadMusicCodec)); - } map['discord_presence'] = Variable(discordPresence); map['endless_playback'] = Variable(endlessPlayback); map['enable_connect'] = Variable(enableConnect); @@ -1210,7 +1102,6 @@ class PreferencesTableData extends DataClass PreferencesTableCompanion toCompanion(bool nullToAbsent) { return PreferencesTableCompanion( id: Value(id), - audioQuality: Value(audioQuality), albumColorSync: Value(albumColorSync), amoledDarkTheme: Value(amoledDarkTheme), checkUpdate: Value(checkUpdate), @@ -1226,13 +1117,11 @@ class PreferencesTableData extends DataClass searchMode: Value(searchMode), downloadLocation: Value(downloadLocation), localLibraryLocation: Value(localLibraryLocation), - pipedInstance: Value(pipedInstance), - invidiousInstance: Value(invidiousInstance), themeMode: Value(themeMode), - audioSource: Value(audioSource), + audioSourceId: audioSourceId == null && nullToAbsent + ? const Value.absent() + : Value(audioSourceId), youtubeClientEngine: Value(youtubeClientEngine), - streamMusicCodec: Value(streamMusicCodec), - downloadMusicCodec: Value(downloadMusicCodec), discordPresence: Value(discordPresence), endlessPlayback: Value(endlessPlayback), enableConnect: Value(enableConnect), @@ -1246,8 +1135,6 @@ class PreferencesTableData extends DataClass serializer ??= driftRuntimeOptions.defaultSerializer; return PreferencesTableData( id: serializer.fromJson(json['id']), - audioQuality: $PreferencesTableTable.$converteraudioQuality - .fromJson(serializer.fromJson(json['audioQuality'])), albumColorSync: serializer.fromJson(json['albumColorSync']), amoledDarkTheme: serializer.fromJson(json['amoledDarkTheme']), checkUpdate: serializer.fromJson(json['checkUpdate']), @@ -1269,18 +1156,11 @@ class PreferencesTableData extends DataClass downloadLocation: serializer.fromJson(json['downloadLocation']), localLibraryLocation: serializer.fromJson>(json['localLibraryLocation']), - pipedInstance: serializer.fromJson(json['pipedInstance']), - invidiousInstance: serializer.fromJson(json['invidiousInstance']), themeMode: $PreferencesTableTable.$converterthemeMode .fromJson(serializer.fromJson(json['themeMode'])), - audioSource: $PreferencesTableTable.$converteraudioSource - .fromJson(serializer.fromJson(json['audioSource'])), + audioSourceId: serializer.fromJson(json['audioSourceId']), youtubeClientEngine: $PreferencesTableTable.$converteryoutubeClientEngine .fromJson(serializer.fromJson(json['youtubeClientEngine'])), - streamMusicCodec: $PreferencesTableTable.$converterstreamMusicCodec - .fromJson(serializer.fromJson(json['streamMusicCodec'])), - downloadMusicCodec: $PreferencesTableTable.$converterdownloadMusicCodec - .fromJson(serializer.fromJson(json['downloadMusicCodec'])), discordPresence: serializer.fromJson(json['discordPresence']), endlessPlayback: serializer.fromJson(json['endlessPlayback']), enableConnect: serializer.fromJson(json['enableConnect']), @@ -1293,8 +1173,6 @@ class PreferencesTableData extends DataClass serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), - 'audioQuality': serializer.toJson( - $PreferencesTableTable.$converteraudioQuality.toJson(audioQuality)), 'albumColorSync': serializer.toJson(albumColorSync), 'amoledDarkTheme': serializer.toJson(amoledDarkTheme), 'checkUpdate': serializer.toJson(checkUpdate), @@ -1315,21 +1193,12 @@ class PreferencesTableData extends DataClass 'downloadLocation': serializer.toJson(downloadLocation), 'localLibraryLocation': serializer.toJson>(localLibraryLocation), - 'pipedInstance': serializer.toJson(pipedInstance), - 'invidiousInstance': serializer.toJson(invidiousInstance), 'themeMode': serializer.toJson( $PreferencesTableTable.$converterthemeMode.toJson(themeMode)), - 'audioSource': serializer.toJson( - $PreferencesTableTable.$converteraudioSource.toJson(audioSource)), + 'audioSourceId': serializer.toJson(audioSourceId), 'youtubeClientEngine': serializer.toJson($PreferencesTableTable .$converteryoutubeClientEngine .toJson(youtubeClientEngine)), - 'streamMusicCodec': serializer.toJson($PreferencesTableTable - .$converterstreamMusicCodec - .toJson(streamMusicCodec)), - 'downloadMusicCodec': serializer.toJson($PreferencesTableTable - .$converterdownloadMusicCodec - .toJson(downloadMusicCodec)), 'discordPresence': serializer.toJson(discordPresence), 'endlessPlayback': serializer.toJson(endlessPlayback), 'enableConnect': serializer.toJson(enableConnect), @@ -1340,7 +1209,6 @@ class PreferencesTableData extends DataClass PreferencesTableData copyWith( {int? id, - SourceQualities? audioQuality, bool? albumColorSync, bool? amoledDarkTheme, bool? checkUpdate, @@ -1356,13 +1224,9 @@ class PreferencesTableData extends DataClass SearchMode? searchMode, String? downloadLocation, List? localLibraryLocation, - String? pipedInstance, - String? invidiousInstance, ThemeMode? themeMode, - AudioSource? audioSource, + Value audioSourceId = const Value.absent(), YoutubeClientEngine? youtubeClientEngine, - SourceCodecs? streamMusicCodec, - SourceCodecs? downloadMusicCodec, bool? discordPresence, bool? endlessPlayback, bool? enableConnect, @@ -1370,7 +1234,6 @@ class PreferencesTableData extends DataClass bool? cacheMusic}) => PreferencesTableData( id: id ?? this.id, - audioQuality: audioQuality ?? this.audioQuality, albumColorSync: albumColorSync ?? this.albumColorSync, amoledDarkTheme: amoledDarkTheme ?? this.amoledDarkTheme, checkUpdate: checkUpdate ?? this.checkUpdate, @@ -1386,13 +1249,10 @@ class PreferencesTableData extends DataClass searchMode: searchMode ?? this.searchMode, downloadLocation: downloadLocation ?? this.downloadLocation, localLibraryLocation: localLibraryLocation ?? this.localLibraryLocation, - pipedInstance: pipedInstance ?? this.pipedInstance, - invidiousInstance: invidiousInstance ?? this.invidiousInstance, themeMode: themeMode ?? this.themeMode, - audioSource: audioSource ?? this.audioSource, + audioSourceId: + audioSourceId.present ? audioSourceId.value : this.audioSourceId, youtubeClientEngine: youtubeClientEngine ?? this.youtubeClientEngine, - streamMusicCodec: streamMusicCodec ?? this.streamMusicCodec, - downloadMusicCodec: downloadMusicCodec ?? this.downloadMusicCodec, discordPresence: discordPresence ?? this.discordPresence, endlessPlayback: endlessPlayback ?? this.endlessPlayback, enableConnect: enableConnect ?? this.enableConnect, @@ -1402,9 +1262,6 @@ class PreferencesTableData extends DataClass PreferencesTableData copyWithCompanion(PreferencesTableCompanion data) { return PreferencesTableData( id: data.id.present ? data.id.value : this.id, - audioQuality: data.audioQuality.present - ? data.audioQuality.value - : this.audioQuality, albumColorSync: data.albumColorSync.present ? data.albumColorSync.value : this.albumColorSync, @@ -1443,24 +1300,13 @@ class PreferencesTableData extends DataClass localLibraryLocation: data.localLibraryLocation.present ? data.localLibraryLocation.value : this.localLibraryLocation, - pipedInstance: data.pipedInstance.present - ? data.pipedInstance.value - : this.pipedInstance, - invidiousInstance: data.invidiousInstance.present - ? data.invidiousInstance.value - : this.invidiousInstance, themeMode: data.themeMode.present ? data.themeMode.value : this.themeMode, - audioSource: - data.audioSource.present ? data.audioSource.value : this.audioSource, + audioSourceId: data.audioSourceId.present + ? data.audioSourceId.value + : this.audioSourceId, youtubeClientEngine: data.youtubeClientEngine.present ? data.youtubeClientEngine.value : this.youtubeClientEngine, - streamMusicCodec: data.streamMusicCodec.present - ? data.streamMusicCodec.value - : this.streamMusicCodec, - downloadMusicCodec: data.downloadMusicCodec.present - ? data.downloadMusicCodec.value - : this.downloadMusicCodec, discordPresence: data.discordPresence.present ? data.discordPresence.value : this.discordPresence, @@ -1481,7 +1327,6 @@ class PreferencesTableData extends DataClass String toString() { return (StringBuffer('PreferencesTableData(') ..write('id: $id, ') - ..write('audioQuality: $audioQuality, ') ..write('albumColorSync: $albumColorSync, ') ..write('amoledDarkTheme: $amoledDarkTheme, ') ..write('checkUpdate: $checkUpdate, ') @@ -1497,13 +1342,9 @@ class PreferencesTableData extends DataClass ..write('searchMode: $searchMode, ') ..write('downloadLocation: $downloadLocation, ') ..write('localLibraryLocation: $localLibraryLocation, ') - ..write('pipedInstance: $pipedInstance, ') - ..write('invidiousInstance: $invidiousInstance, ') ..write('themeMode: $themeMode, ') - ..write('audioSource: $audioSource, ') + ..write('audioSourceId: $audioSourceId, ') ..write('youtubeClientEngine: $youtubeClientEngine, ') - ..write('streamMusicCodec: $streamMusicCodec, ') - ..write('downloadMusicCodec: $downloadMusicCodec, ') ..write('discordPresence: $discordPresence, ') ..write('endlessPlayback: $endlessPlayback, ') ..write('enableConnect: $enableConnect, ') @@ -1516,7 +1357,6 @@ class PreferencesTableData extends DataClass @override int get hashCode => Object.hashAll([ id, - audioQuality, albumColorSync, amoledDarkTheme, checkUpdate, @@ -1532,13 +1372,9 @@ class PreferencesTableData extends DataClass searchMode, downloadLocation, localLibraryLocation, - pipedInstance, - invidiousInstance, themeMode, - audioSource, + audioSourceId, youtubeClientEngine, - streamMusicCodec, - downloadMusicCodec, discordPresence, endlessPlayback, enableConnect, @@ -1550,7 +1386,6 @@ class PreferencesTableData extends DataClass identical(this, other) || (other is PreferencesTableData && other.id == this.id && - other.audioQuality == this.audioQuality && other.albumColorSync == this.albumColorSync && other.amoledDarkTheme == this.amoledDarkTheme && other.checkUpdate == this.checkUpdate && @@ -1566,13 +1401,9 @@ class PreferencesTableData extends DataClass other.searchMode == this.searchMode && other.downloadLocation == this.downloadLocation && other.localLibraryLocation == this.localLibraryLocation && - other.pipedInstance == this.pipedInstance && - other.invidiousInstance == this.invidiousInstance && other.themeMode == this.themeMode && - other.audioSource == this.audioSource && + other.audioSourceId == this.audioSourceId && other.youtubeClientEngine == this.youtubeClientEngine && - other.streamMusicCodec == this.streamMusicCodec && - other.downloadMusicCodec == this.downloadMusicCodec && other.discordPresence == this.discordPresence && other.endlessPlayback == this.endlessPlayback && other.enableConnect == this.enableConnect && @@ -1582,7 +1413,6 @@ class PreferencesTableData extends DataClass class PreferencesTableCompanion extends UpdateCompanion { final Value id; - final Value audioQuality; final Value albumColorSync; final Value amoledDarkTheme; final Value checkUpdate; @@ -1598,13 +1428,9 @@ class PreferencesTableCompanion extends UpdateCompanion { final Value searchMode; final Value downloadLocation; final Value> localLibraryLocation; - final Value pipedInstance; - final Value invidiousInstance; final Value themeMode; - final Value audioSource; + final Value audioSourceId; final Value youtubeClientEngine; - final Value streamMusicCodec; - final Value downloadMusicCodec; final Value discordPresence; final Value endlessPlayback; final Value enableConnect; @@ -1612,7 +1438,6 @@ class PreferencesTableCompanion extends UpdateCompanion { final Value cacheMusic; const PreferencesTableCompanion({ this.id = const Value.absent(), - this.audioQuality = const Value.absent(), this.albumColorSync = const Value.absent(), this.amoledDarkTheme = const Value.absent(), this.checkUpdate = const Value.absent(), @@ -1628,13 +1453,9 @@ class PreferencesTableCompanion extends UpdateCompanion { this.searchMode = const Value.absent(), this.downloadLocation = const Value.absent(), this.localLibraryLocation = const Value.absent(), - this.pipedInstance = const Value.absent(), - this.invidiousInstance = const Value.absent(), this.themeMode = const Value.absent(), - this.audioSource = const Value.absent(), + this.audioSourceId = const Value.absent(), this.youtubeClientEngine = const Value.absent(), - this.streamMusicCodec = const Value.absent(), - this.downloadMusicCodec = const Value.absent(), this.discordPresence = const Value.absent(), this.endlessPlayback = const Value.absent(), this.enableConnect = const Value.absent(), @@ -1643,7 +1464,6 @@ class PreferencesTableCompanion extends UpdateCompanion { }); PreferencesTableCompanion.insert({ this.id = const Value.absent(), - this.audioQuality = const Value.absent(), this.albumColorSync = const Value.absent(), this.amoledDarkTheme = const Value.absent(), this.checkUpdate = const Value.absent(), @@ -1659,13 +1479,9 @@ class PreferencesTableCompanion extends UpdateCompanion { this.searchMode = const Value.absent(), this.downloadLocation = const Value.absent(), this.localLibraryLocation = const Value.absent(), - this.pipedInstance = const Value.absent(), - this.invidiousInstance = const Value.absent(), this.themeMode = const Value.absent(), - this.audioSource = const Value.absent(), + this.audioSourceId = const Value.absent(), this.youtubeClientEngine = const Value.absent(), - this.streamMusicCodec = const Value.absent(), - this.downloadMusicCodec = const Value.absent(), this.discordPresence = const Value.absent(), this.endlessPlayback = const Value.absent(), this.enableConnect = const Value.absent(), @@ -1674,7 +1490,6 @@ class PreferencesTableCompanion extends UpdateCompanion { }); static Insertable custom({ Expression? id, - Expression? audioQuality, Expression? albumColorSync, Expression? amoledDarkTheme, Expression? checkUpdate, @@ -1690,13 +1505,9 @@ class PreferencesTableCompanion extends UpdateCompanion { Expression? searchMode, Expression? downloadLocation, Expression? localLibraryLocation, - Expression? pipedInstance, - Expression? invidiousInstance, Expression? themeMode, - Expression? audioSource, + Expression? audioSourceId, Expression? youtubeClientEngine, - Expression? streamMusicCodec, - Expression? downloadMusicCodec, Expression? discordPresence, Expression? endlessPlayback, Expression? enableConnect, @@ -1705,7 +1516,6 @@ class PreferencesTableCompanion extends UpdateCompanion { }) { return RawValuesInsertable({ if (id != null) 'id': id, - if (audioQuality != null) 'audio_quality': audioQuality, if (albumColorSync != null) 'album_color_sync': albumColorSync, if (amoledDarkTheme != null) 'amoled_dark_theme': amoledDarkTheme, if (checkUpdate != null) 'check_update': checkUpdate, @@ -1723,15 +1533,10 @@ class PreferencesTableCompanion extends UpdateCompanion { if (downloadLocation != null) 'download_location': downloadLocation, if (localLibraryLocation != null) 'local_library_location': localLibraryLocation, - if (pipedInstance != null) 'piped_instance': pipedInstance, - if (invidiousInstance != null) 'invidious_instance': invidiousInstance, if (themeMode != null) 'theme_mode': themeMode, - if (audioSource != null) 'audio_source': audioSource, + if (audioSourceId != null) 'audio_source_id': audioSourceId, if (youtubeClientEngine != null) 'youtube_client_engine': youtubeClientEngine, - if (streamMusicCodec != null) 'stream_music_codec': streamMusicCodec, - if (downloadMusicCodec != null) - 'download_music_codec': downloadMusicCodec, if (discordPresence != null) 'discord_presence': discordPresence, if (endlessPlayback != null) 'endless_playback': endlessPlayback, if (enableConnect != null) 'enable_connect': enableConnect, @@ -1742,7 +1547,6 @@ class PreferencesTableCompanion extends UpdateCompanion { PreferencesTableCompanion copyWith( {Value? id, - Value? audioQuality, Value? albumColorSync, Value? amoledDarkTheme, Value? checkUpdate, @@ -1758,13 +1562,9 @@ class PreferencesTableCompanion extends UpdateCompanion { Value? searchMode, Value? downloadLocation, Value>? localLibraryLocation, - Value? pipedInstance, - Value? invidiousInstance, Value? themeMode, - Value? audioSource, + Value? audioSourceId, Value? youtubeClientEngine, - Value? streamMusicCodec, - Value? downloadMusicCodec, Value? discordPresence, Value? endlessPlayback, Value? enableConnect, @@ -1772,7 +1572,6 @@ class PreferencesTableCompanion extends UpdateCompanion { Value? cacheMusic}) { return PreferencesTableCompanion( id: id ?? this.id, - audioQuality: audioQuality ?? this.audioQuality, albumColorSync: albumColorSync ?? this.albumColorSync, amoledDarkTheme: amoledDarkTheme ?? this.amoledDarkTheme, checkUpdate: checkUpdate ?? this.checkUpdate, @@ -1788,13 +1587,9 @@ class PreferencesTableCompanion extends UpdateCompanion { searchMode: searchMode ?? this.searchMode, downloadLocation: downloadLocation ?? this.downloadLocation, localLibraryLocation: localLibraryLocation ?? this.localLibraryLocation, - pipedInstance: pipedInstance ?? this.pipedInstance, - invidiousInstance: invidiousInstance ?? this.invidiousInstance, themeMode: themeMode ?? this.themeMode, - audioSource: audioSource ?? this.audioSource, + audioSourceId: audioSourceId ?? this.audioSourceId, youtubeClientEngine: youtubeClientEngine ?? this.youtubeClientEngine, - streamMusicCodec: streamMusicCodec ?? this.streamMusicCodec, - downloadMusicCodec: downloadMusicCodec ?? this.downloadMusicCodec, discordPresence: discordPresence ?? this.discordPresence, endlessPlayback: endlessPlayback ?? this.endlessPlayback, enableConnect: enableConnect ?? this.enableConnect, @@ -1809,11 +1604,6 @@ class PreferencesTableCompanion extends UpdateCompanion { if (id.present) { map['id'] = Variable(id.value); } - if (audioQuality.present) { - map['audio_quality'] = Variable($PreferencesTableTable - .$converteraudioQuality - .toSql(audioQuality.value)); - } if (albumColorSync.present) { map['album_color_sync'] = Variable(albumColorSync.value); } @@ -1869,36 +1659,18 @@ class PreferencesTableCompanion extends UpdateCompanion { .$converterlocalLibraryLocation .toSql(localLibraryLocation.value)); } - if (pipedInstance.present) { - map['piped_instance'] = Variable(pipedInstance.value); - } - if (invidiousInstance.present) { - map['invidious_instance'] = Variable(invidiousInstance.value); - } if (themeMode.present) { map['theme_mode'] = Variable( $PreferencesTableTable.$converterthemeMode.toSql(themeMode.value)); } - if (audioSource.present) { - map['audio_source'] = Variable($PreferencesTableTable - .$converteraudioSource - .toSql(audioSource.value)); + if (audioSourceId.present) { + map['audio_source_id'] = Variable(audioSourceId.value); } if (youtubeClientEngine.present) { map['youtube_client_engine'] = Variable($PreferencesTableTable .$converteryoutubeClientEngine .toSql(youtubeClientEngine.value)); } - if (streamMusicCodec.present) { - map['stream_music_codec'] = Variable($PreferencesTableTable - .$converterstreamMusicCodec - .toSql(streamMusicCodec.value)); - } - if (downloadMusicCodec.present) { - map['download_music_codec'] = Variable($PreferencesTableTable - .$converterdownloadMusicCodec - .toSql(downloadMusicCodec.value)); - } if (discordPresence.present) { map['discord_presence'] = Variable(discordPresence.value); } @@ -1921,7 +1693,6 @@ class PreferencesTableCompanion extends UpdateCompanion { String toString() { return (StringBuffer('PreferencesTableCompanion(') ..write('id: $id, ') - ..write('audioQuality: $audioQuality, ') ..write('albumColorSync: $albumColorSync, ') ..write('amoledDarkTheme: $amoledDarkTheme, ') ..write('checkUpdate: $checkUpdate, ') @@ -1937,13 +1708,9 @@ class PreferencesTableCompanion extends UpdateCompanion { ..write('searchMode: $searchMode, ') ..write('downloadLocation: $downloadLocation, ') ..write('localLibraryLocation: $localLibraryLocation, ') - ..write('pipedInstance: $pipedInstance, ') - ..write('invidiousInstance: $invidiousInstance, ') ..write('themeMode: $themeMode, ') - ..write('audioSource: $audioSource, ') + ..write('audioSourceId: $audioSourceId, ') ..write('youtubeClientEngine: $youtubeClientEngine, ') - ..write('streamMusicCodec: $streamMusicCodec, ') - ..write('downloadMusicCodec: $downloadMusicCodec, ') ..write('discordPresence: $discordPresence, ') ..write('endlessPlayback: $endlessPlayback, ') ..write('enableConnect: $enableConnect, ') @@ -2539,20 +2306,20 @@ class $SourceMatchTableTable extends SourceMatchTable late final GeneratedColumn trackId = GeneratedColumn( 'track_id', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); - static const VerificationMeta _sourceIdMeta = - const VerificationMeta('sourceId'); + static const VerificationMeta _sourceInfoMeta = + const VerificationMeta('sourceInfo'); @override - late final GeneratedColumn sourceId = GeneratedColumn( - 'source_id', aliasedName, false, + late final GeneratedColumn sourceInfo = GeneratedColumn( + 'source_info', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("{}")); + static const VerificationMeta _sourceTypeMeta = + const VerificationMeta('sourceType'); + @override + late final GeneratedColumn sourceType = GeneratedColumn( + 'source_type', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); - @override - late final GeneratedColumnWithTypeConverter sourceType = - GeneratedColumn('source_type', aliasedName, false, - type: DriftSqlType.string, - requiredDuringInsert: false, - defaultValue: Constant(SourceType.youtube.name)) - .withConverter( - $SourceMatchTableTable.$convertersourceType); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override @@ -2563,7 +2330,7 @@ class $SourceMatchTableTable extends SourceMatchTable defaultValue: currentDateAndTime); @override List get $columns => - [id, trackId, sourceId, sourceType, createdAt]; + [id, trackId, sourceInfo, sourceType, createdAt]; @override String get aliasedName => _alias ?? actualTableName; @override @@ -2584,11 +2351,19 @@ class $SourceMatchTableTable extends SourceMatchTable } else if (isInserting) { context.missing(_trackIdMeta); } - if (data.containsKey('source_id')) { - context.handle(_sourceIdMeta, - sourceId.isAcceptableOrUnknown(data['source_id']!, _sourceIdMeta)); + if (data.containsKey('source_info')) { + context.handle( + _sourceInfoMeta, + sourceInfo.isAcceptableOrUnknown( + data['source_info']!, _sourceInfoMeta)); + } + if (data.containsKey('source_type')) { + context.handle( + _sourceTypeMeta, + sourceType.isAcceptableOrUnknown( + data['source_type']!, _sourceTypeMeta)); } else if (isInserting) { - context.missing(_sourceIdMeta); + context.missing(_sourceTypeMeta); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, @@ -2607,11 +2382,10 @@ class $SourceMatchTableTable extends SourceMatchTable .read(DriftSqlType.int, data['${effectivePrefix}id'])!, trackId: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}track_id'])!, - sourceId: attachedDatabase.typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}source_id'])!, - sourceType: $SourceMatchTableTable.$convertersourceType.fromSql( - attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}source_type'])!), + sourceInfo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}source_info'])!, + sourceType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}source_type'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, ); @@ -2621,22 +2395,19 @@ class $SourceMatchTableTable extends SourceMatchTable $SourceMatchTableTable createAlias(String alias) { return $SourceMatchTableTable(attachedDatabase, alias); } - - static JsonTypeConverter2 $convertersourceType = - const EnumNameConverter(SourceType.values); } class SourceMatchTableData extends DataClass implements Insertable { final int id; final String trackId; - final String sourceId; - final SourceType sourceType; + final String sourceInfo; + final String sourceType; final DateTime createdAt; const SourceMatchTableData( {required this.id, required this.trackId, - required this.sourceId, + required this.sourceInfo, required this.sourceType, required this.createdAt}); @override @@ -2644,11 +2415,8 @@ class SourceMatchTableData extends DataClass final map = {}; map['id'] = Variable(id); map['track_id'] = Variable(trackId); - map['source_id'] = Variable(sourceId); - { - map['source_type'] = Variable( - $SourceMatchTableTable.$convertersourceType.toSql(sourceType)); - } + map['source_info'] = Variable(sourceInfo); + map['source_type'] = Variable(sourceType); map['created_at'] = Variable(createdAt); return map; } @@ -2657,7 +2425,7 @@ class SourceMatchTableData extends DataClass return SourceMatchTableCompanion( id: Value(id), trackId: Value(trackId), - sourceId: Value(sourceId), + sourceInfo: Value(sourceInfo), sourceType: Value(sourceType), createdAt: Value(createdAt), ); @@ -2669,9 +2437,8 @@ class SourceMatchTableData extends DataClass return SourceMatchTableData( id: serializer.fromJson(json['id']), trackId: serializer.fromJson(json['trackId']), - sourceId: serializer.fromJson(json['sourceId']), - sourceType: $SourceMatchTableTable.$convertersourceType - .fromJson(serializer.fromJson(json['sourceType'])), + sourceInfo: serializer.fromJson(json['sourceInfo']), + sourceType: serializer.fromJson(json['sourceType']), createdAt: serializer.fromJson(json['createdAt']), ); } @@ -2681,9 +2448,8 @@ class SourceMatchTableData extends DataClass return { 'id': serializer.toJson(id), 'trackId': serializer.toJson(trackId), - 'sourceId': serializer.toJson(sourceId), - 'sourceType': serializer.toJson( - $SourceMatchTableTable.$convertersourceType.toJson(sourceType)), + 'sourceInfo': serializer.toJson(sourceInfo), + 'sourceType': serializer.toJson(sourceType), 'createdAt': serializer.toJson(createdAt), }; } @@ -2691,13 +2457,13 @@ class SourceMatchTableData extends DataClass SourceMatchTableData copyWith( {int? id, String? trackId, - String? sourceId, - SourceType? sourceType, + String? sourceInfo, + String? sourceType, DateTime? createdAt}) => SourceMatchTableData( id: id ?? this.id, trackId: trackId ?? this.trackId, - sourceId: sourceId ?? this.sourceId, + sourceInfo: sourceInfo ?? this.sourceInfo, sourceType: sourceType ?? this.sourceType, createdAt: createdAt ?? this.createdAt, ); @@ -2705,7 +2471,8 @@ class SourceMatchTableData extends DataClass return SourceMatchTableData( id: data.id.present ? data.id.value : this.id, trackId: data.trackId.present ? data.trackId.value : this.trackId, - sourceId: data.sourceId.present ? data.sourceId.value : this.sourceId, + sourceInfo: + data.sourceInfo.present ? data.sourceInfo.value : this.sourceInfo, sourceType: data.sourceType.present ? data.sourceType.value : this.sourceType, createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, @@ -2717,7 +2484,7 @@ class SourceMatchTableData extends DataClass return (StringBuffer('SourceMatchTableData(') ..write('id: $id, ') ..write('trackId: $trackId, ') - ..write('sourceId: $sourceId, ') + ..write('sourceInfo: $sourceInfo, ') ..write('sourceType: $sourceType, ') ..write('createdAt: $createdAt') ..write(')')) @@ -2725,14 +2492,15 @@ class SourceMatchTableData extends DataClass } @override - int get hashCode => Object.hash(id, trackId, sourceId, sourceType, createdAt); + int get hashCode => + Object.hash(id, trackId, sourceInfo, sourceType, createdAt); @override bool operator ==(Object other) => identical(this, other) || (other is SourceMatchTableData && other.id == this.id && other.trackId == this.trackId && - other.sourceId == this.sourceId && + other.sourceInfo == this.sourceInfo && other.sourceType == this.sourceType && other.createdAt == this.createdAt); } @@ -2740,35 +2508,35 @@ class SourceMatchTableData extends DataClass class SourceMatchTableCompanion extends UpdateCompanion { final Value id; final Value trackId; - final Value sourceId; - final Value sourceType; + final Value sourceInfo; + final Value sourceType; final Value createdAt; const SourceMatchTableCompanion({ this.id = const Value.absent(), this.trackId = const Value.absent(), - this.sourceId = const Value.absent(), + this.sourceInfo = const Value.absent(), this.sourceType = const Value.absent(), this.createdAt = const Value.absent(), }); SourceMatchTableCompanion.insert({ this.id = const Value.absent(), required String trackId, - required String sourceId, - this.sourceType = const Value.absent(), + this.sourceInfo = const Value.absent(), + required String sourceType, this.createdAt = const Value.absent(), }) : trackId = Value(trackId), - sourceId = Value(sourceId); + sourceType = Value(sourceType); static Insertable custom({ Expression? id, Expression? trackId, - Expression? sourceId, + Expression? sourceInfo, Expression? sourceType, Expression? createdAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (trackId != null) 'track_id': trackId, - if (sourceId != null) 'source_id': sourceId, + if (sourceInfo != null) 'source_info': sourceInfo, if (sourceType != null) 'source_type': sourceType, if (createdAt != null) 'created_at': createdAt, }); @@ -2777,13 +2545,13 @@ class SourceMatchTableCompanion extends UpdateCompanion { SourceMatchTableCompanion copyWith( {Value? id, Value? trackId, - Value? sourceId, - Value? sourceType, + Value? sourceInfo, + Value? sourceType, Value? createdAt}) { return SourceMatchTableCompanion( id: id ?? this.id, trackId: trackId ?? this.trackId, - sourceId: sourceId ?? this.sourceId, + sourceInfo: sourceInfo ?? this.sourceInfo, sourceType: sourceType ?? this.sourceType, createdAt: createdAt ?? this.createdAt, ); @@ -2798,12 +2566,11 @@ class SourceMatchTableCompanion extends UpdateCompanion { if (trackId.present) { map['track_id'] = Variable(trackId.value); } - if (sourceId.present) { - map['source_id'] = Variable(sourceId.value); + if (sourceInfo.present) { + map['source_info'] = Variable(sourceInfo.value); } if (sourceType.present) { - map['source_type'] = Variable( - $SourceMatchTableTable.$convertersourceType.toSql(sourceType.value)); + map['source_type'] = Variable(sourceType.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); @@ -2816,7 +2583,7 @@ class SourceMatchTableCompanion extends UpdateCompanion { return (StringBuffer('SourceMatchTableCompanion(') ..write('id: $id, ') ..write('trackId: $trackId, ') - ..write('sourceId: $sourceId, ') + ..write('sourceInfo: $sourceInfo, ') ..write('sourceType: $sourceType, ') ..write('createdAt: $createdAt') ..write(')')) @@ -3740,12 +3507,12 @@ class LyricsTableCompanion extends UpdateCompanion { } } -class $MetadataPluginsTableTable extends MetadataPluginsTable - with TableInfo<$MetadataPluginsTableTable, MetadataPluginsTableData> { +class $PluginsTableTable extends PluginsTable + with TableInfo<$PluginsTableTable, PluginsTableData> { @override final GeneratedDatabase attachedDatabase; final String? _alias; - $MetadataPluginsTableTable(this.attachedDatabase, [this._alias]); + $PluginsTableTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( @@ -3790,24 +3557,32 @@ class $MetadataPluginsTableTable extends MetadataPluginsTable late final GeneratedColumnWithTypeConverter, String> apis = GeneratedColumn('apis', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter>( - $MetadataPluginsTableTable.$converterapis); + .withConverter>($PluginsTableTable.$converterapis); @override late final GeneratedColumnWithTypeConverter, String> abilities = GeneratedColumn('abilities', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true) - .withConverter>( - $MetadataPluginsTableTable.$converterabilities); - static const VerificationMeta _selectedMeta = - const VerificationMeta('selected'); + .withConverter>($PluginsTableTable.$converterabilities); + static const VerificationMeta _selectedForMetadataMeta = + const VerificationMeta('selectedForMetadata'); @override - late final GeneratedColumn selected = GeneratedColumn( - 'selected', aliasedName, false, + late final GeneratedColumn selectedForMetadata = GeneratedColumn( + 'selected_for_metadata', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, - defaultConstraints: - GeneratedColumn.constraintIsAlways('CHECK ("selected" IN (0, 1))'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("selected_for_metadata" IN (0, 1))'), defaultValue: const Constant(false)); + static const VerificationMeta _selectedForAudioSourceMeta = + const VerificationMeta('selectedForAudioSource'); + @override + late final GeneratedColumn selectedForAudioSource = + GeneratedColumn('selected_for_audio_source', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("selected_for_audio_source" IN (0, 1))'), + defaultValue: const Constant(false)); static const VerificationMeta _repositoryMeta = const VerificationMeta('repository'); @override @@ -3821,7 +3596,7 @@ class $MetadataPluginsTableTable extends MetadataPluginsTable 'plugin_api_version', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, - defaultValue: const Constant('1.0.0')); + defaultValue: const Constant('2.0.0')); @override List get $columns => [ id, @@ -3832,7 +3607,8 @@ class $MetadataPluginsTableTable extends MetadataPluginsTable entryPoint, apis, abilities, - selected, + selectedForMetadata, + selectedForAudioSource, repository, pluginApiVersion ]; @@ -3840,10 +3616,9 @@ class $MetadataPluginsTableTable extends MetadataPluginsTable String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; - static const String $name = 'metadata_plugins_table'; + static const String $name = 'plugins_table'; @override - VerificationContext validateIntegrity( - Insertable instance, + VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); @@ -3884,9 +3659,17 @@ class $MetadataPluginsTableTable extends MetadataPluginsTable } else if (isInserting) { context.missing(_entryPointMeta); } - if (data.containsKey('selected')) { - context.handle(_selectedMeta, - selected.isAcceptableOrUnknown(data['selected']!, _selectedMeta)); + if (data.containsKey('selected_for_metadata')) { + context.handle( + _selectedForMetadataMeta, + selectedForMetadata.isAcceptableOrUnknown( + data['selected_for_metadata']!, _selectedForMetadataMeta)); + } + if (data.containsKey('selected_for_audio_source')) { + context.handle( + _selectedForAudioSourceMeta, + selectedForAudioSource.isAcceptableOrUnknown( + data['selected_for_audio_source']!, _selectedForAudioSourceMeta)); } if (data.containsKey('repository')) { context.handle( @@ -3906,10 +3689,9 @@ class $MetadataPluginsTableTable extends MetadataPluginsTable @override Set get $primaryKey => {id}; @override - MetadataPluginsTableData map(Map data, - {String? tablePrefix}) { + PluginsTableData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; - return MetadataPluginsTableData( + return PluginsTableData( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, name: attachedDatabase.typeMapping @@ -3922,14 +3704,17 @@ class $MetadataPluginsTableTable extends MetadataPluginsTable .read(DriftSqlType.string, data['${effectivePrefix}author'])!, entryPoint: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}entry_point'])!, - apis: $MetadataPluginsTableTable.$converterapis.fromSql(attachedDatabase + apis: $PluginsTableTable.$converterapis.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}apis'])!), - abilities: $MetadataPluginsTableTable.$converterabilities.fromSql( - attachedDatabase.typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}abilities'])!), - selected: attachedDatabase.typeMapping - .read(DriftSqlType.bool, data['${effectivePrefix}selected'])!, + abilities: $PluginsTableTable.$converterabilities.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}abilities'])!), + selectedForMetadata: attachedDatabase.typeMapping.read( + DriftSqlType.bool, data['${effectivePrefix}selected_for_metadata'])!, + selectedForAudioSource: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}selected_for_audio_source'])!, repository: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}repository']), pluginApiVersion: attachedDatabase.typeMapping.read( @@ -3938,8 +3723,8 @@ class $MetadataPluginsTableTable extends MetadataPluginsTable } @override - $MetadataPluginsTableTable createAlias(String alias) { - return $MetadataPluginsTableTable(attachedDatabase, alias); + $PluginsTableTable createAlias(String alias) { + return $PluginsTableTable(attachedDatabase, alias); } static TypeConverter, String> $converterapis = @@ -3948,8 +3733,8 @@ class $MetadataPluginsTableTable extends MetadataPluginsTable const StringListConverter(); } -class MetadataPluginsTableData extends DataClass - implements Insertable { +class PluginsTableData extends DataClass + implements Insertable { final int id; final String name; final String description; @@ -3958,10 +3743,11 @@ class MetadataPluginsTableData extends DataClass final String entryPoint; final List apis; final List abilities; - final bool selected; + final bool selectedForMetadata; + final bool selectedForAudioSource; final String? repository; final String pluginApiVersion; - const MetadataPluginsTableData( + const PluginsTableData( {required this.id, required this.name, required this.description, @@ -3970,7 +3756,8 @@ class MetadataPluginsTableData extends DataClass required this.entryPoint, required this.apis, required this.abilities, - required this.selected, + required this.selectedForMetadata, + required this.selectedForAudioSource, this.repository, required this.pluginApiVersion}); @override @@ -3983,14 +3770,15 @@ class MetadataPluginsTableData extends DataClass map['author'] = Variable(author); map['entry_point'] = Variable(entryPoint); { - map['apis'] = Variable( - $MetadataPluginsTableTable.$converterapis.toSql(apis)); + map['apis'] = + Variable($PluginsTableTable.$converterapis.toSql(apis)); } { map['abilities'] = Variable( - $MetadataPluginsTableTable.$converterabilities.toSql(abilities)); + $PluginsTableTable.$converterabilities.toSql(abilities)); } - map['selected'] = Variable(selected); + map['selected_for_metadata'] = Variable(selectedForMetadata); + map['selected_for_audio_source'] = Variable(selectedForAudioSource); if (!nullToAbsent || repository != null) { map['repository'] = Variable(repository); } @@ -3998,8 +3786,8 @@ class MetadataPluginsTableData extends DataClass return map; } - MetadataPluginsTableCompanion toCompanion(bool nullToAbsent) { - return MetadataPluginsTableCompanion( + PluginsTableCompanion toCompanion(bool nullToAbsent) { + return PluginsTableCompanion( id: Value(id), name: Value(name), description: Value(description), @@ -4008,7 +3796,8 @@ class MetadataPluginsTableData extends DataClass entryPoint: Value(entryPoint), apis: Value(apis), abilities: Value(abilities), - selected: Value(selected), + selectedForMetadata: Value(selectedForMetadata), + selectedForAudioSource: Value(selectedForAudioSource), repository: repository == null && nullToAbsent ? const Value.absent() : Value(repository), @@ -4016,10 +3805,10 @@ class MetadataPluginsTableData extends DataClass ); } - factory MetadataPluginsTableData.fromJson(Map json, + factory PluginsTableData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; - return MetadataPluginsTableData( + return PluginsTableData( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), description: serializer.fromJson(json['description']), @@ -4028,7 +3817,10 @@ class MetadataPluginsTableData extends DataClass entryPoint: serializer.fromJson(json['entryPoint']), apis: serializer.fromJson>(json['apis']), abilities: serializer.fromJson>(json['abilities']), - selected: serializer.fromJson(json['selected']), + selectedForMetadata: + serializer.fromJson(json['selectedForMetadata']), + selectedForAudioSource: + serializer.fromJson(json['selectedForAudioSource']), repository: serializer.fromJson(json['repository']), pluginApiVersion: serializer.fromJson(json['pluginApiVersion']), ); @@ -4045,13 +3837,14 @@ class MetadataPluginsTableData extends DataClass 'entryPoint': serializer.toJson(entryPoint), 'apis': serializer.toJson>(apis), 'abilities': serializer.toJson>(abilities), - 'selected': serializer.toJson(selected), + 'selectedForMetadata': serializer.toJson(selectedForMetadata), + 'selectedForAudioSource': serializer.toJson(selectedForAudioSource), 'repository': serializer.toJson(repository), 'pluginApiVersion': serializer.toJson(pluginApiVersion), }; } - MetadataPluginsTableData copyWith( + PluginsTableData copyWith( {int? id, String? name, String? description, @@ -4060,10 +3853,11 @@ class MetadataPluginsTableData extends DataClass String? entryPoint, List? apis, List? abilities, - bool? selected, + bool? selectedForMetadata, + bool? selectedForAudioSource, Value repository = const Value.absent(), String? pluginApiVersion}) => - MetadataPluginsTableData( + PluginsTableData( id: id ?? this.id, name: name ?? this.name, description: description ?? this.description, @@ -4072,13 +3866,14 @@ class MetadataPluginsTableData extends DataClass entryPoint: entryPoint ?? this.entryPoint, apis: apis ?? this.apis, abilities: abilities ?? this.abilities, - selected: selected ?? this.selected, + selectedForMetadata: selectedForMetadata ?? this.selectedForMetadata, + selectedForAudioSource: + selectedForAudioSource ?? this.selectedForAudioSource, repository: repository.present ? repository.value : this.repository, pluginApiVersion: pluginApiVersion ?? this.pluginApiVersion, ); - MetadataPluginsTableData copyWithCompanion( - MetadataPluginsTableCompanion data) { - return MetadataPluginsTableData( + PluginsTableData copyWithCompanion(PluginsTableCompanion data) { + return PluginsTableData( id: data.id.present ? data.id.value : this.id, name: data.name.present ? data.name.value : this.name, description: @@ -4089,7 +3884,12 @@ class MetadataPluginsTableData extends DataClass data.entryPoint.present ? data.entryPoint.value : this.entryPoint, apis: data.apis.present ? data.apis.value : this.apis, abilities: data.abilities.present ? data.abilities.value : this.abilities, - selected: data.selected.present ? data.selected.value : this.selected, + selectedForMetadata: data.selectedForMetadata.present + ? data.selectedForMetadata.value + : this.selectedForMetadata, + selectedForAudioSource: data.selectedForAudioSource.present + ? data.selectedForAudioSource.value + : this.selectedForAudioSource, repository: data.repository.present ? data.repository.value : this.repository, pluginApiVersion: data.pluginApiVersion.present @@ -4100,7 +3900,7 @@ class MetadataPluginsTableData extends DataClass @override String toString() { - return (StringBuffer('MetadataPluginsTableData(') + return (StringBuffer('PluginsTableData(') ..write('id: $id, ') ..write('name: $name, ') ..write('description: $description, ') @@ -4109,7 +3909,8 @@ class MetadataPluginsTableData extends DataClass ..write('entryPoint: $entryPoint, ') ..write('apis: $apis, ') ..write('abilities: $abilities, ') - ..write('selected: $selected, ') + ..write('selectedForMetadata: $selectedForMetadata, ') + ..write('selectedForAudioSource: $selectedForAudioSource, ') ..write('repository: $repository, ') ..write('pluginApiVersion: $pluginApiVersion') ..write(')')) @@ -4117,12 +3918,23 @@ class MetadataPluginsTableData extends DataClass } @override - int get hashCode => Object.hash(id, name, description, version, author, - entryPoint, apis, abilities, selected, repository, pluginApiVersion); + int get hashCode => Object.hash( + id, + name, + description, + version, + author, + entryPoint, + apis, + abilities, + selectedForMetadata, + selectedForAudioSource, + repository, + pluginApiVersion); @override bool operator ==(Object other) => identical(this, other) || - (other is MetadataPluginsTableData && + (other is PluginsTableData && other.id == this.id && other.name == this.name && other.description == this.description && @@ -4131,13 +3943,13 @@ class MetadataPluginsTableData extends DataClass other.entryPoint == this.entryPoint && other.apis == this.apis && other.abilities == this.abilities && - other.selected == this.selected && + other.selectedForMetadata == this.selectedForMetadata && + other.selectedForAudioSource == this.selectedForAudioSource && other.repository == this.repository && other.pluginApiVersion == this.pluginApiVersion); } -class MetadataPluginsTableCompanion - extends UpdateCompanion { +class PluginsTableCompanion extends UpdateCompanion { final Value id; final Value name; final Value description; @@ -4146,10 +3958,11 @@ class MetadataPluginsTableCompanion final Value entryPoint; final Value> apis; final Value> abilities; - final Value selected; + final Value selectedForMetadata; + final Value selectedForAudioSource; final Value repository; final Value pluginApiVersion; - const MetadataPluginsTableCompanion({ + const PluginsTableCompanion({ this.id = const Value.absent(), this.name = const Value.absent(), this.description = const Value.absent(), @@ -4158,11 +3971,12 @@ class MetadataPluginsTableCompanion this.entryPoint = const Value.absent(), this.apis = const Value.absent(), this.abilities = const Value.absent(), - this.selected = const Value.absent(), + this.selectedForMetadata = const Value.absent(), + this.selectedForAudioSource = const Value.absent(), this.repository = const Value.absent(), this.pluginApiVersion = const Value.absent(), }); - MetadataPluginsTableCompanion.insert({ + PluginsTableCompanion.insert({ this.id = const Value.absent(), required String name, required String description, @@ -4171,7 +3985,8 @@ class MetadataPluginsTableCompanion required String entryPoint, required List apis, required List abilities, - this.selected = const Value.absent(), + this.selectedForMetadata = const Value.absent(), + this.selectedForAudioSource = const Value.absent(), this.repository = const Value.absent(), this.pluginApiVersion = const Value.absent(), }) : name = Value(name), @@ -4181,7 +3996,7 @@ class MetadataPluginsTableCompanion entryPoint = Value(entryPoint), apis = Value(apis), abilities = Value(abilities); - static Insertable custom({ + static Insertable custom({ Expression? id, Expression? name, Expression? description, @@ -4190,7 +4005,8 @@ class MetadataPluginsTableCompanion Expression? entryPoint, Expression? apis, Expression? abilities, - Expression? selected, + Expression? selectedForMetadata, + Expression? selectedForAudioSource, Expression? repository, Expression? pluginApiVersion, }) { @@ -4203,13 +4019,16 @@ class MetadataPluginsTableCompanion if (entryPoint != null) 'entry_point': entryPoint, if (apis != null) 'apis': apis, if (abilities != null) 'abilities': abilities, - if (selected != null) 'selected': selected, + if (selectedForMetadata != null) + 'selected_for_metadata': selectedForMetadata, + if (selectedForAudioSource != null) + 'selected_for_audio_source': selectedForAudioSource, if (repository != null) 'repository': repository, if (pluginApiVersion != null) 'plugin_api_version': pluginApiVersion, }); } - MetadataPluginsTableCompanion copyWith( + PluginsTableCompanion copyWith( {Value? id, Value? name, Value? description, @@ -4218,10 +4037,11 @@ class MetadataPluginsTableCompanion Value? entryPoint, Value>? apis, Value>? abilities, - Value? selected, + Value? selectedForMetadata, + Value? selectedForAudioSource, Value? repository, Value? pluginApiVersion}) { - return MetadataPluginsTableCompanion( + return PluginsTableCompanion( id: id ?? this.id, name: name ?? this.name, description: description ?? this.description, @@ -4230,7 +4050,9 @@ class MetadataPluginsTableCompanion entryPoint: entryPoint ?? this.entryPoint, apis: apis ?? this.apis, abilities: abilities ?? this.abilities, - selected: selected ?? this.selected, + selectedForMetadata: selectedForMetadata ?? this.selectedForMetadata, + selectedForAudioSource: + selectedForAudioSource ?? this.selectedForAudioSource, repository: repository ?? this.repository, pluginApiVersion: pluginApiVersion ?? this.pluginApiVersion, ); @@ -4258,16 +4080,19 @@ class MetadataPluginsTableCompanion map['entry_point'] = Variable(entryPoint.value); } if (apis.present) { - map['apis'] = Variable( - $MetadataPluginsTableTable.$converterapis.toSql(apis.value)); + map['apis'] = + Variable($PluginsTableTable.$converterapis.toSql(apis.value)); } if (abilities.present) { - map['abilities'] = Variable($MetadataPluginsTableTable - .$converterabilities - .toSql(abilities.value)); + map['abilities'] = Variable( + $PluginsTableTable.$converterabilities.toSql(abilities.value)); } - if (selected.present) { - map['selected'] = Variable(selected.value); + if (selectedForMetadata.present) { + map['selected_for_metadata'] = Variable(selectedForMetadata.value); + } + if (selectedForAudioSource.present) { + map['selected_for_audio_source'] = + Variable(selectedForAudioSource.value); } if (repository.present) { map['repository'] = Variable(repository.value); @@ -4280,7 +4105,7 @@ class MetadataPluginsTableCompanion @override String toString() { - return (StringBuffer('MetadataPluginsTableCompanion(') + return (StringBuffer('PluginsTableCompanion(') ..write('id: $id, ') ..write('name: $name, ') ..write('description: $description, ') @@ -4289,7 +4114,8 @@ class MetadataPluginsTableCompanion ..write('entryPoint: $entryPoint, ') ..write('apis: $apis, ') ..write('abilities: $abilities, ') - ..write('selected: $selected, ') + ..write('selectedForMetadata: $selectedForMetadata, ') + ..write('selectedForAudioSource: $selectedForAudioSource, ') ..write('repository: $repository, ') ..write('pluginApiVersion: $pluginApiVersion') ..write(')')) @@ -4314,12 +4140,9 @@ abstract class _$AppDatabase extends GeneratedDatabase { $AudioPlayerStateTableTable(this); late final $HistoryTableTable historyTable = $HistoryTableTable(this); late final $LyricsTableTable lyricsTable = $LyricsTableTable(this); - late final $MetadataPluginsTableTable metadataPluginsTable = - $MetadataPluginsTableTable(this); + late final $PluginsTableTable pluginsTable = $PluginsTableTable(this); late final Index uniqueBlacklist = Index('unique_blacklist', 'CREATE UNIQUE INDEX unique_blacklist ON blacklist_table (element_type, element_id)'); - late final Index uniqTrackMatch = Index('uniq_track_match', - 'CREATE UNIQUE INDEX uniq_track_match ON source_match_table (track_id, source_id, source_type)'); @override Iterable> get allTables => allSchemaEntities.whereType>(); @@ -4334,9 +4157,8 @@ abstract class _$AppDatabase extends GeneratedDatabase { audioPlayerStateTable, historyTable, lyricsTable, - metadataPluginsTable, - uniqueBlacklist, - uniqTrackMatch + pluginsTable, + uniqueBlacklist ]; } @@ -4661,7 +4483,6 @@ typedef $$BlacklistTableTableProcessedTableManager = ProcessedTableManager< typedef $$PreferencesTableTableCreateCompanionBuilder = PreferencesTableCompanion Function({ Value id, - Value audioQuality, Value albumColorSync, Value amoledDarkTheme, Value checkUpdate, @@ -4677,13 +4498,9 @@ typedef $$PreferencesTableTableCreateCompanionBuilder Value searchMode, Value downloadLocation, Value> localLibraryLocation, - Value pipedInstance, - Value invidiousInstance, Value themeMode, - Value audioSource, + Value audioSourceId, Value youtubeClientEngine, - Value streamMusicCodec, - Value downloadMusicCodec, Value discordPresence, Value endlessPlayback, Value enableConnect, @@ -4693,7 +4510,6 @@ typedef $$PreferencesTableTableCreateCompanionBuilder typedef $$PreferencesTableTableUpdateCompanionBuilder = PreferencesTableCompanion Function({ Value id, - Value audioQuality, Value albumColorSync, Value amoledDarkTheme, Value checkUpdate, @@ -4709,13 +4525,9 @@ typedef $$PreferencesTableTableUpdateCompanionBuilder Value searchMode, Value downloadLocation, Value> localLibraryLocation, - Value pipedInstance, - Value invidiousInstance, Value themeMode, - Value audioSource, + Value audioSourceId, Value youtubeClientEngine, - Value streamMusicCodec, - Value downloadMusicCodec, Value discordPresence, Value endlessPlayback, Value enableConnect, @@ -4735,11 +4547,6 @@ class $$PreferencesTableTableFilterComposer ColumnFilters get id => $composableBuilder( column: $table.id, builder: (column) => ColumnFilters(column)); - ColumnWithTypeConverterFilters - get audioQuality => $composableBuilder( - column: $table.audioQuality, - builder: (column) => ColumnWithTypeConverterFilters(column)); - ColumnFilters get albumColorSync => $composableBuilder( column: $table.albumColorSync, builder: (column) => ColumnFilters(column)); @@ -4805,22 +4612,13 @@ class $$PreferencesTableTableFilterComposer column: $table.localLibraryLocation, builder: (column) => ColumnWithTypeConverterFilters(column)); - ColumnFilters get pipedInstance => $composableBuilder( - column: $table.pipedInstance, builder: (column) => ColumnFilters(column)); - - ColumnFilters get invidiousInstance => $composableBuilder( - column: $table.invidiousInstance, - builder: (column) => ColumnFilters(column)); - ColumnWithTypeConverterFilters get themeMode => $composableBuilder( column: $table.themeMode, builder: (column) => ColumnWithTypeConverterFilters(column)); - ColumnWithTypeConverterFilters - get audioSource => $composableBuilder( - column: $table.audioSource, - builder: (column) => ColumnWithTypeConverterFilters(column)); + ColumnFilters get audioSourceId => $composableBuilder( + column: $table.audioSourceId, builder: (column) => ColumnFilters(column)); ColumnWithTypeConverterFilters @@ -4828,16 +4626,6 @@ class $$PreferencesTableTableFilterComposer column: $table.youtubeClientEngine, builder: (column) => ColumnWithTypeConverterFilters(column)); - ColumnWithTypeConverterFilters - get streamMusicCodec => $composableBuilder( - column: $table.streamMusicCodec, - builder: (column) => ColumnWithTypeConverterFilters(column)); - - ColumnWithTypeConverterFilters - get downloadMusicCodec => $composableBuilder( - column: $table.downloadMusicCodec, - builder: (column) => ColumnWithTypeConverterFilters(column)); - ColumnFilters get discordPresence => $composableBuilder( column: $table.discordPresence, builder: (column) => ColumnFilters(column)); @@ -4868,10 +4656,6 @@ class $$PreferencesTableTableOrderingComposer ColumnOrderings get id => $composableBuilder( column: $table.id, builder: (column) => ColumnOrderings(column)); - ColumnOrderings get audioQuality => $composableBuilder( - column: $table.audioQuality, - builder: (column) => ColumnOrderings(column)); - ColumnOrderings get albumColorSync => $composableBuilder( column: $table.albumColorSync, builder: (column) => ColumnOrderings(column)); @@ -4927,32 +4711,17 @@ class $$PreferencesTableTableOrderingComposer column: $table.localLibraryLocation, builder: (column) => ColumnOrderings(column)); - ColumnOrderings get pipedInstance => $composableBuilder( - column: $table.pipedInstance, - builder: (column) => ColumnOrderings(column)); - - ColumnOrderings get invidiousInstance => $composableBuilder( - column: $table.invidiousInstance, - builder: (column) => ColumnOrderings(column)); - ColumnOrderings get themeMode => $composableBuilder( column: $table.themeMode, builder: (column) => ColumnOrderings(column)); - ColumnOrderings get audioSource => $composableBuilder( - column: $table.audioSource, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get audioSourceId => $composableBuilder( + column: $table.audioSourceId, + builder: (column) => ColumnOrderings(column)); ColumnOrderings get youtubeClientEngine => $composableBuilder( column: $table.youtubeClientEngine, builder: (column) => ColumnOrderings(column)); - ColumnOrderings get streamMusicCodec => $composableBuilder( - column: $table.streamMusicCodec, - builder: (column) => ColumnOrderings(column)); - - ColumnOrderings get downloadMusicCodec => $composableBuilder( - column: $table.downloadMusicCodec, - builder: (column) => ColumnOrderings(column)); - ColumnOrderings get discordPresence => $composableBuilder( column: $table.discordPresence, builder: (column) => ColumnOrderings(column)); @@ -4984,10 +4753,6 @@ class $$PreferencesTableTableAnnotationComposer GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); - GeneratedColumnWithTypeConverter get audioQuality => - $composableBuilder( - column: $table.audioQuality, builder: (column) => column); - GeneratedColumn get albumColorSync => $composableBuilder( column: $table.albumColorSync, builder: (column) => column); @@ -5038,31 +4803,16 @@ class $$PreferencesTableTableAnnotationComposer get localLibraryLocation => $composableBuilder( column: $table.localLibraryLocation, builder: (column) => column); - GeneratedColumn get pipedInstance => $composableBuilder( - column: $table.pipedInstance, builder: (column) => column); - - GeneratedColumn get invidiousInstance => $composableBuilder( - column: $table.invidiousInstance, builder: (column) => column); - GeneratedColumnWithTypeConverter get themeMode => $composableBuilder(column: $table.themeMode, builder: (column) => column); - GeneratedColumnWithTypeConverter get audioSource => - $composableBuilder( - column: $table.audioSource, builder: (column) => column); + GeneratedColumn get audioSourceId => $composableBuilder( + column: $table.audioSourceId, builder: (column) => column); GeneratedColumnWithTypeConverter get youtubeClientEngine => $composableBuilder( column: $table.youtubeClientEngine, builder: (column) => column); - GeneratedColumnWithTypeConverter get streamMusicCodec => - $composableBuilder( - column: $table.streamMusicCodec, builder: (column) => column); - - GeneratedColumnWithTypeConverter - get downloadMusicCodec => $composableBuilder( - column: $table.downloadMusicCodec, builder: (column) => column); - GeneratedColumn get discordPresence => $composableBuilder( column: $table.discordPresence, builder: (column) => column); @@ -5108,7 +4858,6 @@ class $$PreferencesTableTableTableManager extends RootTableManager< $$PreferencesTableTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value id = const Value.absent(), - Value audioQuality = const Value.absent(), Value albumColorSync = const Value.absent(), Value amoledDarkTheme = const Value.absent(), Value checkUpdate = const Value.absent(), @@ -5124,14 +4873,10 @@ class $$PreferencesTableTableTableManager extends RootTableManager< Value searchMode = const Value.absent(), Value downloadLocation = const Value.absent(), Value> localLibraryLocation = const Value.absent(), - Value pipedInstance = const Value.absent(), - Value invidiousInstance = const Value.absent(), Value themeMode = const Value.absent(), - Value audioSource = const Value.absent(), + Value audioSourceId = const Value.absent(), Value youtubeClientEngine = const Value.absent(), - Value streamMusicCodec = const Value.absent(), - Value downloadMusicCodec = const Value.absent(), Value discordPresence = const Value.absent(), Value endlessPlayback = const Value.absent(), Value enableConnect = const Value.absent(), @@ -5140,7 +4885,6 @@ class $$PreferencesTableTableTableManager extends RootTableManager< }) => PreferencesTableCompanion( id: id, - audioQuality: audioQuality, albumColorSync: albumColorSync, amoledDarkTheme: amoledDarkTheme, checkUpdate: checkUpdate, @@ -5156,13 +4900,9 @@ class $$PreferencesTableTableTableManager extends RootTableManager< searchMode: searchMode, downloadLocation: downloadLocation, localLibraryLocation: localLibraryLocation, - pipedInstance: pipedInstance, - invidiousInstance: invidiousInstance, themeMode: themeMode, - audioSource: audioSource, + audioSourceId: audioSourceId, youtubeClientEngine: youtubeClientEngine, - streamMusicCodec: streamMusicCodec, - downloadMusicCodec: downloadMusicCodec, discordPresence: discordPresence, endlessPlayback: endlessPlayback, enableConnect: enableConnect, @@ -5171,7 +4911,6 @@ class $$PreferencesTableTableTableManager extends RootTableManager< ), createCompanionCallback: ({ Value id = const Value.absent(), - Value audioQuality = const Value.absent(), Value albumColorSync = const Value.absent(), Value amoledDarkTheme = const Value.absent(), Value checkUpdate = const Value.absent(), @@ -5187,14 +4926,10 @@ class $$PreferencesTableTableTableManager extends RootTableManager< Value searchMode = const Value.absent(), Value downloadLocation = const Value.absent(), Value> localLibraryLocation = const Value.absent(), - Value pipedInstance = const Value.absent(), - Value invidiousInstance = const Value.absent(), Value themeMode = const Value.absent(), - Value audioSource = const Value.absent(), + Value audioSourceId = const Value.absent(), Value youtubeClientEngine = const Value.absent(), - Value streamMusicCodec = const Value.absent(), - Value downloadMusicCodec = const Value.absent(), Value discordPresence = const Value.absent(), Value endlessPlayback = const Value.absent(), Value enableConnect = const Value.absent(), @@ -5203,7 +4938,6 @@ class $$PreferencesTableTableTableManager extends RootTableManager< }) => PreferencesTableCompanion.insert( id: id, - audioQuality: audioQuality, albumColorSync: albumColorSync, amoledDarkTheme: amoledDarkTheme, checkUpdate: checkUpdate, @@ -5219,13 +4953,9 @@ class $$PreferencesTableTableTableManager extends RootTableManager< searchMode: searchMode, downloadLocation: downloadLocation, localLibraryLocation: localLibraryLocation, - pipedInstance: pipedInstance, - invidiousInstance: invidiousInstance, themeMode: themeMode, - audioSource: audioSource, + audioSourceId: audioSourceId, youtubeClientEngine: youtubeClientEngine, - streamMusicCodec: streamMusicCodec, - downloadMusicCodec: downloadMusicCodec, discordPresence: discordPresence, endlessPlayback: endlessPlayback, enableConnect: enableConnect, @@ -5586,16 +5316,16 @@ typedef $$SourceMatchTableTableCreateCompanionBuilder = SourceMatchTableCompanion Function({ Value id, required String trackId, - required String sourceId, - Value sourceType, + Value sourceInfo, + required String sourceType, Value createdAt, }); typedef $$SourceMatchTableTableUpdateCompanionBuilder = SourceMatchTableCompanion Function({ Value id, Value trackId, - Value sourceId, - Value sourceType, + Value sourceInfo, + Value sourceType, Value createdAt, }); @@ -5614,13 +5344,11 @@ class $$SourceMatchTableTableFilterComposer ColumnFilters get trackId => $composableBuilder( column: $table.trackId, builder: (column) => ColumnFilters(column)); - ColumnFilters get sourceId => $composableBuilder( - column: $table.sourceId, builder: (column) => ColumnFilters(column)); + ColumnFilters get sourceInfo => $composableBuilder( + column: $table.sourceInfo, builder: (column) => ColumnFilters(column)); - ColumnWithTypeConverterFilters - get sourceType => $composableBuilder( - column: $table.sourceType, - builder: (column) => ColumnWithTypeConverterFilters(column)); + ColumnFilters get sourceType => $composableBuilder( + column: $table.sourceType, builder: (column) => ColumnFilters(column)); ColumnFilters get createdAt => $composableBuilder( column: $table.createdAt, builder: (column) => ColumnFilters(column)); @@ -5641,8 +5369,8 @@ class $$SourceMatchTableTableOrderingComposer ColumnOrderings get trackId => $composableBuilder( column: $table.trackId, builder: (column) => ColumnOrderings(column)); - ColumnOrderings get sourceId => $composableBuilder( - column: $table.sourceId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get sourceInfo => $composableBuilder( + column: $table.sourceInfo, builder: (column) => ColumnOrderings(column)); ColumnOrderings get sourceType => $composableBuilder( column: $table.sourceType, builder: (column) => ColumnOrderings(column)); @@ -5666,12 +5394,11 @@ class $$SourceMatchTableTableAnnotationComposer GeneratedColumn get trackId => $composableBuilder(column: $table.trackId, builder: (column) => column); - GeneratedColumn get sourceId => - $composableBuilder(column: $table.sourceId, builder: (column) => column); + GeneratedColumn get sourceInfo => $composableBuilder( + column: $table.sourceInfo, builder: (column) => column); - GeneratedColumnWithTypeConverter get sourceType => - $composableBuilder( - column: $table.sourceType, builder: (column) => column); + GeneratedColumn get sourceType => $composableBuilder( + column: $table.sourceType, builder: (column) => column); GeneratedColumn get createdAt => $composableBuilder(column: $table.createdAt, builder: (column) => column); @@ -5707,28 +5434,28 @@ class $$SourceMatchTableTableTableManager extends RootTableManager< updateCompanionCallback: ({ Value id = const Value.absent(), Value trackId = const Value.absent(), - Value sourceId = const Value.absent(), - Value sourceType = const Value.absent(), + Value sourceInfo = const Value.absent(), + Value sourceType = const Value.absent(), Value createdAt = const Value.absent(), }) => SourceMatchTableCompanion( id: id, trackId: trackId, - sourceId: sourceId, + sourceInfo: sourceInfo, sourceType: sourceType, createdAt: createdAt, ), createCompanionCallback: ({ Value id = const Value.absent(), required String trackId, - required String sourceId, - Value sourceType = const Value.absent(), + Value sourceInfo = const Value.absent(), + required String sourceType, Value createdAt = const Value.absent(), }) => SourceMatchTableCompanion.insert( id: id, trackId: trackId, - sourceId: sourceId, + sourceInfo: sourceInfo, sourceType: sourceType, createdAt: createdAt, ), @@ -6280,8 +6007,8 @@ typedef $$LyricsTableTableProcessedTableManager = ProcessedTableManager< ), LyricsTableData, PrefetchHooks Function()>; -typedef $$MetadataPluginsTableTableCreateCompanionBuilder - = MetadataPluginsTableCompanion Function({ +typedef $$PluginsTableTableCreateCompanionBuilder = PluginsTableCompanion + Function({ Value id, required String name, required String description, @@ -6290,12 +6017,13 @@ typedef $$MetadataPluginsTableTableCreateCompanionBuilder required String entryPoint, required List apis, required List abilities, - Value selected, + Value selectedForMetadata, + Value selectedForAudioSource, Value repository, Value pluginApiVersion, }); -typedef $$MetadataPluginsTableTableUpdateCompanionBuilder - = MetadataPluginsTableCompanion Function({ +typedef $$PluginsTableTableUpdateCompanionBuilder = PluginsTableCompanion + Function({ Value id, Value name, Value description, @@ -6304,14 +6032,15 @@ typedef $$MetadataPluginsTableTableUpdateCompanionBuilder Value entryPoint, Value> apis, Value> abilities, - Value selected, + Value selectedForMetadata, + Value selectedForAudioSource, Value repository, Value pluginApiVersion, }); -class $$MetadataPluginsTableTableFilterComposer - extends Composer<_$AppDatabase, $MetadataPluginsTableTable> { - $$MetadataPluginsTableTableFilterComposer({ +class $$PluginsTableTableFilterComposer + extends Composer<_$AppDatabase, $PluginsTableTable> { + $$PluginsTableTableFilterComposer({ required super.$db, required super.$table, super.joinBuilder, @@ -6346,8 +6075,13 @@ class $$MetadataPluginsTableTableFilterComposer column: $table.abilities, builder: (column) => ColumnWithTypeConverterFilters(column)); - ColumnFilters get selected => $composableBuilder( - column: $table.selected, builder: (column) => ColumnFilters(column)); + ColumnFilters get selectedForMetadata => $composableBuilder( + column: $table.selectedForMetadata, + builder: (column) => ColumnFilters(column)); + + ColumnFilters get selectedForAudioSource => $composableBuilder( + column: $table.selectedForAudioSource, + builder: (column) => ColumnFilters(column)); ColumnFilters get repository => $composableBuilder( column: $table.repository, builder: (column) => ColumnFilters(column)); @@ -6357,9 +6091,9 @@ class $$MetadataPluginsTableTableFilterComposer builder: (column) => ColumnFilters(column)); } -class $$MetadataPluginsTableTableOrderingComposer - extends Composer<_$AppDatabase, $MetadataPluginsTableTable> { - $$MetadataPluginsTableTableOrderingComposer({ +class $$PluginsTableTableOrderingComposer + extends Composer<_$AppDatabase, $PluginsTableTable> { + $$PluginsTableTableOrderingComposer({ required super.$db, required super.$table, super.joinBuilder, @@ -6390,8 +6124,13 @@ class $$MetadataPluginsTableTableOrderingComposer ColumnOrderings get abilities => $composableBuilder( column: $table.abilities, builder: (column) => ColumnOrderings(column)); - ColumnOrderings get selected => $composableBuilder( - column: $table.selected, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get selectedForMetadata => $composableBuilder( + column: $table.selectedForMetadata, + builder: (column) => ColumnOrderings(column)); + + ColumnOrderings get selectedForAudioSource => $composableBuilder( + column: $table.selectedForAudioSource, + builder: (column) => ColumnOrderings(column)); ColumnOrderings get repository => $composableBuilder( column: $table.repository, builder: (column) => ColumnOrderings(column)); @@ -6401,9 +6140,9 @@ class $$MetadataPluginsTableTableOrderingComposer builder: (column) => ColumnOrderings(column)); } -class $$MetadataPluginsTableTableAnnotationComposer - extends Composer<_$AppDatabase, $MetadataPluginsTableTable> { - $$MetadataPluginsTableTableAnnotationComposer({ +class $$PluginsTableTableAnnotationComposer + extends Composer<_$AppDatabase, $PluginsTableTable> { + $$PluginsTableTableAnnotationComposer({ required super.$db, required super.$table, super.joinBuilder, @@ -6434,8 +6173,11 @@ class $$MetadataPluginsTableTableAnnotationComposer GeneratedColumnWithTypeConverter, String> get abilities => $composableBuilder(column: $table.abilities, builder: (column) => column); - GeneratedColumn get selected => - $composableBuilder(column: $table.selected, builder: (column) => column); + GeneratedColumn get selectedForMetadata => $composableBuilder( + column: $table.selectedForMetadata, builder: (column) => column); + + GeneratedColumn get selectedForAudioSource => $composableBuilder( + column: $table.selectedForAudioSource, builder: (column) => column); GeneratedColumn get repository => $composableBuilder( column: $table.repository, builder: (column) => column); @@ -6444,35 +6186,31 @@ class $$MetadataPluginsTableTableAnnotationComposer column: $table.pluginApiVersion, builder: (column) => column); } -class $$MetadataPluginsTableTableTableManager extends RootTableManager< +class $$PluginsTableTableTableManager extends RootTableManager< _$AppDatabase, - $MetadataPluginsTableTable, - MetadataPluginsTableData, - $$MetadataPluginsTableTableFilterComposer, - $$MetadataPluginsTableTableOrderingComposer, - $$MetadataPluginsTableTableAnnotationComposer, - $$MetadataPluginsTableTableCreateCompanionBuilder, - $$MetadataPluginsTableTableUpdateCompanionBuilder, + $PluginsTableTable, + PluginsTableData, + $$PluginsTableTableFilterComposer, + $$PluginsTableTableOrderingComposer, + $$PluginsTableTableAnnotationComposer, + $$PluginsTableTableCreateCompanionBuilder, + $$PluginsTableTableUpdateCompanionBuilder, ( - MetadataPluginsTableData, - BaseReferences<_$AppDatabase, $MetadataPluginsTableTable, - MetadataPluginsTableData> + PluginsTableData, + BaseReferences<_$AppDatabase, $PluginsTableTable, PluginsTableData> ), - MetadataPluginsTableData, + PluginsTableData, PrefetchHooks Function()> { - $$MetadataPluginsTableTableTableManager( - _$AppDatabase db, $MetadataPluginsTableTable table) + $$PluginsTableTableTableManager(_$AppDatabase db, $PluginsTableTable table) : super(TableManagerState( db: db, table: table, createFilteringComposer: () => - $$MetadataPluginsTableTableFilterComposer($db: db, $table: table), + $$PluginsTableTableFilterComposer($db: db, $table: table), createOrderingComposer: () => - $$MetadataPluginsTableTableOrderingComposer( - $db: db, $table: table), + $$PluginsTableTableOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => - $$MetadataPluginsTableTableAnnotationComposer( - $db: db, $table: table), + $$PluginsTableTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value id = const Value.absent(), Value name = const Value.absent(), @@ -6482,11 +6220,12 @@ class $$MetadataPluginsTableTableTableManager extends RootTableManager< Value entryPoint = const Value.absent(), Value> apis = const Value.absent(), Value> abilities = const Value.absent(), - Value selected = const Value.absent(), + Value selectedForMetadata = const Value.absent(), + Value selectedForAudioSource = const Value.absent(), Value repository = const Value.absent(), Value pluginApiVersion = const Value.absent(), }) => - MetadataPluginsTableCompanion( + PluginsTableCompanion( id: id, name: name, description: description, @@ -6495,7 +6234,8 @@ class $$MetadataPluginsTableTableTableManager extends RootTableManager< entryPoint: entryPoint, apis: apis, abilities: abilities, - selected: selected, + selectedForMetadata: selectedForMetadata, + selectedForAudioSource: selectedForAudioSource, repository: repository, pluginApiVersion: pluginApiVersion, ), @@ -6508,11 +6248,12 @@ class $$MetadataPluginsTableTableTableManager extends RootTableManager< required String entryPoint, required List apis, required List abilities, - Value selected = const Value.absent(), + Value selectedForMetadata = const Value.absent(), + Value selectedForAudioSource = const Value.absent(), Value repository = const Value.absent(), Value pluginApiVersion = const Value.absent(), }) => - MetadataPluginsTableCompanion.insert( + PluginsTableCompanion.insert( id: id, name: name, description: description, @@ -6521,7 +6262,8 @@ class $$MetadataPluginsTableTableTableManager extends RootTableManager< entryPoint: entryPoint, apis: apis, abilities: abilities, - selected: selected, + selectedForMetadata: selectedForMetadata, + selectedForAudioSource: selectedForAudioSource, repository: repository, pluginApiVersion: pluginApiVersion, ), @@ -6532,23 +6274,21 @@ class $$MetadataPluginsTableTableTableManager extends RootTableManager< )); } -typedef $$MetadataPluginsTableTableProcessedTableManager - = ProcessedTableManager< - _$AppDatabase, - $MetadataPluginsTableTable, - MetadataPluginsTableData, - $$MetadataPluginsTableTableFilterComposer, - $$MetadataPluginsTableTableOrderingComposer, - $$MetadataPluginsTableTableAnnotationComposer, - $$MetadataPluginsTableTableCreateCompanionBuilder, - $$MetadataPluginsTableTableUpdateCompanionBuilder, - ( - MetadataPluginsTableData, - BaseReferences<_$AppDatabase, $MetadataPluginsTableTable, - MetadataPluginsTableData> - ), - MetadataPluginsTableData, - PrefetchHooks Function()>; +typedef $$PluginsTableTableProcessedTableManager = ProcessedTableManager< + _$AppDatabase, + $PluginsTableTable, + PluginsTableData, + $$PluginsTableTableFilterComposer, + $$PluginsTableTableOrderingComposer, + $$PluginsTableTableAnnotationComposer, + $$PluginsTableTableCreateCompanionBuilder, + $$PluginsTableTableUpdateCompanionBuilder, + ( + PluginsTableData, + BaseReferences<_$AppDatabase, $PluginsTableTable, PluginsTableData> + ), + PluginsTableData, + PrefetchHooks Function()>; class $AppDatabaseManager { final _$AppDatabase _db; @@ -6571,6 +6311,6 @@ class $AppDatabaseManager { $$HistoryTableTableTableManager(_db, _db.historyTable); $$LyricsTableTableTableManager get lyricsTable => $$LyricsTableTableTableManager(_db, _db.lyricsTable); - $$MetadataPluginsTableTableTableManager get metadataPluginsTable => - $$MetadataPluginsTableTableTableManager(_db, _db.metadataPluginsTable); + $$PluginsTableTableTableManager get pluginsTable => + $$PluginsTableTableTableManager(_db, _db.pluginsTable); } diff --git a/lib/models/database/database.steps.dart b/lib/models/database/database.steps.dart index a228f5a7..42cbdf6d 100644 --- a/lib/models/database/database.steps.dart +++ b/lib/models/database/database.steps.dart @@ -1,10 +1,10 @@ +// dart format width=80 import 'package:drift/internal/versioned_schema.dart' as i0; import 'package:drift/drift.dart' as i1; import 'package:drift/drift.dart'; // ignore_for_file: type=lint,unused_import import 'package:flutter/material.dart'; import 'package:spotube/models/database/database.dart'; import 'package:spotube/models/metadata/market.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; // GENERATED BY drift_dev, DO NOT MODIFY. final class Schema2 extends i0.VersionedSchema { @@ -329,8 +329,7 @@ class Shape2 extends i0.VersionedTable { i1.GeneratedColumn _column_7(String aliasedName) => i1.GeneratedColumn('audio_quality', aliasedName, false, - type: i1.DriftSqlType.string, - defaultValue: Constant(SourceQualities.high.name)); + type: i1.DriftSqlType.string, defaultValue: Constant("high")); i1.GeneratedColumn _column_8(String aliasedName) => i1.GeneratedColumn('album_color_sync', aliasedName, false, type: i1.DriftSqlType.bool, @@ -417,16 +416,13 @@ i1.GeneratedColumn _column_25(String aliasedName) => defaultValue: Constant(ThemeMode.system.name)); i1.GeneratedColumn _column_26(String aliasedName) => i1.GeneratedColumn('audio_source', aliasedName, false, - type: i1.DriftSqlType.string, - defaultValue: Constant(AudioSource.youtube.name)); + type: i1.DriftSqlType.string, defaultValue: Constant("youtube")); i1.GeneratedColumn _column_27(String aliasedName) => i1.GeneratedColumn('stream_music_codec', aliasedName, false, - type: i1.DriftSqlType.string, - defaultValue: Constant(SourceCodecs.weba.name)); + type: i1.DriftSqlType.string, defaultValue: Constant("weba")); i1.GeneratedColumn _column_28(String aliasedName) => i1.GeneratedColumn('download_music_codec', aliasedName, false, - type: i1.DriftSqlType.string, - defaultValue: Constant(SourceCodecs.m4a.name)); + type: i1.DriftSqlType.string, defaultValue: Constant("m4a")); i1.GeneratedColumn _column_29(String aliasedName) => i1.GeneratedColumn('discord_presence', aliasedName, false, type: i1.DriftSqlType.bool, @@ -511,8 +507,7 @@ i1.GeneratedColumn _column_38(String aliasedName) => type: i1.DriftSqlType.string); i1.GeneratedColumn _column_39(String aliasedName) => i1.GeneratedColumn('source_type', aliasedName, false, - type: i1.DriftSqlType.string, - defaultValue: Constant(SourceType.youtube.name)); + type: i1.DriftSqlType.string, defaultValue: Constant("youtube")); class Shape6 extends i0.VersionedTable { Shape6({required super.source, required super.alias}) : super.aliased(); @@ -1407,7 +1402,7 @@ final class Schema5 extends i0.VersionedSchema { i1.GeneratedColumn _column_55(String aliasedName) => i1.GeneratedColumn('accent_color_scheme', aliasedName, false, type: i1.DriftSqlType.string, - defaultValue: const Constant("Slate:0xff64748b")); + defaultValue: const Constant("Orange:0xFFf97315")); final class Schema6 extends i0.VersionedSchema { Schema6({required super.database}) : super(version: 6); @@ -2053,7 +2048,7 @@ final class Schema8 extends i0.VersionedSchema { _column_13, _column_14, _column_15, - _column_55, + _column_69, _column_17, _column_18, _column_19, @@ -2188,7 +2183,7 @@ final class Schema8 extends i0.VersionedSchema { _column_65, _column_66, _column_67, - _column_69, + _column_70, ], attachedDatabase: database, ), @@ -2200,8 +2195,550 @@ final class Schema8 extends i0.VersionedSchema { } i1.GeneratedColumn _column_69(String aliasedName) => + i1.GeneratedColumn('accent_color_scheme', aliasedName, false, + type: i1.DriftSqlType.string, + defaultValue: const Constant("Slate:0xff64748b")); +i1.GeneratedColumn _column_70(String aliasedName) => i1.GeneratedColumn('plugin_api_version', aliasedName, false, type: i1.DriftSqlType.string, defaultValue: const Constant('1.0.0')); + +final class Schema9 extends i0.VersionedSchema { + Schema9({required super.database}) : super(version: 9); + @override + late final List entities = [ + authenticationTable, + blacklistTable, + preferencesTable, + scrobblerTable, + skipSegmentTable, + sourceMatchTable, + audioPlayerStateTable, + historyTable, + lyricsTable, + pluginsTable, + 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_15, + _column_69, + _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_56, + _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 Shape14 audioPlayerStateTable = Shape14( + source: i0.VersionedTable( + entityName: 'audio_player_state_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_41, + _column_42, + _column_43, + _column_57, + _column_58, + ], + 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); + late final Shape16 pluginsTable = Shape16( + source: i0.VersionedTable( + entityName: 'plugins_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_59, + _column_60, + _column_61, + _column_62, + _column_63, + _column_64, + _column_65, + _column_71, + _column_72, + _column_67, + _column_73, + ], + 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 Shape16 extends i0.VersionedTable { + Shape16({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get id => + columnsByName['id']! as i1.GeneratedColumn; + i1.GeneratedColumn get name => + columnsByName['name']! as i1.GeneratedColumn; + i1.GeneratedColumn get description => + columnsByName['description']! as i1.GeneratedColumn; + i1.GeneratedColumn get version => + columnsByName['version']! as i1.GeneratedColumn; + i1.GeneratedColumn get author => + columnsByName['author']! as i1.GeneratedColumn; + i1.GeneratedColumn get entryPoint => + columnsByName['entry_point']! as i1.GeneratedColumn; + i1.GeneratedColumn get apis => + columnsByName['apis']! as i1.GeneratedColumn; + i1.GeneratedColumn get abilities => + columnsByName['abilities']! as i1.GeneratedColumn; + i1.GeneratedColumn get selectedForMetadata => + columnsByName['selected_for_metadata']! as i1.GeneratedColumn; + i1.GeneratedColumn get selectedForAudioSource => + columnsByName['selected_for_audio_source']! as i1.GeneratedColumn; + i1.GeneratedColumn get repository => + columnsByName['repository']! as i1.GeneratedColumn; + i1.GeneratedColumn get pluginApiVersion => + columnsByName['plugin_api_version']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_71(String aliasedName) => + i1.GeneratedColumn('selected_for_metadata', aliasedName, false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("selected_for_metadata" IN (0, 1))'), + defaultValue: const Constant(false)); +i1.GeneratedColumn _column_72(String aliasedName) => + i1.GeneratedColumn('selected_for_audio_source', aliasedName, false, + type: i1.DriftSqlType.bool, + defaultConstraints: i1.GeneratedColumn.constraintIsAlways( + 'CHECK ("selected_for_audio_source" IN (0, 1))'), + defaultValue: const Constant(false)); +i1.GeneratedColumn _column_73(String aliasedName) => + i1.GeneratedColumn('plugin_api_version', aliasedName, false, + type: i1.DriftSqlType.string, defaultValue: const Constant('2.0.0')); + +final class Schema10 extends i0.VersionedSchema { + Schema10({required super.database}) : super(version: 10); + @override + late final List entities = [ + authenticationTable, + blacklistTable, + preferencesTable, + scrobblerTable, + skipSegmentTable, + sourceMatchTable, + audioPlayerStateTable, + historyTable, + lyricsTable, + pluginsTable, + 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 Shape17 preferencesTable = Shape17( + source: i0.VersionedTable( + entityName: 'preferences_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_8, + _column_9, + _column_10, + _column_11, + _column_12, + _column_13, + _column_14, + _column_15, + _column_69, + _column_17, + _column_18, + _column_19, + _column_20, + _column_21, + _column_22, + _column_25, + _column_74, + _column_54, + _column_29, + _column_30, + _column_31, + _column_56, + _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 Shape18 sourceMatchTable = Shape18( + source: i0.VersionedTable( + entityName: 'source_match_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_37, + _column_75, + _column_76, + _column_32, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape14 audioPlayerStateTable = Shape14( + source: i0.VersionedTable( + entityName: 'audio_player_state_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_40, + _column_41, + _column_42, + _column_43, + _column_57, + _column_58, + ], + 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); + late final Shape16 pluginsTable = Shape16( + source: i0.VersionedTable( + entityName: 'plugins_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [], + columns: [ + _column_0, + _column_59, + _column_60, + _column_61, + _column_62, + _column_63, + _column_64, + _column_65, + _column_71, + _column_72, + _column_67, + _column_73, + ], + 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_info, source_type)'); +} + +class Shape17 extends i0.VersionedTable { + Shape17({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get id => + columnsByName['id']! as i1.GeneratedColumn; + i1.GeneratedColumn get albumColorSync => + columnsByName['album_color_sync']! as i1.GeneratedColumn; + i1.GeneratedColumn get amoledDarkTheme => + columnsByName['amoled_dark_theme']! as i1.GeneratedColumn; + i1.GeneratedColumn get checkUpdate => + columnsByName['check_update']! as i1.GeneratedColumn; + i1.GeneratedColumn get normalizeAudio => + columnsByName['normalize_audio']! as i1.GeneratedColumn; + i1.GeneratedColumn get showSystemTrayIcon => + columnsByName['show_system_tray_icon']! as i1.GeneratedColumn; + i1.GeneratedColumn get systemTitleBar => + columnsByName['system_title_bar']! as i1.GeneratedColumn; + i1.GeneratedColumn get skipNonMusic => + columnsByName['skip_non_music']! as i1.GeneratedColumn; + i1.GeneratedColumn get closeBehavior => + columnsByName['close_behavior']! as i1.GeneratedColumn; + i1.GeneratedColumn get accentColorScheme => + columnsByName['accent_color_scheme']! as i1.GeneratedColumn; + i1.GeneratedColumn get layoutMode => + columnsByName['layout_mode']! as i1.GeneratedColumn; + i1.GeneratedColumn get locale => + columnsByName['locale']! as i1.GeneratedColumn; + i1.GeneratedColumn get market => + columnsByName['market']! as i1.GeneratedColumn; + i1.GeneratedColumn get searchMode => + columnsByName['search_mode']! as i1.GeneratedColumn; + i1.GeneratedColumn get downloadLocation => + columnsByName['download_location']! as i1.GeneratedColumn; + i1.GeneratedColumn get localLibraryLocation => + columnsByName['local_library_location']! as i1.GeneratedColumn; + i1.GeneratedColumn get themeMode => + columnsByName['theme_mode']! as i1.GeneratedColumn; + i1.GeneratedColumn get audioSourceId => + columnsByName['audio_source_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get youtubeClientEngine => + columnsByName['youtube_client_engine']! as i1.GeneratedColumn; + i1.GeneratedColumn get discordPresence => + columnsByName['discord_presence']! as i1.GeneratedColumn; + i1.GeneratedColumn get endlessPlayback => + columnsByName['endless_playback']! as i1.GeneratedColumn; + i1.GeneratedColumn get enableConnect => + columnsByName['enable_connect']! as i1.GeneratedColumn; + i1.GeneratedColumn get connectPort => + columnsByName['connect_port']! as i1.GeneratedColumn; + i1.GeneratedColumn get cacheMusic => + columnsByName['cache_music']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_74(String aliasedName) => + i1.GeneratedColumn('audio_source_id', aliasedName, true, + type: i1.DriftSqlType.string); + +class Shape18 extends i0.VersionedTable { + Shape18({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get id => + columnsByName['id']! as i1.GeneratedColumn; + i1.GeneratedColumn get trackId => + columnsByName['track_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get sourceInfo => + columnsByName['source_info']! as i1.GeneratedColumn; + i1.GeneratedColumn get sourceType => + columnsByName['source_type']! as i1.GeneratedColumn; + i1.GeneratedColumn get createdAt => + columnsByName['created_at']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_75(String aliasedName) => + i1.GeneratedColumn('source_info', aliasedName, false, + type: i1.DriftSqlType.string, defaultValue: const Constant("{}")); +i1.GeneratedColumn _column_76(String aliasedName) => + i1.GeneratedColumn('source_type', aliasedName, false, + type: i1.DriftSqlType.string); i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema2 schema) from1To2, required Future Function(i1.Migrator m, Schema3 schema) from2To3, @@ -2210,6 +2747,8 @@ i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema6 schema) from5To6, required Future Function(i1.Migrator m, Schema7 schema) from6To7, required Future Function(i1.Migrator m, Schema8 schema) from7To8, + required Future Function(i1.Migrator m, Schema9 schema) from8To9, + required Future Function(i1.Migrator m, Schema10 schema) from9To10, }) { return (currentVersion, database) async { switch (currentVersion) { @@ -2248,6 +2787,16 @@ i0.MigrationStepWithVersion migrationSteps({ final migrator = i1.Migrator(database, schema); await from7To8(migrator, schema); return 8; + case 8: + final schema = Schema9(database: database); + final migrator = i1.Migrator(database, schema); + await from8To9(migrator, schema); + return 9; + case 9: + final schema = Schema10(database: database); + final migrator = i1.Migrator(database, schema); + await from9To10(migrator, schema); + return 10; default: throw ArgumentError.value('Unknown migration from $currentVersion'); } @@ -2262,6 +2811,8 @@ i1.OnUpgrade stepByStep({ required Future Function(i1.Migrator m, Schema6 schema) from5To6, required Future Function(i1.Migrator m, Schema7 schema) from6To7, required Future Function(i1.Migrator m, Schema8 schema) from7To8, + required Future Function(i1.Migrator m, Schema9 schema) from8To9, + required Future Function(i1.Migrator m, Schema10 schema) from9To10, }) => i0.VersionedSchema.stepByStepHelper( step: migrationSteps( @@ -2272,4 +2823,6 @@ i1.OnUpgrade stepByStep({ from5To6: from5To6, from6To7: from6To7, from7To8: from7To8, + from8To9: from8To9, + from9To10: from9To10, )); diff --git a/lib/models/database/tables/metadata_plugins.dart b/lib/models/database/tables/metadata_plugins.dart index 8fa3b064..3447497d 100644 --- a/lib/models/database/tables/metadata_plugins.dart +++ b/lib/models/database/tables/metadata_plugins.dart @@ -1,6 +1,6 @@ part of '../database.dart'; -class MetadataPluginsTable extends Table { +class PluginsTable extends Table { IntColumn get id => integer().autoIncrement()(); TextColumn get name => text().withLength(min: 1, max: 50)(); TextColumn get description => text()(); @@ -9,8 +9,11 @@ class MetadataPluginsTable extends Table { TextColumn get entryPoint => text()(); TextColumn get apis => text().map(const StringListConverter())(); TextColumn get abilities => text().map(const StringListConverter())(); - BoolColumn get selected => boolean().withDefault(const Constant(false))(); + BoolColumn get selectedForMetadata => + boolean().withDefault(const Constant(false))(); + BoolColumn get selectedForAudioSource => + boolean().withDefault(const Constant(false))(); TextColumn get repository => text().nullable()(); TextColumn get pluginApiVersion => - text().withDefault(const Constant('1.0.0'))(); + text().withDefault(const Constant('2.0.0'))(); } diff --git a/lib/models/database/tables/preferences.dart b/lib/models/database/tables/preferences.dart index 64580330..3029e2a8 100644 --- a/lib/models/database/tables/preferences.dart +++ b/lib/models/database/tables/preferences.dart @@ -11,17 +11,6 @@ enum CloseBehavior { close, } -enum AudioSource { - youtube("YouTube"), - piped("Piped"), - jiosaavn("JioSaavn"), - invidious("Invidious"), - dabMusic("DAB Music"); - - final String label; - const AudioSource(this.label); -} - enum YoutubeClientEngine { ytDlp("yt-dlp"), youtubeExplode("YouTubeExplode"), @@ -56,8 +45,6 @@ enum SearchMode { class PreferencesTable extends Table { IntColumn get id => integer().autoIncrement()(); - TextColumn get audioQuality => textEnum() - .withDefault(Constant(SourceQualities.high.name))(); BoolColumn get albumColorSync => boolean().withDefault(const Constant(true))(); BoolColumn get amoledDarkTheme => @@ -89,20 +76,11 @@ class PreferencesTable extends Table { TextColumn get downloadLocation => text().withDefault(const Constant(""))(); TextColumn get localLibraryLocation => text().withDefault(const Constant("")).map(const StringListConverter())(); - TextColumn get pipedInstance => - text().withDefault(const Constant("https://pipedapi.kavin.rocks"))(); - TextColumn get invidiousInstance => - text().withDefault(const Constant("https://inv.nadeko.net"))(); TextColumn get themeMode => textEnum().withDefault(Constant(ThemeMode.system.name))(); - TextColumn get audioSource => - textEnum().withDefault(Constant(AudioSource.youtube.name))(); + TextColumn get audioSourceId => text().nullable()(); TextColumn get youtubeClientEngine => textEnum() .withDefault(Constant(YoutubeClientEngine.youtubeExplode.name))(); - TextColumn get streamMusicCodec => - textEnum().withDefault(Constant(SourceCodecs.weba.name))(); - TextColumn get downloadMusicCodec => - textEnum().withDefault(Constant(SourceCodecs.m4a.name))(); BoolColumn get discordPresence => boolean().withDefault(const Constant(true))(); BoolColumn get endlessPlayback => @@ -116,7 +94,6 @@ class PreferencesTable extends Table { static PreferencesTableData defaults() { return PreferencesTableData( id: 0, - audioQuality: SourceQualities.high, albumColorSync: true, amoledDarkTheme: false, checkUpdate: true, @@ -132,13 +109,11 @@ class PreferencesTable extends Table { searchMode: SearchMode.youtube, downloadLocation: "", localLibraryLocation: [], - pipedInstance: "https://pipedapi.kavin.rocks", - invidiousInstance: "https://inv.nadeko.net", themeMode: ThemeMode.system, - audioSource: AudioSource.youtube, - youtubeClientEngine: YoutubeClientEngine.youtubeExplode, - streamMusicCodec: SourceCodecs.m4a, - downloadMusicCodec: SourceCodecs.m4a, + audioSourceId: null, + youtubeClientEngine: kIsIOS + ? YoutubeClientEngine.youtubeExplode + : YoutubeClientEngine.newPipe, discordPresence: true, endlessPlayback: true, enableConnect: false, diff --git a/lib/models/database/tables/source_match.dart b/lib/models/database/tables/source_match.dart index fa659287..66a4959c 100644 --- a/lib/models/database/tables/source_match.dart +++ b/lib/models/database/tables/source_match.dart @@ -1,26 +1,9 @@ part of '../database.dart'; -enum SourceType { - youtube._("YouTube"), - youtubeMusic._("YouTube Music"), - jiosaavn._("JioSaavn"), - dabMusic._("DAB Music"); - - final String label; - - const SourceType._(this.label); -} - -@TableIndex( - name: "uniq_track_match", - columns: {#trackId, #sourceId, #sourceType}, - unique: true, -) class SourceMatchTable extends Table { IntColumn get id => integer().autoIncrement()(); TextColumn get trackId => text()(); - TextColumn get sourceId => text()(); - TextColumn get sourceType => - textEnum().withDefault(Constant(SourceType.youtube.name))(); + TextColumn get sourceInfo => text().withDefault(const Constant("{}"))(); + TextColumn get sourceType => text()(); DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)(); } diff --git a/lib/models/metadata/audio_source.dart b/lib/models/metadata/audio_source.dart new file mode 100644 index 00000000..4fb790ea --- /dev/null +++ b/lib/models/metadata/audio_source.dart @@ -0,0 +1,110 @@ +part of 'metadata.dart'; + +final oneOptionalDecimalFormatter = NumberFormat('0.#', 'en_US'); + +enum SpotubeMediaCompressionType { + lossy, + lossless, +} + +@Freezed(unionKey: 'type') +class SpotubeAudioSourceContainerPreset + with _$SpotubeAudioSourceContainerPreset { + const SpotubeAudioSourceContainerPreset._(); + + @FreezedUnionValue("lossy") + factory SpotubeAudioSourceContainerPreset.lossy({ + required SpotubeMediaCompressionType type, + required String name, + required List qualities, + }) = SpotubeAudioSourceContainerPresetLossy; + + @FreezedUnionValue("lossless") + factory SpotubeAudioSourceContainerPreset.lossless({ + required SpotubeMediaCompressionType type, + required String name, + required List qualities, + }) = SpotubeAudioSourceContainerPresetLossless; + + factory SpotubeAudioSourceContainerPreset.fromJson( + Map json) => + _$SpotubeAudioSourceContainerPresetFromJson(json); + + String getFileExtension() { + return switch (name) { + "mp4" => "m4a", + "webm" => "weba", + _ => name, + }; + } +} + +@freezed +class SpotubeAudioLossyContainerQuality + with _$SpotubeAudioLossyContainerQuality { + const SpotubeAudioLossyContainerQuality._(); + + factory SpotubeAudioLossyContainerQuality({ + required int bitrate, // bits per second + }) = _SpotubeAudioLossyContainerQuality; + + factory SpotubeAudioLossyContainerQuality.fromJson( + Map json) => + _$SpotubeAudioLossyContainerQualityFromJson(json); + + @override + toString() { + return "${oneOptionalDecimalFormatter.format(bitrate / 1000)}kbps"; + } +} + +@freezed +class SpotubeAudioLosslessContainerQuality + with _$SpotubeAudioLosslessContainerQuality { + const SpotubeAudioLosslessContainerQuality._(); + + factory SpotubeAudioLosslessContainerQuality({ + required int bitDepth, // bit + required int sampleRate, // hz + }) = _SpotubeAudioLosslessContainerQuality; + + factory SpotubeAudioLosslessContainerQuality.fromJson( + Map json) => + _$SpotubeAudioLosslessContainerQualityFromJson(json); + + @override + toString() { + return "${bitDepth}bit • ${oneOptionalDecimalFormatter.format(sampleRate / 1000)}kHz"; + } +} + +@freezed +class SpotubeAudioSourceMatchObject with _$SpotubeAudioSourceMatchObject { + factory SpotubeAudioSourceMatchObject({ + required String id, + required String title, + required List artists, + required Duration duration, + String? thumbnail, + required String externalUri, + }) = _SpotubeAudioSourceMatchObject; + + factory SpotubeAudioSourceMatchObject.fromJson(Map json) => + _$SpotubeAudioSourceMatchObjectFromJson(json); +} + +@freezed +class SpotubeAudioSourceStreamObject with _$SpotubeAudioSourceStreamObject { + factory SpotubeAudioSourceStreamObject({ + required String url, + required String container, + required SpotubeMediaCompressionType type, + String? codec, + double? bitrate, + int? bitDepth, + double? sampleRate, + }) = _SpotubeAudioSourceStreamObject; + + factory SpotubeAudioSourceStreamObject.fromJson(Map json) => + _$SpotubeAudioSourceStreamObjectFromJson(json); +} diff --git a/lib/models/metadata/metadata.dart b/lib/models/metadata/metadata.dart index 97da704c..e68bcd14 100644 --- a/lib/models/metadata/metadata.dart +++ b/lib/models/metadata/metadata.dart @@ -5,6 +5,7 @@ import 'dart:typed_data'; import 'package:collection/collection.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:intl/intl.dart'; import 'package:metadata_god/metadata_god.dart'; import 'package:mime/mime.dart'; import 'package:path/path.dart'; @@ -15,6 +16,7 @@ import 'package:spotube/utils/primitive_utils.dart'; part 'metadata.g.dart'; part 'metadata.freezed.dart'; +part 'audio_source.dart'; part 'album.dart'; part 'artist.dart'; part 'browse.dart'; diff --git a/lib/models/metadata/metadata.freezed.dart b/lib/models/metadata/metadata.freezed.dart index bb4cf3f8..fee1cbc2 100644 --- a/lib/models/metadata/metadata.freezed.dart +++ b/lib/models/metadata/metadata.freezed.dart @@ -14,6 +14,1500 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); +SpotubeAudioSourceContainerPreset _$SpotubeAudioSourceContainerPresetFromJson( + Map json) { + switch (json['type']) { + case 'lossy': + return SpotubeAudioSourceContainerPresetLossy.fromJson(json); + case 'lossless': + return SpotubeAudioSourceContainerPresetLossless.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'type', + 'SpotubeAudioSourceContainerPreset', + 'Invalid union type "${json['type']}"!'); + } +} + +/// @nodoc +mixin _$SpotubeAudioSourceContainerPreset { + SpotubeMediaCompressionType get type => throw _privateConstructorUsedError; + String get name => throw _privateConstructorUsedError; + List get qualities => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(SpotubeMediaCompressionType type, String name, + List qualities) + lossy, + required TResult Function(SpotubeMediaCompressionType type, String name, + List qualities) + lossless, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossy, + TResult? Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossless, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossy, + TResult Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossless, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(SpotubeAudioSourceContainerPresetLossy value) + lossy, + required TResult Function(SpotubeAudioSourceContainerPresetLossless value) + lossless, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SpotubeAudioSourceContainerPresetLossy value)? lossy, + TResult? Function(SpotubeAudioSourceContainerPresetLossless value)? + lossless, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SpotubeAudioSourceContainerPresetLossy value)? lossy, + TResult Function(SpotubeAudioSourceContainerPresetLossless value)? lossless, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this SpotubeAudioSourceContainerPreset to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of SpotubeAudioSourceContainerPreset + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $SpotubeAudioSourceContainerPresetCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SpotubeAudioSourceContainerPresetCopyWith<$Res> { + factory $SpotubeAudioSourceContainerPresetCopyWith( + SpotubeAudioSourceContainerPreset value, + $Res Function(SpotubeAudioSourceContainerPreset) then) = + _$SpotubeAudioSourceContainerPresetCopyWithImpl<$Res, + SpotubeAudioSourceContainerPreset>; + @useResult + $Res call({SpotubeMediaCompressionType type, String name}); +} + +/// @nodoc +class _$SpotubeAudioSourceContainerPresetCopyWithImpl<$Res, + $Val extends SpotubeAudioSourceContainerPreset> + implements $SpotubeAudioSourceContainerPresetCopyWith<$Res> { + _$SpotubeAudioSourceContainerPresetCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of SpotubeAudioSourceContainerPreset + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? name = null, + }) { + return _then(_value.copyWith( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as SpotubeMediaCompressionType, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$SpotubeAudioSourceContainerPresetLossyImplCopyWith<$Res> + implements $SpotubeAudioSourceContainerPresetCopyWith<$Res> { + factory _$$SpotubeAudioSourceContainerPresetLossyImplCopyWith( + _$SpotubeAudioSourceContainerPresetLossyImpl value, + $Res Function(_$SpotubeAudioSourceContainerPresetLossyImpl) then) = + __$$SpotubeAudioSourceContainerPresetLossyImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {SpotubeMediaCompressionType type, + String name, + List qualities}); +} + +/// @nodoc +class __$$SpotubeAudioSourceContainerPresetLossyImplCopyWithImpl<$Res> + extends _$SpotubeAudioSourceContainerPresetCopyWithImpl<$Res, + _$SpotubeAudioSourceContainerPresetLossyImpl> + implements _$$SpotubeAudioSourceContainerPresetLossyImplCopyWith<$Res> { + __$$SpotubeAudioSourceContainerPresetLossyImplCopyWithImpl( + _$SpotubeAudioSourceContainerPresetLossyImpl _value, + $Res Function(_$SpotubeAudioSourceContainerPresetLossyImpl) _then) + : super(_value, _then); + + /// Create a copy of SpotubeAudioSourceContainerPreset + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? name = null, + Object? qualities = null, + }) { + return _then(_$SpotubeAudioSourceContainerPresetLossyImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as SpotubeMediaCompressionType, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + qualities: null == qualities + ? _value._qualities + : qualities // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SpotubeAudioSourceContainerPresetLossyImpl + extends SpotubeAudioSourceContainerPresetLossy { + _$SpotubeAudioSourceContainerPresetLossyImpl( + {required this.type, + required this.name, + required final List qualities}) + : _qualities = qualities, + super._(); + + factory _$SpotubeAudioSourceContainerPresetLossyImpl.fromJson( + Map json) => + _$$SpotubeAudioSourceContainerPresetLossyImplFromJson(json); + + @override + final SpotubeMediaCompressionType type; + @override + final String name; + final List _qualities; + @override + List get qualities { + if (_qualities is EqualUnmodifiableListView) return _qualities; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_qualities); + } + + @override + String toString() { + return 'SpotubeAudioSourceContainerPreset.lossy(type: $type, name: $name, qualities: $qualities)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SpotubeAudioSourceContainerPresetLossyImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality() + .equals(other._qualities, _qualities)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, type, name, const DeepCollectionEquality().hash(_qualities)); + + /// Create a copy of SpotubeAudioSourceContainerPreset + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SpotubeAudioSourceContainerPresetLossyImplCopyWith< + _$SpotubeAudioSourceContainerPresetLossyImpl> + get copyWith => + __$$SpotubeAudioSourceContainerPresetLossyImplCopyWithImpl< + _$SpotubeAudioSourceContainerPresetLossyImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(SpotubeMediaCompressionType type, String name, + List qualities) + lossy, + required TResult Function(SpotubeMediaCompressionType type, String name, + List qualities) + lossless, + }) { + return lossy(type, name, qualities); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossy, + TResult? Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossless, + }) { + return lossy?.call(type, name, qualities); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossy, + TResult Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossless, + required TResult orElse(), + }) { + if (lossy != null) { + return lossy(type, name, qualities); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SpotubeAudioSourceContainerPresetLossy value) + lossy, + required TResult Function(SpotubeAudioSourceContainerPresetLossless value) + lossless, + }) { + return lossy(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SpotubeAudioSourceContainerPresetLossy value)? lossy, + TResult? Function(SpotubeAudioSourceContainerPresetLossless value)? + lossless, + }) { + return lossy?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SpotubeAudioSourceContainerPresetLossy value)? lossy, + TResult Function(SpotubeAudioSourceContainerPresetLossless value)? lossless, + required TResult orElse(), + }) { + if (lossy != null) { + return lossy(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$SpotubeAudioSourceContainerPresetLossyImplToJson( + this, + ); + } +} + +abstract class SpotubeAudioSourceContainerPresetLossy + extends SpotubeAudioSourceContainerPreset { + factory SpotubeAudioSourceContainerPresetLossy( + {required final SpotubeMediaCompressionType type, + required final String name, + required final List qualities}) = + _$SpotubeAudioSourceContainerPresetLossyImpl; + SpotubeAudioSourceContainerPresetLossy._() : super._(); + + factory SpotubeAudioSourceContainerPresetLossy.fromJson( + Map json) = + _$SpotubeAudioSourceContainerPresetLossyImpl.fromJson; + + @override + SpotubeMediaCompressionType get type; + @override + String get name; + @override + List get qualities; + + /// Create a copy of SpotubeAudioSourceContainerPreset + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SpotubeAudioSourceContainerPresetLossyImplCopyWith< + _$SpotubeAudioSourceContainerPresetLossyImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$SpotubeAudioSourceContainerPresetLosslessImplCopyWith<$Res> + implements $SpotubeAudioSourceContainerPresetCopyWith<$Res> { + factory _$$SpotubeAudioSourceContainerPresetLosslessImplCopyWith( + _$SpotubeAudioSourceContainerPresetLosslessImpl value, + $Res Function(_$SpotubeAudioSourceContainerPresetLosslessImpl) then) = + __$$SpotubeAudioSourceContainerPresetLosslessImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {SpotubeMediaCompressionType type, + String name, + List qualities}); +} + +/// @nodoc +class __$$SpotubeAudioSourceContainerPresetLosslessImplCopyWithImpl<$Res> + extends _$SpotubeAudioSourceContainerPresetCopyWithImpl<$Res, + _$SpotubeAudioSourceContainerPresetLosslessImpl> + implements _$$SpotubeAudioSourceContainerPresetLosslessImplCopyWith<$Res> { + __$$SpotubeAudioSourceContainerPresetLosslessImplCopyWithImpl( + _$SpotubeAudioSourceContainerPresetLosslessImpl _value, + $Res Function(_$SpotubeAudioSourceContainerPresetLosslessImpl) _then) + : super(_value, _then); + + /// Create a copy of SpotubeAudioSourceContainerPreset + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? name = null, + Object? qualities = null, + }) { + return _then(_$SpotubeAudioSourceContainerPresetLosslessImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as SpotubeMediaCompressionType, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + qualities: null == qualities + ? _value._qualities + : qualities // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SpotubeAudioSourceContainerPresetLosslessImpl + extends SpotubeAudioSourceContainerPresetLossless { + _$SpotubeAudioSourceContainerPresetLosslessImpl( + {required this.type, + required this.name, + required final List qualities}) + : _qualities = qualities, + super._(); + + factory _$SpotubeAudioSourceContainerPresetLosslessImpl.fromJson( + Map json) => + _$$SpotubeAudioSourceContainerPresetLosslessImplFromJson(json); + + @override + final SpotubeMediaCompressionType type; + @override + final String name; + final List _qualities; + @override + List get qualities { + if (_qualities is EqualUnmodifiableListView) return _qualities; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_qualities); + } + + @override + String toString() { + return 'SpotubeAudioSourceContainerPreset.lossless(type: $type, name: $name, qualities: $qualities)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SpotubeAudioSourceContainerPresetLosslessImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality() + .equals(other._qualities, _qualities)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, type, name, const DeepCollectionEquality().hash(_qualities)); + + /// Create a copy of SpotubeAudioSourceContainerPreset + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SpotubeAudioSourceContainerPresetLosslessImplCopyWith< + _$SpotubeAudioSourceContainerPresetLosslessImpl> + get copyWith => + __$$SpotubeAudioSourceContainerPresetLosslessImplCopyWithImpl< + _$SpotubeAudioSourceContainerPresetLosslessImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(SpotubeMediaCompressionType type, String name, + List qualities) + lossy, + required TResult Function(SpotubeMediaCompressionType type, String name, + List qualities) + lossless, + }) { + return lossless(type, name, qualities); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossy, + TResult? Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossless, + }) { + return lossless?.call(type, name, qualities); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossy, + TResult Function(SpotubeMediaCompressionType type, String name, + List qualities)? + lossless, + required TResult orElse(), + }) { + if (lossless != null) { + return lossless(type, name, qualities); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SpotubeAudioSourceContainerPresetLossy value) + lossy, + required TResult Function(SpotubeAudioSourceContainerPresetLossless value) + lossless, + }) { + return lossless(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SpotubeAudioSourceContainerPresetLossy value)? lossy, + TResult? Function(SpotubeAudioSourceContainerPresetLossless value)? + lossless, + }) { + return lossless?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SpotubeAudioSourceContainerPresetLossy value)? lossy, + TResult Function(SpotubeAudioSourceContainerPresetLossless value)? lossless, + required TResult orElse(), + }) { + if (lossless != null) { + return lossless(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$SpotubeAudioSourceContainerPresetLosslessImplToJson( + this, + ); + } +} + +abstract class SpotubeAudioSourceContainerPresetLossless + extends SpotubeAudioSourceContainerPreset { + factory SpotubeAudioSourceContainerPresetLossless( + {required final SpotubeMediaCompressionType type, + required final String name, + required final List + qualities}) = _$SpotubeAudioSourceContainerPresetLosslessImpl; + SpotubeAudioSourceContainerPresetLossless._() : super._(); + + factory SpotubeAudioSourceContainerPresetLossless.fromJson( + Map json) = + _$SpotubeAudioSourceContainerPresetLosslessImpl.fromJson; + + @override + SpotubeMediaCompressionType get type; + @override + String get name; + @override + List get qualities; + + /// Create a copy of SpotubeAudioSourceContainerPreset + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SpotubeAudioSourceContainerPresetLosslessImplCopyWith< + _$SpotubeAudioSourceContainerPresetLosslessImpl> + get copyWith => throw _privateConstructorUsedError; +} + +SpotubeAudioLossyContainerQuality _$SpotubeAudioLossyContainerQualityFromJson( + Map json) { + return _SpotubeAudioLossyContainerQuality.fromJson(json); +} + +/// @nodoc +mixin _$SpotubeAudioLossyContainerQuality { + int get bitrate => throw _privateConstructorUsedError; + + /// Serializes this SpotubeAudioLossyContainerQuality to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of SpotubeAudioLossyContainerQuality + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $SpotubeAudioLossyContainerQualityCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SpotubeAudioLossyContainerQualityCopyWith<$Res> { + factory $SpotubeAudioLossyContainerQualityCopyWith( + SpotubeAudioLossyContainerQuality value, + $Res Function(SpotubeAudioLossyContainerQuality) then) = + _$SpotubeAudioLossyContainerQualityCopyWithImpl<$Res, + SpotubeAudioLossyContainerQuality>; + @useResult + $Res call({int bitrate}); +} + +/// @nodoc +class _$SpotubeAudioLossyContainerQualityCopyWithImpl<$Res, + $Val extends SpotubeAudioLossyContainerQuality> + implements $SpotubeAudioLossyContainerQualityCopyWith<$Res> { + _$SpotubeAudioLossyContainerQualityCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of SpotubeAudioLossyContainerQuality + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bitrate = null, + }) { + return _then(_value.copyWith( + bitrate: null == bitrate + ? _value.bitrate + : bitrate // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$SpotubeAudioLossyContainerQualityImplCopyWith<$Res> + implements $SpotubeAudioLossyContainerQualityCopyWith<$Res> { + factory _$$SpotubeAudioLossyContainerQualityImplCopyWith( + _$SpotubeAudioLossyContainerQualityImpl value, + $Res Function(_$SpotubeAudioLossyContainerQualityImpl) then) = + __$$SpotubeAudioLossyContainerQualityImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int bitrate}); +} + +/// @nodoc +class __$$SpotubeAudioLossyContainerQualityImplCopyWithImpl<$Res> + extends _$SpotubeAudioLossyContainerQualityCopyWithImpl<$Res, + _$SpotubeAudioLossyContainerQualityImpl> + implements _$$SpotubeAudioLossyContainerQualityImplCopyWith<$Res> { + __$$SpotubeAudioLossyContainerQualityImplCopyWithImpl( + _$SpotubeAudioLossyContainerQualityImpl _value, + $Res Function(_$SpotubeAudioLossyContainerQualityImpl) _then) + : super(_value, _then); + + /// Create a copy of SpotubeAudioLossyContainerQuality + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bitrate = null, + }) { + return _then(_$SpotubeAudioLossyContainerQualityImpl( + bitrate: null == bitrate + ? _value.bitrate + : bitrate // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SpotubeAudioLossyContainerQualityImpl + extends _SpotubeAudioLossyContainerQuality { + _$SpotubeAudioLossyContainerQualityImpl({required this.bitrate}) : super._(); + + factory _$SpotubeAudioLossyContainerQualityImpl.fromJson( + Map json) => + _$$SpotubeAudioLossyContainerQualityImplFromJson(json); + + @override + final int bitrate; + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SpotubeAudioLossyContainerQualityImpl && + (identical(other.bitrate, bitrate) || other.bitrate == bitrate)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, bitrate); + + /// Create a copy of SpotubeAudioLossyContainerQuality + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SpotubeAudioLossyContainerQualityImplCopyWith< + _$SpotubeAudioLossyContainerQualityImpl> + get copyWith => __$$SpotubeAudioLossyContainerQualityImplCopyWithImpl< + _$SpotubeAudioLossyContainerQualityImpl>(this, _$identity); + + @override + Map toJson() { + return _$$SpotubeAudioLossyContainerQualityImplToJson( + this, + ); + } +} + +abstract class _SpotubeAudioLossyContainerQuality + extends SpotubeAudioLossyContainerQuality { + factory _SpotubeAudioLossyContainerQuality({required final int bitrate}) = + _$SpotubeAudioLossyContainerQualityImpl; + _SpotubeAudioLossyContainerQuality._() : super._(); + + factory _SpotubeAudioLossyContainerQuality.fromJson( + Map json) = + _$SpotubeAudioLossyContainerQualityImpl.fromJson; + + @override + int get bitrate; + + /// Create a copy of SpotubeAudioLossyContainerQuality + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SpotubeAudioLossyContainerQualityImplCopyWith< + _$SpotubeAudioLossyContainerQualityImpl> + get copyWith => throw _privateConstructorUsedError; +} + +SpotubeAudioLosslessContainerQuality + _$SpotubeAudioLosslessContainerQualityFromJson(Map json) { + return _SpotubeAudioLosslessContainerQuality.fromJson(json); +} + +/// @nodoc +mixin _$SpotubeAudioLosslessContainerQuality { + int get bitDepth => throw _privateConstructorUsedError; // bit + int get sampleRate => throw _privateConstructorUsedError; + + /// Serializes this SpotubeAudioLosslessContainerQuality to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of SpotubeAudioLosslessContainerQuality + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $SpotubeAudioLosslessContainerQualityCopyWith< + SpotubeAudioLosslessContainerQuality> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SpotubeAudioLosslessContainerQualityCopyWith<$Res> { + factory $SpotubeAudioLosslessContainerQualityCopyWith( + SpotubeAudioLosslessContainerQuality value, + $Res Function(SpotubeAudioLosslessContainerQuality) then) = + _$SpotubeAudioLosslessContainerQualityCopyWithImpl<$Res, + SpotubeAudioLosslessContainerQuality>; + @useResult + $Res call({int bitDepth, int sampleRate}); +} + +/// @nodoc +class _$SpotubeAudioLosslessContainerQualityCopyWithImpl<$Res, + $Val extends SpotubeAudioLosslessContainerQuality> + implements $SpotubeAudioLosslessContainerQualityCopyWith<$Res> { + _$SpotubeAudioLosslessContainerQualityCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of SpotubeAudioLosslessContainerQuality + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bitDepth = null, + Object? sampleRate = null, + }) { + return _then(_value.copyWith( + bitDepth: null == bitDepth + ? _value.bitDepth + : bitDepth // ignore: cast_nullable_to_non_nullable + as int, + sampleRate: null == sampleRate + ? _value.sampleRate + : sampleRate // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$SpotubeAudioLosslessContainerQualityImplCopyWith<$Res> + implements $SpotubeAudioLosslessContainerQualityCopyWith<$Res> { + factory _$$SpotubeAudioLosslessContainerQualityImplCopyWith( + _$SpotubeAudioLosslessContainerQualityImpl value, + $Res Function(_$SpotubeAudioLosslessContainerQualityImpl) then) = + __$$SpotubeAudioLosslessContainerQualityImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({int bitDepth, int sampleRate}); +} + +/// @nodoc +class __$$SpotubeAudioLosslessContainerQualityImplCopyWithImpl<$Res> + extends _$SpotubeAudioLosslessContainerQualityCopyWithImpl<$Res, + _$SpotubeAudioLosslessContainerQualityImpl> + implements _$$SpotubeAudioLosslessContainerQualityImplCopyWith<$Res> { + __$$SpotubeAudioLosslessContainerQualityImplCopyWithImpl( + _$SpotubeAudioLosslessContainerQualityImpl _value, + $Res Function(_$SpotubeAudioLosslessContainerQualityImpl) _then) + : super(_value, _then); + + /// Create a copy of SpotubeAudioLosslessContainerQuality + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? bitDepth = null, + Object? sampleRate = null, + }) { + return _then(_$SpotubeAudioLosslessContainerQualityImpl( + bitDepth: null == bitDepth + ? _value.bitDepth + : bitDepth // ignore: cast_nullable_to_non_nullable + as int, + sampleRate: null == sampleRate + ? _value.sampleRate + : sampleRate // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SpotubeAudioLosslessContainerQualityImpl + extends _SpotubeAudioLosslessContainerQuality { + _$SpotubeAudioLosslessContainerQualityImpl( + {required this.bitDepth, required this.sampleRate}) + : super._(); + + factory _$SpotubeAudioLosslessContainerQualityImpl.fromJson( + Map json) => + _$$SpotubeAudioLosslessContainerQualityImplFromJson(json); + + @override + final int bitDepth; +// bit + @override + final int sampleRate; + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SpotubeAudioLosslessContainerQualityImpl && + (identical(other.bitDepth, bitDepth) || + other.bitDepth == bitDepth) && + (identical(other.sampleRate, sampleRate) || + other.sampleRate == sampleRate)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, bitDepth, sampleRate); + + /// Create a copy of SpotubeAudioLosslessContainerQuality + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SpotubeAudioLosslessContainerQualityImplCopyWith< + _$SpotubeAudioLosslessContainerQualityImpl> + get copyWith => __$$SpotubeAudioLosslessContainerQualityImplCopyWithImpl< + _$SpotubeAudioLosslessContainerQualityImpl>(this, _$identity); + + @override + Map toJson() { + return _$$SpotubeAudioLosslessContainerQualityImplToJson( + this, + ); + } +} + +abstract class _SpotubeAudioLosslessContainerQuality + extends SpotubeAudioLosslessContainerQuality { + factory _SpotubeAudioLosslessContainerQuality( + {required final int bitDepth, required final int sampleRate}) = + _$SpotubeAudioLosslessContainerQualityImpl; + _SpotubeAudioLosslessContainerQuality._() : super._(); + + factory _SpotubeAudioLosslessContainerQuality.fromJson( + Map json) = + _$SpotubeAudioLosslessContainerQualityImpl.fromJson; + + @override + int get bitDepth; // bit + @override + int get sampleRate; + + /// Create a copy of SpotubeAudioLosslessContainerQuality + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SpotubeAudioLosslessContainerQualityImplCopyWith< + _$SpotubeAudioLosslessContainerQualityImpl> + get copyWith => throw _privateConstructorUsedError; +} + +SpotubeAudioSourceMatchObject _$SpotubeAudioSourceMatchObjectFromJson( + Map json) { + return _SpotubeAudioSourceMatchObject.fromJson(json); +} + +/// @nodoc +mixin _$SpotubeAudioSourceMatchObject { + String get id => throw _privateConstructorUsedError; + String get title => throw _privateConstructorUsedError; + List get artists => throw _privateConstructorUsedError; + Duration get duration => throw _privateConstructorUsedError; + String? get thumbnail => throw _privateConstructorUsedError; + String get externalUri => throw _privateConstructorUsedError; + + /// Serializes this SpotubeAudioSourceMatchObject to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of SpotubeAudioSourceMatchObject + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $SpotubeAudioSourceMatchObjectCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SpotubeAudioSourceMatchObjectCopyWith<$Res> { + factory $SpotubeAudioSourceMatchObjectCopyWith( + SpotubeAudioSourceMatchObject value, + $Res Function(SpotubeAudioSourceMatchObject) then) = + _$SpotubeAudioSourceMatchObjectCopyWithImpl<$Res, + SpotubeAudioSourceMatchObject>; + @useResult + $Res call( + {String id, + String title, + List artists, + Duration duration, + String? thumbnail, + String externalUri}); +} + +/// @nodoc +class _$SpotubeAudioSourceMatchObjectCopyWithImpl<$Res, + $Val extends SpotubeAudioSourceMatchObject> + implements $SpotubeAudioSourceMatchObjectCopyWith<$Res> { + _$SpotubeAudioSourceMatchObjectCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of SpotubeAudioSourceMatchObject + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? title = null, + Object? artists = null, + Object? duration = null, + Object? thumbnail = freezed, + Object? externalUri = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + artists: null == artists + ? _value.artists + : artists // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _value.duration + : duration // ignore: cast_nullable_to_non_nullable + as Duration, + thumbnail: freezed == thumbnail + ? _value.thumbnail + : thumbnail // ignore: cast_nullable_to_non_nullable + as String?, + externalUri: null == externalUri + ? _value.externalUri + : externalUri // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$SpotubeAudioSourceMatchObjectImplCopyWith<$Res> + implements $SpotubeAudioSourceMatchObjectCopyWith<$Res> { + factory _$$SpotubeAudioSourceMatchObjectImplCopyWith( + _$SpotubeAudioSourceMatchObjectImpl value, + $Res Function(_$SpotubeAudioSourceMatchObjectImpl) then) = + __$$SpotubeAudioSourceMatchObjectImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + String title, + List artists, + Duration duration, + String? thumbnail, + String externalUri}); +} + +/// @nodoc +class __$$SpotubeAudioSourceMatchObjectImplCopyWithImpl<$Res> + extends _$SpotubeAudioSourceMatchObjectCopyWithImpl<$Res, + _$SpotubeAudioSourceMatchObjectImpl> + implements _$$SpotubeAudioSourceMatchObjectImplCopyWith<$Res> { + __$$SpotubeAudioSourceMatchObjectImplCopyWithImpl( + _$SpotubeAudioSourceMatchObjectImpl _value, + $Res Function(_$SpotubeAudioSourceMatchObjectImpl) _then) + : super(_value, _then); + + /// Create a copy of SpotubeAudioSourceMatchObject + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? title = null, + Object? artists = null, + Object? duration = null, + Object? thumbnail = freezed, + Object? externalUri = null, + }) { + return _then(_$SpotubeAudioSourceMatchObjectImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + title: null == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String, + artists: null == artists + ? _value._artists + : artists // ignore: cast_nullable_to_non_nullable + as List, + duration: null == duration + ? _value.duration + : duration // ignore: cast_nullable_to_non_nullable + as Duration, + thumbnail: freezed == thumbnail + ? _value.thumbnail + : thumbnail // ignore: cast_nullable_to_non_nullable + as String?, + externalUri: null == externalUri + ? _value.externalUri + : externalUri // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SpotubeAudioSourceMatchObjectImpl + implements _SpotubeAudioSourceMatchObject { + _$SpotubeAudioSourceMatchObjectImpl( + {required this.id, + required this.title, + required final List artists, + required this.duration, + this.thumbnail, + required this.externalUri}) + : _artists = artists; + + factory _$SpotubeAudioSourceMatchObjectImpl.fromJson( + Map json) => + _$$SpotubeAudioSourceMatchObjectImplFromJson(json); + + @override + final String id; + @override + final String title; + final List _artists; + @override + List get artists { + if (_artists is EqualUnmodifiableListView) return _artists; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_artists); + } + + @override + final Duration duration; + @override + final String? thumbnail; + @override + final String externalUri; + + @override + String toString() { + return 'SpotubeAudioSourceMatchObject(id: $id, title: $title, artists: $artists, duration: $duration, thumbnail: $thumbnail, externalUri: $externalUri)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SpotubeAudioSourceMatchObjectImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.title, title) || other.title == title) && + const DeepCollectionEquality().equals(other._artists, _artists) && + (identical(other.duration, duration) || + other.duration == duration) && + (identical(other.thumbnail, thumbnail) || + other.thumbnail == thumbnail) && + (identical(other.externalUri, externalUri) || + other.externalUri == externalUri)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + title, + const DeepCollectionEquality().hash(_artists), + duration, + thumbnail, + externalUri); + + /// Create a copy of SpotubeAudioSourceMatchObject + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SpotubeAudioSourceMatchObjectImplCopyWith< + _$SpotubeAudioSourceMatchObjectImpl> + get copyWith => __$$SpotubeAudioSourceMatchObjectImplCopyWithImpl< + _$SpotubeAudioSourceMatchObjectImpl>(this, _$identity); + + @override + Map toJson() { + return _$$SpotubeAudioSourceMatchObjectImplToJson( + this, + ); + } +} + +abstract class _SpotubeAudioSourceMatchObject + implements SpotubeAudioSourceMatchObject { + factory _SpotubeAudioSourceMatchObject( + {required final String id, + required final String title, + required final List artists, + required final Duration duration, + final String? thumbnail, + required final String externalUri}) = _$SpotubeAudioSourceMatchObjectImpl; + + factory _SpotubeAudioSourceMatchObject.fromJson(Map json) = + _$SpotubeAudioSourceMatchObjectImpl.fromJson; + + @override + String get id; + @override + String get title; + @override + List get artists; + @override + Duration get duration; + @override + String? get thumbnail; + @override + String get externalUri; + + /// Create a copy of SpotubeAudioSourceMatchObject + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SpotubeAudioSourceMatchObjectImplCopyWith< + _$SpotubeAudioSourceMatchObjectImpl> + get copyWith => throw _privateConstructorUsedError; +} + +SpotubeAudioSourceStreamObject _$SpotubeAudioSourceStreamObjectFromJson( + Map json) { + return _SpotubeAudioSourceStreamObject.fromJson(json); +} + +/// @nodoc +mixin _$SpotubeAudioSourceStreamObject { + String get url => throw _privateConstructorUsedError; + String get container => throw _privateConstructorUsedError; + SpotubeMediaCompressionType get type => throw _privateConstructorUsedError; + String? get codec => throw _privateConstructorUsedError; + double? get bitrate => throw _privateConstructorUsedError; + int? get bitDepth => throw _privateConstructorUsedError; + double? get sampleRate => throw _privateConstructorUsedError; + + /// Serializes this SpotubeAudioSourceStreamObject to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of SpotubeAudioSourceStreamObject + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $SpotubeAudioSourceStreamObjectCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SpotubeAudioSourceStreamObjectCopyWith<$Res> { + factory $SpotubeAudioSourceStreamObjectCopyWith( + SpotubeAudioSourceStreamObject value, + $Res Function(SpotubeAudioSourceStreamObject) then) = + _$SpotubeAudioSourceStreamObjectCopyWithImpl<$Res, + SpotubeAudioSourceStreamObject>; + @useResult + $Res call( + {String url, + String container, + SpotubeMediaCompressionType type, + String? codec, + double? bitrate, + int? bitDepth, + double? sampleRate}); +} + +/// @nodoc +class _$SpotubeAudioSourceStreamObjectCopyWithImpl<$Res, + $Val extends SpotubeAudioSourceStreamObject> + implements $SpotubeAudioSourceStreamObjectCopyWith<$Res> { + _$SpotubeAudioSourceStreamObjectCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of SpotubeAudioSourceStreamObject + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? url = null, + Object? container = null, + Object? type = null, + Object? codec = freezed, + Object? bitrate = freezed, + Object? bitDepth = freezed, + Object? sampleRate = freezed, + }) { + return _then(_value.copyWith( + url: null == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String, + container: null == container + ? _value.container + : container // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as SpotubeMediaCompressionType, + codec: freezed == codec + ? _value.codec + : codec // ignore: cast_nullable_to_non_nullable + as String?, + bitrate: freezed == bitrate + ? _value.bitrate + : bitrate // ignore: cast_nullable_to_non_nullable + as double?, + bitDepth: freezed == bitDepth + ? _value.bitDepth + : bitDepth // ignore: cast_nullable_to_non_nullable + as int?, + sampleRate: freezed == sampleRate + ? _value.sampleRate + : sampleRate // ignore: cast_nullable_to_non_nullable + as double?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$SpotubeAudioSourceStreamObjectImplCopyWith<$Res> + implements $SpotubeAudioSourceStreamObjectCopyWith<$Res> { + factory _$$SpotubeAudioSourceStreamObjectImplCopyWith( + _$SpotubeAudioSourceStreamObjectImpl value, + $Res Function(_$SpotubeAudioSourceStreamObjectImpl) then) = + __$$SpotubeAudioSourceStreamObjectImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String url, + String container, + SpotubeMediaCompressionType type, + String? codec, + double? bitrate, + int? bitDepth, + double? sampleRate}); +} + +/// @nodoc +class __$$SpotubeAudioSourceStreamObjectImplCopyWithImpl<$Res> + extends _$SpotubeAudioSourceStreamObjectCopyWithImpl<$Res, + _$SpotubeAudioSourceStreamObjectImpl> + implements _$$SpotubeAudioSourceStreamObjectImplCopyWith<$Res> { + __$$SpotubeAudioSourceStreamObjectImplCopyWithImpl( + _$SpotubeAudioSourceStreamObjectImpl _value, + $Res Function(_$SpotubeAudioSourceStreamObjectImpl) _then) + : super(_value, _then); + + /// Create a copy of SpotubeAudioSourceStreamObject + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? url = null, + Object? container = null, + Object? type = null, + Object? codec = freezed, + Object? bitrate = freezed, + Object? bitDepth = freezed, + Object? sampleRate = freezed, + }) { + return _then(_$SpotubeAudioSourceStreamObjectImpl( + url: null == url + ? _value.url + : url // ignore: cast_nullable_to_non_nullable + as String, + container: null == container + ? _value.container + : container // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as SpotubeMediaCompressionType, + codec: freezed == codec + ? _value.codec + : codec // ignore: cast_nullable_to_non_nullable + as String?, + bitrate: freezed == bitrate + ? _value.bitrate + : bitrate // ignore: cast_nullable_to_non_nullable + as double?, + bitDepth: freezed == bitDepth + ? _value.bitDepth + : bitDepth // ignore: cast_nullable_to_non_nullable + as int?, + sampleRate: freezed == sampleRate + ? _value.sampleRate + : sampleRate // ignore: cast_nullable_to_non_nullable + as double?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SpotubeAudioSourceStreamObjectImpl + implements _SpotubeAudioSourceStreamObject { + _$SpotubeAudioSourceStreamObjectImpl( + {required this.url, + required this.container, + required this.type, + this.codec, + this.bitrate, + this.bitDepth, + this.sampleRate}); + + factory _$SpotubeAudioSourceStreamObjectImpl.fromJson( + Map json) => + _$$SpotubeAudioSourceStreamObjectImplFromJson(json); + + @override + final String url; + @override + final String container; + @override + final SpotubeMediaCompressionType type; + @override + final String? codec; + @override + final double? bitrate; + @override + final int? bitDepth; + @override + final double? sampleRate; + + @override + String toString() { + return 'SpotubeAudioSourceStreamObject(url: $url, container: $container, type: $type, codec: $codec, bitrate: $bitrate, bitDepth: $bitDepth, sampleRate: $sampleRate)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SpotubeAudioSourceStreamObjectImpl && + (identical(other.url, url) || other.url == url) && + (identical(other.container, container) || + other.container == container) && + (identical(other.type, type) || other.type == type) && + (identical(other.codec, codec) || other.codec == codec) && + (identical(other.bitrate, bitrate) || other.bitrate == bitrate) && + (identical(other.bitDepth, bitDepth) || + other.bitDepth == bitDepth) && + (identical(other.sampleRate, sampleRate) || + other.sampleRate == sampleRate)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, url, container, type, codec, bitrate, bitDepth, sampleRate); + + /// Create a copy of SpotubeAudioSourceStreamObject + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SpotubeAudioSourceStreamObjectImplCopyWith< + _$SpotubeAudioSourceStreamObjectImpl> + get copyWith => __$$SpotubeAudioSourceStreamObjectImplCopyWithImpl< + _$SpotubeAudioSourceStreamObjectImpl>(this, _$identity); + + @override + Map toJson() { + return _$$SpotubeAudioSourceStreamObjectImplToJson( + this, + ); + } +} + +abstract class _SpotubeAudioSourceStreamObject + implements SpotubeAudioSourceStreamObject { + factory _SpotubeAudioSourceStreamObject( + {required final String url, + required final String container, + required final SpotubeMediaCompressionType type, + final String? codec, + final double? bitrate, + final int? bitDepth, + final double? sampleRate}) = _$SpotubeAudioSourceStreamObjectImpl; + + factory _SpotubeAudioSourceStreamObject.fromJson(Map json) = + _$SpotubeAudioSourceStreamObjectImpl.fromJson; + + @override + String get url; + @override + String get container; + @override + SpotubeMediaCompressionType get type; + @override + String? get codec; + @override + double? get bitrate; + @override + int? get bitDepth; + @override + double? get sampleRate; + + /// Create a copy of SpotubeAudioSourceStreamObject + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SpotubeAudioSourceStreamObjectImplCopyWith< + _$SpotubeAudioSourceStreamObjectImpl> + get copyWith => throw _privateConstructorUsedError; +} + SpotubeFullAlbumObject _$SpotubeFullAlbumObjectFromJson( Map json) { return _SpotubeFullAlbumObject.fromJson(json); @@ -4499,7 +5993,6 @@ PluginConfiguration _$PluginConfigurationFromJson(Map json) { /// @nodoc mixin _$PluginConfiguration { - PluginType get type => throw _privateConstructorUsedError; String get name => throw _privateConstructorUsedError; String get description => throw _privateConstructorUsedError; String get version => throw _privateConstructorUsedError; @@ -4527,8 +6020,7 @@ abstract class $PluginConfigurationCopyWith<$Res> { _$PluginConfigurationCopyWithImpl<$Res, PluginConfiguration>; @useResult $Res call( - {PluginType type, - String name, + {String name, String description, String version, String author, @@ -4554,7 +6046,6 @@ class _$PluginConfigurationCopyWithImpl<$Res, $Val extends PluginConfiguration> @pragma('vm:prefer-inline') @override $Res call({ - Object? type = null, Object? name = null, Object? description = null, Object? version = null, @@ -4566,10 +6057,6 @@ class _$PluginConfigurationCopyWithImpl<$Res, $Val extends PluginConfiguration> Object? repository = freezed, }) { return _then(_value.copyWith( - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as PluginType, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -4619,8 +6106,7 @@ abstract class _$$PluginConfigurationImplCopyWith<$Res> @override @useResult $Res call( - {PluginType type, - String name, + {String name, String description, String version, String author, @@ -4644,7 +6130,6 @@ class __$$PluginConfigurationImplCopyWithImpl<$Res> @pragma('vm:prefer-inline') @override $Res call({ - Object? type = null, Object? name = null, Object? description = null, Object? version = null, @@ -4656,10 +6141,6 @@ class __$$PluginConfigurationImplCopyWithImpl<$Res> Object? repository = freezed, }) { return _then(_$PluginConfigurationImpl( - type: null == type - ? _value.type - : type // ignore: cast_nullable_to_non_nullable - as PluginType, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -4704,8 +6185,7 @@ class __$$PluginConfigurationImplCopyWithImpl<$Res> @JsonSerializable() class _$PluginConfigurationImpl extends _PluginConfiguration { _$PluginConfigurationImpl( - {required this.type, - required this.name, + {required this.name, required this.description, required this.version, required this.author, @@ -4721,8 +6201,6 @@ class _$PluginConfigurationImpl extends _PluginConfiguration { factory _$PluginConfigurationImpl.fromJson(Map json) => _$$PluginConfigurationImplFromJson(json); - @override - final PluginType type; @override final String name; @override @@ -4758,7 +6236,7 @@ class _$PluginConfigurationImpl extends _PluginConfiguration { @override String toString() { - return 'PluginConfiguration(type: $type, name: $name, description: $description, version: $version, author: $author, entryPoint: $entryPoint, pluginApiVersion: $pluginApiVersion, apis: $apis, abilities: $abilities, repository: $repository)'; + return 'PluginConfiguration(name: $name, description: $description, version: $version, author: $author, entryPoint: $entryPoint, pluginApiVersion: $pluginApiVersion, apis: $apis, abilities: $abilities, repository: $repository)'; } @override @@ -4766,7 +6244,6 @@ class _$PluginConfigurationImpl extends _PluginConfiguration { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PluginConfigurationImpl && - (identical(other.type, type) || other.type == type) && (identical(other.name, name) || other.name == name) && (identical(other.description, description) || other.description == description) && @@ -4787,7 +6264,6 @@ class _$PluginConfigurationImpl extends _PluginConfiguration { @override int get hashCode => Object.hash( runtimeType, - type, name, description, version, @@ -4817,8 +6293,7 @@ class _$PluginConfigurationImpl extends _PluginConfiguration { abstract class _PluginConfiguration extends PluginConfiguration { factory _PluginConfiguration( - {required final PluginType type, - required final String name, + {required final String name, required final String description, required final String version, required final String author, @@ -4832,8 +6307,6 @@ abstract class _PluginConfiguration extends PluginConfiguration { factory _PluginConfiguration.fromJson(Map json) = _$PluginConfigurationImpl.fromJson; - @override - PluginType get type; @override String get name; @override @@ -5064,6 +6537,7 @@ mixin _$MetadataPluginRepository { String get owner => throw _privateConstructorUsedError; String get description => throw _privateConstructorUsedError; String get repoUrl => throw _privateConstructorUsedError; + List get topics => throw _privateConstructorUsedError; /// Serializes this MetadataPluginRepository to a JSON map. Map toJson() => throw _privateConstructorUsedError; @@ -5081,7 +6555,12 @@ abstract class $MetadataPluginRepositoryCopyWith<$Res> { $Res Function(MetadataPluginRepository) then) = _$MetadataPluginRepositoryCopyWithImpl<$Res, MetadataPluginRepository>; @useResult - $Res call({String name, String owner, String description, String repoUrl}); + $Res call( + {String name, + String owner, + String description, + String repoUrl, + List topics}); } /// @nodoc @@ -5104,6 +6583,7 @@ class _$MetadataPluginRepositoryCopyWithImpl<$Res, Object? owner = null, Object? description = null, Object? repoUrl = null, + Object? topics = null, }) { return _then(_value.copyWith( name: null == name @@ -5122,6 +6602,10 @@ class _$MetadataPluginRepositoryCopyWithImpl<$Res, ? _value.repoUrl : repoUrl // ignore: cast_nullable_to_non_nullable as String, + topics: null == topics + ? _value.topics + : topics // ignore: cast_nullable_to_non_nullable + as List, ) as $Val); } } @@ -5135,7 +6619,12 @@ abstract class _$$MetadataPluginRepositoryImplCopyWith<$Res> __$$MetadataPluginRepositoryImplCopyWithImpl<$Res>; @override @useResult - $Res call({String name, String owner, String description, String repoUrl}); + $Res call( + {String name, + String owner, + String description, + String repoUrl, + List topics}); } /// @nodoc @@ -5157,6 +6646,7 @@ class __$$MetadataPluginRepositoryImplCopyWithImpl<$Res> Object? owner = null, Object? description = null, Object? repoUrl = null, + Object? topics = null, }) { return _then(_$MetadataPluginRepositoryImpl( name: null == name @@ -5175,6 +6665,10 @@ class __$$MetadataPluginRepositoryImplCopyWithImpl<$Res> ? _value.repoUrl : repoUrl // ignore: cast_nullable_to_non_nullable as String, + topics: null == topics + ? _value._topics + : topics // ignore: cast_nullable_to_non_nullable + as List, )); } } @@ -5186,7 +6680,9 @@ class _$MetadataPluginRepositoryImpl implements _MetadataPluginRepository { {required this.name, required this.owner, required this.description, - required this.repoUrl}); + required this.repoUrl, + required final List topics}) + : _topics = topics; factory _$MetadataPluginRepositoryImpl.fromJson(Map json) => _$$MetadataPluginRepositoryImplFromJson(json); @@ -5199,10 +6695,17 @@ class _$MetadataPluginRepositoryImpl implements _MetadataPluginRepository { final String description; @override final String repoUrl; + final List _topics; + @override + List get topics { + if (_topics is EqualUnmodifiableListView) return _topics; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_topics); + } @override String toString() { - return 'MetadataPluginRepository(name: $name, owner: $owner, description: $description, repoUrl: $repoUrl)'; + return 'MetadataPluginRepository(name: $name, owner: $owner, description: $description, repoUrl: $repoUrl, topics: $topics)'; } @override @@ -5214,13 +6717,14 @@ class _$MetadataPluginRepositoryImpl implements _MetadataPluginRepository { (identical(other.owner, owner) || other.owner == owner) && (identical(other.description, description) || other.description == description) && - (identical(other.repoUrl, repoUrl) || other.repoUrl == repoUrl)); + (identical(other.repoUrl, repoUrl) || other.repoUrl == repoUrl) && + const DeepCollectionEquality().equals(other._topics, _topics)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => - Object.hash(runtimeType, name, owner, description, repoUrl); + int get hashCode => Object.hash(runtimeType, name, owner, description, + repoUrl, const DeepCollectionEquality().hash(_topics)); /// Create a copy of MetadataPluginRepository /// with the given fields replaced by the non-null parameter values. @@ -5244,7 +6748,8 @@ abstract class _MetadataPluginRepository implements MetadataPluginRepository { {required final String name, required final String owner, required final String description, - required final String repoUrl}) = _$MetadataPluginRepositoryImpl; + required final String repoUrl, + required final List topics}) = _$MetadataPluginRepositoryImpl; factory _MetadataPluginRepository.fromJson(Map json) = _$MetadataPluginRepositoryImpl.fromJson; @@ -5257,6 +6762,8 @@ abstract class _MetadataPluginRepository implements MetadataPluginRepository { String get description; @override String get repoUrl; + @override + List get topics; /// Create a copy of MetadataPluginRepository /// with the given fields replaced by the non-null parameter values. diff --git a/lib/models/metadata/metadata.g.dart b/lib/models/metadata/metadata.g.dart index 6f416330..56783d80 100644 --- a/lib/models/metadata/metadata.g.dart +++ b/lib/models/metadata/metadata.g.dart @@ -6,6 +6,123 @@ part of 'metadata.dart'; // JsonSerializableGenerator // ************************************************************************** +_$SpotubeAudioSourceContainerPresetLossyImpl + _$$SpotubeAudioSourceContainerPresetLossyImplFromJson(Map json) => + _$SpotubeAudioSourceContainerPresetLossyImpl( + type: $enumDecode(_$SpotubeMediaCompressionTypeEnumMap, json['type']), + name: json['name'] as String, + qualities: (json['qualities'] as List) + .map((e) => SpotubeAudioLossyContainerQuality.fromJson( + Map.from(e as Map))) + .toList(), + ); + +Map _$$SpotubeAudioSourceContainerPresetLossyImplToJson( + _$SpotubeAudioSourceContainerPresetLossyImpl instance) => + { + 'type': _$SpotubeMediaCompressionTypeEnumMap[instance.type]!, + 'name': instance.name, + 'qualities': instance.qualities.map((e) => e.toJson()).toList(), + }; + +const _$SpotubeMediaCompressionTypeEnumMap = { + SpotubeMediaCompressionType.lossy: 'lossy', + SpotubeMediaCompressionType.lossless: 'lossless', +}; + +_$SpotubeAudioSourceContainerPresetLosslessImpl + _$$SpotubeAudioSourceContainerPresetLosslessImplFromJson(Map json) => + _$SpotubeAudioSourceContainerPresetLosslessImpl( + type: $enumDecode(_$SpotubeMediaCompressionTypeEnumMap, json['type']), + name: json['name'] as String, + qualities: (json['qualities'] as List) + .map((e) => SpotubeAudioLosslessContainerQuality.fromJson( + Map.from(e as Map))) + .toList(), + ); + +Map _$$SpotubeAudioSourceContainerPresetLosslessImplToJson( + _$SpotubeAudioSourceContainerPresetLosslessImpl instance) => + { + 'type': _$SpotubeMediaCompressionTypeEnumMap[instance.type]!, + 'name': instance.name, + 'qualities': instance.qualities.map((e) => e.toJson()).toList(), + }; + +_$SpotubeAudioLossyContainerQualityImpl + _$$SpotubeAudioLossyContainerQualityImplFromJson(Map json) => + _$SpotubeAudioLossyContainerQualityImpl( + bitrate: (json['bitrate'] as num).toInt(), + ); + +Map _$$SpotubeAudioLossyContainerQualityImplToJson( + _$SpotubeAudioLossyContainerQualityImpl instance) => + { + 'bitrate': instance.bitrate, + }; + +_$SpotubeAudioLosslessContainerQualityImpl + _$$SpotubeAudioLosslessContainerQualityImplFromJson(Map json) => + _$SpotubeAudioLosslessContainerQualityImpl( + bitDepth: (json['bitDepth'] as num).toInt(), + sampleRate: (json['sampleRate'] as num).toInt(), + ); + +Map _$$SpotubeAudioLosslessContainerQualityImplToJson( + _$SpotubeAudioLosslessContainerQualityImpl instance) => + { + 'bitDepth': instance.bitDepth, + 'sampleRate': instance.sampleRate, + }; + +_$SpotubeAudioSourceMatchObjectImpl + _$$SpotubeAudioSourceMatchObjectImplFromJson(Map json) => + _$SpotubeAudioSourceMatchObjectImpl( + id: json['id'] as String, + title: json['title'] as String, + artists: (json['artists'] as List) + .map((e) => e as String) + .toList(), + duration: Duration(microseconds: (json['duration'] as num).toInt()), + thumbnail: json['thumbnail'] as String?, + externalUri: json['externalUri'] as String, + ); + +Map _$$SpotubeAudioSourceMatchObjectImplToJson( + _$SpotubeAudioSourceMatchObjectImpl instance) => + { + 'id': instance.id, + 'title': instance.title, + 'artists': instance.artists, + 'duration': instance.duration.inMicroseconds, + 'thumbnail': instance.thumbnail, + 'externalUri': instance.externalUri, + }; + +_$SpotubeAudioSourceStreamObjectImpl + _$$SpotubeAudioSourceStreamObjectImplFromJson(Map json) => + _$SpotubeAudioSourceStreamObjectImpl( + url: json['url'] as String, + container: json['container'] as String, + type: $enumDecode(_$SpotubeMediaCompressionTypeEnumMap, json['type']), + codec: json['codec'] as String?, + bitrate: (json['bitrate'] as num?)?.toDouble(), + bitDepth: (json['bitDepth'] as num?)?.toInt(), + sampleRate: (json['sampleRate'] as num?)?.toDouble(), + ); + +Map _$$SpotubeAudioSourceStreamObjectImplToJson( + _$SpotubeAudioSourceStreamObjectImpl instance) => + { + 'url': instance.url, + 'container': instance.container, + 'type': _$SpotubeMediaCompressionTypeEnumMap[instance.type]!, + 'codec': instance.codec, + 'bitrate': instance.bitrate, + 'bitDepth': instance.bitDepth, + 'sampleRate': instance.sampleRate, + }; + _$SpotubeFullAlbumObjectImpl _$$SpotubeFullAlbumObjectImplFromJson(Map json) => _$SpotubeFullAlbumObjectImpl( id: json['id'] as String, @@ -419,7 +536,6 @@ Map _$$SpotubeUserObjectImplToJson( _$PluginConfigurationImpl _$$PluginConfigurationImplFromJson(Map json) => _$PluginConfigurationImpl( - type: $enumDecode(_$PluginTypeEnumMap, json['type']), name: json['name'] as String, description: json['description'] as String, version: json['version'] as String, @@ -440,7 +556,6 @@ _$PluginConfigurationImpl _$$PluginConfigurationImplFromJson(Map json) => Map _$$PluginConfigurationImplToJson( _$PluginConfigurationImpl instance) => { - 'type': _$PluginTypeEnumMap[instance.type]!, 'name': instance.name, 'description': instance.description, 'version': instance.version, @@ -453,10 +568,6 @@ Map _$$PluginConfigurationImplToJson( 'repository': instance.repository, }; -const _$PluginTypeEnumMap = { - PluginType.metadata: 'metadata', -}; - const _$PluginApisEnumMap = { PluginApis.webview: 'webview', PluginApis.localstorage: 'localstorage', @@ -466,6 +577,8 @@ const _$PluginApisEnumMap = { const _$PluginAbilitiesEnumMap = { PluginAbilities.authentication: 'authentication', PluginAbilities.scrobbling: 'scrobbling', + PluginAbilities.metadata: 'metadata', + PluginAbilities.audioSource: 'audio-source', }; _$PluginUpdateAvailableImpl _$$PluginUpdateAvailableImplFromJson(Map json) => @@ -490,6 +603,8 @@ _$MetadataPluginRepositoryImpl _$$MetadataPluginRepositoryImplFromJson( owner: json['owner'] as String, description: json['description'] as String, repoUrl: json['repoUrl'] as String, + topics: + (json['topics'] as List).map((e) => e as String).toList(), ); Map _$$MetadataPluginRepositoryImplToJson( @@ -499,4 +614,5 @@ Map _$$MetadataPluginRepositoryImplToJson( 'owner': instance.owner, 'description': instance.description, 'repoUrl': instance.repoUrl, + 'topics': instance.topics, }; diff --git a/lib/models/metadata/plugin.dart b/lib/models/metadata/plugin.dart index ac6bb0b9..6bc84160 100644 --- a/lib/models/metadata/plugin.dart +++ b/lib/models/metadata/plugin.dart @@ -1,17 +1,20 @@ part of 'metadata.dart'; -enum PluginType { metadata } - enum PluginApis { webview, localstorage, timezone } -enum PluginAbilities { authentication, scrobbling } +enum PluginAbilities { + authentication, + scrobbling, + metadata, + @JsonValue('audio-source') + audioSource, +} @freezed class PluginConfiguration with _$PluginConfiguration { const PluginConfiguration._(); factory PluginConfiguration({ - required PluginType type, required String name, required String description, required String version, diff --git a/lib/models/metadata/repository.dart b/lib/models/metadata/repository.dart index 06151dee..2a83f791 100644 --- a/lib/models/metadata/repository.dart +++ b/lib/models/metadata/repository.dart @@ -7,6 +7,7 @@ class MetadataPluginRepository with _$MetadataPluginRepository { required String owner, required String description, required String repoUrl, + required List topics, }) = _MetadataPluginRepository; factory MetadataPluginRepository.fromJson(Map json) => diff --git a/lib/models/playback/track_sources.dart b/lib/models/playback/track_sources.dart index 1666609c..677b34b8 100644 --- a/lib/models/playback/track_sources.dart +++ b/lib/models/playback/track_sources.dart @@ -1,122 +1,15 @@ import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:spotube/models/database/database.dart'; import 'package:spotube/models/metadata/metadata.dart'; -import 'package:spotube/services/audio_player/audio_player.dart'; -import 'package:spotube/services/logger/logger.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; -part 'track_sources.freezed.dart'; part 'track_sources.g.dart'; -@freezed -class TrackSourceQuery with _$TrackSourceQuery { - TrackSourceQuery._(); - - factory TrackSourceQuery({ - required String id, - required String title, - required List artists, - required String album, - required int durationMs, - required String isrc, - required bool explicit, - }) = _TrackSourceQuery; - - factory TrackSourceQuery.fromJson(Map json) => - _$TrackSourceQueryFromJson(json); - - factory TrackSourceQuery.fromTrack(SpotubeFullTrackObject track) { - return TrackSourceQuery( - id: track.id, - title: track.name, - artists: track.artists.map((e) => e.name).toList(), - album: track.album.name, - durationMs: track.durationMs, - isrc: track.isrc, - explicit: track.explicit, - ); - } - - /// Parses [SpotubeMedia]'s [uri] property to create a [TrackSourceQuery]. - factory TrackSourceQuery.parseUri(String url) { - final isLocal = !url.startsWith("http"); - - if (isLocal) { - try { - return TrackSourceQuery( - id: url, - title: '', - artists: [], - album: '', - durationMs: 0, - isrc: '', - explicit: false, - ); - } catch (e, stackTrace) { - AppLogger.log.e( - "Failed to parse local track URI: $url\n$e", - stackTrace: stackTrace, - ); - } - } - - final uri = Uri.parse(url); - return TrackSourceQuery( - id: uri.pathSegments.last, - title: uri.queryParameters['title'] ?? '', - artists: uri.queryParameters['artists']?.split(',') ?? [], - album: uri.queryParameters['album'] ?? '', - durationMs: int.tryParse(uri.queryParameters['durationMs'] ?? '0') ?? 0, - isrc: uri.queryParameters['isrc'] ?? '', - explicit: uri.queryParameters['explicit']?.toLowerCase() == 'true', - ); - } - - String queryString() { - return toJson() - .entries - .map((e) => - "${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value is List ? e.value.join(",") : e.value.toString())}") - .join("&"); - } -} - -@freezed -class TrackSourceInfo with _$TrackSourceInfo { - factory TrackSourceInfo({ - required String id, - required String title, - required String artists, - required String thumbnail, - required String pageUrl, - required int durationMs, - }) = _TrackSourceInfo; - - factory TrackSourceInfo.fromJson(Map json) => - _$TrackSourceInfoFromJson(json); -} - -@freezed -class TrackSource with _$TrackSource { - factory TrackSource({ - required String url, - required SourceQualities quality, - required SourceCodecs codec, - required String bitrate, - required String qualityLabel, - }) = _TrackSource; - - factory TrackSource.fromJson(Map json) => - _$TrackSourceFromJson(json); -} - @JsonSerializable() class BasicSourcedTrack { - final TrackSourceQuery query; - final AudioSource source; - final TrackSourceInfo info; - final List sources; - final List siblings; + final SpotubeFullTrackObject query; + final SpotubeAudioSourceMatchObject info; + final String source; + final List sources; + final List siblings; BasicSourcedTrack({ required this.query, required this.source, diff --git a/lib/models/playback/track_sources.g.dart b/lib/models/playback/track_sources.g.dart index dd63aebb..3088493a 100644 --- a/lib/models/playback/track_sources.g.dart +++ b/lib/models/playback/track_sources.g.dart @@ -7,17 +7,18 @@ part of 'track_sources.dart'; // ************************************************************************** BasicSourcedTrack _$BasicSourcedTrackFromJson(Map json) => BasicSourcedTrack( - query: TrackSourceQuery.fromJson( + query: SpotubeFullTrackObject.fromJson( Map.from(json['query'] as Map)), - source: $enumDecode(_$AudioSourceEnumMap, json['source']), - info: TrackSourceInfo.fromJson( + source: json['source'] as String, + info: SpotubeAudioSourceMatchObject.fromJson( Map.from(json['info'] as Map)), sources: (json['sources'] as List) - .map((e) => TrackSource.fromJson(Map.from(e as Map))) + .map((e) => SpotubeAudioSourceStreamObject.fromJson( + Map.from(e as Map))) .toList(), siblings: (json['siblings'] as List?) - ?.map((e) => - TrackSourceInfo.fromJson(Map.from(e as Map))) + ?.map((e) => SpotubeAudioSourceMatchObject.fromJson( + Map.from(e as Map))) .toList() ?? const [], ); @@ -25,92 +26,8 @@ BasicSourcedTrack _$BasicSourcedTrackFromJson(Map json) => BasicSourcedTrack( Map _$BasicSourcedTrackToJson(BasicSourcedTrack instance) => { 'query': instance.query.toJson(), - 'source': _$AudioSourceEnumMap[instance.source]!, 'info': instance.info.toJson(), + 'source': instance.source, 'sources': instance.sources.map((e) => e.toJson()).toList(), 'siblings': instance.siblings.map((e) => e.toJson()).toList(), }; - -const _$AudioSourceEnumMap = { - AudioSource.youtube: 'youtube', - AudioSource.piped: 'piped', - AudioSource.jiosaavn: 'jiosaavn', - AudioSource.invidious: 'invidious', - AudioSource.dabMusic: 'dabMusic', -}; - -_$TrackSourceQueryImpl _$$TrackSourceQueryImplFromJson(Map json) => - _$TrackSourceQueryImpl( - id: json['id'] as String, - title: json['title'] as String, - artists: - (json['artists'] as List).map((e) => e as String).toList(), - album: json['album'] as String, - durationMs: (json['durationMs'] as num).toInt(), - isrc: json['isrc'] as String, - explicit: json['explicit'] as bool, - ); - -Map _$$TrackSourceQueryImplToJson( - _$TrackSourceQueryImpl instance) => - { - 'id': instance.id, - 'title': instance.title, - 'artists': instance.artists, - 'album': instance.album, - 'durationMs': instance.durationMs, - 'isrc': instance.isrc, - 'explicit': instance.explicit, - }; - -_$TrackSourceInfoImpl _$$TrackSourceInfoImplFromJson(Map json) => - _$TrackSourceInfoImpl( - id: json['id'] as String, - title: json['title'] as String, - artists: json['artists'] as String, - thumbnail: json['thumbnail'] as String, - pageUrl: json['pageUrl'] as String, - durationMs: (json['durationMs'] as num).toInt(), - ); - -Map _$$TrackSourceInfoImplToJson( - _$TrackSourceInfoImpl instance) => - { - 'id': instance.id, - 'title': instance.title, - 'artists': instance.artists, - 'thumbnail': instance.thumbnail, - 'pageUrl': instance.pageUrl, - 'durationMs': instance.durationMs, - }; - -_$TrackSourceImpl _$$TrackSourceImplFromJson(Map json) => _$TrackSourceImpl( - url: json['url'] as String, - quality: $enumDecode(_$SourceQualitiesEnumMap, json['quality']), - codec: $enumDecode(_$SourceCodecsEnumMap, json['codec']), - bitrate: json['bitrate'] as String, - qualityLabel: json['qualityLabel'] as String, - ); - -Map _$$TrackSourceImplToJson(_$TrackSourceImpl instance) => - { - 'url': instance.url, - 'quality': _$SourceQualitiesEnumMap[instance.quality]!, - 'codec': _$SourceCodecsEnumMap[instance.codec]!, - 'bitrate': instance.bitrate, - 'qualityLabel': instance.qualityLabel, - }; - -const _$SourceQualitiesEnumMap = { - SourceQualities.uncompressed: 'uncompressed', - SourceQualities.high: 'high', - SourceQualities.medium: 'medium', - SourceQualities.low: 'low', -}; - -const _$SourceCodecsEnumMap = { - SourceCodecs.m4a: 'm4a', - SourceCodecs.weba: 'weba', - SourceCodecs.mp3: 'mp3', - SourceCodecs.flac: 'flac', -}; diff --git a/lib/modules/library/local_folder/cache_export_dialog.dart b/lib/modules/library/local_folder/cache_export_dialog.dart index 0f10defc..4c86a8d5 100644 --- a/lib/modules/library/local_folder/cache_export_dialog.dart +++ b/lib/modules/library/local_folder/cache_export_dialog.dart @@ -6,9 +6,8 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:path/path.dart' as path; import 'package:spotube/extensions/context.dart'; import 'package:spotube/services/logger/logger.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; -final codecs = SourceCodecs.values.map((s) => s.name); +const containers = ["m4a", "mp3", "mp4", "ogg", "wav", "flac"]; class LocalFolderCacheExportDialog extends HookConsumerWidget { final Directory exportDir; @@ -30,7 +29,8 @@ class LocalFolderCacheExportDialog extends HookConsumerWidget { final stream = cacheDir.list().where( (event) => event is File && - codecs.contains(path.extension(event.path).replaceAll(".", "")), + containers + .contains(path.extension(event.path).replaceAll(".", "")), ); stream.listen( diff --git a/lib/modules/metadata_plugins/installed_plugin.dart b/lib/modules/metadata_plugins/installed_plugin.dart index ea8cbf29..7abda5ec 100644 --- a/lib/modules/metadata_plugins/installed_plugin.dart +++ b/lib/modules/metadata_plugins/installed_plugin.dart @@ -3,6 +3,7 @@ import 'package:shadcn_flutter/shadcn_flutter.dart'; import 'package:shadcn_flutter/shadcn_flutter_extension.dart'; import 'package:spotube/collections/spotube_icons.dart'; import 'package:spotube/components/markdown/markdown.dart'; +import 'package:spotube/extensions/constrains.dart'; import 'package:spotube/extensions/context.dart'; import 'package:spotube/models/metadata/metadata.dart'; import 'package:spotube/modules/metadata_plugins/plugin_update_available_dialog.dart'; @@ -12,29 +13,60 @@ import 'package:spotube/provider/metadata_plugin/metadata_plugin_provider.dart'; import 'package:spotube/provider/metadata_plugin/updater/update_checker.dart'; import 'package:url_launcher/url_launcher.dart'; +final validAbilities = { + PluginAbilities.metadata: ("Metadata", SpotubeIcons.album), + PluginAbilities.audioSource: ("Audio Source", SpotubeIcons.music), +}; + class MetadataInstalledPluginItem extends HookConsumerWidget { final PluginConfiguration plugin; - final bool isDefault; + final bool isDefaultMetadata; + final bool isDefaultAudioSource; const MetadataInstalledPluginItem({ super.key, required this.plugin, - required this.isDefault, + required this.isDefaultMetadata, + required this.isDefaultAudioSource, }); @override Widget build(BuildContext context, ref) { + final mediaQuery = MediaQuery.sizeOf(context); + final metadataPlugin = ref.watch(metadataPluginProvider); - final isAuthenticatedSnapshot = - ref.watch(metadataPluginAuthenticatedProvider); + final audioSourcePlugin = ref.watch(audioSourcePluginProvider); + final pluginSnapshot = switch ((isDefaultMetadata, isDefaultAudioSource)) { + (true, _) => metadataPlugin, + (false, true) => audioSourcePlugin, + _ => null, + }; + final pluginsNotifier = ref.watch(metadataPluginsProvider.notifier); - final requiresAuth = - isDefault && plugin.abilities.contains(PluginAbilities.authentication); - final supportsScrobbling = - isDefault && plugin.abilities.contains(PluginAbilities.scrobbling); - final isAuthenticated = isAuthenticatedSnapshot.asData?.value == true; - final updateAvailable = - isDefault ? ref.watch(metadataPluginUpdateCheckerProvider) : null; - final hasUpdate = isDefault && updateAvailable?.asData?.value != null; + + final requiresAuth = (isDefaultMetadata || isDefaultAudioSource) && + plugin.abilities.contains(PluginAbilities.authentication); + final supportsScrobbling = isDefaultMetadata && + plugin.abilities.contains(PluginAbilities.scrobbling); + + final isMetadataAuthenticatedSnapshot = + ref.watch(metadataPluginAuthenticatedProvider); + final isAudioSourceAuthenticatedSnapshot = + ref.watch(audioSourcePluginAuthenticatedProvider); + final isAuthenticated = (isDefaultMetadata && + isMetadataAuthenticatedSnapshot.asData?.value == true) || + (isDefaultAudioSource && + isAudioSourceAuthenticatedSnapshot.asData?.value == true); + + final metadataUpdateAvailable = + ref.watch(metadataPluginUpdateCheckerProvider); + final audioSourceUpdateAvailable = + ref.watch(audioSourcePluginUpdateCheckerProvider); + final updateAvailable = switch ((isDefaultMetadata, isDefaultAudioSource)) { + (true, _) => metadataUpdateAvailable, + (false, true) => audioSourceUpdateAvailable, + _ => null, + }; + final hasUpdate = updateAvailable?.asData?.value != null; return Card( child: Column( @@ -79,6 +111,18 @@ class MetadataInstalledPluginItem extends HookConsumerWidget { spacing: 8, children: [ Text(plugin.description), + Wrap( + spacing: 8, + runSpacing: 8, + children: [ + for (final ability in plugin.abilities) + if (validAbilities.keys.contains(ability)) + SecondaryBadge( + leading: Icon(validAbilities[ability]!.$2), + child: Text(validAbilities[ability]!.$1), + ), + ], + ), if (repoUrl != null) Wrap( spacing: 8, @@ -200,111 +244,158 @@ class MetadataInstalledPluginItem extends HookConsumerWidget { ], ), ), - Row( + Wrap( spacing: 8, + runSpacing: 8, + alignment: WrapAlignment.spaceBetween, children: [ - Button.secondary( - enabled: !isDefault, - onPressed: () async { - await pluginsNotifier.setDefaultPlugin(plugin); - }, - child: Text( - isDefault - ? context.l10n.default_plugin - : context.l10n.set_default, - ), - ), - if (isDefault) - Consumer(builder: (context, ref, _) { - final supportTextSnapshot = - ref.watch(metadataPluginSupportTextProvider); - - if (supportTextSnapshot.hasValue && - supportTextSnapshot.value == null) { - return const SizedBox.shrink(); - } - - final bgColor = context.theme.brightness == Brightness.dark - ? const Color.fromARGB(255, 255, 145, 175) - : Colors.pink[600]; - final textColor = context.theme.brightness == Brightness.dark - ? Colors.pink[700] - : Colors.pink[50]; - - final mediaQuery = MediaQuery.sizeOf(context); - - return Button( - style: ButtonVariance.secondary.copyWith( - decoration: (context, states, value) { - return value.copyWithIfBoxDecoration( - color: bgColor, - ); - }, - textStyle: (context, states, value) { - return value.copyWith( - color: textColor, - ); - }, - iconTheme: (context, states, value) { - return value.copyWith( - color: textColor, - ); + Wrap( + spacing: 8, + runSpacing: 8, + children: [ + if (plugin.abilities.contains(PluginAbilities.metadata)) + Button.secondary( + enabled: !isDefaultMetadata, + onPressed: () async { + await pluginsNotifier.setDefaultMetadataPlugin(plugin); }, + child: Text( + isDefaultMetadata + ? context.l10n.default_metadata_source + : context.l10n.set_default_metadata_source, + ), ), - leading: const Icon(SpotubeIcons.heartFilled), - child: Text(context.l10n.support), - onPressed: () { - showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: - Text(context.l10n.support_plugin_development), - content: ConstrainedBox( - constraints: BoxConstraints( - maxHeight: mediaQuery.height * 0.8, - maxWidth: 720, - ), - child: SizedBox( - width: double.infinity, - child: SingleChildScrollView( - child: AppMarkdown( - data: supportTextSnapshot.value ?? "", + if (plugin.abilities.contains(PluginAbilities.audioSource)) + Button.secondary( + enabled: !isDefaultAudioSource, + onPressed: () async { + await pluginsNotifier + .setDefaultAudioSourcePlugin(plugin); + }, + child: Text( + isDefaultAudioSource + ? context.l10n.default_audio_source + : context.l10n.set_default_audio_source, + ), + ), + ], + ), + Row( + mainAxisSize: + mediaQuery.smAndUp ? MainAxisSize.min : MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.end, + spacing: 8, + children: [ + if (isDefaultMetadata || isDefaultAudioSource) + Consumer(builder: (context, ref, _) { + final metadataSupportTextSnapshot = + ref.watch(metadataPluginSupportTextProvider); + final audioSourceSupportTextSnapshot = + ref.watch(audioSourcePluginSupportTextProvider); + + final supportTextSnapshot = + switch ((isDefaultMetadata, isDefaultAudioSource)) { + (true, _) => metadataSupportTextSnapshot, + (false, true) => audioSourceSupportTextSnapshot, + _ => null, + }; + + if ((supportTextSnapshot?.hasValue ?? false) && + supportTextSnapshot?.value == null) { + return const SizedBox.shrink(); + } + + final bgColor = + context.theme.brightness == Brightness.dark + ? const Color.fromARGB(255, 255, 145, 175) + : Colors.pink[600]; + final textColor = + context.theme.brightness == Brightness.dark + ? Colors.pink[700] + : Colors.pink[50]; + + final mediaQuery = MediaQuery.sizeOf(context); + + return Button( + style: ButtonVariance.secondary.copyWith( + decoration: (context, states, value) { + return value.copyWithIfBoxDecoration( + color: bgColor, + ); + }, + textStyle: (context, states, value) { + return value.copyWith( + color: textColor, + ); + }, + iconTheme: (context, states, value) { + return value.copyWith( + color: textColor, + ); + }, + ), + leading: const Icon(SpotubeIcons.heartFilled), + child: Text(context.l10n.support), + onPressed: () { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: Text( + context.l10n.support_plugin_development), + content: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: mediaQuery.height * 0.8, + maxWidth: 720, + ), + child: SizedBox( + width: double.infinity, + child: SingleChildScrollView( + child: AppMarkdown( + data: supportTextSnapshot + ?.asData?.value ?? + "", + ), + ), ), ), - ), - ), - actions: [ - Button.secondary( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text(context.l10n.close), - ), - ], + actions: [ + Button.secondary( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text(context.l10n.close), + ), + ], + ); + }, ); }, ); - }, - ); - }), - const Spacer(), - if (isDefault && requiresAuth && !isAuthenticated) - Button.primary( - onPressed: () async { - await metadataPlugin.asData?.value?.auth.authenticate(); - }, - leading: const Icon(SpotubeIcons.login), - child: Text(context.l10n.login), - ) - else if (isDefault && requiresAuth && isAuthenticated) - Button.destructive( - onPressed: () async { - await metadataPlugin.asData?.value?.auth.logout(); - }, - leading: const Icon(SpotubeIcons.logout), - child: Text(context.l10n.logout), - ) + }), + if ((isDefaultMetadata || isDefaultAudioSource) && + requiresAuth && + !isAuthenticated) + Button.primary( + onPressed: () async { + await pluginSnapshot?.asData?.value?.auth + .authenticate(); + }, + leading: const Icon(SpotubeIcons.login), + child: Text(context.l10n.login), + ) + else if ((isDefaultMetadata || isDefaultAudioSource) && + requiresAuth && + isAuthenticated) + Button.destructive( + onPressed: () async { + await pluginSnapshot?.asData?.value?.auth.logout(); + }, + leading: const Icon(SpotubeIcons.logout), + child: Text(context.l10n.logout), + ), + ], + ) ], ) ], diff --git a/lib/modules/metadata_plugins/plugin_repository.dart b/lib/modules/metadata_plugins/plugin_repository.dart index c303c46b..9bd71f0a 100644 --- a/lib/modules/metadata_plugins/plugin_repository.dart +++ b/lib/modules/metadata_plugins/plugin_repository.dart @@ -11,6 +11,11 @@ import 'package:spotube/provider/metadata_plugin/metadata_plugin_provider.dart'; import 'package:url_launcher/url_launcher_string.dart'; import 'package:change_case/change_case.dart'; +final validTopics = { + "spotube-metadata-plugin": ("Metadata", SpotubeIcons.album), + "spotube-audio-source-plugin": ("Audio Source", SpotubeIcons.music), +}; + class MetadataPluginRepositoryItem extends HookConsumerWidget { final MetadataPluginRepository pluginRepo; const MetadataPluginRepositoryItem({ @@ -208,6 +213,12 @@ class MetadataPluginRepositoryItem extends HookConsumerWidget { ), ), ], + for (final topic in pluginRepo.topics) + if (validTopics.keys.contains(topic)) + SecondaryBadge( + leading: Icon(validTopics[topic]!.$2), + child: Text(validTopics[topic]!.$1), + ), SecondaryBadge( leading: host == "github.com" ? const Icon(SpotubeIcons.github) diff --git a/lib/modules/player/player.dart b/lib/modules/player/player.dart index 4250e153..5ea690e0 100644 --- a/lib/modules/player/player.dart +++ b/lib/modules/player/player.dart @@ -21,11 +21,9 @@ import 'package:spotube/extensions/constrains.dart'; import 'package:spotube/extensions/context.dart'; import 'package:spotube/modules/root/spotube_navigation_bar.dart'; import 'package:spotube/provider/audio_player/audio_player.dart'; +import 'package:spotube/provider/metadata_plugin/audio_source/quality_label.dart'; import 'package:spotube/provider/server/active_track_sources.dart'; import 'package:spotube/provider/volume_provider.dart'; -import 'package:spotube/services/sourced_track/sources/youtube.dart'; - -import 'package:url_launcher/url_launcher_string.dart'; class PlayerView extends HookConsumerWidget { final PanelController panelController; @@ -45,14 +43,7 @@ class PlayerView extends HookConsumerWidget { final currentActiveTrackSource = sourcedCurrentTrack.asData?.value?.source; final isLocalTrack = currentActiveTrack is SpotubeLocalTrackObject; final mediaQuery = MediaQuery.sizeOf(context); - - final activeSourceCodec = useMemoized( - () { - return currentActiveTrackSource - ?.getSourceOfCodec(currentActiveTrackSource.codec); - }, - [currentActiveTrackSource?.sources, currentActiveTrackSource?.codec], - ); + final qualityLabel = ref.watch(audioSourceQualityLabelProvider); final shouldHide = useState(true); @@ -117,22 +108,6 @@ class PlayerView extends HookConsumerWidget { ) ], trailing: [ - if (currentActiveTrackSource is YoutubeSourcedTrack) - TextButton( - size: const ButtonSize(1.2), - leading: Assets.images.logos.songlinkTransparent.image( - width: 20, - height: 20, - color: theme.colorScheme.foreground, - ), - onPressed: () { - final url = - "https://song.link/s/${currentActiveTrack?.id}"; - - launchUrlString(url); - }, - child: Text(context.l10n.song_link), - ), if (!isLocalTrack) Tooltip( tooltip: TooltipContainer( @@ -276,20 +251,19 @@ class PlayerView extends HookConsumerWidget { }), ), const Gap(25), - if (activeSourceCodec != null) - OutlineBadge( - style: const ButtonStyle.outline( - size: ButtonSize.normal, - density: ButtonDensity.dense, - shape: ButtonShape.rectangle, - ).copyWith( - textStyle: (context, states, value) { - return value.copyWith(fontWeight: FontWeight.w500); - }, - ), - leading: const Icon(SpotubeIcons.lightningOutlined), - child: Text(activeSourceCodec.qualityLabel), - ) + OutlineBadge( + style: const ButtonStyle.outline( + size: ButtonSize.normal, + density: ButtonDensity.dense, + shape: ButtonShape.rectangle, + ).copyWith( + textStyle: (context, states, value) { + return value.copyWith(fontWeight: FontWeight.w500); + }, + ), + leading: const Icon(SpotubeIcons.lightningOutlined), + child: Text(qualityLabel), + ) ], ), ), diff --git a/lib/modules/player/sibling_tracks_sheet.dart b/lib/modules/player/sibling_tracks_sheet.dart index a6c3ae32..7b780143 100644 --- a/lib/modules/player/sibling_tracks_sheet.dart +++ b/lib/modules/player/sibling_tracks_sheet.dart @@ -1,60 +1,16 @@ -import 'package:collection/collection.dart'; - import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:shadcn_flutter/shadcn_flutter.dart'; -import 'package:shadcn_flutter/shadcn_flutter_extension.dart'; -import 'package:spotube/collections/assets.gen.dart'; -import 'package:spotube/collections/spotube_icons.dart'; -import 'package:spotube/components/button/back_button.dart'; import 'package:spotube/components/image/universal_image.dart'; import 'package:spotube/components/inter_scrollbar/inter_scrollbar.dart'; import 'package:spotube/components/ui/button_tile.dart'; import 'package:spotube/extensions/constrains.dart'; import 'package:spotube/extensions/context.dart'; import 'package:spotube/extensions/duration.dart'; -import 'package:spotube/hooks/controllers/use_shadcn_text_editing_controller.dart'; -import 'package:spotube/hooks/utils/use_debounce.dart'; -import 'package:spotube/models/database/database.dart'; import 'package:spotube/models/metadata/metadata.dart'; -import 'package:spotube/models/playback/track_sources.dart'; import 'package:spotube/provider/audio_player/audio_player.dart'; import 'package:spotube/provider/audio_player/querying_track_info.dart'; import 'package:spotube/provider/server/active_track_sources.dart'; -import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; -import 'package:spotube/provider/youtube_engine/youtube_engine.dart'; -import 'package:spotube/services/sourced_track/models/video_info.dart'; -import 'package:spotube/services/sourced_track/sources/jiosaavn.dart'; -import 'package:spotube/services/sourced_track/sources/youtube.dart'; -import 'package:spotube/utils/service_utils.dart'; - -final sourceInfoToIconMap = { - AudioSource.youtube: - const Icon(SpotubeIcons.youtube, color: Color(0xFFFF0000)), - AudioSource.jiosaavn: Container( - height: 30, - width: 30, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(90), - image: DecorationImage( - image: Assets.images.logos.jiosaavn.provider(), - fit: BoxFit.cover, - ), - ), - ), - AudioSource.piped: const Icon(SpotubeIcons.piped), - AudioSource.invidious: Container( - height: 18, - width: 18, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(90), - image: DecorationImage( - image: Assets.images.logos.invidious.provider(), - fit: BoxFit.cover, - ), - ), - ), -}; class SiblingTracksSheet extends HookConsumerWidget { final bool floating; @@ -65,94 +21,21 @@ class SiblingTracksSheet extends HookConsumerWidget { @override Widget build(BuildContext context, ref) { - final theme = Theme.of(context); - final isFetchingActiveTrack = ref.watch(queryingTrackInfoProvider); - final preferences = ref.watch(userPreferencesProvider); - final youtubeEngine = ref.watch(youtubeEngineProvider); + final controller = useScrollController(); - final isLoading = useState(false); - final isSearching = useState(false); - final searchMode = useState(preferences.searchMode); + final isFetchingActiveTrack = ref.watch(queryingTrackInfoProvider); final activeTrackSources = ref.watch(activeTrackSourcesProvider); final activeTrackNotifier = activeTrackSources.asData?.value?.notifier; final activeTrack = activeTrackSources.asData?.value?.track; final activeTrackSource = activeTrackSources.asData?.value?.source; - final title = ServiceUtils.getTitle( - activeTrack?.name ?? "", - artists: activeTrack?.artists.map((e) => e.name).toList() ?? [], - onlyCleanArtist: true, - ).trim(); - - final defaultSearchTerm = - "$title - ${activeTrack?.artists.asString() ?? ""}"; - final searchController = useShadcnTextEditingController( - text: defaultSearchTerm, - ); - - final searchTerm = useDebounce( - useValueListenable(searchController).text, - ); - - final controller = useScrollController(); - - final searchRequest = useMemoized(() async { - if (searchTerm.trim().isEmpty || activeTrackSource == null) { - return []; - } - if (preferences.audioSource == AudioSource.jiosaavn) { - final resultsJioSaavn = - await jiosaavnClient.search.songs(searchTerm.trim()); - final results = await Future.wait( - resultsJioSaavn.results.mapIndexed((i, song) async { - final siblingType = JioSaavnSourcedTrack.toSiblingType(song); - return siblingType.info; - })); - - final activeSourceInfo = activeTrackSource.info; - - return results - ..removeWhere((element) => element.id == activeSourceInfo.id) - ..insert( - 0, - activeSourceInfo, - ); - } else { - final resultsYt = await youtubeEngine.searchVideos(searchTerm.trim()); - - final searchResults = await Future.wait( - resultsYt - .map(YoutubeVideoInfo.fromVideo) - .mapIndexed((i, video) async { - if (!context.mounted) return null; - final siblingType = - await YoutubeSourcedTrack.toSiblingType(i, video, ref); - return siblingType.info; - }) - .whereType>() - .toList(), - ); - final activeSourceInfo = activeTrackSource.info; - return searchResults - ..removeWhere((element) => element.id == activeSourceInfo.id) - ..insert(0, activeSourceInfo); - } - }, [ - searchTerm, - searchMode.value, - activeTrack, - activeTrackSource, - preferences.audioSource, - youtubeEngine, - ]); - - final siblings = useMemoized( + final siblings = useMemoized>( () => !isFetchingActiveTrack ? [ if (activeTrackSource != null) activeTrackSource.info, ...?activeTrackSource?.siblings, ] - : [], + : [], [activeTrackSource, isFetchingActiveTrack], ); @@ -166,74 +49,6 @@ class SiblingTracksSheet extends HookConsumerWidget { return null; }, [activeTrack, previousActiveTrack]); - final itemBuilder = useCallback( - (TrackSourceInfo sourceInfo, AudioSource source) { - final icon = sourceInfoToIconMap[source]; - return ButtonTile( - style: ButtonVariance.ghost, - padding: const EdgeInsets.symmetric(horizontal: 8), - title: Text( - sourceInfo.title, - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - leading: UniversalImage( - path: sourceInfo.thumbnail, - height: 60, - width: 60, - ), - trailing: Text(Duration(milliseconds: sourceInfo.durationMs) - .toHumanReadableString()), - subtitle: Row( - children: [ - if (icon != null) icon, - Flexible( - child: Text( - " • ${sourceInfo.artists}", - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - ], - ), - enabled: !isFetchingActiveTrack && !isLoading.value, - selected: !isFetchingActiveTrack && - sourceInfo.id == activeTrackSource?.info.id, - onPressed: () async { - if (!isFetchingActiveTrack && - sourceInfo.id != activeTrackSource?.info.id) { - try { - isLoading.value = true; - await activeTrackNotifier?.swapWithSibling(sourceInfo); - await ref.read(audioPlayerProvider.notifier).swapActiveSource(); - - if (context.mounted) { - if (MediaQuery.sizeOf(context).mdAndUp) { - closeOverlay(context); - } else { - closeDrawer(context); - } - } - } finally { - if (context.mounted) { - isLoading.value = false; - } - } - } - }, - ); - }, - [ - activeTrackSource, - activeTrackNotifier, - siblings, - isFetchingActiveTrack, - isLoading.value, - ], - ); - - final scale = context.theme.scaling; - return SafeArea( child: Column( mainAxisSize: MainAxisSize.min, @@ -244,72 +59,16 @@ class SiblingTracksSheet extends HookConsumerWidget { spacing: 5, children: [ AnimatedSwitcher( - duration: const Duration(milliseconds: 300), - child: !isSearching.value - ? Text( - context.l10n.alternative_track_sources, - ).bold() - : ConstrainedBox( - constraints: BoxConstraints( - maxWidth: 320 * scale, - maxHeight: 38 * scale, - ), - child: TextField( - autofocus: true, - controller: searchController, - placeholder: Text(context.l10n.search), - style: theme.typography.bold, - ), - ), - ), - const Spacer(), - if (!isSearching.value) ...[ - IconButton.outline( - icon: const Icon(SpotubeIcons.search, size: 18), - onPressed: () { - isSearching.value = true; - }, - ), - if (!floating) const BackButton(icon: SpotubeIcons.angleDown) - ] else ...[ - if (preferences.audioSource == AudioSource.piped) - IconButton.outline( - icon: const Icon(SpotubeIcons.filter, size: 18), - onPressed: () { - showPopover( - context: context, - alignment: Alignment.bottomRight, - builder: (context) { - return DropdownMenu( - children: SearchMode.values - .map( - (e) => MenuButton( - onPressed: (context) { - searchMode.value = e; - }, - enabled: searchMode.value != e, - child: Text(e.label), - ), - ) - .toList(), - ); - }, - ); - }, - ), - IconButton.outline( - icon: const Icon(SpotubeIcons.close, size: 18), - onPressed: () { - isSearching.value = false; - }, - ), - ] + duration: const Duration(milliseconds: 300), + child: Text( + context.l10n.alternative_track_sources, + ).bold()), ], ), ), AnimatedSwitcher( duration: const Duration(milliseconds: 300), - child: isLoading.value + child: activeTrackSources.isLoading ? const SizedBox( width: double.infinity, child: LinearProgressIndicator(), @@ -323,42 +82,62 @@ class SiblingTracksSheet extends HookConsumerWidget { FadeTransition(opacity: animation, child: child), child: InterScrollbar( controller: controller, - child: switch (isSearching.value) { - false => ListView.separated( - padding: const EdgeInsets.all(8.0), - controller: controller, - itemCount: siblings.length, - separatorBuilder: (context, index) => const Gap(8), - itemBuilder: (context, index) => itemBuilder( - siblings[index], - activeTrackSource!.source, - ), - ), - true => FutureBuilder( - future: searchRequest, - builder: (context, snapshot) { - if (snapshot.hasError) { - return Center( - child: Text(snapshot.error.toString()), - ); - } else if (!snapshot.hasData) { - return const Center( - child: CircularProgressIndicator()); - } + child: ListView.separated( + padding: const EdgeInsets.all(8.0), + controller: controller, + itemCount: siblings.length, + separatorBuilder: (context, index) => const Gap(8), + itemBuilder: (context, index) { + final sourceInfo = siblings[index]; - return ListView.separated( - padding: const EdgeInsets.all(8.0), - controller: controller, - itemCount: snapshot.data!.length, - separatorBuilder: (context, index) => const Gap(8), - itemBuilder: (context, index) => itemBuilder( - snapshot.data![index], - preferences.audioSource, - ), - ); + return ButtonTile( + style: ButtonVariance.ghost, + padding: const EdgeInsets.symmetric(horizontal: 8), + title: Text( + sourceInfo.title, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + leading: sourceInfo.thumbnail != null + ? UniversalImage( + path: sourceInfo.thumbnail!, + height: 60, + width: 60, + ) + : null, + trailing: + Text(sourceInfo.duration.toHumanReadableString()), + subtitle: Flexible( + child: Text( + sourceInfo.artists.join(", "), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + enabled: !isFetchingActiveTrack, + selected: !isFetchingActiveTrack && + sourceInfo.id == activeTrackSource?.info.id, + onPressed: () async { + if (!isFetchingActiveTrack && + sourceInfo.id != activeTrackSource?.info.id) { + await activeTrackNotifier + ?.swapWithSibling(sourceInfo); + await ref + .read(audioPlayerProvider.notifier) + .swapActiveSource(); + + if (context.mounted) { + if (MediaQuery.sizeOf(context).mdAndUp) { + closeOverlay(context); + } else { + closeDrawer(context); + } + } + } }, - ), - }, + ); + }, + ), ), ), ), diff --git a/lib/modules/root/sidebar/sidebar.dart b/lib/modules/root/sidebar/sidebar.dart index e4e7db3d..1538d624 100644 --- a/lib/modules/root/sidebar/sidebar.dart +++ b/lib/modules/root/sidebar/sidebar.dart @@ -22,7 +22,7 @@ class Sidebar extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final ThemeData(:colorScheme) = Theme.of(context); - final mediaQuery = MediaQuery.of(context); + final mediaQuery = MediaQuery.sizeOf(context); final layoutMode = ref.watch(userPreferencesProvider.select((s) => s.layoutMode)); diff --git a/lib/modules/root/use_global_subscriptions.dart b/lib/modules/root/use_global_subscriptions.dart index 68f70b5a..9a492d31 100644 --- a/lib/modules/root/use_global_subscriptions.dart +++ b/lib/modules/root/use_global_subscriptions.dart @@ -31,7 +31,7 @@ void useGlobalSubscriptions(WidgetRef ref) { showDialog( context: context, builder: (context) => MetadataPluginUpdateAvailableDialog( - plugin: pluginConfig.defaultPluginConfig!, + plugin: pluginConfig.defaultMetadataPluginConfig!, update: pluginUpdate, ), ); diff --git a/lib/pages/getting_started/sections/playback.dart b/lib/pages/getting_started/sections/playback.dart index a6f887cb..699024b1 100644 --- a/lib/pages/getting_started/sections/playback.dart +++ b/lib/pages/getting_started/sections/playback.dart @@ -1,32 +1,11 @@ -import 'package:flutter/material.dart' show Badge; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:shadcn_flutter/shadcn_flutter.dart'; -import 'package:spotube/collections/assets.gen.dart'; import 'package:spotube/collections/spotube_icons.dart'; import 'package:spotube/components/ui/button_tile.dart'; -import 'package:spotube/models/database/database.dart'; import 'package:spotube/modules/getting_started/blur_card.dart'; import 'package:spotube/extensions/context.dart'; import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; -final audioSourceToIconMap = { - AudioSource.youtube: const Icon( - SpotubeIcons.youtube, - color: Colors.red, - size: 20, - ), - AudioSource.piped: const Icon(SpotubeIcons.piped, size: 20), - AudioSource.invidious: ClipRRect( - borderRadius: BorderRadius.circular(26), - child: Assets.images.logos.invidious.image(width: 26, height: 26), - ), - AudioSource.jiosaavn: - Assets.images.logos.jiosaavn.image(width: 20, height: 20), - AudioSource.dabMusic: - Assets.images.logos.dabMusic.image(width: 20, height: 20), -}; - class GettingStartedPagePlaybackSection extends HookConsumerWidget { final VoidCallback onNext; final VoidCallback onPrevious; @@ -42,19 +21,19 @@ class GettingStartedPagePlaybackSection extends HookConsumerWidget { final preferences = ref.watch(userPreferencesProvider); final preferencesNotifier = ref.read(userPreferencesProvider.notifier); - final audioSourceToDescription = useMemoized( - () => { - AudioSource.youtube: "${context.l10n.youtube_source_description}\n" - "${context.l10n.highest_quality("148kbps mp4, 128kbps opus")}", - AudioSource.piped: context.l10n.piped_source_description, - AudioSource.jiosaavn: - "${context.l10n.jiosaavn_source_description}\n" - "${context.l10n.highest_quality("320kbps mp4")}", - AudioSource.invidious: context.l10n.invidious_source_description, - AudioSource.dabMusic: "${context.l10n.dab_music_source_description}\n" - "${context.l10n.highest_quality("320kbps mp3, HI-RES 24bit 44.1kHz-96kHz flac")}", - }, - []); + // final audioSourceToDescription = useMemoized( + // () => { + // AudioSource.youtube: "${context.l10n.youtube_source_description}\n" + // "${context.l10n.highest_quality("148kbps mp4, 128kbps opus")}", + // AudioSource.piped: context.l10n.piped_source_description, + // AudioSource.jiosaavn: + // "${context.l10n.jiosaavn_source_description}\n" + // "${context.l10n.highest_quality("320kbps mp4")}", + // AudioSource.invidious: context.l10n.invidious_source_description, + // AudioSource.dabMusic: "${context.l10n.dab_music_source_description}\n" + // "${context.l10n.highest_quality("320kbps mp3, HI-RES 24bit 44.1kHz-96kHz flac")}", + // }, + // []); return Center( child: BlurCard( @@ -69,44 +48,44 @@ class GettingStartedPagePlaybackSection extends HookConsumerWidget { ], ), const Gap(16), - Align( - alignment: Alignment.centerLeft, - child: Text(context.l10n.select_audio_source).semiBold().large(), - ), - const Gap(16), - RadioGroup( - value: preferences.audioSource, - onChanged: (value) { - preferencesNotifier.setAudioSource(value); - }, - child: Wrap( - spacing: 6, - runSpacing: 6, - children: [ - for (final source in AudioSource.values) - Badge( - isLabelVisible: source == AudioSource.dabMusic, - label: const Text("NEW"), - backgroundColor: Colors.lime[300], - textColor: Colors.black, - child: RadioCard( - value: source, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - audioSourceToIconMap[source]!, - Text(source.label), - ], - ), - ), - ), - ], - ), - ), - const Gap(16), - Text( - audioSourceToDescription[preferences.audioSource]!, - ).small().muted(), + // Align( + // alignment: Alignment.centerLeft, + // child: Text(context.l10n.select_audio_source).semiBold().large(), + // ), + // const Gap(16), + // RadioGroup( + // value: preferences.audioSource, + // onChanged: (value) { + // preferencesNotifier.setAudioSource(value); + // }, + // child: Wrap( + // spacing: 6, + // runSpacing: 6, + // children: [ + // for (final source in AudioSource.values) + // Badge( + // isLabelVisible: source == AudioSource.dabMusic, + // label: const Text("NEW"), + // backgroundColor: Colors.lime[300], + // textColor: Colors.black, + // child: RadioCard( + // value: source, + // child: Column( + // mainAxisSize: MainAxisSize.min, + // children: [ + // audioSourceToIconMap[source]!, + // Text(source.label), + // ], + // ), + // ), + // ), + // ], + // ), + // ), + // const Gap(16), + // Text( + // audioSourceToDescription[preferences.audioSource]!, + // ).small().muted(), const Gap(16), ButtonTile( title: Text(context.l10n.endless_playback), diff --git a/lib/pages/library/user_downloads.dart b/lib/pages/library/user_downloads.dart index 6566bed6..73dc692f 100644 --- a/lib/pages/library/user_downloads.dart +++ b/lib/pages/library/user_downloads.dart @@ -16,7 +16,7 @@ class UserDownloadsPage extends HookConsumerWidget { Widget build(BuildContext context, ref) { final downloadManager = ref.watch(downloadManagerProvider); - final history = downloadManager.$backHistory; + final history = downloadManager.$history; return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -48,7 +48,7 @@ class UserDownloadsPage extends HookConsumerWidget { child: ListView.builder( itemCount: history.length, itemBuilder: (context, index) { - return DownloadItem(track: history.elementAt(index)); + return DownloadItem(track: history.elementAt(index).query); }, ), ), diff --git a/lib/pages/library/user_local_tracks/local_folder.dart b/lib/pages/library/user_local_tracks/local_folder.dart index 27af0f57..58a7a023 100644 --- a/lib/pages/library/user_local_tracks/local_folder.dart +++ b/lib/pages/library/user_local_tracks/local_folder.dart @@ -346,36 +346,41 @@ class LocalLibraryPage extends HookConsumerWidget { controller: controller, child: Skeletonizer( enabled: trackSnapshot.isLoading, - child: ListView.builder( + child: CustomScrollView( controller: controller, physics: const AlwaysScrollableScrollPhysics(), - itemCount: trackSnapshot.isLoading - ? 5 - : filteredTracks.length, - itemBuilder: (context, index) { - if (trackSnapshot.isLoading) { - return TrackTile( - playlist: playlist, - track: FakeData.track, - index: index, - ); - } + slivers: [ + SliverList.builder( + itemCount: trackSnapshot.isLoading + ? 5 + : filteredTracks.length, + itemBuilder: (context, index) { + if (trackSnapshot.isLoading) { + return TrackTile( + playlist: playlist, + track: FakeData.track, + index: index, + ); + } - final track = filteredTracks[index]; - return TrackTile( - index: index, - playlist: playlist, - track: track, - userPlaylist: false, - onTap: () async { - await playLocalTracks( - ref, - sortedTracks, - currentTrack: track, + final track = filteredTracks[index]; + return TrackTile( + index: index, + playlist: playlist, + track: track, + userPlaylist: false, + onTap: () async { + await playLocalTracks( + ref, + sortedTracks, + currentTrack: track, + ); + }, ); }, - ); - }, + ), + const SliverGap(200), + ], ), ), ), @@ -398,7 +403,7 @@ class LocalLibraryPage extends HookConsumerWidget { error: (error, stackTrace) => Text(error.toString() + stackTrace.toString()), ); - }) + }), ], ), ), diff --git a/lib/pages/settings/metadata_plugins.dart b/lib/pages/settings/metadata_plugins.dart index 6698a67f..d4cb1ecf 100644 --- a/lib/pages/settings/metadata_plugins.dart +++ b/lib/pages/settings/metadata_plugins.dart @@ -30,6 +30,7 @@ class SettingsMetadataProviderPage extends HookConsumerWidget { @override Widget build(BuildContext context, ref) { + final tabState = useState(0); final formKey = useMemoized(() => GlobalKey(), []); final plugins = ref.watch(metadataPluginsProvider); @@ -49,19 +50,50 @@ class SettingsMetadataProviderPage extends HookConsumerWidget { final pluginRepos = pluginReposSnapshot.asData?.value.items ?? []; if (installedPluginIds.isEmpty) return pluginRepos; - return pluginRepos + final availablePlugins = pluginRepos .whereNot((repo) => installedPluginIds.contains(repo.repoUrl)) .toList(); + + if (tabState.value != 0) { + // metadata only plugins + return availablePlugins.where( + (d) { + return d.topics.contains( + tabState.value == 1 + ? "spotube-metadata-plugin" + : "spotube-audio-source-plugin", + ); + }, + ).toList(); + } + + return availablePlugins; // all plugins }, - [plugins.asData?.value.plugins, pluginReposSnapshot.asData?.value], + [ + plugins.asData?.value.plugins, + pluginReposSnapshot.asData?.value, + tabState.value, + ], ); + final installedPlugins = useMemoized?>(() { + if (tabState.value == 0) return plugins.asData?.value.plugins; + + return plugins.asData?.value.plugins.where((d) { + return d.abilities.contains( + tabState.value == 1 + ? PluginAbilities.metadata + : PluginAbilities.audioSource, + ); + }).toList(); + }, [tabState.value, plugins.asData?.value]); + return SafeArea( bottom: false, child: Scaffold( headers: [ TitleBar( - title: Text(context.l10n.metadata_provider_plugins), + title: Text(context.l10n.plugins), ) ], child: Padding( @@ -193,6 +225,20 @@ class SettingsMetadataProviderPage extends HookConsumerWidget { ), ), const SliverGap(12), + SliverToBoxAdapter( + child: TabList( + index: tabState.value, + onChanged: (value) { + tabState.value = value; + }, + children: const [ + TabItem(child: Text("All")), + TabItem(child: Text("Metadata")), + TabItem(child: Text("Audio Source")), + ], + ), + ), + const SliverGap(12), if (plugins.asData?.value.plugins.isNotEmpty ?? false) SliverToBoxAdapter( child: Row( @@ -207,15 +253,20 @@ class SettingsMetadataProviderPage extends HookConsumerWidget { ), const SliverGap(20), SliverList.separated( - itemCount: plugins.asData?.value.plugins.length ?? 0, + itemCount: installedPlugins?.length ?? 0, separatorBuilder: (context, index) => const Gap(12), itemBuilder: (context, index) { - final plugin = plugins.asData!.value.plugins[index]; - final isDefault = - plugins.asData!.value.defaultPlugin == index; + final plugin = installedPlugins![index]; + final isDefaultMetadata = + plugins.asData!.value.defaultMetadataPluginConfig?.slug == + plugin.slug; + final isDefaultAudioSource = plugins + .asData!.value.defaultAudioSourcePluginConfig?.slug == + plugin.slug; return MetadataInstalledPluginItem( plugin: plugin, - isDefault: isDefault, + isDefaultMetadata: isDefaultMetadata, + isDefaultAudioSource: isDefaultAudioSource, ); }, ), @@ -249,6 +300,7 @@ class SettingsMetadataProviderPage extends HookConsumerWidget { description: "Loading...", repoUrl: "", owner: "", + topics: [], ), ), ); diff --git a/lib/pages/settings/sections/accounts.dart b/lib/pages/settings/sections/accounts.dart index af8e1b80..ca859ada 100644 --- a/lib/pages/settings/sections/accounts.dart +++ b/lib/pages/settings/sections/accounts.dart @@ -21,8 +21,8 @@ class SettingsAccountSection extends HookConsumerWidget { children: [ ListTile( leading: const Icon(SpotubeIcons.extensions), - title: Text(context.l10n.metadata_provider_plugins), - subtitle: Text(context.l10n.configure_your_own_metadata_plugin), + title: Text(context.l10n.plugins), + subtitle: Text(context.l10n.configure_plugins), onTap: () { context.pushRoute(const SettingsMetadataProviderRoute()); }, diff --git a/lib/pages/settings/sections/playback.dart b/lib/pages/settings/sections/playback.dart index 6d0b5dc3..7a498ac0 100644 --- a/lib/pages/settings/sections/playback.dart +++ b/lib/pages/settings/sections/playback.dart @@ -1,30 +1,24 @@ import 'dart:io'; import 'package:auto_route/auto_route.dart'; -import 'package:collection/collection.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart' show ListTile; -import 'package:google_fonts/google_fonts.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:piped_client/piped_client.dart'; import 'package:shadcn_flutter/shadcn_flutter.dart'; import 'package:spotube/collections/routes.gr.dart'; import 'package:spotube/collections/spotube_icons.dart'; +import 'package:spotube/components/adaptive/adaptive_select_tile.dart'; import 'package:spotube/models/database/database.dart'; import 'package:spotube/modules/settings/playback/edit_connect_port_dialog.dart'; -import 'package:spotube/modules/settings/playback/edit_instance_url_dialog.dart'; import 'package:spotube/modules/settings/section_card_with_heading.dart'; -import 'package:spotube/components/adaptive/adaptive_select_tile.dart'; import 'package:spotube/extensions/context.dart'; import 'package:spotube/modules/settings/youtube_engine_not_installed_dialog.dart'; -import 'package:spotube/provider/audio_player/sources/invidious_instances_provider.dart'; -import 'package:spotube/provider/audio_player/sources/piped_instances_provider.dart'; +import 'package:spotube/provider/metadata_plugin/audio_source/quality_presets.dart'; import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; import 'package:spotube/services/kv_store/kv_store.dart'; - -import 'package:spotube/services/sourced_track/enums.dart'; import 'package:spotube/services/youtube_engine/yt_dlp_engine.dart'; + import 'package:spotube/utils/platform.dart'; class SettingsPlaybackSection extends HookConsumerWidget { @@ -34,332 +28,107 @@ class SettingsPlaybackSection extends HookConsumerWidget { Widget build(BuildContext context, ref) { final preferences = ref.watch(userPreferencesProvider); final preferencesNotifier = ref.watch(userPreferencesProvider.notifier); + final sourcePresets = ref.watch(audioSourcePresetsProvider); + final sourcePresetsNotifier = + ref.watch(audioSourcePresetsProvider.notifier); final theme = Theme.of(context); return SectionCardWithHeading( heading: context.l10n.playback, children: [ - AdaptiveSelectTile( - secondary: const Icon(SpotubeIcons.audioQuality), - title: Text(context.l10n.audio_quality), - value: preferences.audioQuality, - options: [ - if (preferences.audioSource == AudioSource.dabMusic) - SelectItemButton( - value: SourceQualities.uncompressed, - child: Text(context.l10n.uncompressed), - ), - SelectItemButton( - value: SourceQualities.high, - child: Text(context.l10n.high), - ), - if (preferences.audioSource != AudioSource.dabMusic) ...[ - SelectItemButton( - value: SourceQualities.medium, - child: Text(context.l10n.medium), - ), - SelectItemButton( - value: SourceQualities.low, - child: Text(context.l10n.low), - ), - ] - ], - onChanged: (value) { - if (value != null) { - preferencesNotifier.setAudioQuality(value); - } - }, - ), - AdaptiveSelectTile( - secondary: const Icon(SpotubeIcons.api), - title: Text(context.l10n.audio_source), - value: preferences.audioSource, - options: AudioSource.values + AdaptiveSelectTile( + secondary: const Icon(SpotubeIcons.engine), + title: Text(context.l10n.youtube_engine), + value: preferences.youtubeClientEngine, + options: YoutubeClientEngine.values + .where((e) => e.isAvailableForPlatform()) .map((e) => SelectItemButton( value: e, child: Text(e.label), )) .toList(), - onChanged: (value) { + onChanged: (value) async { if (value == null) return; - preferencesNotifier.setAudioSource(value); + if (value == YoutubeClientEngine.ytDlp) { + final customPath = KVStoreService.getYoutubeEnginePath(value); + if (!await YtDlpEngine.isInstalled() && + (customPath == null || !await File(customPath).exists()) && + context.mounted) { + final hasInstalled = await showDialog( + context: context, + builder: (context) => + YouTubeEngineNotInstalledDialog(engine: value), + ); + if (hasInstalled != true) return; + } + } + preferencesNotifier.setYoutubeClientEngine(value); }, ), - AnimatedCrossFade( - duration: const Duration(milliseconds: 300), - crossFadeState: preferences.audioSource != AudioSource.piped - ? CrossFadeState.showFirst - : CrossFadeState.showSecond, - firstChild: const SizedBox.shrink(), - secondChild: Consumer( - builder: (context, ref, child) { - final instanceList = ref.watch(pipedInstancesFutureProvider); - - return instanceList.when( - data: (data) { - return AdaptiveSelectTile( - secondary: const Icon(SpotubeIcons.piped), - title: Text(context.l10n.piped_instance), - subtitle: Text( - "${context.l10n.piped_description}\n" - "${context.l10n.piped_warning}", - ), - value: preferences.pipedInstance, - showValueWhenUnfolded: false, - trailing: [ - Tooltip( - tooltip: TooltipContainer( - child: Text(context.l10n.add_custom_url), - ).call, - child: IconButton.outline( - icon: const Icon(SpotubeIcons.edit), - size: ButtonSize.small, - onPressed: () { - showDialog( - context: context, - barrierColor: Colors.black.withValues(alpha: 0.5), - builder: (context) => - SettingsPlaybackEditInstanceUrlDialog( - title: context.l10n.piped_instance, - initialValue: preferences.pipedInstance, - onSave: (value) { - preferencesNotifier.setPipedInstance(value); - }, - ), - ); - }, - ), - ) - ], - options: [ - if (data - .none((e) => e.apiUrl == preferences.pipedInstance)) - SelectItemButton( - value: preferences.pipedInstance, - child: Text.rich( - TextSpan( - style: theme.typography.xSmall.copyWith( - color: theme.colorScheme.foreground, - ), - children: [ - TextSpan(text: context.l10n.custom), - const TextSpan(text: "\n"), - TextSpan(text: preferences.pipedInstance), - ], - ), - ), - ), - for (final e in data.sortedBy((e) => e.name)) - SelectItemButton( - value: e.apiUrl, - child: RichText( - text: TextSpan( - style: theme.typography.normal.copyWith( - color: theme.colorScheme.foreground, - ), - children: [ - TextSpan( - text: "${e.name.trim()}\n", - ), - TextSpan( - text: e.locations - .map(countryCodeToEmoji) - .join(""), - style: GoogleFonts.notoColorEmoji(), - ), - ], - ), - ), - ), - ], - onChanged: (value) { - if (value != null) { - preferencesNotifier.setPipedInstance(value); - } - }, - ); - }, - loading: () => const Center( - child: CircularProgressIndicator(), - ), - error: (error, stackTrace) => Text(error.toString()), - ); + if (sourcePresets.presets.isNotEmpty) ...[ + AdaptiveSelectTile( + secondary: const Icon(SpotubeIcons.api), + title: Text(context.l10n.streaming_music_codec), + value: sourcePresets.selectedStreamingContainerIndex, + options: [ + for (final MapEntry(:key, value: preset) + in sourcePresets.presets.asMap().entries) + SelectItemButton(value: key, child: Text(preset.name)), + ], + onChanged: (value) { + if (value == null) return; + sourcePresetsNotifier.setSelectedStreamingContainerIndex(value); }, ), - ), - AnimatedCrossFade( - duration: const Duration(milliseconds: 300), - crossFadeState: preferences.audioSource != AudioSource.invidious - ? CrossFadeState.showFirst - : CrossFadeState.showSecond, - firstChild: const SizedBox.shrink(), - secondChild: Consumer( - builder: (context, ref, child) { - final instanceList = ref.watch(invidiousInstancesProvider); - - return instanceList.when( - data: (data) { - return AdaptiveSelectTile( - secondary: const Icon(SpotubeIcons.piped), - title: Text(context.l10n.invidious_instance), - subtitle: Text( - "${context.l10n.invidious_description}\n" - "${context.l10n.invidious_warning}", - ), - trailing: [ - Tooltip( - tooltip: TooltipContainer( - child: Text(context.l10n.add_custom_url), - ).call, - child: IconButton.outline( - icon: const Icon(SpotubeIcons.edit), - size: ButtonSize.small, - onPressed: () { - showDialog( - context: context, - barrierColor: Colors.black.withValues(alpha: 0.5), - builder: (context) => - SettingsPlaybackEditInstanceUrlDialog( - title: context.l10n.invidious_instance, - initialValue: preferences.invidiousInstance, - onSave: (value) { - preferencesNotifier - .setInvidiousInstance(value); - }, - ), - ); - }, - ), - ) - ], - value: preferences.invidiousInstance, - showValueWhenUnfolded: false, - options: [ - if (data.none((e) => - e.details.uri == preferences.invidiousInstance)) - SelectItemButton( - value: preferences.invidiousInstance, - child: Text.rich( - TextSpan( - style: theme.typography.xSmall.copyWith( - color: theme.colorScheme.foreground, - ), - children: [ - TextSpan(text: context.l10n.custom), - const TextSpan(text: "\n"), - TextSpan(text: preferences.invidiousInstance), - ], - ), - ), - ), - for (final e in data.sortedBy((e) => e.name)) - SelectItemButton( - value: e.details.uri, - child: RichText( - text: TextSpan( - style: theme.typography.normal.copyWith( - color: theme.colorScheme.foreground, - ), - children: [ - TextSpan( - text: "${e.name.trim()}\n", - ), - TextSpan( - text: countryCodeToEmoji( - e.details.region, - ), - style: GoogleFonts.notoColorEmoji(), - ), - ], - ), - ), - ), - ], - onChanged: (value) { - if (value != null) { - preferencesNotifier.setInvidiousInstance(value); - } - }, - ); - }, - loading: () => const Center( - child: CircularProgressIndicator(), - ), - error: (error, stackTrace) => Text(error.toString()), - ); + AdaptiveSelectTile( + secondary: const Icon(SpotubeIcons.api), + title: const Text("Streaming music quality"), + value: sourcePresets.selectedStreamingQualityIndex, + options: [ + for (final MapEntry(:key, value: quality) in sourcePresets + .presets[sourcePresets.selectedStreamingContainerIndex] + .qualities + .asMap() + .entries) + SelectItemButton(value: key, child: Text(quality.toString())), + ], + onChanged: (value) { + if (value == null) return; + sourcePresetsNotifier.setSelectedStreamingQualityIndex(value); }, ), - ), - switch (preferences.audioSource) { - AudioSource.youtube => AdaptiveSelectTile( - secondary: const Icon(SpotubeIcons.engine), - title: Text(context.l10n.youtube_engine), - value: preferences.youtubeClientEngine, - options: YoutubeClientEngine.values - .where((e) => e.isAvailableForPlatform()) - .map((e) => SelectItemButton( - value: e, - child: Text(e.label), - )) - .toList(), - onChanged: (value) async { - if (value == null) return; - if (value == YoutubeClientEngine.ytDlp) { - final customPath = KVStoreService.getYoutubeEnginePath(value); - if (!await YtDlpEngine.isInstalled() && - (customPath == null || - !await File(customPath).exists()) && - context.mounted) { - final hasInstalled = await showDialog( - context: context, - builder: (context) => - YouTubeEngineNotInstalledDialog(engine: value), - ); - if (hasInstalled != true) return; - } - } - preferencesNotifier.setYoutubeClientEngine(value); - }, - ), - AudioSource.piped || - AudioSource.invidious => - AdaptiveSelectTile( - secondary: const Icon(SpotubeIcons.search), - title: Text(context.l10n.search_mode), - value: preferences.searchMode, - options: SearchMode.values - .map((e) => SelectItemButton( - value: e, - child: Text(e.label), - )) - .toList(), - onChanged: (value) { - if (value == null) return; - preferencesNotifier.setSearchMode(value); - }, - ), - _ => const SizedBox.shrink(), - }, - AnimatedCrossFade( - duration: const Duration(milliseconds: 300), - crossFadeState: preferences.searchMode == SearchMode.youtube && - (preferences.audioSource == AudioSource.piped || - preferences.audioSource == AudioSource.youtube || - preferences.audioSource == AudioSource.invidious) - ? CrossFadeState.showFirst - : CrossFadeState.showSecond, - firstChild: ListTile( - leading: const Icon(SpotubeIcons.skip), - title: Text(context.l10n.skip_non_music), - trailing: Switch( - value: preferences.skipNonMusic, - onChanged: (state) { - preferencesNotifier.setSkipNonMusic(state); - }, - ), + AdaptiveSelectTile( + secondary: const Icon(SpotubeIcons.api), + title: Text(context.l10n.download_music_codec), + value: sourcePresets.selectedDownloadingContainerIndex, + options: [ + for (final MapEntry(:key, value: preset) + in sourcePresets.presets.asMap().entries) + SelectItemButton(value: key, child: Text(preset.name)), + ], + onChanged: (value) { + if (value == null) return; + sourcePresetsNotifier.setSelectedDownloadingContainerIndex(value); + }, ), - secondChild: const SizedBox.shrink(), - ), + AdaptiveSelectTile( + secondary: const Icon(SpotubeIcons.api), + title: const Text("Downloading music quality"), + value: sourcePresets.selectedStreamingQualityIndex, + options: [ + for (final MapEntry(:key, value: quality) in sourcePresets + .presets[sourcePresets.selectedDownloadingContainerIndex] + .qualities + .asMap() + .entries) + SelectItemButton(value: key, child: Text(quality.toString())), + ], + onChanged: (value) { + if (value == null) return; + sourcePresetsNotifier.setSelectedStreamingQualityIndex(value); + }, + ), + ], ListTile( title: Text(context.l10n.cache_music), subtitle: kIsMobile @@ -403,50 +172,6 @@ class SettingsPlaybackSection extends HookConsumerWidget { onChanged: preferencesNotifier.setNormalizeAudio, ), ), - if (const [AudioSource.jiosaavn, AudioSource.dabMusic] - .contains(preferences.audioSource) == - false) ...[ - AdaptiveSelectTile( - popupConstraints: const BoxConstraints(maxWidth: 300), - secondary: const Icon(SpotubeIcons.stream), - title: Text(context.l10n.streaming_music_codec), - value: preferences.streamMusicCodec, - showValueWhenUnfolded: false, - options: SourceCodecs.values - .map((e) => SelectItemButton( - value: e, - child: Text( - e.label, - style: theme.typography.small, - ), - )) - .toList(), - onChanged: (value) { - if (value == null) return; - preferencesNotifier.setStreamMusicCodec(value); - }, - ), - AdaptiveSelectTile( - popupConstraints: const BoxConstraints(maxWidth: 300), - secondary: const Icon(SpotubeIcons.file), - title: Text(context.l10n.download_music_codec), - value: preferences.downloadMusicCodec, - showValueWhenUnfolded: false, - options: SourceCodecs.values - .map((e) => SelectItemButton( - value: e, - child: Text( - e.label, - style: theme.typography.small, - ), - )) - .toList(), - onChanged: (value) { - if (value == null) return; - preferencesNotifier.setDownloadMusicCodec(value); - }, - ), - ], ListTile( leading: const Icon(SpotubeIcons.repeat), title: Text(context.l10n.endless_playback), diff --git a/lib/provider/audio_player/audio_player.dart b/lib/provider/audio_player/audio_player.dart index 5db28125..1bfd8f2d 100644 --- a/lib/provider/audio_player/audio_player.dart +++ b/lib/provider/audio_player/audio_player.dart @@ -7,12 +7,11 @@ import 'package:media_kit/media_kit.dart'; import 'package:spotube/extensions/list.dart'; import 'package:spotube/models/database/database.dart'; import 'package:spotube/models/metadata/metadata.dart'; -import 'package:spotube/models/playback/track_sources.dart'; import 'package:spotube/provider/audio_player/state.dart'; import 'package:spotube/provider/blacklist_provider.dart'; import 'package:spotube/provider/database/database.dart'; import 'package:spotube/provider/discord_provider.dart'; -import 'package:spotube/provider/server/track_sources.dart'; +import 'package:spotube/provider/server/sourced_track_provider.dart'; import 'package:spotube/services/audio_player/audio_player.dart'; import 'package:spotube/services/logger/logger.dart'; @@ -164,8 +163,8 @@ class AudioPlayerNotifier extends Notifier { final tracks = []; for (final media in playlist.medias) { - final trackQuery = TrackSourceQuery.parseUri(media.uri); - final track = trackGroupedById[trackQuery.id]?.firstOrNull; + final track = trackGroupedById[SpotubeMedia.media(media).track.id] + ?.firstOrNull; if (track != null) { tracks.add(track); } @@ -400,10 +399,9 @@ class AudioPlayerNotifier extends Notifier { // because of timeout final intendedActiveTrack = medias.elementAt(initialIndex); if (intendedActiveTrack.track is! SpotubeLocalTrackObject) { - await ref.read( - trackSourcesProvider( - TrackSourceQuery.fromTrack( - intendedActiveTrack.track as SpotubeFullTrackObject), + ref.read( + sourcedTrackProvider( + intendedActiveTrack.track as SpotubeFullTrackObject, ).future, ); } diff --git a/lib/provider/audio_player/audio_player_streams.dart b/lib/provider/audio_player/audio_player_streams.dart index 507e9d49..eff13134 100644 --- a/lib/provider/audio_player/audio_player_streams.dart +++ b/lib/provider/audio_player/audio_player_streams.dart @@ -3,14 +3,13 @@ import 'dart:math'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:spotube/models/metadata/metadata.dart'; -import 'package:spotube/models/playback/track_sources.dart'; import 'package:spotube/provider/audio_player/audio_player.dart'; import 'package:spotube/provider/audio_player/state.dart'; import 'package:spotube/provider/discord_provider.dart'; import 'package:spotube/provider/history/history.dart'; import 'package:spotube/provider/metadata_plugin/core/scrobble.dart'; import 'package:spotube/provider/metadata_plugin/metadata_plugin_provider.dart'; -import 'package:spotube/provider/server/track_sources.dart'; +import 'package:spotube/provider/server/sourced_track_provider.dart'; import 'package:spotube/provider/skip_segments/skip_segments.dart'; import 'package:spotube/provider/scrobbler/scrobbler.dart'; import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; @@ -156,9 +155,7 @@ class AudioPlayerStreamListeners { try { await ref.read( - trackSourcesProvider( - TrackSourceQuery.fromTrack(nextTrack as SpotubeFullTrackObject), - ).future, + sourcedTrackProvider(nextTrack as SpotubeFullTrackObject).future, ); } finally { lastTrack = nextTrack.id; diff --git a/lib/provider/audio_player/querying_track_info.dart b/lib/provider/audio_player/querying_track_info.dart index ce99b261..06e9653c 100644 --- a/lib/provider/audio_player/querying_track_info.dart +++ b/lib/provider/audio_player/querying_track_info.dart @@ -1,8 +1,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:spotube/models/metadata/metadata.dart'; -import 'package:spotube/models/playback/track_sources.dart'; import 'package:spotube/provider/audio_player/audio_player.dart'; -import 'package:spotube/provider/server/track_sources.dart'; +import 'package:spotube/provider/server/sourced_track_provider.dart'; final queryingTrackInfoProvider = Provider((ref) { final audioPlayer = ref.watch(audioPlayerProvider); @@ -16,10 +15,9 @@ final queryingTrackInfoProvider = Provider((ref) { } return ref - .watch(trackSourcesProvider( - TrackSourceQuery.fromTrack( - audioPlayer.activeTrack! as SpotubeFullTrackObject, - ), - )) + .watch( + sourcedTrackProvider( + audioPlayer.activeTrack! as SpotubeFullTrackObject), + ) .isLoading; }); diff --git a/lib/provider/audio_player/sources/invidious_instances_provider.dart b/lib/provider/audio_player/sources/invidious_instances_provider.dart deleted file mode 100644 index c04ac765..00000000 --- a/lib/provider/audio_player/sources/invidious_instances_provider.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:spotube/services/sourced_track/sources/invidious.dart'; - -final invidiousInstancesProvider = FutureProvider((ref) async { - final invidious = ref.watch(invidiousProvider); - - final instances = await invidious.instances(); - - return instances - .where((instance) => instance.details.type == "https") - .toList(); -}); diff --git a/lib/provider/audio_player/sources/piped_instances_provider.dart b/lib/provider/audio_player/sources/piped_instances_provider.dart deleted file mode 100644 index 3c5d5f04..00000000 --- a/lib/provider/audio_player/sources/piped_instances_provider.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:spotube/services/logger/logger.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:piped_client/piped_client.dart'; -import 'package:spotube/services/sourced_track/sources/piped.dart'; - -final pipedInstancesFutureProvider = FutureProvider>( - (ref) async { - try { - final pipedClient = ref.watch(pipedProvider); - - return await pipedClient.instanceList(); - } catch (e, stack) { - AppLogger.reportError(e, stack); - return []; - } - }, -); diff --git a/lib/provider/download_manager_provider.dart b/lib/provider/download_manager_provider.dart index d7f28b67..d64da32e 100644 --- a/lib/provider/download_manager_provider.dart +++ b/lib/provider/download_manager_provider.dart @@ -2,8 +2,8 @@ import 'dart:async'; import 'dart:io'; import 'package:spotube/models/metadata/metadata.dart'; -import 'package:spotube/models/playback/track_sources.dart'; -import 'package:spotube/provider/server/track_sources.dart'; +import 'package:spotube/provider/metadata_plugin/audio_source/quality_presets.dart'; +import 'package:spotube/provider/server/sourced_track_provider.dart'; import 'package:spotube/services/logger/logger.dart'; import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart'; @@ -12,7 +12,6 @@ import 'package:metadata_god/metadata_god.dart'; import 'package:path/path.dart'; import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; import 'package:spotube/services/download_manager/download_manager.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; import 'package:spotube/services/sourced_track/sourced_track.dart'; import 'package:spotube/utils/primitive_utils.dart'; import 'package:spotube/utils/service_utils.dart'; @@ -20,20 +19,21 @@ import 'package:spotube/utils/service_utils.dart'; class DownloadManagerProvider extends ChangeNotifier { DownloadManagerProvider({required this.ref}) : $history = {}, - $backHistory = {}, dl = DownloadManager() { dl.statusStream.listen((event) async { try { final (:request, :status) = event; final sourcedTrack = $history.firstWhereOrNull( - (element) => element.getUrlOfCodec(downloadCodec) == request.url, + (element) => + element.getUrlOfQuality( + downloadContainer, + downloadQualityIndex, + ) == + request.url, ); + if (sourcedTrack == null) return; - final track = $backHistory.firstWhereOrNull( - (element) => element.id == sourcedTrack.query.id, - ); - if (track == null) return; final savePath = getTrackFileUrl(sourcedTrack); // related to onFileExists @@ -45,11 +45,12 @@ class DownloadManagerProvider extends ChangeNotifier { await oldFile.exists()) { await oldFile.rename(savePath); } + if (status != DownloadStatus.completed || //? WebA audiotagging is not supported yet //? Although in future by converting weba to opus & then tagging it //? is possible using vorbis comments - downloadCodec == SourceCodecs.weba) { + downloadContainer.getFileExtension() == "weba") { return; } @@ -60,13 +61,13 @@ class DownloadManagerProvider extends ChangeNotifier { } final imageBytes = await ServiceUtils.downloadImage( - (track.album.images).asUrlString( + (sourcedTrack.query.album.images).asUrlString( placeholder: ImagePlaceholder.albumArt, index: 1, ), ); - final metadata = track.toMetadata( + final metadata = sourcedTrack.query.toMetadata( fileLength: await file.length(), imageBytes: imageBytes, ); @@ -88,8 +89,13 @@ class DownloadManagerProvider extends ChangeNotifier { String get downloadDirectory => ref.read(userPreferencesProvider.select((s) => s.downloadLocation)); - SourceCodecs get downloadCodec => - ref.read(userPreferencesProvider.select((s) => s.downloadMusicCodec)); + SpotubeAudioSourceContainerPreset get downloadContainer => ref.read( + audioSourcePresetsProvider + .select((s) => s.presets[s.selectedDownloadingContainerIndex]), + ); + + int get downloadQualityIndex => ref.read(audioSourcePresetsProvider + .select((s) => s.selectedDownloadingQualityIndex)); int get $downloadCount => dl .getAllDownloads() @@ -103,17 +109,16 @@ class DownloadManagerProvider extends ChangeNotifier { final Set $history; // these are the tracks which metadata hasn't been fetched yet - final Set $backHistory; final DownloadManager dl; String getTrackFileUrl(SourcedTrack track) { final name = - "${track.query.title} - ${track.query.artists.join(", ")}.${downloadCodec.name}"; + "${track.query.name} - ${track.query.artists.map((e) => e.name).join(", ")}.${downloadContainer.getFileExtension()}"; return join(downloadDirectory, PrimitiveUtils.toSafeFileName(name)); } bool isActive(SpotubeFullTrackObject track) { - if ($backHistory.contains(track)) return true; + if ($history.any((e) => e.query.id == track.id)) return true; final sourcedTrack = $history.firstWhereOrNull( (element) => element.query.id == track.id, @@ -130,14 +135,15 @@ class DownloadManagerProvider extends ChangeNotifier { download.status.value == DownloadStatus.queued, ) .map((e) => e.request.url) - .contains(sourcedTrack.getUrlOfCodec(downloadCodec)!); + .contains(sourcedTrack.getUrlOfQuality( + downloadContainer, + downloadQualityIndex, + )!); } /// For singular downloads Future addToQueue(SpotubeFullTrackObject track) async { - final sourcedTrack = await ref.read( - trackSourcesProvider(TrackSourceQuery.fromTrack(track)).future, - ); + final sourcedTrack = await ref.read(sourcedTrackProvider(track).future); final savePath = getTrackFileUrl(sourcedTrack); @@ -150,40 +156,17 @@ class DownloadManagerProvider extends ChangeNotifier { await oldFile.rename("$savePath.old"); } - if (sourcedTrack.codec == downloadCodec) { - final downloadTask = await dl.addDownload( - sourcedTrack.getUrlOfCodec(downloadCodec)!, - savePath, - ); - if (downloadTask != null) { - $history.add(sourcedTrack); - } - } else { - $backHistory.add(track); - final sourcedTrack = await ref - .read( - trackSourcesProvider( - TrackSourceQuery.fromTrack(track), - ).future, - ) - .then((d) { - $backHistory.remove(track); - return d; - }); - final downloadTask = await dl.addDownload( - sourcedTrack.getUrlOfCodec(downloadCodec)!, - savePath, - ); - if (downloadTask != null) { - $history.add(sourcedTrack); - } + final downloadTask = await dl.addDownload( + sourcedTrack.getUrlOfQuality(downloadContainer, downloadQualityIndex)!, + savePath, + ); + if (downloadTask != null) { + $history.add(sourcedTrack); } - notifyListeners(); } Future batchAddToQueue(List tracks) async { - $backHistory.addAll(tracks); notifyListeners(); for (final track in tracks) { try { @@ -204,18 +187,21 @@ class DownloadManagerProvider extends ChangeNotifier { Future removeFromQueue(SpotubeFullTrackObject track) async { final sourcedTrack = await mapToSourcedTrack(track); - await dl.removeDownload(sourcedTrack.getUrlOfCodec(downloadCodec)!); + await dl.removeDownload( + sourcedTrack.getUrlOfQuality(downloadContainer, downloadQualityIndex)!); $history.remove(sourcedTrack); } Future pause(SpotubeFullTrackObject track) async { final sourcedTrack = await mapToSourcedTrack(track); - return dl.pauseDownload(sourcedTrack.getUrlOfCodec(downloadCodec)!); + return dl.pauseDownload( + sourcedTrack.getUrlOfQuality(downloadContainer, downloadQualityIndex)!); } Future resume(SpotubeFullTrackObject track) async { final sourcedTrack = await mapToSourcedTrack(track); - return dl.resumeDownload(sourcedTrack.getUrlOfCodec(downloadCodec)!); + return dl.resumeDownload( + sourcedTrack.getUrlOfQuality(downloadContainer, downloadQualityIndex)!); } Future retry(SpotubeFullTrackObject track) { @@ -224,7 +210,8 @@ class DownloadManagerProvider extends ChangeNotifier { void cancel(SpotubeFullTrackObject track) async { final sourcedTrack = await mapToSourcedTrack(track); - return dl.cancelDownload(sourcedTrack.getUrlOfCodec(downloadCodec)!); + return dl.cancelDownload( + sourcedTrack.getUrlOfQuality(downloadContainer, downloadQualityIndex)!); } void cancelAll() { @@ -242,9 +229,7 @@ class DownloadManagerProvider extends ChangeNotifier { return historicTrack; } - final sourcedTrack = await ref.read( - trackSourcesProvider(TrackSourceQuery.fromTrack(track)).future, - ); + final sourcedTrack = await ref.read(sourcedTrackProvider(track).future); return sourcedTrack; } @@ -258,7 +243,10 @@ class DownloadManagerProvider extends ChangeNotifier { if (sourcedTrack == null) { return null; } - return dl.getDownload(sourcedTrack.getUrlOfCodec(downloadCodec)!)?.status; + return dl + .getDownload(sourcedTrack.getUrlOfQuality( + downloadContainer, downloadQualityIndex)!) + ?.status; } ValueNotifier? getProgressNotifier(SpotubeFullTrackObject track) { @@ -268,7 +256,10 @@ class DownloadManagerProvider extends ChangeNotifier { if (sourcedTrack == null) { return null; } - return dl.getDownload(sourcedTrack.getUrlOfCodec(downloadCodec)!)?.progress; + return dl + .getDownload(sourcedTrack.getUrlOfQuality( + downloadContainer, downloadQualityIndex)!) + ?.progress; } } diff --git a/lib/provider/metadata_plugin/audio_source/quality_label.dart b/lib/provider/metadata_plugin/audio_source/quality_label.dart new file mode 100644 index 00000000..113ed54e --- /dev/null +++ b/lib/provider/metadata_plugin/audio_source/quality_label.dart @@ -0,0 +1,12 @@ +import 'package:riverpod/riverpod.dart'; +import 'package:spotube/provider/metadata_plugin/audio_source/quality_presets.dart'; + +final audioSourceQualityLabelProvider = Provider((ref) { + final sourceQuality = ref.watch(audioSourcePresetsProvider); + final sourceContainer = sourceQuality.presets + .elementAtOrNull(sourceQuality.selectedStreamingContainerIndex); + final quality = sourceContainer?.qualities + .elementAtOrNull(sourceQuality.selectedStreamingQualityIndex); + + return "${sourceContainer?.name ?? "Unknown"} • ${quality?.toString() ?? "Unknown"}"; +}); diff --git a/lib/provider/metadata_plugin/audio_source/quality_presets.dart b/lib/provider/metadata_plugin/audio_source/quality_presets.dart new file mode 100644 index 00000000..0a8b00fe --- /dev/null +++ b/lib/provider/metadata_plugin/audio_source/quality_presets.dart @@ -0,0 +1,131 @@ +import 'dart:convert'; + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:spotube/models/metadata/metadata.dart'; +import 'package:spotube/provider/metadata_plugin/metadata_plugin_provider.dart'; +import 'package:spotube/services/audio_player/audio_player.dart'; +import 'package:spotube/services/metadata/metadata.dart'; + +part 'quality_presets.g.dart'; +part 'quality_presets.freezed.dart'; + +@freezed +class AudioSourcePresetsState with _$AudioSourcePresetsState { + factory AudioSourcePresetsState({ + @Default([]) final List presets, + @Default(0) final int selectedStreamingQualityIndex, + @Default(0) final int selectedStreamingContainerIndex, + @Default(0) final int selectedDownloadingQualityIndex, + @Default(0) final int selectedDownloadingContainerIndex, + }) = _AudioSourcePresetsState; + + factory AudioSourcePresetsState.fromJson(Map json) => + _$AudioSourcePresetsStateFromJson(json); +} + +class AudioSourceAvailableQualityPresetsNotifier + extends Notifier { + @override + build() { + final audioSourceSnapshot = ref.watch(audioSourcePluginProvider); + final audioSourceConfigSnapshot = ref.watch( + metadataPluginsProvider.select((data) => + data.whenData((value) => value.defaultAudioSourcePluginConfig)), + ); + + _initialize(audioSourceSnapshot, audioSourceConfigSnapshot); + + listenSelf((previous, next) { + final isNewLossless = + next.presets.elementAtOrNull(next.selectedStreamingContainerIndex) + is SpotubeAudioSourceContainerPresetLossless; + final isOldLossless = previous?.presets + .elementAtOrNull(previous.selectedStreamingContainerIndex) + is SpotubeAudioSourceContainerPresetLossless; + if (!isOldLossless && isNewLossless) { + audioPlayer.setDemuxerBufferSize(6 * 1024 * 1024); // 6MB + } else if (isOldLossless && !isNewLossless) { + audioPlayer.setDemuxerBufferSize(4 * 1024 * 1024); // 4MB + } + }); + + return AudioSourcePresetsState(); + } + + void _initialize( + AsyncValue audioSourceSnapshot, + AsyncValue audioSourceConfigSnapshot, + ) async { + audioSourceConfigSnapshot.whenData((audioSourceConfig) { + audioSourceSnapshot.whenData((audioSource) async { + if (audioSource == null || audioSourceConfig == null) { + throw Exception("Dude wat?"); + } + final preferences = await SharedPreferences.getInstance(); + final persistedStateStr = + preferences.getString("audioSourceState-${audioSourceConfig.slug}"); + + if (persistedStateStr != null) { + state = + AudioSourcePresetsState.fromJson(jsonDecode(persistedStateStr)) + .copyWith( + presets: audioSource.audioSource.supportedPresets, + ); + } else { + state = AudioSourcePresetsState( + presets: audioSource.audioSource.supportedPresets, + ); + } + }); + }); + } + + void setSelectedStreamingContainerIndex(int index) { + state = state.copyWith( + selectedStreamingContainerIndex: index, + selectedStreamingQualityIndex: + 0, // Resetting both because it's a different quality + ); + _updatePreferences(); + } + + void setSelectedStreamingQualityIndex(int index) { + state = state.copyWith(selectedStreamingQualityIndex: index); + _updatePreferences(); + } + + void setSelectedDownloadingContainerIndex(int index) { + state = state.copyWith( + selectedDownloadingContainerIndex: index, + selectedDownloadingQualityIndex: + 0, // Resetting both because it's a different quality + ); + _updatePreferences(); + } + + void setSelectedDownloadingQualityIndex(int index) { + state = state.copyWith(selectedDownloadingQualityIndex: index); + _updatePreferences(); + } + + void _updatePreferences() async { + final audioSourceConfig = await ref.read(metadataPluginsProvider + .selectAsync((data) => data.defaultAudioSourcePluginConfig)); + if (audioSourceConfig == null) { + throw Exception("Dude wat?"); + } + + final preferences = await SharedPreferences.getInstance(); + await preferences.setString( + "audioSourceState-${audioSourceConfig.slug}", + jsonEncode(state), + ); + } +} + +final audioSourcePresetsProvider = NotifierProvider< + AudioSourceAvailableQualityPresetsNotifier, AudioSourcePresetsState>( + () => AudioSourceAvailableQualityPresetsNotifier(), +); diff --git a/lib/provider/metadata_plugin/audio_source/quality_presets.freezed.dart b/lib/provider/metadata_plugin/audio_source/quality_presets.freezed.dart new file mode 100644 index 00000000..a8e0c9f7 --- /dev/null +++ b/lib/provider/metadata_plugin/audio_source/quality_presets.freezed.dart @@ -0,0 +1,289 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'quality_presets.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +AudioSourcePresetsState _$AudioSourcePresetsStateFromJson( + Map json) { + return _AudioSourcePresetsState.fromJson(json); +} + +/// @nodoc +mixin _$AudioSourcePresetsState { + List get presets => + throw _privateConstructorUsedError; + int get selectedStreamingQualityIndex => throw _privateConstructorUsedError; + int get selectedStreamingContainerIndex => throw _privateConstructorUsedError; + int get selectedDownloadingQualityIndex => throw _privateConstructorUsedError; + int get selectedDownloadingContainerIndex => + throw _privateConstructorUsedError; + + /// Serializes this AudioSourcePresetsState to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of AudioSourcePresetsState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $AudioSourcePresetsStateCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AudioSourcePresetsStateCopyWith<$Res> { + factory $AudioSourcePresetsStateCopyWith(AudioSourcePresetsState value, + $Res Function(AudioSourcePresetsState) then) = + _$AudioSourcePresetsStateCopyWithImpl<$Res, AudioSourcePresetsState>; + @useResult + $Res call( + {List presets, + int selectedStreamingQualityIndex, + int selectedStreamingContainerIndex, + int selectedDownloadingQualityIndex, + int selectedDownloadingContainerIndex}); +} + +/// @nodoc +class _$AudioSourcePresetsStateCopyWithImpl<$Res, + $Val extends AudioSourcePresetsState> + implements $AudioSourcePresetsStateCopyWith<$Res> { + _$AudioSourcePresetsStateCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of AudioSourcePresetsState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? presets = null, + Object? selectedStreamingQualityIndex = null, + Object? selectedStreamingContainerIndex = null, + Object? selectedDownloadingQualityIndex = null, + Object? selectedDownloadingContainerIndex = null, + }) { + return _then(_value.copyWith( + presets: null == presets + ? _value.presets + : presets // ignore: cast_nullable_to_non_nullable + as List, + selectedStreamingQualityIndex: null == selectedStreamingQualityIndex + ? _value.selectedStreamingQualityIndex + : selectedStreamingQualityIndex // ignore: cast_nullable_to_non_nullable + as int, + selectedStreamingContainerIndex: null == selectedStreamingContainerIndex + ? _value.selectedStreamingContainerIndex + : selectedStreamingContainerIndex // ignore: cast_nullable_to_non_nullable + as int, + selectedDownloadingQualityIndex: null == selectedDownloadingQualityIndex + ? _value.selectedDownloadingQualityIndex + : selectedDownloadingQualityIndex // ignore: cast_nullable_to_non_nullable + as int, + selectedDownloadingContainerIndex: null == + selectedDownloadingContainerIndex + ? _value.selectedDownloadingContainerIndex + : selectedDownloadingContainerIndex // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$AudioSourcePresetsStateImplCopyWith<$Res> + implements $AudioSourcePresetsStateCopyWith<$Res> { + factory _$$AudioSourcePresetsStateImplCopyWith( + _$AudioSourcePresetsStateImpl value, + $Res Function(_$AudioSourcePresetsStateImpl) then) = + __$$AudioSourcePresetsStateImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {List presets, + int selectedStreamingQualityIndex, + int selectedStreamingContainerIndex, + int selectedDownloadingQualityIndex, + int selectedDownloadingContainerIndex}); +} + +/// @nodoc +class __$$AudioSourcePresetsStateImplCopyWithImpl<$Res> + extends _$AudioSourcePresetsStateCopyWithImpl<$Res, + _$AudioSourcePresetsStateImpl> + implements _$$AudioSourcePresetsStateImplCopyWith<$Res> { + __$$AudioSourcePresetsStateImplCopyWithImpl( + _$AudioSourcePresetsStateImpl _value, + $Res Function(_$AudioSourcePresetsStateImpl) _then) + : super(_value, _then); + + /// Create a copy of AudioSourcePresetsState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? presets = null, + Object? selectedStreamingQualityIndex = null, + Object? selectedStreamingContainerIndex = null, + Object? selectedDownloadingQualityIndex = null, + Object? selectedDownloadingContainerIndex = null, + }) { + return _then(_$AudioSourcePresetsStateImpl( + presets: null == presets + ? _value._presets + : presets // ignore: cast_nullable_to_non_nullable + as List, + selectedStreamingQualityIndex: null == selectedStreamingQualityIndex + ? _value.selectedStreamingQualityIndex + : selectedStreamingQualityIndex // ignore: cast_nullable_to_non_nullable + as int, + selectedStreamingContainerIndex: null == selectedStreamingContainerIndex + ? _value.selectedStreamingContainerIndex + : selectedStreamingContainerIndex // ignore: cast_nullable_to_non_nullable + as int, + selectedDownloadingQualityIndex: null == selectedDownloadingQualityIndex + ? _value.selectedDownloadingQualityIndex + : selectedDownloadingQualityIndex // ignore: cast_nullable_to_non_nullable + as int, + selectedDownloadingContainerIndex: null == + selectedDownloadingContainerIndex + ? _value.selectedDownloadingContainerIndex + : selectedDownloadingContainerIndex // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$AudioSourcePresetsStateImpl implements _AudioSourcePresetsState { + _$AudioSourcePresetsStateImpl( + {final List presets = const [], + this.selectedStreamingQualityIndex = 0, + this.selectedStreamingContainerIndex = 0, + this.selectedDownloadingQualityIndex = 0, + this.selectedDownloadingContainerIndex = 0}) + : _presets = presets; + + factory _$AudioSourcePresetsStateImpl.fromJson(Map json) => + _$$AudioSourcePresetsStateImplFromJson(json); + + final List _presets; + @override + @JsonKey() + List get presets { + if (_presets is EqualUnmodifiableListView) return _presets; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_presets); + } + + @override + @JsonKey() + final int selectedStreamingQualityIndex; + @override + @JsonKey() + final int selectedStreamingContainerIndex; + @override + @JsonKey() + final int selectedDownloadingQualityIndex; + @override + @JsonKey() + final int selectedDownloadingContainerIndex; + + @override + String toString() { + return 'AudioSourcePresetsState(presets: $presets, selectedStreamingQualityIndex: $selectedStreamingQualityIndex, selectedStreamingContainerIndex: $selectedStreamingContainerIndex, selectedDownloadingQualityIndex: $selectedDownloadingQualityIndex, selectedDownloadingContainerIndex: $selectedDownloadingContainerIndex)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AudioSourcePresetsStateImpl && + const DeepCollectionEquality().equals(other._presets, _presets) && + (identical(other.selectedStreamingQualityIndex, + selectedStreamingQualityIndex) || + other.selectedStreamingQualityIndex == + selectedStreamingQualityIndex) && + (identical(other.selectedStreamingContainerIndex, + selectedStreamingContainerIndex) || + other.selectedStreamingContainerIndex == + selectedStreamingContainerIndex) && + (identical(other.selectedDownloadingQualityIndex, + selectedDownloadingQualityIndex) || + other.selectedDownloadingQualityIndex == + selectedDownloadingQualityIndex) && + (identical(other.selectedDownloadingContainerIndex, + selectedDownloadingContainerIndex) || + other.selectedDownloadingContainerIndex == + selectedDownloadingContainerIndex)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_presets), + selectedStreamingQualityIndex, + selectedStreamingContainerIndex, + selectedDownloadingQualityIndex, + selectedDownloadingContainerIndex); + + /// Create a copy of AudioSourcePresetsState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$AudioSourcePresetsStateImplCopyWith<_$AudioSourcePresetsStateImpl> + get copyWith => __$$AudioSourcePresetsStateImplCopyWithImpl< + _$AudioSourcePresetsStateImpl>(this, _$identity); + + @override + Map toJson() { + return _$$AudioSourcePresetsStateImplToJson( + this, + ); + } +} + +abstract class _AudioSourcePresetsState implements AudioSourcePresetsState { + factory _AudioSourcePresetsState( + {final List presets, + final int selectedStreamingQualityIndex, + final int selectedStreamingContainerIndex, + final int selectedDownloadingQualityIndex, + final int selectedDownloadingContainerIndex}) = + _$AudioSourcePresetsStateImpl; + + factory _AudioSourcePresetsState.fromJson(Map json) = + _$AudioSourcePresetsStateImpl.fromJson; + + @override + List get presets; + @override + int get selectedStreamingQualityIndex; + @override + int get selectedStreamingContainerIndex; + @override + int get selectedDownloadingQualityIndex; + @override + int get selectedDownloadingContainerIndex; + + /// Create a copy of AudioSourcePresetsState + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$AudioSourcePresetsStateImplCopyWith<_$AudioSourcePresetsStateImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/provider/metadata_plugin/audio_source/quality_presets.g.dart b/lib/provider/metadata_plugin/audio_source/quality_presets.g.dart new file mode 100644 index 00000000..f3d8fd41 --- /dev/null +++ b/lib/provider/metadata_plugin/audio_source/quality_presets.g.dart @@ -0,0 +1,38 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'quality_presets.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$AudioSourcePresetsStateImpl _$$AudioSourcePresetsStateImplFromJson( + Map json) => + _$AudioSourcePresetsStateImpl( + presets: (json['presets'] as List?) + ?.map((e) => SpotubeAudioSourceContainerPreset.fromJson( + Map.from(e as Map))) + .toList() ?? + const [], + selectedStreamingQualityIndex: + (json['selectedStreamingQualityIndex'] as num?)?.toInt() ?? 0, + selectedStreamingContainerIndex: + (json['selectedStreamingContainerIndex'] as num?)?.toInt() ?? 0, + selectedDownloadingQualityIndex: + (json['selectedDownloadingQualityIndex'] as num?)?.toInt() ?? 0, + selectedDownloadingContainerIndex: + (json['selectedDownloadingContainerIndex'] as num?)?.toInt() ?? 0, + ); + +Map _$$AudioSourcePresetsStateImplToJson( + _$AudioSourcePresetsStateImpl instance) => + { + 'presets': instance.presets.map((e) => e.toJson()).toList(), + 'selectedStreamingQualityIndex': instance.selectedStreamingQualityIndex, + 'selectedStreamingContainerIndex': + instance.selectedStreamingContainerIndex, + 'selectedDownloadingQualityIndex': + instance.selectedDownloadingQualityIndex, + 'selectedDownloadingContainerIndex': + instance.selectedDownloadingContainerIndex, + }; diff --git a/lib/provider/metadata_plugin/core/auth.dart b/lib/provider/metadata_plugin/core/auth.dart index 9aa696fc..dc5e7eb6 100644 --- a/lib/provider/metadata_plugin/core/auth.dart +++ b/lib/provider/metadata_plugin/core/auth.dart @@ -8,7 +8,7 @@ class MetadataPluginAuthenticatedNotifier extends AsyncNotifier { @override FutureOr build() async { final defaultPluginConfig = ref.watch(metadataPluginsProvider); - if (defaultPluginConfig.asData?.value.defaultPluginConfig?.abilities + if (defaultPluginConfig.asData?.value.defaultMetadataPluginConfig?.abilities .contains(PluginAbilities.authentication) != true) { return false; @@ -35,3 +35,36 @@ final metadataPluginAuthenticatedProvider = AsyncNotifierProvider( MetadataPluginAuthenticatedNotifier.new, ); + +class AudioSourcePluginAuthenticatedNotifier extends AsyncNotifier { + @override + FutureOr build() async { + final defaultPluginConfig = ref.watch(metadataPluginsProvider); + if (defaultPluginConfig + .asData?.value.defaultAudioSourcePluginConfig?.abilities + .contains(PluginAbilities.authentication) != + true) { + return false; + } + + final defaultPlugin = await ref.watch(audioSourcePluginProvider.future); + if (defaultPlugin == null) { + return false; + } + + final sub = defaultPlugin.auth.authStateStream.listen((event) { + state = AsyncData(defaultPlugin.auth.isAuthenticated()); + }); + + ref.onDispose(() { + sub.cancel(); + }); + + return defaultPlugin.auth.isAuthenticated(); + } +} + +final audioSourcePluginAuthenticatedProvider = + AsyncNotifierProvider( + AudioSourcePluginAuthenticatedNotifier.new, +); diff --git a/lib/provider/metadata_plugin/core/repositories.dart b/lib/provider/metadata_plugin/core/repositories.dart index 55c11ed2..a78f63d9 100644 --- a/lib/provider/metadata_plugin/core/repositories.dart +++ b/lib/provider/metadata_plugin/core/repositories.dart @@ -49,6 +49,7 @@ class MetadataPluginRepositoriesNotifier owner: repo["owner"]["login"] ?? "", description: repo["description"] ?? "", repoUrl: repo["html_url"] ?? "", + topics: repo["topics"].cast() ?? [], ); }).toList(); diff --git a/lib/provider/metadata_plugin/core/scrobble.dart b/lib/provider/metadata_plugin/core/scrobble.dart index 376572ad..0f8fcc19 100644 --- a/lib/provider/metadata_plugin/core/scrobble.dart +++ b/lib/provider/metadata_plugin/core/scrobble.dart @@ -10,8 +10,10 @@ class MetadataPluginScrobbleNotifier @override build() { final metadataPlugin = ref.watch(metadataPluginProvider); - final pluginConfig = - ref.watch(metadataPluginsProvider).valueOrNull?.defaultPluginConfig; + final pluginConfig = ref + .watch(metadataPluginsProvider) + .valueOrNull + ?.defaultMetadataPluginConfig; if (metadataPlugin.valueOrNull == null || pluginConfig == null || diff --git a/lib/provider/metadata_plugin/core/support.dart b/lib/provider/metadata_plugin/core/support.dart index 88bfbf5c..8864f1b1 100644 --- a/lib/provider/metadata_plugin/core/support.dart +++ b/lib/provider/metadata_plugin/core/support.dart @@ -9,3 +9,13 @@ final metadataPluginSupportTextProvider = FutureProvider((ref) async { } return await metadataPlugin.core.support; }); + +final audioSourcePluginSupportTextProvider = + FutureProvider((ref) async { + final audioSourcePlugin = await ref.watch(audioSourcePluginProvider.future); + + if (audioSourcePlugin == null) { + throw 'No metadata plugin available'; + } + return await audioSourcePlugin.core.support; +}); diff --git a/lib/provider/metadata_plugin/metadata_plugin_provider.dart b/lib/provider/metadata_plugin/metadata_plugin_provider.dart index cf19c1f5..cdc96c41 100644 --- a/lib/provider/metadata_plugin/metadata_plugin_provider.dart +++ b/lib/provider/metadata_plugin/metadata_plugin_provider.dart @@ -4,12 +4,14 @@ import 'dart:io'; import 'package:collection/collection.dart'; import 'package:dio/dio.dart'; import 'package:drift/drift.dart'; +import 'package:flutter/services.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:path/path.dart'; import 'package:path_provider/path_provider.dart'; import 'package:spotube/models/database/database.dart'; import 'package:spotube/models/metadata/metadata.dart'; import 'package:spotube/provider/database/database.dart'; +import 'package:spotube/provider/youtube_engine/youtube_engine.dart'; import 'package:spotube/services/dio/dio.dart'; import 'package:spotube/services/logger/logger.dart'; import 'package:spotube/services/metadata/errors/exceptions.dart'; @@ -24,18 +26,28 @@ final allowedDomainsRegex = RegExp( class MetadataPluginState { final List plugins; - final int defaultPlugin; + final int defaultMetadataPlugin; + final int defaultAudioSourcePlugin; const MetadataPluginState({ this.plugins = const [], - this.defaultPlugin = -1, + this.defaultMetadataPlugin = -1, + this.defaultAudioSourcePlugin = -1, }); - PluginConfiguration? get defaultPluginConfig { - if (defaultPlugin < 0 || defaultPlugin >= plugins.length) { + PluginConfiguration? get defaultMetadataPluginConfig { + if (defaultMetadataPlugin < 0 || defaultMetadataPlugin >= plugins.length) { return null; } - return plugins[defaultPlugin]; + return plugins[defaultMetadataPlugin]; + } + + PluginConfiguration? get defaultAudioSourcePluginConfig { + if (defaultAudioSourcePlugin < 0 || + defaultAudioSourcePlugin >= plugins.length) { + return null; + } + return plugins[defaultAudioSourcePlugin]; } factory MetadataPluginState.fromJson(Map json) { @@ -43,24 +55,30 @@ class MetadataPluginState { plugins: (json["plugins"] as List) .map((e) => PluginConfiguration.fromJson(e)) .toList(), - defaultPlugin: json["default_plugin"] ?? -1, + defaultMetadataPlugin: json["default_metadata_plugin"] ?? -1, + defaultAudioSourcePlugin: json['default_audio_source_plugin'], ); } Map toJson() { return { "plugins": plugins.map((e) => e.toJson()).toList(), - "default_plugin": defaultPlugin, + "default_metadata_plugin": defaultMetadataPlugin, + "default_audio_source_plugin": defaultAudioSourcePlugin }; } MetadataPluginState copyWith({ List? plugins, - int? defaultPlugin, + int? defaultMetadataPlugin, + int? defaultAudioSourcePlugin, }) { return MetadataPluginState( plugins: plugins ?? this.plugins, - defaultPlugin: defaultPlugin ?? this.defaultPlugin, + defaultMetadataPlugin: + defaultMetadataPlugin ?? this.defaultMetadataPlugin, + defaultAudioSourcePlugin: + defaultAudioSourcePlugin ?? this.defaultAudioSourcePlugin, ); } } @@ -72,7 +90,7 @@ class MetadataPluginNotifier extends AsyncNotifier { build() async { final database = ref.watch(databaseProvider); - final subscription = database.metadataPluginsTable.select().watch().listen( + final subscription = database.pluginsTable.select().watch().listen( (event) async { state = AsyncValue.data(await toStatePlugins(event)); }, @@ -82,22 +100,26 @@ class MetadataPluginNotifier extends AsyncNotifier { subscription.cancel(); }); - final plugins = await database.metadataPluginsTable.select().get(); + final plugins = await database.pluginsTable.select().get(); - return await toStatePlugins(plugins); + final pluginState = await toStatePlugins(plugins); + + await _loadDefaultPlugins(pluginState); + + return pluginState; } Future toStatePlugins( - List plugins, + List plugins, ) async { - int defaultPlugin = -1; + int defaultMetadataPlugin = -1; + int defaultAudioSourcePlugin = -1; final pluginConfigs = []; for (int i = 0; i < plugins.length; i++) { final plugin = plugins[i]; final pluginConfig = PluginConfiguration( - type: PluginType.metadata, name: plugin.name, author: plugin.author, description: plugin.description, @@ -133,23 +155,66 @@ class MetadataPluginNotifier extends AsyncNotifier { !await pluginJsonFile.exists() || !await pluginBinaryFile.exists()) { // Delete the plugin entry from DB if the plugin files are not there. - await database.metadataPluginsTable.deleteOne(plugin); + await database.pluginsTable.deleteOne(plugin); continue; } pluginConfigs.add(pluginConfig); - if (plugin.selected) { - defaultPlugin = pluginConfigs.length - 1; + if (plugin.selectedForMetadata) { + defaultMetadataPlugin = pluginConfigs.length - 1; + } + if (plugin.selectedForAudioSource) { + defaultAudioSourcePlugin = pluginConfigs.length - 1; } } return MetadataPluginState( plugins: pluginConfigs, - defaultPlugin: defaultPlugin, + defaultMetadataPlugin: defaultMetadataPlugin, + defaultAudioSourcePlugin: defaultAudioSourcePlugin, ); } + Future _loadDefaultPlugins(MetadataPluginState pluginState) async { + const plugins = [ + "spotube-plugin-musicbrainz-listenbrainz", + "spotube-plugin-youtube-audio", + ]; + + for (final plugin in plugins) { + final byteData = await rootBundle.load( + "assets/plugins/$plugin/plugin.smplug", + ); + final pluginConfig = + await extractPluginArchive(byteData.buffer.asUint8List()); + try { + await addPlugin(pluginConfig); + } on MetadataPluginException catch (e) { + if (e.errorCode == MetadataPluginErrorCode.duplicatePlugin && + await isPluginUpdate(pluginConfig)) { + final oldConfig = pluginState.plugins + .firstWhereOrNull((p) => p.slug == pluginConfig.slug); + if (oldConfig == null) continue; + final isDefaultMetadata = + oldConfig == pluginState.defaultMetadataPluginConfig; + final isDefaultAudioSource = + oldConfig == pluginState.defaultAudioSourcePluginConfig; + + await removePlugin(pluginConfig); + await addPlugin(pluginConfig); + + if (isDefaultMetadata) { + await setDefaultMetadataPlugin(pluginConfig); + } + if (isDefaultAudioSource) { + await setDefaultAudioSourcePlugin(pluginConfig); + } + } + } + } + } + Uri _getGithubReleasesUrl(String repoUrl) { final parsedUri = Uri.parse(repoUrl); final uri = parsedUri.replace( @@ -327,7 +392,7 @@ class MetadataPluginNotifier extends AsyncNotifier { Future addPlugin(PluginConfiguration plugin) async { _assertPluginApiCompatibility(plugin); - final pluginRes = await (database.metadataPluginsTable.select() + final pluginRes = await (database.pluginsTable.select() ..where( (tbl) => tbl.name.equals(plugin.name) & tbl.author.equals(plugin.author), @@ -339,8 +404,8 @@ class MetadataPluginNotifier extends AsyncNotifier { throw MetadataPluginException.duplicatePlugin(); } - await database.metadataPluginsTable.insertOne( - MetadataPluginsTableCompanion.insert( + await database.pluginsTable.insertOne( + PluginsTableCompanion.insert( name: plugin.name, author: plugin.author, description: plugin.description, @@ -351,7 +416,22 @@ class MetadataPluginNotifier extends AsyncNotifier { pluginApiVersion: Value(plugin.pluginApiVersion), repository: Value(plugin.repository), // Setting the very first plugin as the default plugin - selected: Value(state.valueOrNull?.plugins.isEmpty ?? true), + selectedForMetadata: Value( + (state.valueOrNull?.plugins + .where( + (d) => d.abilities.contains(PluginAbilities.metadata)) + .isEmpty ?? + true) && + plugin.abilities.contains(PluginAbilities.metadata), + ), + selectedForAudioSource: Value( + (state.valueOrNull?.plugins + .where((d) => + d.abilities.contains(PluginAbilities.audioSource)) + .isEmpty ?? + true) && + plugin.abilities.contains(PluginAbilities.audioSource), + ), ), ); } @@ -362,26 +442,65 @@ class MetadataPluginNotifier extends AsyncNotifier { if (pluginExtractionDir.existsSync()) { await pluginExtractionDir.delete(recursive: true); } - await database.metadataPluginsTable.deleteWhere((tbl) => + await database.pluginsTable.deleteWhere((tbl) => tbl.name.equals(plugin.name) & tbl.author.equals(plugin.author)); // Same here, if the removed plugin is the default plugin // set the first available plugin as the default plugin // only when there is 1 remaining plugin - if (state.valueOrNull?.defaultPluginConfig == plugin) { - final remainingPlugins = - state.valueOrNull?.plugins.where((p) => p != plugin) ?? []; + if (state.valueOrNull?.defaultMetadataPluginConfig == plugin) { + final remainingPlugins = state.valueOrNull?.plugins.where( + (p) => + p != plugin && p.abilities.contains(PluginAbilities.metadata), + ) ?? + []; if (remainingPlugins.length == 1) { - await setDefaultPlugin(remainingPlugins.first); + await setDefaultMetadataPlugin(remainingPlugins.first); } } + + if (state.valueOrNull?.defaultAudioSourcePluginConfig == plugin) { + final remainingPlugins = state.valueOrNull?.plugins.where( + (p) => + p != plugin && + p.abilities.contains(PluginAbilities.audioSource), + ) ?? + []; + if (remainingPlugins.length == 1) { + await setDefaultAudioSourcePlugin(remainingPlugins.first); + } + } + } + + Future isPluginUpdate(PluginConfiguration newPlugin) async { + final pluginRes = await (database.pluginsTable.select() + ..where( + (tbl) => + tbl.name.equals(newPlugin.name) & + tbl.author.equals(newPlugin.author), + ) + ..limit(1)) + .get(); + + if (pluginRes.isEmpty) { + return false; + } + + final oldPlugin = pluginRes.first; + final oldPluginApiVersion = Version.parse(oldPlugin.pluginApiVersion); + final newPluginApiVersion = Version.parse(newPlugin.pluginApiVersion); + + return newPluginApiVersion > oldPluginApiVersion; } Future updatePlugin( PluginConfiguration plugin, PluginUpdateAvailable update, ) async { - final isDefault = plugin == state.valueOrNull?.defaultPluginConfig; + final isDefaultMetadata = + plugin == state.valueOrNull?.defaultMetadataPluginConfig; + final isDefaultAudioSource = + plugin == state.valueOrNull?.defaultAudioSourcePluginConfig; final pluginUpdatedConfig = await downloadAndCachePlugin(update.downloadUrl); @@ -394,21 +513,46 @@ class MetadataPluginNotifier extends AsyncNotifier { await removePlugin(plugin); await addPlugin(pluginUpdatedConfig); - if (isDefault) { - await setDefaultPlugin(pluginUpdatedConfig); + if (isDefaultMetadata) { + await setDefaultMetadataPlugin(pluginUpdatedConfig); + } + if (isDefaultAudioSource) { + await setDefaultAudioSourcePlugin(pluginUpdatedConfig); } } - Future setDefaultPlugin(PluginConfiguration plugin) async { - await database.metadataPluginsTable - .update() - .write(const MetadataPluginsTableCompanion(selected: Value(false))); + Future setDefaultMetadataPlugin(PluginConfiguration plugin) async { + assert( + plugin.abilities.contains(PluginAbilities.metadata), + "Must be a metadata plugin", + ); - await (database.metadataPluginsTable.update() + await database.pluginsTable + .update() + .write(const PluginsTableCompanion(selectedForMetadata: Value(false))); + + await (database.pluginsTable.update() ..where((tbl) => tbl.name.equals(plugin.name) & tbl.author.equals(plugin.author))) .write( - const MetadataPluginsTableCompanion(selected: Value(true)), + const PluginsTableCompanion(selectedForMetadata: Value(true)), + ); + } + + Future setDefaultAudioSourcePlugin(PluginConfiguration plugin) async { + assert( + plugin.abilities.contains(PluginAbilities.audioSource), + "Must be an audio-source plugin", + ); + + await database.pluginsTable.update().write( + const PluginsTableCompanion(selectedForAudioSource: Value(false))); + + await (database.pluginsTable.update() + ..where((tbl) => + tbl.name.equals(plugin.name) & tbl.author.equals(plugin.author))) + .write( + const PluginsTableCompanion(selectedForAudioSource: Value(true)), ); } @@ -445,8 +589,10 @@ final metadataPluginsProvider = final metadataPluginProvider = FutureProvider( (ref) async { final defaultPlugin = await ref.watch( - metadataPluginsProvider.selectAsync((data) => data.defaultPluginConfig), + metadataPluginsProvider + .selectAsync((data) => data.defaultMetadataPluginConfig), ); + final youtubeEngine = ref.read(youtubeEngineProvider); if (defaultPlugin == null) { return null; @@ -456,6 +602,34 @@ final metadataPluginProvider = FutureProvider( final pluginByteCode = await pluginsNotifier.getPluginByteCode(defaultPlugin); - return await MetadataPlugin.create(defaultPlugin, pluginByteCode); + return await MetadataPlugin.create( + youtubeEngine, + defaultPlugin, + pluginByteCode, + ); + }, +); + +final audioSourcePluginProvider = FutureProvider( + (ref) async { + final defaultPlugin = await ref.watch( + metadataPluginsProvider + .selectAsync((data) => data.defaultAudioSourcePluginConfig), + ); + final youtubeEngine = ref.watch(youtubeEngineProvider); + + if (defaultPlugin == null) { + return null; + } + + final pluginsNotifier = ref.read(metadataPluginsProvider.notifier); + final pluginByteCode = + await pluginsNotifier.getPluginByteCode(defaultPlugin); + + return await MetadataPlugin.create( + youtubeEngine, + defaultPlugin, + pluginByteCode, + ); }, ); diff --git a/lib/provider/metadata_plugin/updater/update_checker.dart b/lib/provider/metadata_plugin/updater/update_checker.dart index b53ab2b5..6a7dc589 100644 --- a/lib/provider/metadata_plugin/updater/update_checker.dart +++ b/lib/provider/metadata_plugin/updater/update_checker.dart @@ -8,10 +8,25 @@ final metadataPluginUpdateCheckerProvider = final metadataPlugin = await ref.watch(metadataPluginProvider.future); if (metadataPlugin == null || - metadataPluginConfigs.defaultPluginConfig == null) { + metadataPluginConfigs.defaultMetadataPluginConfig == null) { return null; } return metadataPlugin.core - .checkUpdate(metadataPluginConfigs.defaultPluginConfig!); + .checkUpdate(metadataPluginConfigs.defaultMetadataPluginConfig!); +}); + +final audioSourcePluginUpdateCheckerProvider = + FutureProvider((ref) async { + final audioSourcePluginConfigs = + await ref.watch(metadataPluginsProvider.future); + final audioSourcePlugin = await ref.watch(audioSourcePluginProvider.future); + + if (audioSourcePlugin == null || + audioSourcePluginConfigs.defaultAudioSourcePluginConfig == null) { + return null; + } + + return audioSourcePlugin.core + .checkUpdate(audioSourcePluginConfigs.defaultAudioSourcePluginConfig!); }); diff --git a/lib/provider/server/active_track_sources.dart b/lib/provider/server/active_track_sources.dart index 5b64dc26..603ca0e4 100644 --- a/lib/provider/server/active_track_sources.dart +++ b/lib/provider/server/active_track_sources.dart @@ -1,14 +1,13 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:spotube/models/metadata/metadata.dart'; -import 'package:spotube/models/playback/track_sources.dart'; import 'package:spotube/provider/audio_player/audio_player.dart'; -import 'package:spotube/provider/server/track_sources.dart'; +import 'package:spotube/provider/server/sourced_track_provider.dart'; import 'package:spotube/services/sourced_track/sourced_track.dart'; final activeTrackSourcesProvider = FutureProvider< ({ SourcedTrack? source, - TrackSourcesNotifier? notifier, + SourcedTrackNotifier? notifier, SpotubeTrackObject track, })?>((ref) async { final audioPlayerState = ref.watch(audioPlayerProvider); @@ -25,13 +24,15 @@ final activeTrackSourcesProvider = FutureProvider< ); } - final trackQuery = TrackSourceQuery.fromTrack( - audioPlayerState.activeTrack! as SpotubeFullTrackObject, + final sourcedTrack = await ref.watch( + sourcedTrackProvider( + audioPlayerState.activeTrack! as SpotubeFullTrackObject, + ).future, ); - - final sourcedTrack = await ref.watch(trackSourcesProvider(trackQuery).future); final sourcedTrackNotifier = ref.watch( - trackSourcesProvider(trackQuery).notifier, + sourcedTrackProvider( + audioPlayerState.activeTrack! as SpotubeFullTrackObject, + ).notifier, ); return ( diff --git a/lib/provider/server/routes/playback.dart b/lib/provider/server/routes/playback.dart index 4bce7444..f7085505 100644 --- a/lib/provider/server/routes/playback.dart +++ b/lib/provider/server/routes/playback.dart @@ -11,16 +11,14 @@ import 'package:path/path.dart'; import 'package:shelf/shelf.dart'; import 'package:spotube/models/metadata/metadata.dart'; import 'package:spotube/models/parser/range_headers.dart'; -import 'package:spotube/models/playback/track_sources.dart'; import 'package:spotube/provider/audio_player/audio_player.dart'; import 'package:spotube/provider/audio_player/state.dart'; import 'package:spotube/provider/server/active_track_sources.dart'; -import 'package:spotube/provider/server/track_sources.dart'; +import 'package:spotube/provider/server/sourced_track_provider.dart'; import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; import 'package:spotube/services/audio_player/audio_player.dart'; import 'package:spotube/services/logger/logger.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; import 'package:spotube/services/sourced_track/sourced_track.dart'; import 'package:spotube/utils/service_utils.dart'; import 'package:youtube_explode_dart/youtube_explode_dart.dart'; @@ -50,26 +48,30 @@ class ServerPlaybackRoutes { return join( await UserPreferencesNotifier.getMusicCacheDir(), ServiceUtils.sanitizeFilename( - '${track.query.title} - ${track.query.artists.join(",")} (${track.info.id}).${track.codec.name}', + '${track.query.name} - ${track.query.artists.map((d) => d.name).join(",")} (${track.info.id}).${track.qualityPreset!.getFileExtension()}', ), ); } Future _getSourcedTrack( - Request request, String trackId) async { + Request request, + String trackId, + ) async { final track = playlist.tracks.firstWhere((element) => element.id == trackId); final activeSourcedTrack = await ref.read(activeTrackSourcesProvider.future); + + final media = audioPlayer.playlist.medias + .firstWhere((e) => e.uri == request.requestedUri.toString()); + final spotubeMedia = + media is SpotubeMedia ? media : SpotubeMedia.media(media); final sourcedTrack = activeSourcedTrack?.track.id == track.id ? activeSourcedTrack?.source : await ref.read( - trackSourcesProvider( - //! Use [Request.requestedUri] as it contains full https url. - //! [Request.url] will exclude and starts relatively. (streams/... basically) - TrackSourceQuery.parseUri(request.requestedUri.toString()), - ).future, + sourcedTrackProvider(spotubeMedia.track as SpotubeFullTrackObject) + .future, ); return sourcedTrack; @@ -80,7 +82,7 @@ class ServerPlaybackRoutes { SourcedTrack track, ) async { AppLogger.log.i( - "HEAD request for track: ${track.query.title}\n" + "HEAD request for track: ${track.query.name}\n" "Headers: ${request.headers}", ); @@ -92,7 +94,7 @@ class ServerPlaybackRoutes { return dio_lib.Response( statusCode: 200, headers: Headers.fromMap({ - "content-type": ["audio/${track.codec.name}"], + "content-type": ["audio/${track.qualityPreset!.name}"], "content-length": ["$fileLength"], "accept-ranges": ["bytes"], "content-range": ["bytes 0-$fileLength/$fileLength"], @@ -103,7 +105,7 @@ class ServerPlaybackRoutes { String url = track.url ?? await ref - .read(trackSourcesProvider(track.query).notifier) + .read(sourcedTrackProvider(track.query).notifier) .swapWithNextSibling() .then((track) => track.url!); @@ -129,7 +131,7 @@ class ServerPlaybackRoutes { Map headers, ) async { AppLogger.log.i( - "GET request for track: ${track.query.title}\n" + "GET request for track: ${track.query.name}\n" "Headers: ${request.headers}", ); @@ -143,7 +145,7 @@ class ServerPlaybackRoutes { response: dio_lib.Response( statusCode: 200, headers: Headers.fromMap({ - "content-type": ["audio/${track.codec.name}"], + "content-type": ["audio/${track.qualityPreset!.name}"], "content-length": ["$cachedFileLength"], "accept-ranges": ["bytes"], "content-range": ["bytes 0-$cachedFileLength/$cachedFileLength"], @@ -158,7 +160,7 @@ class ServerPlaybackRoutes { String url = track.url ?? await ref - .read(trackSourcesProvider(track.query).notifier) + .read(sourcedTrackProvider(track.query).notifier) .swapWithNextSibling() .then((track) => track.url!); @@ -180,7 +182,7 @@ class ServerPlaybackRoutes { AppLogger.reportError(e, stack); final sourcedTrack = await ref - .read(trackSourcesProvider(track.query).notifier) + .read(sourcedTrackProvider(track.query).notifier) .refreshStreamingUrl(); url = sourcedTrack.url!; @@ -206,11 +208,9 @@ class ServerPlaybackRoutes { ); } - if (headers["range"] == "bytes=0-" && track.codec == SourceCodecs.flac) { - final bufferSize = - userPreferences.audioQuality == SourceQualities.uncompressed - ? 6 * 1024 * 1024 // 6MB for lossless - : 4 * 1024 * 1024; // 4MB for lossy + if (headers["range"] == "bytes=0-" && + track.qualityPreset is SpotubeAudioSourceContainerPresetLossless) { + const bufferSize = 6 * 1024 * 1024; // 6MB for lossless final endRange = min( bufferSize, @@ -228,7 +228,7 @@ class ServerPlaybackRoutes { final res = await dio.get(url, options: options); AppLogger.log.i( - "Response for track: ${track.query.title}\n" + "Response for track: ${track.query.name}\n" "Status Code: ${res.statusCode}\n" "Headers: ${res.headers.map}", ); @@ -262,7 +262,8 @@ class ServerPlaybackRoutes { await trackPartialCacheFile.rename(trackCacheFile.path); } - if (contentRange.total == fileLength && track.codec != SourceCodecs.weba) { + if (contentRange.total == fileLength && + track.qualityPreset!.getFileExtension() != "weba") { final playlistTrack = playlist.tracks.firstWhereOrNull( (element) => element.id == track.query.id, ); @@ -286,7 +287,9 @@ class ServerPlaybackRoutes { imageBytes: imageBytes, fileLength: fileLength, ), - ); + ).catchError((e, stackTrace) { + AppLogger.reportError(e, stackTrace); + }); } return (bytes: bytes, response: res); diff --git a/lib/provider/server/sourced_track_provider.dart b/lib/provider/server/sourced_track_provider.dart new file mode 100644 index 00000000..7934ecc7 --- /dev/null +++ b/lib/provider/server/sourced_track_provider.dart @@ -0,0 +1,49 @@ +import 'dart:async'; + +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:spotube/models/metadata/metadata.dart'; +import 'package:spotube/provider/metadata_plugin/audio_source/quality_presets.dart'; +import 'package:spotube/provider/metadata_plugin/metadata_plugin_provider.dart'; +import 'package:spotube/services/sourced_track/sourced_track.dart'; + +class SourcedTrackNotifier + extends FamilyAsyncNotifier { + @override + FutureOr build(query) { + ref.watch(audioSourcePluginProvider); + ref.watch(audioSourcePresetsProvider); + + return SourcedTrack.fetchFromTrack(query: query, ref: ref); + } + + Future refreshStreamingUrl() async { + return await update((prev) async { + return await prev.refreshStream(); + }); + } + + Future copyWithSibling() async { + return await update((prev) async { + return prev.copyWithSibling(); + }); + } + + Future swapWithSibling( + SpotubeAudioSourceMatchObject sibling, + ) async { + return await update((prev) async { + return await prev.swapWithSibling(sibling) ?? prev; + }); + } + + Future swapWithNextSibling() async { + return await update((prev) async { + return await prev.swapWithSibling(prev.siblings.first) as SourcedTrack; + }); + } +} + +final sourcedTrackProvider = AsyncNotifierProviderFamily( + () => SourcedTrackNotifier(), +); diff --git a/lib/provider/server/track_sources.dart b/lib/provider/server/track_sources.dart deleted file mode 100644 index 24502471..00000000 --- a/lib/provider/server/track_sources.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'dart:async'; - -import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:spotube/models/playback/track_sources.dart'; -import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; -import 'package:spotube/services/sourced_track/sourced_track.dart'; - -class TrackSourcesNotifier - extends FamilyAsyncNotifier { - @override - FutureOr build(query) { - ref.watch(userPreferencesProvider.select((p) => p.audioQuality)); - ref.watch(userPreferencesProvider.select((p) => p.audioSource)); - ref.watch(userPreferencesProvider.select((p) => p.streamMusicCodec)); - ref.watch(userPreferencesProvider.select((p) => p.downloadMusicCodec)); - - return SourcedTrack.fetchFromQuery(query: query, ref: ref); - } - - Future refreshStreamingUrl() async { - return await update((prev) async { - return await prev.refreshStream(); - }); - } - - Future copyWithSibling() async { - return await update((prev) async { - return prev.copyWithSibling(); - }); - } - - Future swapWithSibling(TrackSourceInfo sibling) async { - return await update((prev) async { - return await prev.swapWithSibling(sibling) ?? prev; - }); - } - - Future swapWithNextSibling() async { - return await update((prev) async { - return await prev.swapWithSibling(prev.siblings.first) as SourcedTrack; - }); - } -} - -final trackSourcesProvider = AsyncNotifierProviderFamily( - () => TrackSourcesNotifier(), -); diff --git a/lib/provider/skip_segments/skip_segments.dart b/lib/provider/skip_segments/skip_segments.dart index accccddd..dc06f326 100644 --- a/lib/provider/skip_segments/skip_segments.dart +++ b/lib/provider/skip_segments/skip_segments.dart @@ -86,18 +86,10 @@ final segmentProvider = FutureProvider( if (snapshot == null) return null; final (:track, :source, :notifier) = snapshot; if (track is SpotubeLocalTrackObject) return null; - if (source!.source case AudioSource.jiosaavn) return null; + if (!source!.source.toLowerCase().contains("youtube")) return null; - final skipNonMusic = ref.watch( - userPreferencesProvider.select( - (s) { - final isPipedYTMusicMode = s.audioSource == AudioSource.piped && - s.searchMode == SearchMode.youtubeMusic; - - return s.skipNonMusic && !isPipedYTMusicMode; - }, - ), - ); + final skipNonMusic = + ref.watch(userPreferencesProvider.select((s) => s.skipNonMusic)); if (!skipNonMusic) { return SourcedSegments(segments: [], source: source.info.id); diff --git a/lib/provider/track_options/track_options_provider.dart b/lib/provider/track_options/track_options_provider.dart index 42f363d9..e6b05201 100644 --- a/lib/provider/track_options/track_options_provider.dart +++ b/lib/provider/track_options/track_options_provider.dart @@ -21,12 +21,10 @@ import 'package:spotube/provider/metadata_plugin/library/playlists.dart'; import 'package:spotube/provider/metadata_plugin/library/tracks.dart'; import 'package:spotube/provider/metadata_plugin/metadata_plugin_provider.dart'; import 'package:spotube/services/metadata/errors/exceptions.dart'; -import 'package:url_launcher/url_launcher_string.dart'; enum TrackOptionValue { album, share, - songlink, addToPlaylist, addToQueue, removeFromPlaylist, @@ -237,10 +235,6 @@ class TrackOptionsActions { case TrackOptionValue.share: actionShare(context); break; - case TrackOptionValue.songlink: - final url = "https://song.link/s/${track.id}"; - await launchUrlString(url); - break; case TrackOptionValue.details: if (track is! SpotubeFullTrackObject) break; showDialog( @@ -252,8 +246,8 @@ class TrackOptionsActions { ); break; case TrackOptionValue.download: - if (track is! SpotubeFullTrackObject) break; - await downloadManager.addToQueue(track as SpotubeFullTrackObject); + if (track is SpotubeLocalTrackObject) break; + downloadManager.addToQueue(track as SpotubeFullTrackObject); break; case TrackOptionValue.startRadio: actionStartRadio(context); diff --git a/lib/provider/user_preferences/user_preferences_provider.dart b/lib/provider/user_preferences/user_preferences_provider.dart index 8e72727c..0b43d043 100644 --- a/lib/provider/user_preferences/user_preferences_provider.dart +++ b/lib/provider/user_preferences/user_preferences_provider.dart @@ -10,7 +10,6 @@ import 'package:spotube/modules/settings/color_scheme_picker_dialog.dart'; import 'package:spotube/provider/database/database.dart'; import 'package:spotube/services/audio_player/audio_player.dart'; import 'package:spotube/services/logger/logger.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; import 'package:spotube/utils/platform.dart'; import 'package:window_manager/window_manager.dart'; import 'package:open_file/open_file.dart'; @@ -54,7 +53,6 @@ class UserPreferencesNotifier extends Notifier { } await audioPlayer.setAudioNormalization(state.normalizeAudio); - await _updatePlayerBufferSize(event.audioQuality, state.audioQuality); } catch (e, stack) { AppLogger.reportError(e, stack); } @@ -80,24 +78,6 @@ class UserPreferencesNotifier extends Notifier { }); } - /// Sets audio player's buffer size based on the selected audio quality - /// Uncompressed quality gets a larger buffer size for smoother playback - /// while other qualities use a standard buffer size. - Future _updatePlayerBufferSize( - SourceQualities newQuality, - SourceQualities oldQuality, - ) async { - if (newQuality == SourceQualities.uncompressed) { - audioPlayer.setDemuxerBufferSize(6 * 1024 * 1024); // 6MB - return; - } - - if (oldQuality == SourceQualities.uncompressed && - newQuality != SourceQualities.uncompressed) { - audioPlayer.setDemuxerBufferSize(4 * 1024 * 1024); // 4MB - } - } - Future setData(PreferencesTableCompanion data) async { final db = ref.read(databaseProvider); @@ -138,14 +118,6 @@ class UserPreferencesNotifier extends Notifier { } } - void setStreamMusicCodec(SourceCodecs codec) { - setData(PreferencesTableCompanion(streamMusicCodec: Value(codec))); - } - - void setDownloadMusicCodec(SourceCodecs codec) { - setData(PreferencesTableCompanion(downloadMusicCodec: Value(codec))); - } - void setThemeMode(ThemeMode mode) { setData(PreferencesTableCompanion(themeMode: Value(mode))); } @@ -172,11 +144,6 @@ class UserPreferencesNotifier extends Notifier { setData(PreferencesTableCompanion(checkUpdate: Value(check))); } - void setAudioQuality(SourceQualities quality) { - setData(PreferencesTableCompanion(audioQuality: Value(quality))); - _updatePlayerBufferSize(quality, state.audioQuality); - } - void setDownloadLocation(String downloadDir) { if (downloadDir.isEmpty) return; setData(PreferencesTableCompanion(downloadLocation: Value(downloadDir))); @@ -207,14 +174,6 @@ class UserPreferencesNotifier extends Notifier { setData(PreferencesTableCompanion(locale: Value(locale))); } - void setPipedInstance(String instance) { - setData(PreferencesTableCompanion(pipedInstance: Value(instance))); - } - - void setInvidiousInstance(String instance) { - setData(PreferencesTableCompanion(invidiousInstance: Value(instance))); - } - void setSearchMode(SearchMode mode) { setData(PreferencesTableCompanion(searchMode: Value(mode))); } @@ -223,27 +182,6 @@ class UserPreferencesNotifier extends Notifier { setData(PreferencesTableCompanion(skipNonMusic: Value(skip))); } - void setAudioSource(AudioSource type) { - switch ((type, state.audioQuality)) { - // DAB music only supports high quality/uncompressed streams - case ( - AudioSource.dabMusic, - SourceQualities.low || SourceQualities.medium - ): - setAudioQuality(SourceQualities.high); - break; - // If the user switches from DAB music to other sources and has - // uncompressed quality selected, downgrade to high quality - case (!= AudioSource.dabMusic, SourceQualities.uncompressed): - setAudioQuality(SourceQualities.high); - break; - default: - break; - } - - setData(PreferencesTableCompanion(audioSource: Value(type))); - } - void setYoutubeClientEngine(YoutubeClientEngine engine) { setData(PreferencesTableCompanion(youtubeClientEngine: Value(engine))); } diff --git a/lib/services/audio_player/audio_player.dart b/lib/services/audio_player/audio_player.dart index 262b9d10..9ae4e973 100644 --- a/lib/services/audio_player/audio_player.dart +++ b/lib/services/audio_player/audio_player.dart @@ -2,7 +2,6 @@ import 'dart:io'; import 'package:media_kit/media_kit.dart' hide Track; import 'package:spotube/models/metadata/metadata.dart'; -import 'package:spotube/models/playback/track_sources.dart'; import 'package:spotube/services/logger/logger.dart'; import 'package:flutter/foundation.dart'; import 'package:spotube/services/audio_player/custom_player.dart'; @@ -22,21 +21,9 @@ class SpotubeMedia extends mk.Media { static String get _host => kIsWindows ? "localhost" : InternetAddress.anyIPv4.address; - static String _queries(SpotubeFullTrackObject track) { - final params = TrackSourceQuery.fromTrack(track).toJson(); - - return params.entries - .map((e) => - "${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value is List ? e.value.join(",") : e.value.toString())}") - .join("&"); - } - final SpotubeTrackObject track; - SpotubeMedia( - this.track, { - Map? extras, - super.httpHeaders, - }) : assert( + SpotubeMedia(this.track) + : assert( track is SpotubeLocalTrackObject || track is SpotubeFullTrackObject, "Track must be a either a local track or a full track object with ISRC", ), @@ -44,8 +31,14 @@ class SpotubeMedia extends mk.Media { super( track is SpotubeLocalTrackObject ? track.path - : "http://$_host:$serverPort/stream/${track.id}?${_queries(track as SpotubeFullTrackObject)}", + : "http://$_host:$serverPort/stream/${track.id}", + extras: track.toJson(), ); + + factory SpotubeMedia.media(Media media) { + assert(media.extras != null, "[Media] must have extra metadata set"); + return SpotubeMedia(SpotubeTrackObject.fromJson(media.extras!)); + } } abstract class AudioPlayerInterface { diff --git a/lib/services/metadata/endpoints/audio_source.dart b/lib/services/metadata/endpoints/audio_source.dart new file mode 100644 index 00000000..d22449c6 --- /dev/null +++ b/lib/services/metadata/endpoints/audio_source.dart @@ -0,0 +1,38 @@ +import 'package:hetu_script/hetu_script.dart'; +import 'package:hetu_script/values.dart'; +import 'package:spotube/models/metadata/metadata.dart'; + +class MetadataPluginAudioSourceEndpoint { + final Hetu hetu; + MetadataPluginAudioSourceEndpoint(this.hetu); + + HTInstance get hetuMetadataAudioSource => + (hetu.fetch("metadataPlugin") as HTInstance).memberGet("audioSource") + as HTInstance; + + List get supportedPresets { + final raw = hetuMetadataAudioSource.memberGet("supportedPresets") as List; + + return raw + .map((e) => SpotubeAudioSourceContainerPreset.fromJson(e)) + .toList(); + } + + Future> matches( + SpotubeFullTrackObject track, + ) async { + final raw = await hetuMetadataAudioSource + .invoke("matches", positionalArgs: [track.toJson()]) as List; + + return raw.map((e) => SpotubeAudioSourceMatchObject.fromJson(e)).toList(); + } + + Future> streams( + SpotubeAudioSourceMatchObject match, + ) async { + final raw = await hetuMetadataAudioSource + .invoke("streams", positionalArgs: [match.toJson()]) as List; + + return raw.map((e) => SpotubeAudioSourceStreamObject.fromJson(e)).toList(); + } +} diff --git a/lib/services/metadata/metadata.dart b/lib/services/metadata/metadata.dart index 0dca9465..22c09458 100644 --- a/lib/services/metadata/metadata.dart +++ b/lib/services/metadata/metadata.dart @@ -3,7 +3,9 @@ import 'dart:typed_data'; import 'package:auto_route/auto_route.dart'; import 'package:hetu_otp_util/hetu_otp_util.dart'; import 'package:hetu_script/hetu_script.dart'; -import 'package:hetu_spotube_plugin/hetu_spotube_plugin.dart'; +import 'package:hetu_spotube_plugin/hetu_spotube_plugin.dart' as spotube_plugin; +import 'package:hetu_spotube_plugin/hetu_spotube_plugin.dart' + hide YouTubeEngine; import 'package:hetu_std/hetu_std.dart'; import 'package:pub_semver/pub_semver.dart'; import 'package:shadcn_flutter/shadcn_flutter.dart'; @@ -15,6 +17,7 @@ import 'package:spotube/models/metadata/metadata.dart'; import 'package:spotube/services/metadata/apis/localstorage.dart'; import 'package:spotube/services/metadata/endpoints/album.dart'; import 'package:spotube/services/metadata/endpoints/artist.dart'; +import 'package:spotube/services/metadata/endpoints/audio_source.dart'; import 'package:spotube/services/metadata/endpoints/auth.dart'; import 'package:spotube/services/metadata/endpoints/browse.dart'; import 'package:spotube/services/metadata/endpoints/playlist.dart'; @@ -22,13 +25,15 @@ import 'package:spotube/services/metadata/endpoints/search.dart'; import 'package:spotube/services/metadata/endpoints/track.dart'; import 'package:spotube/services/metadata/endpoints/core.dart'; import 'package:spotube/services/metadata/endpoints/user.dart'; +import 'package:spotube/services/youtube_engine/youtube_engine.dart'; const defaultMetadataLimit = "20"; class MetadataPlugin { - static final pluginApiVersion = Version.parse("1.0.0"); + static final pluginApiVersion = Version.parse("2.0.0"); static Future create( + YouTubeEngine youtubeEngine, PluginConfiguration config, Uint8List byteCode, ) async { @@ -77,6 +82,58 @@ class MetadataPlugin { ), ); }, + createYoutubeEngine: () { + return spotube_plugin.YouTubeEngine( + search: (query) async { + final result = await youtubeEngine.searchVideos(query); + return result + .map((video) => { + 'id': video.id.value, + 'title': video.title, + 'author': video.author, + 'duration': video.duration?.inSeconds, + 'description': video.description, + 'uploadDate': video.uploadDate?.toIso8601String(), + 'viewCount': video.engagement.viewCount, + 'likeCount': video.engagement.likeCount, + 'isLive': video.isLive, + }) + .toList(); + }, + getVideo: (videoId) async { + final video = await youtubeEngine.getVideo(videoId); + return { + 'id': video.id.value, + 'title': video.title, + 'author': video.author, + 'duration': video.duration?.inSeconds, + 'description': video.description, + 'uploadDate': video.uploadDate?.toIso8601String(), + 'viewCount': video.engagement.viewCount, + 'likeCount': video.engagement.likeCount, + 'isLive': video.isLive, + }; + }, + streamManifest: (videoId) { + return youtubeEngine.getStreamManifest(videoId).then( + (manifest) { + final streams = manifest.audioOnly + .map( + (stream) => { + 'url': stream.url.toString(), + 'quality': stream.qualityLabel, + 'bitrate': stream.bitrate.bitsPerSecond, + 'container': stream.container.name, + 'videoId': stream.videoId, + }, + ) + .toList(); + return streams; + }, + ); + }, + ); + }, ); await HetuStdLoader.loadBytecodeFlutter(hetu); @@ -99,6 +156,7 @@ class MetadataPlugin { late final MetadataAuthEndpoint auth; + late final MetadataPluginAudioSourceEndpoint audioSource; late final MetadataPluginAlbumEndpoint album; late final MetadataPluginArtistEndpoint artist; late final MetadataPluginBrowseEndpoint browse; @@ -111,6 +169,7 @@ class MetadataPlugin { MetadataPlugin._(this.hetu) { auth = MetadataAuthEndpoint(hetu); + audioSource = MetadataPluginAudioSourceEndpoint(hetu); artist = MetadataPluginArtistEndpoint(hetu); album = MetadataPluginAlbumEndpoint(hetu); browse = MetadataPluginBrowseEndpoint(hetu); diff --git a/lib/services/song_link/model.dart b/lib/services/song_link/model.dart deleted file mode 100644 index ae9d3833..00000000 --- a/lib/services/song_link/model.dart +++ /dev/null @@ -1,19 +0,0 @@ -part of './song_link.dart'; - -@freezed -class SongLink with _$SongLink { - const factory SongLink({ - required String displayName, - required String linkId, - required String platform, - required bool show, - required String? uniqueId, - required String? country, - required String? url, - required String? nativeAppUriMobile, - required String? nativeAppUriDesktop, - }) = _SongLink; - - factory SongLink.fromJson(Map json) => - _$SongLinkFromJson(json); -} diff --git a/lib/services/song_link/song_link.dart b/lib/services/song_link/song_link.dart deleted file mode 100644 index e3cffa52..00000000 --- a/lib/services/song_link/song_link.dart +++ /dev/null @@ -1,54 +0,0 @@ -library song_link; - -import 'dart:convert'; - -import 'package:spotube/services/logger/logger.dart'; -import 'package:dio/dio.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:html/parser.dart'; - -part 'model.dart'; - -part 'song_link.freezed.dart'; -part 'song_link.g.dart'; - -abstract class SongLinkService { - static final dio = Dio(); - static Future> links(String spotifyId) async { - try { - final res = await dio.get( - "https://song.link/s/$spotifyId", - options: Options( - headers: { - "Accept": - "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", - "User-Agent": - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" - }, - responseType: ResponseType.plain, - ), - ); - - final document = parse(res.data); - - final script = document.getElementById("__NEXT_DATA__")?.text; - - if (script == null) { - return []; - } - - final pageProps = jsonDecode(script) as Map; - final songLinks = pageProps["props"]?["pageProps"]?["pageData"] - ?["sections"] - ?.firstWhere( - (section) => section?["sectionId"] == "section|auto|links|listen", - )?["links"] as List?; - - return songLinks?.map((link) => SongLink.fromJson(link)).toList() ?? - []; - } catch (e, stackTrace) { - AppLogger.reportError(e, stackTrace); - return []; - } - } -} diff --git a/lib/services/song_link/song_link.freezed.dart b/lib/services/song_link/song_link.freezed.dart deleted file mode 100644 index c704cde3..00000000 --- a/lib/services/song_link/song_link.freezed.dart +++ /dev/null @@ -1,333 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'song_link.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -T _$identity(T value) => value; - -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -SongLink _$SongLinkFromJson(Map json) { - return _SongLink.fromJson(json); -} - -/// @nodoc -mixin _$SongLink { - String get displayName => throw _privateConstructorUsedError; - String get linkId => throw _privateConstructorUsedError; - String get platform => throw _privateConstructorUsedError; - bool get show => throw _privateConstructorUsedError; - String? get uniqueId => throw _privateConstructorUsedError; - String? get country => throw _privateConstructorUsedError; - String? get url => throw _privateConstructorUsedError; - String? get nativeAppUriMobile => throw _privateConstructorUsedError; - String? get nativeAppUriDesktop => throw _privateConstructorUsedError; - - /// Serializes this SongLink to a JSON map. - Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of SongLink - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $SongLinkCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $SongLinkCopyWith<$Res> { - factory $SongLinkCopyWith(SongLink value, $Res Function(SongLink) then) = - _$SongLinkCopyWithImpl<$Res, SongLink>; - @useResult - $Res call( - {String displayName, - String linkId, - String platform, - bool show, - String? uniqueId, - String? country, - String? url, - String? nativeAppUriMobile, - String? nativeAppUriDesktop}); -} - -/// @nodoc -class _$SongLinkCopyWithImpl<$Res, $Val extends SongLink> - implements $SongLinkCopyWith<$Res> { - _$SongLinkCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of SongLink - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? displayName = null, - Object? linkId = null, - Object? platform = null, - Object? show = null, - Object? uniqueId = freezed, - Object? country = freezed, - Object? url = freezed, - Object? nativeAppUriMobile = freezed, - Object? nativeAppUriDesktop = freezed, - }) { - return _then(_value.copyWith( - displayName: null == displayName - ? _value.displayName - : displayName // ignore: cast_nullable_to_non_nullable - as String, - linkId: null == linkId - ? _value.linkId - : linkId // ignore: cast_nullable_to_non_nullable - as String, - platform: null == platform - ? _value.platform - : platform // ignore: cast_nullable_to_non_nullable - as String, - show: null == show - ? _value.show - : show // ignore: cast_nullable_to_non_nullable - as bool, - uniqueId: freezed == uniqueId - ? _value.uniqueId - : uniqueId // ignore: cast_nullable_to_non_nullable - as String?, - country: freezed == country - ? _value.country - : country // ignore: cast_nullable_to_non_nullable - as String?, - url: freezed == url - ? _value.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - nativeAppUriMobile: freezed == nativeAppUriMobile - ? _value.nativeAppUriMobile - : nativeAppUriMobile // ignore: cast_nullable_to_non_nullable - as String?, - nativeAppUriDesktop: freezed == nativeAppUriDesktop - ? _value.nativeAppUriDesktop - : nativeAppUriDesktop // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$SongLinkImplCopyWith<$Res> - implements $SongLinkCopyWith<$Res> { - factory _$$SongLinkImplCopyWith( - _$SongLinkImpl value, $Res Function(_$SongLinkImpl) then) = - __$$SongLinkImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String displayName, - String linkId, - String platform, - bool show, - String? uniqueId, - String? country, - String? url, - String? nativeAppUriMobile, - String? nativeAppUriDesktop}); -} - -/// @nodoc -class __$$SongLinkImplCopyWithImpl<$Res> - extends _$SongLinkCopyWithImpl<$Res, _$SongLinkImpl> - implements _$$SongLinkImplCopyWith<$Res> { - __$$SongLinkImplCopyWithImpl( - _$SongLinkImpl _value, $Res Function(_$SongLinkImpl) _then) - : super(_value, _then); - - /// Create a copy of SongLink - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? displayName = null, - Object? linkId = null, - Object? platform = null, - Object? show = null, - Object? uniqueId = freezed, - Object? country = freezed, - Object? url = freezed, - Object? nativeAppUriMobile = freezed, - Object? nativeAppUriDesktop = freezed, - }) { - return _then(_$SongLinkImpl( - displayName: null == displayName - ? _value.displayName - : displayName // ignore: cast_nullable_to_non_nullable - as String, - linkId: null == linkId - ? _value.linkId - : linkId // ignore: cast_nullable_to_non_nullable - as String, - platform: null == platform - ? _value.platform - : platform // ignore: cast_nullable_to_non_nullable - as String, - show: null == show - ? _value.show - : show // ignore: cast_nullable_to_non_nullable - as bool, - uniqueId: freezed == uniqueId - ? _value.uniqueId - : uniqueId // ignore: cast_nullable_to_non_nullable - as String?, - country: freezed == country - ? _value.country - : country // ignore: cast_nullable_to_non_nullable - as String?, - url: freezed == url - ? _value.url - : url // ignore: cast_nullable_to_non_nullable - as String?, - nativeAppUriMobile: freezed == nativeAppUriMobile - ? _value.nativeAppUriMobile - : nativeAppUriMobile // ignore: cast_nullable_to_non_nullable - as String?, - nativeAppUriDesktop: freezed == nativeAppUriDesktop - ? _value.nativeAppUriDesktop - : nativeAppUriDesktop // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$SongLinkImpl implements _SongLink { - const _$SongLinkImpl( - {required this.displayName, - required this.linkId, - required this.platform, - required this.show, - required this.uniqueId, - required this.country, - required this.url, - required this.nativeAppUriMobile, - required this.nativeAppUriDesktop}); - - factory _$SongLinkImpl.fromJson(Map json) => - _$$SongLinkImplFromJson(json); - - @override - final String displayName; - @override - final String linkId; - @override - final String platform; - @override - final bool show; - @override - final String? uniqueId; - @override - final String? country; - @override - final String? url; - @override - final String? nativeAppUriMobile; - @override - final String? nativeAppUriDesktop; - - @override - String toString() { - return 'SongLink(displayName: $displayName, linkId: $linkId, platform: $platform, show: $show, uniqueId: $uniqueId, country: $country, url: $url, nativeAppUriMobile: $nativeAppUriMobile, nativeAppUriDesktop: $nativeAppUriDesktop)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$SongLinkImpl && - (identical(other.displayName, displayName) || - other.displayName == displayName) && - (identical(other.linkId, linkId) || other.linkId == linkId) && - (identical(other.platform, platform) || - other.platform == platform) && - (identical(other.show, show) || other.show == show) && - (identical(other.uniqueId, uniqueId) || - other.uniqueId == uniqueId) && - (identical(other.country, country) || other.country == country) && - (identical(other.url, url) || other.url == url) && - (identical(other.nativeAppUriMobile, nativeAppUriMobile) || - other.nativeAppUriMobile == nativeAppUriMobile) && - (identical(other.nativeAppUriDesktop, nativeAppUriDesktop) || - other.nativeAppUriDesktop == nativeAppUriDesktop)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, displayName, linkId, platform, - show, uniqueId, country, url, nativeAppUriMobile, nativeAppUriDesktop); - - /// Create a copy of SongLink - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$SongLinkImplCopyWith<_$SongLinkImpl> get copyWith => - __$$SongLinkImplCopyWithImpl<_$SongLinkImpl>(this, _$identity); - - @override - Map toJson() { - return _$$SongLinkImplToJson( - this, - ); - } -} - -abstract class _SongLink implements SongLink { - const factory _SongLink( - {required final String displayName, - required final String linkId, - required final String platform, - required final bool show, - required final String? uniqueId, - required final String? country, - required final String? url, - required final String? nativeAppUriMobile, - required final String? nativeAppUriDesktop}) = _$SongLinkImpl; - - factory _SongLink.fromJson(Map json) = - _$SongLinkImpl.fromJson; - - @override - String get displayName; - @override - String get linkId; - @override - String get platform; - @override - bool get show; - @override - String? get uniqueId; - @override - String? get country; - @override - String? get url; - @override - String? get nativeAppUriMobile; - @override - String? get nativeAppUriDesktop; - - /// Create a copy of SongLink - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$SongLinkImplCopyWith<_$SongLinkImpl> get copyWith => - throw _privateConstructorUsedError; -} diff --git a/lib/services/song_link/song_link.g.dart b/lib/services/song_link/song_link.g.dart deleted file mode 100644 index 7658a74c..00000000 --- a/lib/services/song_link/song_link.g.dart +++ /dev/null @@ -1,32 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'song_link.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_$SongLinkImpl _$$SongLinkImplFromJson(Map json) => _$SongLinkImpl( - displayName: json['displayName'] as String, - linkId: json['linkId'] as String, - platform: json['platform'] as String, - show: json['show'] as bool, - uniqueId: json['uniqueId'] as String?, - country: json['country'] as String?, - url: json['url'] as String?, - nativeAppUriMobile: json['nativeAppUriMobile'] as String?, - nativeAppUriDesktop: json['nativeAppUriDesktop'] as String?, - ); - -Map _$$SongLinkImplToJson(_$SongLinkImpl instance) => - { - 'displayName': instance.displayName, - 'linkId': instance.linkId, - 'platform': instance.platform, - 'show': instance.show, - 'uniqueId': instance.uniqueId, - 'country': instance.country, - 'url': instance.url, - 'nativeAppUriMobile': instance.nativeAppUriMobile, - 'nativeAppUriDesktop': instance.nativeAppUriDesktop, - }; diff --git a/lib/services/sourced_track/enums.dart b/lib/services/sourced_track/enums.dart deleted file mode 100644 index 9a1a5040..00000000 --- a/lib/services/sourced_track/enums.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:spotube/models/playback/track_sources.dart'; - -enum SourceCodecs { - m4a._("M4a (Best for downloaded music)"), - weba._("WebA (Best for streamed music)\nDoesn't support audio metadata"), - mp3._("MP3 (Widely supported audio format)"), - flac._("FLAC (Lossless, best quality)\nLarge file size"); - - final String label; - const SourceCodecs._(this.label); -} - -enum SourceQualities { - uncompressed(3), - high(2), - medium(1), - low(0); - - final int priority; - const SourceQualities(this.priority); - - bool operator <(SourceQualities other) { - return priority < other.priority; - } - - operator >(SourceQualities other) { - return priority > other.priority; - } -} - -typedef SiblingType = ({ - T info, - List? source -}); diff --git a/lib/services/sourced_track/exceptions.dart b/lib/services/sourced_track/exceptions.dart index c841e1e2..4817c9fb 100644 --- a/lib/services/sourced_track/exceptions.dart +++ b/lib/services/sourced_track/exceptions.dart @@ -1,12 +1,12 @@ -import 'package:spotube/models/playback/track_sources.dart'; +import 'package:spotube/models/metadata/metadata.dart'; class TrackNotFoundError extends Error { - final TrackSourceQuery track; + final SpotubeTrackObject track; TrackNotFoundError(this.track); @override String toString() { - return '[TrackNotFoundError] ${track.title} - ${track.artists.join(", ")}'; + return '[TrackNotFoundError] ${track.name} - ${track.artists.join(", ")}'; } } diff --git a/lib/services/sourced_track/models/video_info.dart b/lib/services/sourced_track/models/video_info.dart deleted file mode 100644 index e3452c61..00000000 --- a/lib/services/sourced_track/models/video_info.dart +++ /dev/null @@ -1,136 +0,0 @@ -import 'package:invidious/invidious.dart'; -import 'package:piped_client/piped_client.dart'; -import 'package:spotube/models/database/database.dart'; - -import 'package:youtube_explode_dart/youtube_explode_dart.dart'; - -class YoutubeVideoInfo { - final SearchMode searchMode; - final String title; - final Duration duration; - final String thumbnailUrl; - final String id; - final int likes; - final int dislikes; - final int views; - final String channelName; - final String channelId; - final DateTime publishedAt; - - YoutubeVideoInfo({ - required this.searchMode, - required this.title, - required this.duration, - required this.thumbnailUrl, - required this.id, - required this.likes, - required this.dislikes, - required this.views, - required this.channelName, - required this.publishedAt, - required this.channelId, - }); - - YoutubeVideoInfo.fromJson(Map json) - : title = json['title'], - searchMode = SearchMode.fromString(json['searchMode']), - duration = Duration(seconds: json['duration']), - thumbnailUrl = json['thumbnailUrl'], - id = json['id'], - likes = json['likes'], - dislikes = json['dislikes'], - views = json['views'], - channelName = json['channelName'], - channelId = json['channelId'], - publishedAt = DateTime.tryParse(json['publishedAt']) ?? DateTime.now(); - - Map toJson() => { - 'title': title, - 'duration': duration.inSeconds, - 'thumbnailUrl': thumbnailUrl, - 'id': id, - 'likes': likes, - 'dislikes': dislikes, - 'views': views, - 'channelName': channelName, - 'channelId': channelId, - 'publishedAt': publishedAt.toIso8601String(), - 'searchMode': searchMode.name, - }; - - factory YoutubeVideoInfo.fromVideo(Video video) { - return YoutubeVideoInfo( - searchMode: SearchMode.youtube, - title: video.title, - duration: video.duration ?? Duration.zero, - thumbnailUrl: video.thumbnails.mediumResUrl, - id: video.id.value, - likes: video.engagement.likeCount ?? 0, - dislikes: video.engagement.dislikeCount ?? 0, - views: video.engagement.viewCount, - channelName: video.author, - channelId: '/c/${video.channelId.value}', - publishedAt: video.uploadDate ?? DateTime(2003, 9, 9), - ); - } - - factory YoutubeVideoInfo.fromSearchItemStream( - PipedSearchItemStream searchItem, - SearchMode searchMode, - ) { - return YoutubeVideoInfo( - searchMode: searchMode, - title: searchItem.title, - duration: searchItem.duration, - thumbnailUrl: searchItem.thumbnail, - id: searchItem.id, - likes: 0, - dislikes: 0, - views: searchItem.views, - channelName: searchItem.uploaderName, - channelId: searchItem.uploaderUrl ?? "", - publishedAt: searchItem.uploadedDate != null - ? DateTime.tryParse(searchItem.uploadedDate!) ?? DateTime(2003, 9, 9) - : DateTime(2003, 9, 9), - ); - } - - factory YoutubeVideoInfo.fromStreamResponse( - PipedStreamResponse stream, SearchMode searchMode) { - return YoutubeVideoInfo( - searchMode: searchMode, - title: stream.title, - duration: stream.duration, - thumbnailUrl: stream.thumbnailUrl, - id: stream.id, - likes: stream.likes, - dislikes: stream.dislikes, - views: stream.views, - channelName: stream.uploader, - publishedAt: stream.uploadedDate != null - ? DateTime.tryParse(stream.uploadedDate!) ?? DateTime(2003, 9, 9) - : DateTime(2003, 9, 9), - channelId: stream.uploaderUrl, - ); - } - - factory YoutubeVideoInfo.fromSearchResponse( - InvidiousSearchResponseVideo searchResponse, - SearchMode searchMode, - ) { - return YoutubeVideoInfo( - searchMode: searchMode, - title: searchResponse.title, - duration: Duration(seconds: searchResponse.lengthSeconds), - thumbnailUrl: searchResponse.videoThumbnails.first.url, - id: searchResponse.videoId, - likes: 0, - dislikes: 0, - views: searchResponse.viewCount, - channelName: searchResponse.author, - channelId: searchResponse.authorId, - publishedAt: - DateTime.fromMillisecondsSinceEpoch(searchResponse.published * 1000), - ); - } -} diff --git a/lib/services/sourced_track/sourced_track.dart b/lib/services/sourced_track/sourced_track.dart index a5b2ae93..5da54fc8 100644 --- a/lib/services/sourced_track/sourced_track.dart +++ b/lib/services/sourced_track/sourced_track.dart @@ -1,18 +1,27 @@ +import 'dart:convert'; + import 'package:collection/collection.dart'; +import 'package:dio/dio.dart'; +import 'package:drift/drift.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:spotube/models/database/database.dart'; +import 'package:spotube/models/metadata/metadata.dart'; import 'package:spotube/models/playback/track_sources.dart'; -import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; +import 'package:spotube/provider/database/database.dart'; +import 'package:spotube/provider/metadata_plugin/audio_source/quality_presets.dart'; +import 'package:spotube/provider/metadata_plugin/metadata_plugin_provider.dart'; +import 'package:spotube/services/dio/dio.dart'; +import 'package:spotube/services/logger/logger.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; -import 'package:spotube/services/sourced_track/sources/dab_music.dart'; -import 'package:spotube/services/sourced_track/sources/invidious.dart'; -import 'package:spotube/services/sourced_track/sources/jiosaavn.dart'; -import 'package:spotube/services/sourced_track/sources/piped.dart'; -import 'package:spotube/services/sourced_track/sources/youtube.dart'; +import 'package:spotube/services/sourced_track/exceptions.dart'; import 'package:spotube/utils/service_utils.dart'; -abstract class SourcedTrack extends BasicSourcedTrack { +final officialMusicRegex = RegExp( + r"official\s(video|audio|music\svideo|lyric\svideo|visualizer)", + caseSensitive: false, +); + +class SourcedTrack extends BasicSourcedTrack { final Ref ref; SourcedTrack({ @@ -24,144 +33,267 @@ abstract class SourcedTrack extends BasicSourcedTrack { required super.sources, }); - static SourcedTrack fromJson( - Map json, { - required Ref ref, - }) { - final preferences = ref.read(userPreferencesProvider); - - final info = TrackSourceInfo.fromJson(json["info"]); - final query = TrackSourceQuery.fromJson(json["query"]); - final source = AudioSource.values.firstWhereOrNull( - (source) => source.name == json["source"], - ) ?? - preferences.audioSource; - final siblings = (json["siblings"] as List) - .map((s) => TrackSourceInfo.fromJson(s)) - .toList(); - final sources = - (json["sources"] as List).map((s) => TrackSource.fromJson(s)).toList(); - - return switch (preferences.audioSource) { - AudioSource.youtube => YoutubeSourcedTrack( - ref: ref, - source: source, - siblings: siblings, - info: info, - query: query, - sources: sources, - ), - AudioSource.piped => PipedSourcedTrack( - ref: ref, - source: source, - siblings: siblings, - info: info, - query: query, - sources: sources, - ), - AudioSource.jiosaavn => JioSaavnSourcedTrack( - ref: ref, - source: source, - siblings: siblings, - info: info, - query: query, - sources: sources, - ), - AudioSource.invidious => InvidiousSourcedTrack( - ref: ref, - source: source, - siblings: siblings, - info: info, - query: query, - sources: sources, - ), - AudioSource.dabMusic => DABMusicSourcedTrack( - ref: ref, - source: source, - siblings: siblings, - info: info, - query: query, - sources: sources, - ), - }; - } - - static String getSearchTerm(TrackSourceQuery track) { - final title = ServiceUtils.getTitle( - track.title, - artists: track.artists, - onlyCleanArtist: true, - ).trim(); - - assert(title.trim().isNotEmpty, "Title should not be empty"); - - return "$title - ${track.artists.join(", ")}"; - } - - static Future fetchFromQuery({ - required TrackSourceQuery query, + static Future fetchFromTrack({ + required SpotubeFullTrackObject query, required Ref ref, }) async { - final preferences = ref.read(userPreferencesProvider); - try { - return switch (preferences.audioSource) { - AudioSource.youtube => - await YoutubeSourcedTrack.fetchFromTrack(query: query, ref: ref), - AudioSource.piped => - await PipedSourcedTrack.fetchFromTrack(query: query, ref: ref), - AudioSource.invidious => - await InvidiousSourcedTrack.fetchFromTrack(query: query, ref: ref), - AudioSource.jiosaavn => - await JioSaavnSourcedTrack.fetchFromTrack(query: query, ref: ref), - AudioSource.dabMusic => - await DABMusicSourcedTrack.fetchFromTrack(query: query, ref: ref), - }; - } catch (e) { - if (preferences.audioSource == AudioSource.youtube) { - rethrow; + final audioSource = await ref.read(audioSourcePluginProvider.future); + final audioSourceConfig = await ref.read(metadataPluginsProvider + .selectAsync((data) => data.defaultAudioSourcePluginConfig)); + if (audioSource == null || audioSourceConfig == null) { + throw Exception("Dude wat?"); + } + + final database = ref.read(databaseProvider); + final cachedSource = await (database.select(database.sourceMatchTable) + ..where((s) => + s.trackId.equals(query.id) & + s.sourceType.equals(audioSourceConfig.slug)) + ..limit(1) + ..orderBy([ + (s) => + OrderingTerm(expression: s.createdAt, mode: OrderingMode.desc), + ])) + .get() + .then((s) => s.firstOrNull); + + if (cachedSource == null) { + final siblings = await fetchSiblings(ref: ref, query: query); + if (siblings.isEmpty) { + throw TrackNotFoundError(query); } - return await YoutubeSourcedTrack.fetchFromTrack(query: query, ref: ref); + await database.into(database.sourceMatchTable).insert( + SourceMatchTableCompanion.insert( + trackId: query.id, + sourceInfo: Value(jsonEncode(siblings.first)), + sourceType: audioSourceConfig.slug, + ), + ); + + final manifest = await audioSource.audioSource.streams(siblings.first); + + return SourcedTrack( + ref: ref, + siblings: siblings.skip(1).toList(), + info: siblings.first, + source: audioSourceConfig.slug, + sources: manifest, + query: query, + ); } + final item = SpotubeAudioSourceMatchObject.fromJson( + jsonDecode(cachedSource.sourceInfo), + ); + final manifest = await audioSource.audioSource.streams(item); + + final sourcedTrack = SourcedTrack( + ref: ref, + siblings: [], + sources: manifest, + info: item, + query: query, + source: audioSourceConfig.slug, + ); + + AppLogger.log.i("${query.name}: ${sourcedTrack.url}"); + + return sourcedTrack; } - static Future> fetchSiblings({ - required TrackSourceQuery query, + static List rankResults( + List results, + SpotubeFullTrackObject track, + ) { + return results + .map((sibling) { + int score = 0; + + for (final artist in track.artists) { + final isSameChannelArtist = + sibling.artists.any((a) => a.toLowerCase() == artist.name); + + if (isSameChannelArtist) { + score += 1; + } + + final titleContainsArtist = + sibling.title.toLowerCase().contains(artist.name.toLowerCase()); + + if (titleContainsArtist) { + score += 1; + } + } + + final titleContainsTrackName = + sibling.title.toLowerCase().contains(track.name.toLowerCase()); + + final hasOfficialFlag = + officialMusicRegex.hasMatch(sibling.title.toLowerCase()); + + if (titleContainsTrackName) { + score += 3; + } + + if (hasOfficialFlag) { + score += 1; + } + + if (hasOfficialFlag && titleContainsTrackName) { + score += 2; + } + + return (sibling: sibling, score: score); + }) + .sorted((a, b) => b.score.compareTo(a.score)) + .map((e) => e.sibling) + .toList(); + } + + static Future> fetchSiblings({ + required SpotubeFullTrackObject query, required Ref ref, - }) { - final preferences = ref.read(userPreferencesProvider); + }) async { + final audioSource = await ref.read(audioSourcePluginProvider.future); - return switch (preferences.audioSource) { - AudioSource.piped => - PipedSourcedTrack.fetchSiblings(query: query, ref: ref), - AudioSource.youtube => - YoutubeSourcedTrack.fetchSiblings(query: query, ref: ref), - AudioSource.jiosaavn => - JioSaavnSourcedTrack.fetchSiblings(query: query, ref: ref), - AudioSource.invidious => - InvidiousSourcedTrack.fetchSiblings(query: query, ref: ref), - AudioSource.dabMusic => - DABMusicSourcedTrack.fetchSiblings(query: query, ref: ref), - }; + if (audioSource == null) { + throw Exception("Dude wat?"); + } + + final videoResults = []; + + final searchResults = await audioSource.audioSource.matches(query); + + if (ServiceUtils.onlyContainsEnglish(query.name)) { + videoResults.addAll(searchResults); + } else { + videoResults.addAll(rankResults(searchResults, query)); + } + + return videoResults.toSet().toList(); } - Future copyWithSibling(); + Future copyWithSibling() async { + if (siblings.isNotEmpty) { + return this; + } + final fetchedSiblings = await fetchSiblings(ref: ref, query: query); - Future swapWithSibling(TrackSourceInfo sibling); + return SourcedTrack( + ref: ref, + siblings: fetchedSiblings.where((s) => s.id != info.id).toList(), + source: source, + sources: sources, + info: info, + query: query, + ); + } + + Future swapWithSibling( + SpotubeAudioSourceMatchObject sibling) async { + if (sibling.id == info.id) { + return null; + } + + final audioSource = await ref.read(audioSourcePluginProvider.future); + final audioSourceConfig = await ref.read(metadataPluginsProvider + .selectAsync((data) => data.defaultAudioSourcePluginConfig)); + if (audioSource == null || audioSourceConfig == null) { + throw Exception("Dude wat?"); + } + + // a sibling source that was fetched from the search results + final isStepSibling = siblings.none((s) => s.id == sibling.id); + + final newSourceInfo = isStepSibling + ? sibling + : siblings.firstWhere((s) => s.id == sibling.id); + + final newSiblings = siblings.where((s) => s.id != sibling.id).toList() + ..insert(0, info); + + final manifest = await audioSource.audioSource.streams(newSourceInfo); + + final database = ref.read(databaseProvider); + + await database.into(database.sourceMatchTable).insert( + SourceMatchTableCompanion.insert( + trackId: query.id, + sourceInfo: Value(jsonEncode(siblings.first)), + sourceType: audioSourceConfig.slug, + createdAt: Value(DateTime.now()), + ), + mode: InsertMode.replace, + ); + + return SourcedTrack( + ref: ref, + source: source, + siblings: newSiblings, + sources: manifest, + info: newSourceInfo, + query: query, + ); + } Future swapWithSiblingOfIndex(int index) { return swapWithSibling(siblings[index]); } - Future refreshStream(); + Future refreshStream() async { + final audioSource = await ref.read(audioSourcePluginProvider.future); + final audioSourceConfig = await ref.read(metadataPluginsProvider + .selectAsync((data) => data.defaultAudioSourcePluginConfig)); + if (audioSource == null || audioSourceConfig == null) { + throw Exception("Dude wat?"); + } + + List validStreams = []; + + final stringBuffer = StringBuffer(); + for (final source in sources) { + final res = await globalDio.head( + source.url, + options: + Options(validateStatus: (status) => status != null && status < 500), + ); + + stringBuffer.writeln( + "[${query.id}] ${res.statusCode} ${source.container} ${source.codec} ${source.bitrate}", + ); + + if (res.statusCode! < 400) { + validStreams.add(source); + } + } + + AppLogger.log.d(stringBuffer.toString()); + + if (validStreams.isEmpty) { + validStreams = await audioSource.audioSource.streams(info); + } + + final sourcedTrack = SourcedTrack( + ref: ref, + siblings: siblings, + source: source, + sources: validStreams, + info: info, + query: query, + ); + + AppLogger.log.i("Refreshing ${query.name}: ${sourcedTrack.url}"); + + return sourcedTrack; + } + String? get url { - final preferences = ref.read(userPreferencesProvider); + final preferences = ref.read(audioSourcePresetsProvider); - final codec = preferences.audioSource == AudioSource.jiosaavn - ? SourceCodecs.m4a - : preferences.streamMusicCodec; - - return getUrlOfCodec(codec); + return getUrlOfQuality( + preferences.presets[preferences.selectedStreamingContainerIndex], + preferences.selectedStreamingQualityIndex, + ); } /// Returns the URL of the track based on the codec and quality preferences. @@ -170,58 +302,62 @@ abstract class SourcedTrack extends BasicSourcedTrack { /// /// If no sources match the codec, it will return the first or last source /// based on the user's audio quality preference. - TrackSource? getSourceOfCodec(SourceCodecs codec) { - final preferences = ref.read(userPreferencesProvider); + SpotubeAudioSourceStreamObject? getStreamOfQuality( + SpotubeAudioSourceContainerPreset preset, + int qualityIndex, + ) { + if (sources.isEmpty) return null; + + final quality = preset.qualities[qualityIndex]; final exactMatch = sources.firstWhereOrNull( - (source) => - source.codec == codec && source.quality == preferences.audioQuality, + (source) { + if (source.container != preset.name) return false; + + if (quality case SpotubeAudioLosslessContainerQuality()) { + return source.sampleRate == quality.sampleRate && + source.bitDepth == quality.bitDepth; + } else { + return source.bitrate == + (quality as SpotubeAudioLossyContainerQuality).bitrate; + } + }, ); if (exactMatch != null) { return exactMatch; } - final sameCodecSources = sources - .where((source) => source.codec == codec) - .toList() - .sorted((a, b) { - final aDiff = (a.quality.index - preferences.audioQuality.index).abs(); - final bDiff = (b.quality.index - preferences.audioQuality.index).abs(); - return aDiff != bDiff ? aDiff - bDiff : a.quality.index - b.quality.index; - }).toList(); - - if (sameCodecSources.isNotEmpty) { - return preferences.audioQuality > SourceQualities.low - ? sameCodecSources.first - : sameCodecSources.last; - } - - final fallbackSource = sources.sorted((a, b) { - final aDiff = (a.quality.index - preferences.audioQuality.index).abs(); - final bDiff = (b.quality.index - preferences.audioQuality.index).abs(); - return aDiff != bDiff ? aDiff - bDiff : a.quality.index - b.quality.index; + // Find the preset with closest quality to the supplied quality + return sources.where((source) { + return source.container == preset.name; + }).reduce((prev, curr) { + if (quality is SpotubeAudioLosslessContainerQuality) { + final prevDiff = ((prev.sampleRate ?? 0) - quality.sampleRate).abs() + + ((prev.bitDepth ?? 0) - quality.bitDepth).abs(); + final currDiff = ((curr.sampleRate ?? 0) - quality.sampleRate).abs() + + ((curr.bitDepth ?? 0) - quality.bitDepth).abs(); + return currDiff < prevDiff ? curr : prev; + } else { + final prevDiff = ((prev.bitrate ?? 0) - + (quality as SpotubeAudioLossyContainerQuality).bitrate) + .abs(); + final currDiff = ((curr.bitrate ?? 0) - quality.bitrate).abs(); + return currDiff < prevDiff ? curr : prev; + } }); - - return preferences.audioQuality > SourceQualities.low - ? fallbackSource.firstOrNull - : fallbackSource.lastOrNull; } - String? getUrlOfCodec(SourceCodecs codec) { - return getSourceOfCodec(codec)?.url; + String? getUrlOfQuality( + SpotubeAudioSourceContainerPreset preset, + int qualityIndex, + ) { + return getStreamOfQuality(preset, qualityIndex)?.url; } - SourceCodecs get codec { - final preferences = ref.read(userPreferencesProvider); - - return switch (preferences.audioSource) { - AudioSource.dabMusic => - preferences.audioQuality == SourceQualities.uncompressed - ? SourceCodecs.flac - : SourceCodecs.mp3, - AudioSource.jiosaavn => SourceCodecs.m4a, - _ => preferences.streamMusicCodec - }; + SpotubeAudioSourceContainerPreset? get qualityPreset { + final presetState = ref.read(audioSourcePresetsProvider); + return presetState.presets + .elementAtOrNull(presetState.selectedStreamingContainerIndex); } } diff --git a/lib/services/sourced_track/sources/dab_music.dart b/lib/services/sourced_track/sources/dab_music.dart deleted file mode 100644 index 83cc55b4..00000000 --- a/lib/services/sourced_track/sources/dab_music.dart +++ /dev/null @@ -1,303 +0,0 @@ -import 'dart:convert'; - -import 'package:collection/collection.dart'; -import 'package:dio/dio.dart'; -import 'package:drift/drift.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:spotube/models/database/database.dart'; -import 'package:spotube/models/playback/track_sources.dart'; -import 'package:spotube/provider/database/database.dart'; -import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; -import 'package:spotube/services/logger/logger.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; -import 'package:spotube/services/sourced_track/exceptions.dart'; -import 'package:spotube/services/sourced_track/sourced_track.dart'; -import 'package:dab_music_api/dab_music_api.dart'; - -final dabMusicApiClient = DabMusicApiClient( - Dio(), - baseUrl: "https://dab.yeet.su/api", -); - -/// Only Music source that can't support database caching due to having no endpoint. -/// But ISRC search is 100% reliable so caching is actually not necessary. -class DABMusicSourcedTrack extends SourcedTrack { - DABMusicSourcedTrack({ - required super.ref, - required super.source, - required super.siblings, - required super.info, - required super.query, - required super.sources, - }); - - static Future fetchFromTrack({ - required TrackSourceQuery query, - required Ref ref, - }) async { - try { - final database = ref.read(databaseProvider); - final cachedSource = await (database.select(database.sourceMatchTable) - ..where((s) => s.trackId.equals(query.id)) - ..limit(1) - ..orderBy([ - (s) => OrderingTerm( - expression: s.createdAt, - mode: OrderingMode.desc, - ), - ])) - .get() - .then((s) => s.firstOrNull); - - if (cachedSource != null && - cachedSource.sourceType == SourceType.dabMusic) { - final json = jsonDecode(cachedSource.sourceId); - final info = TrackSourceInfo.fromJson(json["info"]); - final source = (json["sources"] as List?) - ?.map((s) => TrackSource.fromJson(s)) - .toList(); - - final [updatedSource] = await fetchSources( - info.id, - ref.read(userPreferencesProvider).audioQuality, - const AudioQuality( - isHiRes: true, - maximumBitDepth: 16, - maximumSamplingRate: 44.1, - ), - ); - - return DABMusicSourcedTrack( - ref: ref, - source: AudioSource.dabMusic, - siblings: [], - info: info, - query: query, - sources: [ - source!.first.copyWith(url: updatedSource.url), - ], - ); - } - - final siblings = await fetchSiblings(ref: ref, query: query); - - if (siblings.isEmpty) { - throw TrackNotFoundError(query); - } - - await database.into(database.sourceMatchTable).insert( - SourceMatchTableCompanion.insert( - trackId: query.id, - sourceId: jsonEncode({ - "info": siblings.first.info.toJson(), - "sources": (siblings.first.source ?? []) - .map((s) => s.toJson()) - .toList(), - }), - sourceType: const Value(SourceType.dabMusic), - ), - ); - - return DABMusicSourcedTrack( - ref: ref, - siblings: siblings.map((s) => s.info).skip(1).toList(), - sources: siblings.first.source!, - info: siblings.first.info, - query: query, - source: AudioSource.dabMusic, - ); - } catch (e, stackTrace) { - AppLogger.reportError(e, stackTrace); - rethrow; - } - } - - static Future> fetchSources( - String id, - SourceQualities quality, - AudioQuality trackMaximumQuality, - ) async { - try { - final isUncompressed = quality == SourceQualities.uncompressed; - final streamResponse = await dabMusicApiClient.music.getStream( - trackId: id, - quality: isUncompressed ? "27" : "5", - ); - if (streamResponse.url == null) { - throw Exception("No stream URL found for track ID: $id"); - } - - // kbps = (bitDepth * sampleRate * channels) / 1000 - final uncompressedBitrate = !isUncompressed - ? 0 - : ((trackMaximumQuality.maximumBitDepth ?? 0) * - ((trackMaximumQuality.maximumSamplingRate ?? 0) * 1000) * - 2) / - 1000; - return [ - TrackSource( - url: streamResponse.url!, - quality: isUncompressed - ? SourceQualities.uncompressed - : SourceQualities.high, - bitrate: - isUncompressed ? "${uncompressedBitrate.floor()}kbps" : "320kbps", - codec: isUncompressed ? SourceCodecs.flac : SourceCodecs.mp3, - qualityLabel: isUncompressed - ? "${trackMaximumQuality.maximumBitDepth}bit • ${trackMaximumQuality.maximumSamplingRate}kHz • FLAC • Stereo" - : "MP3 • 320kbps • mp3 • Stereo", - ), - ]; - } catch (e, stackTrace) { - AppLogger.reportError(e, stackTrace); - rethrow; - } - } - - static Future toSiblingType( - Ref ref, - int index, - Track result, - ) async { - try { - List? source; - if (index == 0) { - source = await fetchSources( - result.id.toString(), - ref.read(userPreferencesProvider).audioQuality, - result.audioQuality!, - ); - } - - final SiblingType sibling = ( - info: TrackSourceInfo( - artists: result.artist!, - durationMs: Duration(seconds: result.duration!).inMilliseconds, - id: result.id.toString(), - pageUrl: "https://dab.yeet.su/music/${result.id}", - thumbnail: result.albumCover!, - title: result.title!, - ), - source: source, - ); - - return sibling; - } catch (e, stackTrace) { - AppLogger.reportError(e, stackTrace); - rethrow; - } - } - - static Future> fetchSiblings({ - required TrackSourceQuery query, - required Ref ref, - }) async { - try { - List results = []; - - if (query.isrc.isNotEmpty) { - final res = - await dabMusicApiClient.music.getSearch(q: query.isrc, limit: 1); - results = res.tracks ?? []; - } - - if (results.isEmpty) { - final res = await dabMusicApiClient.music.getSearch( - q: SourcedTrack.getSearchTerm(query), - limit: 5, - ); - results = res.tracks ?? []; - } - - if (results.isEmpty) { - return []; - } - - final matchedResults = - results.mapIndexed((index, d) => toSiblingType(ref, index, d)); - - return Future.wait(matchedResults); - } catch (e, stackTrace) { - AppLogger.reportError(e, stackTrace); - rethrow; - } - } - - @override - Future copyWithSibling() async { - if (siblings.isNotEmpty) { - return this; - } - final fetchedSiblings = await fetchSiblings(ref: ref, query: query); - - return DABMusicSourcedTrack( - ref: ref, - siblings: fetchedSiblings - .where((s) => s.info.id != info.id) - .map((s) => s.info) - .toList(), - source: source, - info: info, - query: query, - sources: sources, - ); - } - - @override - Future swapWithSibling(TrackSourceInfo sibling) async { - if (sibling.id == this.info.id) { - return null; - } - - // a sibling source that was fetched from the search results - final isStepSibling = siblings.none((s) => s.id == sibling.id); - - final newSourceInfo = isStepSibling - ? sibling - : siblings.firstWhere((s) => s.id == sibling.id); - final newSiblings = siblings.where((s) => s.id != sibling.id).toList() - ..insert(0, this.info); - - final source = await fetchSources( - sibling.id, - ref.read(userPreferencesProvider).audioQuality, - const AudioQuality( - isHiRes: true, - maximumBitDepth: 16, - maximumSamplingRate: 44.1, - ), - ); - - final database = ref.read(databaseProvider); - - await database.into(database.sourceMatchTable).insert( - SourceMatchTableCompanion.insert( - trackId: query.id, - sourceId: jsonEncode({ - "info": newSourceInfo.toJson(), - "sources": source.map((s) => s.toJson()).toList(), - }), - sourceType: const Value(SourceType.dabMusic), - // Because we're sorting by createdAt in the query - // we have to update it to indicate priority - createdAt: Value(DateTime.now()), - ), - mode: InsertMode.replace, - ); - - return DABMusicSourcedTrack( - ref: ref, - siblings: newSiblings, - sources: source, - info: newSourceInfo, - query: query, - source: AudioSource.dabMusic, - ); - } - - @override - Future refreshStream() async { - // There's no need to refresh the stream for DABMusicSourcedTrack - return this; - } -} diff --git a/lib/services/sourced_track/sources/invidious.dart b/lib/services/sourced_track/sources/invidious.dart deleted file mode 100644 index c5421355..00000000 --- a/lib/services/sourced_track/sources/invidious.dart +++ /dev/null @@ -1,263 +0,0 @@ -import 'package:collection/collection.dart'; -import 'package:drift/drift.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:spotube/models/database/database.dart'; -import 'package:spotube/models/playback/track_sources.dart'; -import 'package:spotube/provider/database/database.dart'; -import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; -import 'package:spotube/services/sourced_track/exceptions.dart'; -import 'package:spotube/services/sourced_track/models/video_info.dart'; -import 'package:spotube/services/sourced_track/sourced_track.dart'; -import 'package:invidious/invidious.dart'; -import 'package:spotube/services/sourced_track/sources/youtube.dart'; -import 'package:spotube/utils/service_utils.dart'; - -final invidiousProvider = Provider( - (ref) { - final invidiousInstance = ref.watch( - userPreferencesProvider.select((s) => s.invidiousInstance), - ); - return InvidiousClient(server: invidiousInstance); - }, -); - -class InvidiousSourcedTrack extends SourcedTrack { - InvidiousSourcedTrack({ - required super.ref, - required super.source, - required super.siblings, - required super.info, - required super.query, - required super.sources, - }); - - static Future fetchFromTrack({ - required TrackSourceQuery query, - required Ref ref, - }) async { - final audioSource = ref.read(userPreferencesProvider).audioSource; - final database = ref.read(databaseProvider); - final cachedSource = await (database.select(database.sourceMatchTable) - ..where((s) => s.trackId.equals(query.id)) - ..limit(1) - ..orderBy([ - (s) => - OrderingTerm(expression: s.createdAt, mode: OrderingMode.desc), - ])) - .getSingleOrNull(); - final invidiousClient = ref.read(invidiousProvider); - - if (cachedSource == null) { - final siblings = await fetchSiblings(ref: ref, query: query); - if (siblings.isEmpty) { - throw TrackNotFoundError(query); - } - - await database.into(database.sourceMatchTable).insert( - SourceMatchTableCompanion.insert( - trackId: query.id, - sourceId: siblings.first.info.id, - sourceType: const Value(SourceType.youtube), - ), - ); - - return InvidiousSourcedTrack( - ref: ref, - siblings: siblings.map((s) => s.info).skip(1).toList(), - sources: siblings.first.source as List, - info: siblings.first.info, - query: query, - source: audioSource, - ); - } else { - final manifest = - await invidiousClient.videos.get(cachedSource.sourceId, local: true); - - return InvidiousSourcedTrack( - ref: ref, - siblings: [], - sources: toSources(manifest), - info: TrackSourceInfo( - id: manifest.videoId, - artists: manifest.author, - pageUrl: "https://www.youtube.com/watch?v=${manifest.videoId}", - thumbnail: manifest.videoThumbnails.first.url, - title: manifest.title, - durationMs: Duration(seconds: manifest.lengthSeconds).inMilliseconds, - ), - query: query, - source: audioSource, - ); - } - } - - static List toSources(InvidiousVideoResponse manifest) { - return manifest.adaptiveFormats.map((stream) { - var isWebm = stream.type.contains("audio/webm"); - return TrackSource( - url: stream.url.toString(), - quality: switch (stream.qualityLabel) { - "high" => SourceQualities.high, - "medium" => SourceQualities.medium, - _ => SourceQualities.low, - }, - codec: isWebm ? SourceCodecs.weba : SourceCodecs.m4a, - bitrate: stream.bitrate, - qualityLabel: - "${isWebm ? "Opus" : "AAC"} • ${stream.bitrate.replaceAll("kbps", "")}kbps " - "• ${isWebm ? "weba" : "m4a"} • Stereo", - ); - }).toList(); - } - - static Future toSiblingType( - int index, - YoutubeVideoInfo item, - InvidiousClient invidiousClient, - ) async { - List? sourceMap; - if (index == 0) { - final manifest = await invidiousClient.videos.get(item.id, local: true); - sourceMap = toSources(manifest); - } - - final SiblingType sibling = ( - info: TrackSourceInfo( - id: item.id, - artists: item.channelName, - pageUrl: "https://www.youtube.com/watch?v=${item.id}", - thumbnail: item.thumbnailUrl, - title: item.title, - durationMs: item.duration.inMilliseconds, - ), - source: sourceMap, - ); - - return sibling; - } - - static Future> fetchSiblings({ - required TrackSourceQuery query, - required Ref ref, - }) async { - final invidiousClient = ref.read(invidiousProvider); - final preference = ref.read(userPreferencesProvider); - - final searchQuery = SourcedTrack.getSearchTerm(query); - - final searchResults = await invidiousClient.search.list( - searchQuery, - type: InvidiousSearchType.video, - ); - - if (ServiceUtils.onlyContainsEnglish(searchQuery)) { - return await Future.wait( - searchResults - .whereType() - .map( - (result) => YoutubeVideoInfo.fromSearchResponse( - result, - preference.searchMode, - ), - ) - .mapIndexed((i, r) => toSiblingType(i, r, invidiousClient)), - ); - } - - final rankedSiblings = YoutubeSourcedTrack.rankResults( - searchResults - .whereType() - .map( - (result) => YoutubeVideoInfo.fromSearchResponse( - result, - preference.searchMode, - ), - ) - .toList(), - query, - ); - - return await Future.wait( - rankedSiblings.mapIndexed((i, r) => toSiblingType(i, r, invidiousClient)), - ); - } - - @override - Future copyWithSibling() async { - if (siblings.isNotEmpty) { - return this; - } - final fetchedSiblings = await fetchSiblings(ref: ref, query: query); - - return InvidiousSourcedTrack( - ref: ref, - siblings: fetchedSiblings - .where((s) => s.info.id != info.id) - .map((s) => s.info) - .toList(), - source: source, - info: info, - query: query, - sources: sources, - ); - } - - @override - Future swapWithSibling(TrackSourceInfo sibling) async { - if (sibling.id == info.id) { - return null; - } - - // a sibling source that was fetched from the search results - final isStepSibling = siblings.none((s) => s.id == sibling.id); - - final newSourceInfo = isStepSibling - ? sibling - : siblings.firstWhere((s) => s.id == sibling.id); - final newSiblings = siblings.where((s) => s.id != sibling.id).toList() - ..insert(0, info); - - final pipedClient = ref.read(invidiousProvider); - - final manifest = - await pipedClient.videos.get(newSourceInfo.id, local: true); - - final database = ref.read(databaseProvider); - await database.into(database.sourceMatchTable).insert( - SourceMatchTableCompanion.insert( - trackId: query.id, - sourceId: newSourceInfo.id, - sourceType: const Value(SourceType.youtube), - // Because we're sorting by createdAt in the query - // we have to update it to indicate priority - createdAt: Value(DateTime.now()), - ), - mode: InsertMode.replace, - ); - - return InvidiousSourcedTrack( - ref: ref, - siblings: newSiblings, - sources: toSources(manifest), - info: newSourceInfo, - query: query, - source: source, - ); - } - - @override - Future refreshStream() async { - final manifest = - await ref.read(invidiousProvider).videos.get(info.id, local: true); - - return InvidiousSourcedTrack( - ref: ref, - siblings: siblings, - sources: toSources(manifest), - info: info, - query: query, - source: source, - ); - } -} diff --git a/lib/services/sourced_track/sources/jiosaavn.dart b/lib/services/sourced_track/sources/jiosaavn.dart deleted file mode 100644 index be78be25..00000000 --- a/lib/services/sourced_track/sources/jiosaavn.dart +++ /dev/null @@ -1,231 +0,0 @@ -import 'package:collection/collection.dart'; -import 'package:drift/drift.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:spotube/models/database/database.dart'; -import 'package:spotube/models/playback/track_sources.dart'; -import 'package:spotube/provider/database/database.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; -import 'package:spotube/services/sourced_track/exceptions.dart'; -import 'package:spotube/services/sourced_track/sourced_track.dart'; -import 'package:jiosaavn/jiosaavn.dart'; -import 'package:spotube/extensions/string.dart'; - -final jiosaavnClient = JioSaavnClient(); - -class JioSaavnSourcedTrack extends SourcedTrack { - JioSaavnSourcedTrack({ - required super.ref, - required super.source, - required super.siblings, - required super.info, - required super.query, - required super.sources, - }); - - static Future fetchFromTrack({ - required TrackSourceQuery query, - required Ref ref, - bool weakMatch = false, - }) async { - final database = ref.read(databaseProvider); - final cachedSource = await (database.select(database.sourceMatchTable) - ..where((s) => s.trackId.equals(query.id)) - ..limit(1) - ..orderBy([ - (s) => - OrderingTerm(expression: s.createdAt, mode: OrderingMode.desc), - ])) - .getSingleOrNull(); - - if (cachedSource == null || - cachedSource.sourceType != SourceType.jiosaavn) { - final siblings = - await fetchSiblings(ref: ref, query: query, weakMatch: weakMatch); - - if (siblings.isEmpty) { - throw TrackNotFoundError(query); - } - - await database.into(database.sourceMatchTable).insert( - SourceMatchTableCompanion.insert( - trackId: query.id, - sourceId: siblings.first.info.id, - sourceType: const Value(SourceType.jiosaavn), - ), - ); - - return JioSaavnSourcedTrack( - ref: ref, - siblings: siblings.map((s) => s.info).skip(1).toList(), - sources: siblings.first.source!, - info: siblings.first.info, - query: query, - source: AudioSource.jiosaavn, - ); - } - - final [item] = - await jiosaavnClient.songs.detailsById([cachedSource.sourceId]); - - final (:info, :source) = toSiblingType(item); - - return JioSaavnSourcedTrack( - ref: ref, - siblings: [], - sources: source!, - query: query, - info: info, - source: AudioSource.jiosaavn, - ); - } - - static SiblingType toSiblingType(SongResponse result) { - final SiblingType sibling = ( - info: TrackSourceInfo( - artists: [ - result.primaryArtists, - if (result.featuredArtists.isNotEmpty) ", ", - result.featuredArtists - ].join("").unescapeHtml(), - durationMs: - Duration(seconds: int.parse(result.duration)).inMilliseconds, - id: result.id, - pageUrl: result.url, - thumbnail: result.image?.last.link ?? "", - title: result.name!.unescapeHtml(), - ), - source: result.downloadUrl!.map((link) { - return TrackSource( - url: link.link, - quality: link.quality == "320kbps" - ? SourceQualities.high - : link.quality == "160kbps" - ? SourceQualities.medium - : SourceQualities.low, - codec: SourceCodecs.m4a, - bitrate: link.quality, - qualityLabel: "AAC • ${link.quality} • MP4 • Stereo", - ); - }).toList() - ); - - return sibling; - } - - static Future> fetchSiblings({ - required TrackSourceQuery query, - required Ref ref, - bool weakMatch = false, - }) async { - final searchQuery = SourcedTrack.getSearchTerm(query); - - final SongSearchResponse(:results) = - await jiosaavnClient.search.songs(searchQuery, limit: 20); - - final trackArtistNames = query.artists; - - final matchedResults = results - .where( - (s) { - s.name?.unescapeHtml().contains(query.title) ?? false; - - final sameName = s.name?.unescapeHtml() == query.title; - final artistNames = [ - s.primaryArtists, - if (s.featuredArtists.isNotEmpty) ", ", - s.featuredArtists - ].join("").unescapeHtml(); - final sameArtists = artistNames.split(", ").any( - (artist) => trackArtistNames.any((ar) => artist == ar), - ); - if (weakMatch) { - final containsName = - s.name?.unescapeHtml().contains(query.title) ?? false; - final containsPrimaryArtist = s.primaryArtists - .unescapeHtml() - .contains(trackArtistNames.first); - - return containsName && containsPrimaryArtist; - } - - return sameName && sameArtists; - }, - ) - .map(toSiblingType) - .toList(); - - if (weakMatch && matchedResults.isEmpty) { - return results.map(toSiblingType).toList(); - } - - return matchedResults; - } - - @override - Future copyWithSibling() async { - if (siblings.isNotEmpty) { - return this; - } - final fetchedSiblings = await fetchSiblings(ref: ref, query: query); - - return JioSaavnSourcedTrack( - ref: ref, - siblings: fetchedSiblings - .where((s) => s.info.id != info.id) - .map((s) => s.info) - .toList(), - source: source, - info: info, - query: query, - sources: sources, - ); - } - - @override - Future swapWithSibling(TrackSourceInfo sibling) async { - if (sibling.id == this.info.id) { - return null; - } - - // a sibling source that was fetched from the search results - final isStepSibling = siblings.none((s) => s.id == sibling.id); - - final newSourceInfo = isStepSibling - ? sibling - : siblings.firstWhere((s) => s.id == sibling.id); - final newSiblings = siblings.where((s) => s.id != sibling.id).toList() - ..insert(0, this.info); - - final [item] = await jiosaavnClient.songs.detailsById([newSourceInfo.id]); - - final (:info, :source) = toSiblingType(item); - - final database = ref.read(databaseProvider); - await database.into(database.sourceMatchTable).insert( - SourceMatchTableCompanion.insert( - trackId: query.id, - sourceId: info.id, - sourceType: const Value(SourceType.jiosaavn), - // Because we're sorting by createdAt in the query - // we have to update it to indicate priority - createdAt: Value(DateTime.now()), - ), - mode: InsertMode.replace, - ); - - return JioSaavnSourcedTrack( - ref: ref, - siblings: newSiblings, - sources: source!, - info: newSourceInfo, - query: query, - source: AudioSource.jiosaavn, - ); - } - - @override - Future refreshStream() async { - // There's no need to refresh the stream for JioSaavnSourcedTrack - return this; - } -} diff --git a/lib/services/sourced_track/sources/piped.dart b/lib/services/sourced_track/sources/piped.dart deleted file mode 100644 index fca6c623..00000000 --- a/lib/services/sourced_track/sources/piped.dart +++ /dev/null @@ -1,292 +0,0 @@ -import 'package:collection/collection.dart'; -import 'package:drift/drift.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:piped_client/piped_client.dart'; -import 'package:spotube/models/database/database.dart'; -import 'package:spotube/models/playback/track_sources.dart'; -import 'package:spotube/provider/database/database.dart'; -import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; - -import 'package:spotube/services/sourced_track/enums.dart'; -import 'package:spotube/services/sourced_track/exceptions.dart'; -import 'package:spotube/services/sourced_track/models/video_info.dart'; -import 'package:spotube/services/sourced_track/sourced_track.dart'; -import 'package:spotube/services/sourced_track/sources/youtube.dart'; -import 'package:spotube/utils/service_utils.dart'; - -final pipedProvider = Provider( - (ref) { - final instance = - ref.watch(userPreferencesProvider.select((s) => s.pipedInstance)); - return PipedClient(instance: instance); - }, -); - -class PipedSourcedTrack extends SourcedTrack { - PipedSourcedTrack({ - required super.ref, - required super.source, - required super.siblings, - required super.info, - required super.query, - required super.sources, - }); - - static Future fetchFromTrack({ - required TrackSourceQuery query, - required Ref ref, - }) async { - final audioSource = ref.read(userPreferencesProvider).audioSource; - final database = ref.read(databaseProvider); - final cachedSource = await (database.select(database.sourceMatchTable) - ..where((s) => s.trackId.equals(query.id)) - ..limit(1) - ..orderBy([ - (s) => - OrderingTerm(expression: s.createdAt, mode: OrderingMode.desc), - ])) - .getSingleOrNull(); - final preferences = ref.read(userPreferencesProvider); - final pipedClient = ref.read(pipedProvider); - - if (cachedSource == null) { - final siblings = await fetchSiblings(ref: ref, query: query); - if (siblings.isEmpty) { - throw TrackNotFoundError(query); - } - - await database.into(database.sourceMatchTable).insert( - SourceMatchTableCompanion.insert( - trackId: query.id, - sourceId: siblings.first.info.id, - sourceType: Value( - preferences.searchMode == SearchMode.youtube - ? SourceType.youtube - : SourceType.youtubeMusic, - ), - ), - ); - - return PipedSourcedTrack( - ref: ref, - siblings: siblings.map((s) => s.info).skip(1).toList(), - source: audioSource, - info: siblings.first.info, - query: query, - sources: siblings.first.source!, - ); - } else { - final manifest = await pipedClient.streams(cachedSource.sourceId); - - return PipedSourcedTrack( - ref: ref, - siblings: [], - sources: toSources(manifest), - info: TrackSourceInfo( - id: manifest.id, - artists: manifest.uploader, - pageUrl: "https://www.youtube.com/watch?v=${manifest.id}", - thumbnail: manifest.thumbnailUrl, - title: manifest.title, - durationMs: manifest.duration.inMilliseconds, - ), - query: query, - source: audioSource, - ); - } - } - - static List toSources(PipedStreamResponse manifest) { - return manifest.audioStreams.map((audio) { - final isMp4 = audio.format == PipedAudioStreamFormat.m4a; - return TrackSource( - url: audio.url.toString(), - quality: switch (audio.quality) { - "high" => SourceQualities.high, - "medium" => SourceQualities.medium, - _ => SourceQualities.low, - }, - codec: isMp4 ? SourceCodecs.m4a : SourceCodecs.weba, - bitrate: audio.bitrate.toString(), - qualityLabel: - "${isMp4 ? "AAC" : "Opus"} • ${(audio.bitrate / 1000).floor()}kbps " - "• ${isMp4 ? "m4a" : "weba"} • Stereo", - ); - }).toList(); - } - - static Future toSiblingType( - int index, - YoutubeVideoInfo item, - PipedClient pipedClient, - ) async { - List? sources; - if (index == 0) { - final manifest = await pipedClient.streams(item.id); - sources = toSources(manifest); - } - - final SiblingType sibling = ( - info: TrackSourceInfo( - id: item.id, - artists: item.channelName, - pageUrl: "https://www.youtube.com/watch?v=${item.id}", - thumbnail: item.thumbnailUrl, - title: item.title, - durationMs: item.duration.inMilliseconds, - ), - source: sources, - ); - - return sibling; - } - - static Future> fetchSiblings({ - required TrackSourceQuery query, - required Ref ref, - }) async { - final pipedClient = ref.read(pipedProvider); - final preference = ref.read(userPreferencesProvider); - - final searchQuery = SourcedTrack.getSearchTerm(query); - - final PipedSearchResult(items: searchResults) = await pipedClient.search( - searchQuery, - preference.searchMode == SearchMode.youtube - ? PipedFilter.videos - : PipedFilter.musicSongs, - ); - - // when falling back to piped API make sure to use the YouTube mode - final isYouTubeMusic = preference.audioSource != AudioSource.piped - ? false - : preference.searchMode == SearchMode.youtubeMusic; - - if (isYouTubeMusic) { - final artists = query.artists; - - return await Future.wait( - searchResults - .map( - (result) => YoutubeVideoInfo.fromSearchItemStream( - result as PipedSearchItemStream, - preference.searchMode, - ), - ) - .sorted((a, b) => b.views.compareTo(a.views)) - .where( - (item) => artists.any( - (artist) => - artist.toLowerCase() == item.channelName.toLowerCase(), - ), - ) - .mapIndexed((i, r) => toSiblingType(i, r, pipedClient)), - ); - } - - if (ServiceUtils.onlyContainsEnglish(searchQuery)) { - return await Future.wait( - searchResults - .whereType() - .map( - (result) => YoutubeVideoInfo.fromSearchItemStream( - result, - preference.searchMode, - ), - ) - .mapIndexed((i, r) => toSiblingType(i, r, pipedClient)), - ); - } - - final rankedSiblings = YoutubeSourcedTrack.rankResults( - searchResults - .map( - (result) => YoutubeVideoInfo.fromSearchItemStream( - result as PipedSearchItemStream, - preference.searchMode, - ), - ) - .toList(), - query, - ); - - return await Future.wait( - rankedSiblings.mapIndexed((i, r) => toSiblingType(i, r, pipedClient)), - ); - } - - @override - Future copyWithSibling() async { - if (siblings.isNotEmpty) { - return this; - } - final fetchedSiblings = await fetchSiblings(ref: ref, query: query); - - return PipedSourcedTrack( - ref: ref, - siblings: fetchedSiblings - .where((s) => s.info.id != info.id) - .map((s) => s.info) - .toList(), - source: source, - info: info, - query: query, - sources: sources, - ); - } - - @override - Future swapWithSibling(TrackSourceInfo sibling) async { - if (sibling.id == info.id) { - return null; - } - - // a sibling source that was fetched from the search results - final isStepSibling = siblings.none((s) => s.id == sibling.id); - - final newSourceInfo = isStepSibling - ? sibling - : siblings.firstWhere((s) => s.id == sibling.id); - final newSiblings = siblings.where((s) => s.id != sibling.id).toList() - ..insert(0, info); - - final pipedClient = ref.read(pipedProvider); - - final manifest = await pipedClient.streams(newSourceInfo.id); - - final database = ref.read(databaseProvider); - await database.into(database.sourceMatchTable).insert( - SourceMatchTableCompanion.insert( - trackId: query.id, - sourceId: newSourceInfo.id, - sourceType: const Value(SourceType.youtube), - // Because we're sorting by createdAt in the query - // we have to update it to indicate priority - createdAt: Value(DateTime.now()), - ), - mode: InsertMode.replace, - ); - - return PipedSourcedTrack( - ref: ref, - siblings: newSiblings, - sources: toSources(manifest), - info: newSourceInfo, - query: query, - source: source, - ); - } - - @override - Future refreshStream() async { - final manifest = await ref.read(pipedProvider).streams(info.id); - return PipedSourcedTrack( - ref: ref, - siblings: siblings, - info: info, - source: source, - query: query, - sources: toSources(manifest), - ); - } -} diff --git a/lib/services/sourced_track/sources/youtube.dart b/lib/services/sourced_track/sources/youtube.dart deleted file mode 100644 index e3e9dd39..00000000 --- a/lib/services/sourced_track/sources/youtube.dart +++ /dev/null @@ -1,439 +0,0 @@ -import 'package:collection/collection.dart'; -import 'package:dio/dio.dart'; -import 'package:drift/drift.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:spotube/models/database/database.dart'; -import 'package:spotube/models/playback/track_sources.dart'; -import 'package:spotube/provider/database/database.dart'; -import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; -import 'package:spotube/provider/youtube_engine/youtube_engine.dart'; -import 'package:spotube/services/dio/dio.dart'; -import 'package:spotube/services/logger/logger.dart'; -import 'package:spotube/services/song_link/song_link.dart'; -import 'package:spotube/services/sourced_track/enums.dart'; -import 'package:spotube/services/sourced_track/exceptions.dart'; -import 'package:spotube/services/sourced_track/models/video_info.dart'; -import 'package:spotube/services/sourced_track/sourced_track.dart'; -import 'package:spotube/utils/service_utils.dart'; -import 'package:youtube_explode_dart/youtube_explode_dart.dart'; - -final officialMusicRegex = RegExp( - r"official\s(video|audio|music\svideo|lyric\svideo|visualizer)", - caseSensitive: false, -); - -class YoutubeSourcedTrack extends SourcedTrack { - YoutubeSourcedTrack({ - required super.source, - required super.siblings, - required super.info, - required super.query, - required super.sources, - required super.ref, - }); - - static Future fetchFromTrack({ - required TrackSourceQuery query, - required Ref ref, - }) async { - final audioSource = ref.read(userPreferencesProvider).audioSource; - final database = ref.read(databaseProvider); - final cachedSource = await (database.select(database.sourceMatchTable) - ..where((s) => s.trackId.equals(query.id)) - ..limit(1) - ..orderBy([ - (s) => - OrderingTerm(expression: s.createdAt, mode: OrderingMode.desc), - ])) - .get() - .then((s) => s.firstOrNull); - - if (cachedSource == null || cachedSource.sourceType != SourceType.youtube) { - final siblings = await fetchSiblings(ref: ref, query: query); - if (siblings.isEmpty) { - throw TrackNotFoundError(query); - } - - await database.into(database.sourceMatchTable).insert( - SourceMatchTableCompanion.insert( - trackId: query.id, - sourceId: siblings.first.info.id, - sourceType: const Value(SourceType.youtube), - ), - ); - - return YoutubeSourcedTrack( - ref: ref, - siblings: siblings.map((s) => s.info).skip(1).toList(), - info: siblings.first.info, - source: audioSource, - sources: siblings.first.source ?? [], - query: query, - ); - } - final (item, manifest) = await ref - .read(youtubeEngineProvider) - .getVideoWithStreamInfo(cachedSource.sourceId); - - final sourcedTrack = YoutubeSourcedTrack( - ref: ref, - siblings: [], - sources: toTrackSources(manifest), - info: TrackSourceInfo( - id: item.id.value, - artists: item.author, - pageUrl: item.url, - thumbnail: item.thumbnails.highResUrl, - title: item.title, - durationMs: item.duration?.inMilliseconds ?? 0, - ), - query: query, - source: audioSource, - ); - - AppLogger.log.i("${query.title}: ${sourcedTrack.url}"); - - return sourcedTrack; - } - - static List toTrackSources(StreamManifest manifest) { - return manifest.audioOnly.map((streamInfo) { - var isWebm = streamInfo.codec.mimeType == "audio/webm"; - return TrackSource( - url: streamInfo.url.toString(), - quality: switch (streamInfo.qualityLabel) { - "medium" => SourceQualities.medium, - "high" => SourceQualities.high, - "low" => SourceQualities.low, - _ => SourceQualities.high, - }, - codec: isWebm ? SourceCodecs.weba : SourceCodecs.m4a, - bitrate: streamInfo.bitrate.bitsPerSecond.toString(), - qualityLabel: - "${isWebm ? "Opus" : "AAC"} • ${(streamInfo.bitrate.kiloBitsPerSecond).floor()}kbps " - "• ${isWebm ? "weba" : "m4a"} • Stereo", - ); - }).toList(); - } - - static Future toSiblingType( - int index, - YoutubeVideoInfo item, - dynamic ref, - ) async { - assert(ref is WidgetRef || ref is Ref, "Invalid ref type"); - - List? sourceMap; - if (index == 0) { - final manifest = - await ref.read(youtubeEngineProvider).getStreamManifest(item.id); - sourceMap = toTrackSources(manifest); - } - - final SiblingType sibling = ( - info: TrackSourceInfo( - id: item.id, - artists: item.channelName, - pageUrl: "https://www.youtube.com/watch?v=${item.id}", - thumbnail: item.thumbnailUrl, - title: item.title, - durationMs: item.duration.inMilliseconds, - ), - source: sourceMap, - ); - - return sibling; - } - - static List rankResults( - List results, TrackSourceQuery track) { - return results - .sorted((a, b) => b.views.compareTo(a.views)) - .map((sibling) { - int score = 0; - - for (final artist in track.artists) { - final isSameChannelArtist = - sibling.channelName.toLowerCase() == artist.toLowerCase(); - final channelContainsArtist = sibling.channelName - .toLowerCase() - .contains(artist.toLowerCase()); - - if (isSameChannelArtist || channelContainsArtist) { - score += 1; - } - - final titleContainsArtist = - sibling.title.toLowerCase().contains(artist.toLowerCase()); - - if (titleContainsArtist) { - score += 1; - } - } - - final titleContainsTrackName = - sibling.title.toLowerCase().contains(track.title.toLowerCase()); - - final hasOfficialFlag = - officialMusicRegex.hasMatch(sibling.title.toLowerCase()); - - if (titleContainsTrackName) { - score += 3; - } - - if (hasOfficialFlag) { - score += 1; - } - - if (hasOfficialFlag && titleContainsTrackName) { - score += 2; - } - - return (sibling: sibling, score: score); - }) - .sorted((a, b) => b.score.compareTo(a.score)) - .map((e) => e.sibling) - .toList(); - } - - static Future> fetchFromIsrc({ - required TrackSourceQuery track, - required Ref ref, - }) async { - final isrcResults = []; - final isrc = track.isrc; - if (isrc.isNotEmpty) { - final searchedVideos = - await ref.read(youtubeEngineProvider).searchVideos(isrc.toString()); - if (searchedVideos.isNotEmpty) { - AppLogger.log - .d("${track.title} ISRC $isrc Total ${searchedVideos.length}"); - - final stringBuffer = StringBuffer(); - - final filteredMatches = searchedVideos - .map(YoutubeVideoInfo.fromVideo) - .map((YoutubeVideoInfo videoInfo) { - final ytWords = videoInfo.title - .toLowerCase() - .replaceAll(RegExp(r'[^\p{L}\p{N}\p{Z}]+', unicode: true), '') - .split(RegExp(r'\p{Z}+', unicode: true)) - .where((item) => item.isNotEmpty); - final spWords = track.title - .toLowerCase() - .replaceAll(RegExp(r'[^\p{L}\p{N}\p{Z}]+', unicode: true), '') - .split(RegExp(r'\p{Z}+', unicode: true)) - .where((item) => item.isNotEmpty); - // Single word and duration match with 3 second tolerance - if (ytWords.any((word) => spWords.contains(word)) && - (videoInfo.duration - - Duration(milliseconds: track.durationMs)) - .abs() - .inMilliseconds <= - 3000) { - stringBuffer.writeln( - "ISRC MATCH: ${videoInfo.id} ${videoInfo.title} by ${videoInfo.channelName} ${videoInfo.duration}", - ); - - return videoInfo; - } - return null; - }) - .nonNulls - .toList(); - - AppLogger.log.d(stringBuffer.toString()); - - isrcResults.addAll(filteredMatches); - } - } - return isrcResults; - } - - static Future> fetchSiblings({ - required TrackSourceQuery query, - required Ref ref, - }) async { - final videoResults = []; - - if (query is! SourcedTrack) { - final isrcResults = await fetchFromIsrc( - track: query, - ref: ref, - ); - - videoResults.addAll(isrcResults); - - if (isrcResults.isEmpty) { - AppLogger.log.w("No ISRC results found, falling back to SongLink"); - - final links = await SongLinkService.links(query.id); - - final stringBuffer = links.fold( - StringBuffer(), - (previousValue, element) { - previousValue.writeln( - "SongLink ${query.id} ${element.platform} ${element.url}"); - return previousValue; - }, - ); - - AppLogger.log.d(stringBuffer.toString()); - - final ytLink = links.firstWhereOrNull( - (link) => link.platform == "youtube", - ); - if (ytLink?.url != null) { - try { - videoResults.add( - YoutubeVideoInfo.fromVideo(await ref - .read(youtubeEngineProvider) - .getVideo(Uri.parse(ytLink!.url!).queryParameters["v"]!)), - ); - } on VideoUnplayableException catch (e, stack) { - // Ignore this error and continue with the search - AppLogger.reportError(e, stack); - } - } else { - AppLogger.log.w("No YouTube link found in SongLink results"); - } - } - } - - final searchQuery = SourcedTrack.getSearchTerm(query); - - final searchResults = - await ref.read(youtubeEngineProvider).searchVideos(searchQuery); - - if (ServiceUtils.onlyContainsEnglish(searchQuery)) { - videoResults - .addAll(searchResults.map(YoutubeVideoInfo.fromVideo).toList()); - } else { - videoResults.addAll(rankResults( - searchResults.map(YoutubeVideoInfo.fromVideo).toList(), - query, - )); - } - - final seenIds = {}; - int index = 0; - return await Future.wait( - videoResults.map((videoResult) async { - // Deduplicate results - if (!seenIds.contains(videoResult.id)) { - seenIds.add(videoResult.id); - return await toSiblingType(index++, videoResult, ref); - } - return null; - }), - ).then((s) => s.whereType().toList()); - } - - @override - Future swapWithSibling(TrackSourceInfo sibling) async { - if (sibling.id == info.id) { - return null; - } - - // a sibling source that was fetched from the search results - final isStepSibling = siblings.none((s) => s.id == sibling.id); - - final newSourceInfo = isStepSibling - ? sibling - : siblings.firstWhere((s) => s.id == sibling.id); - - final newSiblings = siblings.where((s) => s.id != sibling.id).toList() - ..insert(0, info); - - final manifest = await ref - .read(youtubeEngineProvider) - .getStreamManifest(newSourceInfo.id); - - final database = ref.read(databaseProvider); - - await database.into(database.sourceMatchTable).insert( - SourceMatchTableCompanion.insert( - trackId: query.id, - sourceId: newSourceInfo.id, - sourceType: const Value(SourceType.youtube), - // Because we're sorting by createdAt in the query - // we have to update it to indicate priority - createdAt: Value(DateTime.now()), - ), - mode: InsertMode.replace, - ); - - return YoutubeSourcedTrack( - ref: ref, - source: source, - siblings: newSiblings, - sources: toTrackSources(manifest), - info: newSourceInfo, - query: query, - ); - } - - @override - Future copyWithSibling() async { - if (siblings.isNotEmpty) { - return this; - } - final fetchedSiblings = await fetchSiblings(ref: ref, query: query); - - return YoutubeSourcedTrack( - ref: ref, - siblings: fetchedSiblings - .where((s) => s.info.id != info.id) - .map((s) => s.info) - .toList(), - source: source, - sources: sources, - info: info, - query: query, - ); - } - - @override - Future refreshStream() async { - List validStreams = []; - - final stringBuffer = StringBuffer(); - for (final source in sources) { - final res = await globalDio.head( - source.url, - options: - Options(validateStatus: (status) => status != null && status < 500), - ); - - stringBuffer.writeln( - "[${query.id}] ${res.statusCode} ${source.quality} ${source.codec} ${source.bitrate}", - ); - - if (res.statusCode! < 400) { - validStreams.add(source); - } - } - - AppLogger.log.d(stringBuffer.toString()); - - if (validStreams.isEmpty) { - final manifest = - await ref.read(youtubeEngineProvider).getStreamManifest(info.id); - - validStreams = toTrackSources(manifest); - } - - final sourcedTrack = YoutubeSourcedTrack( - ref: ref, - siblings: siblings, - source: source, - sources: validStreams, - info: info, - query: query, - ); - - AppLogger.log.i("Refreshing ${query.title}: ${sourcedTrack.url}"); - - return sourcedTrack; - } -} diff --git a/lib/services/youtube_engine/newpipe_engine.dart b/lib/services/youtube_engine/newpipe_engine.dart index ae451e22..d6445a19 100644 --- a/lib/services/youtube_engine/newpipe_engine.dart +++ b/lib/services/youtube_engine/newpipe_engine.dart @@ -6,7 +6,7 @@ import 'package:youtube_explode_dart/youtube_explode_dart.dart'; import 'package:http_parser/http_parser.dart'; class NewPipeEngine implements YouTubeEngine { - static bool get isAvailableForPlatform => kIsAndroid; + static bool get isAvailableForPlatform => kIsAndroid || kIsDesktop; AudioOnlyStreamInfo _parseAudioStream(AudioStream stream, String videoId) { return AudioOnlyStreamInfo( diff --git a/lib/services/youtube_engine/quickjs_solver.dart b/lib/services/youtube_engine/quickjs_solver.dart new file mode 100644 index 00000000..4e8bfafb --- /dev/null +++ b/lib/services/youtube_engine/quickjs_solver.dart @@ -0,0 +1,167 @@ +import 'dart:async'; +import 'dart:collection'; +import 'dart:convert'; +import 'package:flutter/foundation.dart'; +import 'package:http/http.dart' as http; +import 'package:youtube_explode_dart/js_challenge.dart'; +// ignore: implementation_imports +import 'package:youtube_explode_dart/src/reverse_engineering/challenges/ejs/ejs.dart'; +import 'package:jsf/jsf.dart'; + +/// [WIP] +class QuickJSEJSSolver extends BaseJSChallengeSolver { + final _playerCache = {}; + final _sigCache = <(String, String, JSChallengeType), String>{}; + final QuickJSRuntime qjs; + QuickJSEJSSolver._(this.qjs); + + static Future init() async { + final modules = await EJSBuilder.getJSModules(); + final deno = await QuickJSRuntime.init(modules); + return QuickJSEJSSolver._(deno); + } + + @override + Future solve( + String playerUrl, JSChallengeType type, String challenge) async { + final key = (playerUrl, challenge, type); + if (_sigCache.containsKey(key)) { + return _sigCache[key]!; + } + + var playerScript = _playerCache[playerUrl]; + if (playerScript == null) { + final resp = await http.get(Uri.parse(playerUrl)); + playerScript = _playerCache[playerUrl] = resp.body; + } + final jsCall = EJSBuilder.buildJSCall(playerScript, { + type: [challenge], + }); + + final result = await qjs.eval(jsCall); + // Trim the first and last characters (' delimiters of the JS string) + final data = json.decode(result.substring(1, result.length - 1)) + as Map; + + if (data['type'] != 'result') { + throw Exception('Unexpected response type: ${data['type']}'); + } + final response = data['responses'][0]; + if (response['type'] != 'result') { + throw Exception('Unexpected item response type: ${response['type']}'); + } + final decoded = response['data'][challenge]; + if (decoded == null) { + throw Exception('No data for challenge: $challenge'); + } + + _sigCache[key] = decoded; + + return decoded; + } + + @override + void dispose() { + qjs.dispose(); + } +} + +class _EvalRequest { + final String code; + final Completer completer; + + _EvalRequest(this.code, this.completer); +} + +class QuickJSRuntime { + final JsRuntime _runtime; + final StreamController _stdoutController = + StreamController.broadcast(); + + // Queue for incoming eval requests + final Queue<_EvalRequest> _evalQueue = Queue<_EvalRequest>(); + bool _isProcessing = false; // Flag to indicate if an eval is currently active + + QuickJSRuntime(this._runtime); + + /// Disposes the Deno process. + void dispose() { + _stdoutController.close(); + _runtime.dispose(); + } + + /// Sends JavaScript code to Deno for evaluation. + /// Assumes single-line input produces single-line output. + Future eval(String code) { + final completer = Completer(); + final request = _EvalRequest(code, completer); + _evalQueue.addLast(request); // Add request to the end of the queue + _processQueue(); // Attempt to process the queue + + return completer.future; + } + + // Processes the eval queue. + void _processQueue() { + if (_isProcessing || _evalQueue.isEmpty) { + return; // Already processing or nothing in queue + } + + _isProcessing = true; + final request = + _evalQueue.first; // Get the next request without removing it yet + + StreamSubscription? currentOutputSubscription; + Completer lineReceived = Completer(); + + currentOutputSubscription = _stdoutController.stream.listen((data) { + if (!lineReceived.isCompleted) { + // Assuming single line output per eval. + // This will capture the first full line or chunk received after sending the code. + request.completer.complete(data.trim()); + lineReceived.complete(); + currentOutputSubscription + ?.cancel(); // Cancel subscription for this request + _evalQueue.removeFirst(); // Remove the processed request + _isProcessing = false; // Mark as no longer processing + _processQueue(); // Attempt to process next item in queue + } + }, onError: (e) { + if (!request.completer.isCompleted) { + request.completer.completeError(e); + lineReceived.completeError(e); + currentOutputSubscription?.cancel(); + _evalQueue.removeFirst(); + _isProcessing = false; + _processQueue(); + } + }, onDone: () { + if (!request.completer.isCompleted) { + request.completer.completeError( + StateError('Deno process closed while awaiting eval result.')); + lineReceived.completeError( + StateError('Deno process closed while awaiting eval result.')); + currentOutputSubscription?.cancel(); + _evalQueue.removeFirst(); + _isProcessing = false; + _processQueue(); + } + }); + + debugPrint("[QuickJS Solver] Evaluate ${request.code}"); + final result = _runtime.eval(request.code); + debugPrint("[QuickJS Solver] Evaluation Result $result"); + _stdoutController.add(result); + } + + static Future init(String initCode) async { + debugPrint("[QuickJS Solver] Initializing"); + debugPrint("[QuickJS Solver] script $initCode"); + + final runtime = JsRuntime(); + + runtime.execInitScript(initCode); + + return QuickJSRuntime(runtime); + } +} diff --git a/lib/services/youtube_engine/youtube_explode_engine.dart b/lib/services/youtube_engine/youtube_explode_engine.dart index fa58314c..f8587ca6 100644 --- a/lib/services/youtube_engine/youtube_explode_engine.dart +++ b/lib/services/youtube_engine/youtube_explode_engine.dart @@ -2,6 +2,7 @@ import 'dart:isolate'; import 'package:flutter/foundation.dart'; import 'package:spotube/services/youtube_engine/youtube_engine.dart'; +// import 'package:youtube_explode_dart/solvers.dart'; import 'package:youtube_explode_dart/youtube_explode_dart.dart'; import 'dart:async'; @@ -55,8 +56,9 @@ class IsolatedYoutubeExplode { } } - static void _isolateEntry(SendPort mainSendPort) { + static Future _isolateEntry(SendPort mainSendPort) async { final receivePort = ReceivePort(); + // final solver = await DenoEJSSolver.init(); final youtubeExplode = YoutubeExplode(); final stopWatch = kDebugMode ? Stopwatch() : null; @@ -162,8 +164,8 @@ class YouTubeExplodeEngine implements YouTubeEngine { requireWatchPage: false, ytClients: [ YoutubeApiClient.ios, - YoutubeApiClient.android, YoutubeApiClient.androidVr, + YoutubeApiClient.android, ], ); diff --git a/lib/utils/service_utils.dart b/lib/utils/service_utils.dart index 81c4bfe4..738e4033 100644 --- a/lib/utils/service_utils.dart +++ b/lib/utils/service_utils.dart @@ -10,11 +10,9 @@ import 'package:spotube/models/metadata/metadata.dart'; import 'package:spotube/pages/library/user_local_tracks/user_local_tracks.dart'; import 'package:spotube/modules/root/update_dialog.dart'; -import 'package:spotube/models/lyrics.dart'; import 'package:spotube/provider/database/database.dart'; import 'package:spotube/services/dio/dio.dart'; import 'package:spotube/services/logger/logger.dart'; -import 'package:spotube/services/sourced_track/sourced_track.dart'; import 'package:spotube/utils/primitive_utils.dart'; import 'package:collection/collection.dart'; @@ -189,95 +187,6 @@ abstract class ServiceUtils { return lyrics; } - @Deprecated("In favor spotify lyrics api, this isn't needed anymore") - static const baseUri = "https://www.rentanadviser.com/subtitles"; - - @Deprecated("In favor spotify lyrics api, this isn't needed anymore") - static Future getTimedLyrics(SourcedTrack track) async { - final artistNames = track.query.artists; - final query = getTitle( - track.query.title, - artists: artistNames, - ); - - final searchUri = Uri.parse("$baseUri/subtitles4songs.aspx").replace( - queryParameters: {"q": query}, - ); - - final res = await globalDio.getUri( - searchUri, - options: Options(responseType: ResponseType.plain), - ); - final document = parser.parse(res.data); - final results = - document.querySelectorAll("#tablecontainer table tbody tr td a"); - - final rateSortedResults = results.map((result) { - final title = result.text.trim().toLowerCase(); - int points = 0; - final hasAllArtists = track.query.artists - .every((artist) => title.contains(artist.toLowerCase())); - final hasTrackName = title.contains(track.query.title.toLowerCase()); - final isNotLive = !PrimitiveUtils.containsTextInBracket(title, "live"); - final exactYtMatch = title == track.info.title.toLowerCase(); - if (exactYtMatch) points = 7; - for (final criteria in [hasTrackName, hasAllArtists, isNotLive]) { - if (criteria) points++; - } - return {"result": result, "points": points}; - }).sorted((a, b) => (b["points"] as int).compareTo(a["points"] as int)); - - // not result was found at all - if (rateSortedResults.first["points"] == 0) { - return Future.error("Subtitle lookup failed", StackTrace.current); - } - - final topResult = rateSortedResults.first["result"] as Element; - final subtitleUri = - Uri.parse("$baseUri/${topResult.attributes["href"]}&type=lrc"); - - final lrcDocument = parser.parse((await globalDio.getUri( - subtitleUri, - options: Options(responseType: ResponseType.plain), - )) - .data); - final lrcList = lrcDocument - .querySelector("#ctl00_ContentPlaceHolder1_lbllyrics") - ?.innerHtml - .replaceAll(RegExp(r'

.*

'), "") - .split("
") - .map((e) { - e = e.trim(); - final regexp = RegExp(r'\[.*\]'); - final timeStr = regexp - .firstMatch(e) - ?.group(0) - ?.replaceAll(RegExp(r'\[|\]'), "") - .trim() - .split(":"); - final minuteSeconds = timeStr?.last.split("."); - - return LyricSlice( - time: Duration( - minutes: int.parse(timeStr?.first ?? "0"), - seconds: int.parse(minuteSeconds?.first ?? "0"), - milliseconds: int.parse(minuteSeconds?.last ?? "0"), - ), - text: e.split(regexp).last); - }).toList() ?? - []; - - final subtitle = SubtitleSimple( - name: topResult.text.trim(), - uri: subtitleUri, - lyrics: lrcList, - rating: rateSortedResults.first["points"] as int, - provider: "Rent An Adviser", - ); - - return subtitle; - } - static DateTime parseSpotifyAlbumDate(SpotubeFullAlbumObject? album) { if (album == null) { return DateTime.parse("1975-01-01"); diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 8a9a2e19..8f5a71fe 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -28,6 +29,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); file_selector_plugin_register_with_registrar(file_selector_linux_registrar); + g_autoptr(FlPluginRegistrar) flutter_new_pipe_extractor_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterNewPipeExtractorPlugin"); + flutter_new_pipe_extractor_plugin_register_with_registrar(flutter_new_pipe_extractor_registrar); g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 4e2c2fb3..e174b0ef 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -5,6 +5,7 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_webview_window file_selector_linux + flutter_new_pipe_extractor flutter_secure_storage_linux flutter_timezone gtk @@ -21,6 +22,7 @@ list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST flutter_discord_rpc + jsf metadata_god ) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 3f11a9c7..2931c1b4 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -15,6 +15,7 @@ import device_info_plus import file_picker import file_selector_macos import flutter_inappwebview_macos +import flutter_new_pipe_extractor import flutter_secure_storage_macos import flutter_timezone import local_notifier @@ -42,6 +43,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) + FlutterNewPipeExtractorPlugin.register(with: registry.registrar(forPlugin: "FlutterNewPipeExtractorPlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FlutterTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterTimezonePlugin")) LocalNotifierPlugin.register(with: registry.registrar(forPlugin: "LocalNotifierPlugin")) diff --git a/pubspec.yaml b/pubspec.yaml index 3cc1eb05..9b84196b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,10 +24,6 @@ dependencies: bonsoir: ^5.1.10 cached_network_image: ^3.3.1 connectivity_plus: ^6.1.2 - dab_music_api: - git: - url: https://github.com/KRTirtho/dab_music_api.git - ref: main desktop_webview_window: git: path: packages/desktop_webview_window @@ -81,8 +77,6 @@ dependencies: http: ^1.2.1 image_picker: ^1.1.0 intl: any - invidious: ^0.1.2 - jiosaavn: ^0.1.1 json_annotation: ^4.8.1 local_notifier: ^0.1.6 logger: ^2.0.2 @@ -104,7 +98,6 @@ dependencies: path: ^1.9.0 path_provider: ^2.1.3 permission_handler: ^11.3.1 - piped_client: ^0.1.2 riverpod: ^2.5.1 scrobblenaut: git: @@ -138,7 +131,7 @@ dependencies: wikipedia_api: ^0.1.0 win32_registry: ^1.1.5 window_manager: ^0.4.3 - youtube_explode_dart: ^2.5.1 + youtube_explode_dart: ^3.0.0 yt_dlp_dart: git: url: https://github.com/KRTirtho/yt_dlp_dart.git @@ -168,6 +161,7 @@ dependencies: flutter_markdown_plus: ^1.0.3 pub_semver: ^2.2.0 change_case: ^1.1.0 + jsf: ^0.6.1 dev_dependencies: build_runner: ^2.4.13 @@ -184,7 +178,6 @@ dev_dependencies: process_run: ^0.14.2 pubspec_parse: ^1.3.0 pub_api_client: ^3.0.0 - xml: ^6.5.0 io: ^1.0.4 drift_dev: ^2.21.0 auto_route_generator: ^9.0.0 @@ -235,6 +228,8 @@ flutter: - assets/branding/spotube-logo.png - assets/branding/spotube-logo-light.png - assets/branding/spotube-logo.ico + - assets/plugins/spotube-plugin-musicbrainz-listenbrainz/plugin.smplug + - assets/plugins/spotube-plugin-youtube-audio/plugin.smplug - LICENSE - packages/flutter_undraw/assets/undraw/access_denied.svg - packages/flutter_undraw/assets/undraw/fixing_bugs.svg diff --git a/test/drift/app_db/generated/schema.dart b/test/drift/app_db/generated/schema.dart index dfd3edf3..76573e49 100644 --- a/test/drift/app_db/generated/schema.dart +++ b/test/drift/app_db/generated/schema.dart @@ -1,41 +1,47 @@ +// dart format width=80 // GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint -//@dart=2.12 import 'package:drift/drift.dart'; import 'package:drift/internal/migrations.dart'; -import 'schema_v5.dart' as v5; -import 'schema_v4.dart' as v4; -import 'schema_v8.dart' as v8; -import 'schema_v3.dart' as v3; -import 'schema_v2.dart' as v2; import 'schema_v1.dart' as v1; -import 'schema_v7.dart' as v7; +import 'schema_v2.dart' as v2; +import 'schema_v3.dart' as v3; +import 'schema_v4.dart' as v4; +import 'schema_v5.dart' as v5; import 'schema_v6.dart' as v6; +import 'schema_v7.dart' as v7; +import 'schema_v8.dart' as v8; +import 'schema_v9.dart' as v9; +import 'schema_v10.dart' as v10; class GeneratedHelper implements SchemaInstantiationHelper { @override GeneratedDatabase databaseForVersion(QueryExecutor db, int version) { switch (version) { - case 5: - return v5.DatabaseAtV5(db); - case 4: - return v4.DatabaseAtV4(db); - case 8: - return v8.DatabaseAtV8(db); - case 3: - return v3.DatabaseAtV3(db); - case 2: - return v2.DatabaseAtV2(db); case 1: return v1.DatabaseAtV1(db); - case 7: - return v7.DatabaseAtV7(db); + case 2: + return v2.DatabaseAtV2(db); + case 3: + return v3.DatabaseAtV3(db); + case 4: + return v4.DatabaseAtV4(db); + case 5: + return v5.DatabaseAtV5(db); case 6: return v6.DatabaseAtV6(db); + case 7: + return v7.DatabaseAtV7(db); + case 8: + return v8.DatabaseAtV8(db); + case 9: + return v9.DatabaseAtV9(db); + case 10: + return v10.DatabaseAtV10(db); default: throw MissingSchemaException(version, versions); } } - static const versions = const [1, 2, 3, 4, 5, 6, 7, 8]; + static const versions = const [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; } diff --git a/test/drift/app_db/generated/schema_v1.dart b/test/drift/app_db/generated/schema_v1.dart index 7a849d18..ca848561 100644 --- a/test/drift/app_db/generated/schema_v1.dart +++ b/test/drift/app_db/generated/schema_v1.dart @@ -1,6 +1,6 @@ +// dart format width=80 // GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint -//@dart=2.12 import 'package:drift/drift.dart'; class AuthenticationTable extends Table diff --git a/test/drift/app_db/generated/schema_v10.dart b/test/drift/app_db/generated/schema_v10.dart new file mode 100644 index 00000000..2811ad02 --- /dev/null +++ b/test/drift/app_db/generated/schema_v10.dart @@ -0,0 +1,3407 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class AuthenticationTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + AuthenticationTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn cookie = GeneratedColumn( + 'cookie', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn accessToken = GeneratedColumn( + 'access_token', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn expiration = GeneratedColumn( + 'expiration', aliasedName, false, + type: DriftSqlType.dateTime, requiredDuringInsert: true); + @override + List get $columns => [id, cookie, accessToken, expiration]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'authentication_table'; + @override + Set get $primaryKey => {id}; + @override + AuthenticationTableData map(Map data, + {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return AuthenticationTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + cookie: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}cookie'])!, + accessToken: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}access_token'])!, + expiration: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}expiration'])!, + ); + } + + @override + AuthenticationTable createAlias(String alias) { + return AuthenticationTable(attachedDatabase, alias); + } +} + +class AuthenticationTableData extends DataClass + implements Insertable { + final int id; + final String cookie; + final String accessToken; + final DateTime expiration; + const AuthenticationTableData( + {required this.id, + required this.cookie, + required this.accessToken, + required this.expiration}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['cookie'] = Variable(cookie); + map['access_token'] = Variable(accessToken); + map['expiration'] = Variable(expiration); + return map; + } + + AuthenticationTableCompanion toCompanion(bool nullToAbsent) { + return AuthenticationTableCompanion( + id: Value(id), + cookie: Value(cookie), + accessToken: Value(accessToken), + expiration: Value(expiration), + ); + } + + factory AuthenticationTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return AuthenticationTableData( + id: serializer.fromJson(json['id']), + cookie: serializer.fromJson(json['cookie']), + accessToken: serializer.fromJson(json['accessToken']), + expiration: serializer.fromJson(json['expiration']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'cookie': serializer.toJson(cookie), + 'accessToken': serializer.toJson(accessToken), + 'expiration': serializer.toJson(expiration), + }; + } + + AuthenticationTableData copyWith( + {int? id, + String? cookie, + String? accessToken, + DateTime? expiration}) => + AuthenticationTableData( + id: id ?? this.id, + cookie: cookie ?? this.cookie, + accessToken: accessToken ?? this.accessToken, + expiration: expiration ?? this.expiration, + ); + AuthenticationTableData copyWithCompanion(AuthenticationTableCompanion data) { + return AuthenticationTableData( + id: data.id.present ? data.id.value : this.id, + cookie: data.cookie.present ? data.cookie.value : this.cookie, + accessToken: + data.accessToken.present ? data.accessToken.value : this.accessToken, + expiration: + data.expiration.present ? data.expiration.value : this.expiration, + ); + } + + @override + String toString() { + return (StringBuffer('AuthenticationTableData(') + ..write('id: $id, ') + ..write('cookie: $cookie, ') + ..write('accessToken: $accessToken, ') + ..write('expiration: $expiration') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, cookie, accessToken, expiration); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is AuthenticationTableData && + other.id == this.id && + other.cookie == this.cookie && + other.accessToken == this.accessToken && + other.expiration == this.expiration); +} + +class AuthenticationTableCompanion + extends UpdateCompanion { + final Value id; + final Value cookie; + final Value accessToken; + final Value expiration; + const AuthenticationTableCompanion({ + this.id = const Value.absent(), + this.cookie = const Value.absent(), + this.accessToken = const Value.absent(), + this.expiration = const Value.absent(), + }); + AuthenticationTableCompanion.insert({ + this.id = const Value.absent(), + required String cookie, + required String accessToken, + required DateTime expiration, + }) : cookie = Value(cookie), + accessToken = Value(accessToken), + expiration = Value(expiration); + static Insertable custom({ + Expression? id, + Expression? cookie, + Expression? accessToken, + Expression? expiration, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (cookie != null) 'cookie': cookie, + if (accessToken != null) 'access_token': accessToken, + if (expiration != null) 'expiration': expiration, + }); + } + + AuthenticationTableCompanion copyWith( + {Value? id, + Value? cookie, + Value? accessToken, + Value? expiration}) { + return AuthenticationTableCompanion( + id: id ?? this.id, + cookie: cookie ?? this.cookie, + accessToken: accessToken ?? this.accessToken, + expiration: expiration ?? this.expiration, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (cookie.present) { + map['cookie'] = Variable(cookie.value); + } + if (accessToken.present) { + map['access_token'] = Variable(accessToken.value); + } + if (expiration.present) { + map['expiration'] = Variable(expiration.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('AuthenticationTableCompanion(') + ..write('id: $id, ') + ..write('cookie: $cookie, ') + ..write('accessToken: $accessToken, ') + ..write('expiration: $expiration') + ..write(')')) + .toString(); + } +} + +class BlacklistTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + BlacklistTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn name = GeneratedColumn( + 'name', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn elementType = GeneratedColumn( + 'element_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn elementId = GeneratedColumn( + 'element_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + @override + List get $columns => [id, name, elementType, elementId]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'blacklist_table'; + @override + Set get $primaryKey => {id}; + @override + BlacklistTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return BlacklistTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, + elementType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}element_type'])!, + elementId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}element_id'])!, + ); + } + + @override + BlacklistTable createAlias(String alias) { + return BlacklistTable(attachedDatabase, alias); + } +} + +class BlacklistTableData extends DataClass + implements Insertable { + final int id; + final String name; + final String elementType; + final String elementId; + const BlacklistTableData( + {required this.id, + required this.name, + required this.elementType, + required this.elementId}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + map['element_type'] = Variable(elementType); + map['element_id'] = Variable(elementId); + return map; + } + + BlacklistTableCompanion toCompanion(bool nullToAbsent) { + return BlacklistTableCompanion( + id: Value(id), + name: Value(name), + elementType: Value(elementType), + elementId: Value(elementId), + ); + } + + factory BlacklistTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return BlacklistTableData( + id: serializer.fromJson(json['id']), + name: serializer.fromJson(json['name']), + elementType: serializer.fromJson(json['elementType']), + elementId: serializer.fromJson(json['elementId']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'name': serializer.toJson(name), + 'elementType': serializer.toJson(elementType), + 'elementId': serializer.toJson(elementId), + }; + } + + BlacklistTableData copyWith( + {int? id, String? name, String? elementType, String? elementId}) => + BlacklistTableData( + id: id ?? this.id, + name: name ?? this.name, + elementType: elementType ?? this.elementType, + elementId: elementId ?? this.elementId, + ); + BlacklistTableData copyWithCompanion(BlacklistTableCompanion data) { + return BlacklistTableData( + id: data.id.present ? data.id.value : this.id, + name: data.name.present ? data.name.value : this.name, + elementType: + data.elementType.present ? data.elementType.value : this.elementType, + elementId: data.elementId.present ? data.elementId.value : this.elementId, + ); + } + + @override + String toString() { + return (StringBuffer('BlacklistTableData(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('elementType: $elementType, ') + ..write('elementId: $elementId') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, name, elementType, elementId); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is BlacklistTableData && + other.id == this.id && + other.name == this.name && + other.elementType == this.elementType && + other.elementId == this.elementId); +} + +class BlacklistTableCompanion extends UpdateCompanion { + final Value id; + final Value name; + final Value elementType; + final Value elementId; + const BlacklistTableCompanion({ + this.id = const Value.absent(), + this.name = const Value.absent(), + this.elementType = const Value.absent(), + this.elementId = const Value.absent(), + }); + BlacklistTableCompanion.insert({ + this.id = const Value.absent(), + required String name, + required String elementType, + required String elementId, + }) : name = Value(name), + elementType = Value(elementType), + elementId = Value(elementId); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? elementType, + Expression? elementId, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (name != null) 'name': name, + if (elementType != null) 'element_type': elementType, + if (elementId != null) 'element_id': elementId, + }); + } + + BlacklistTableCompanion copyWith( + {Value? id, + Value? name, + Value? elementType, + Value? elementId}) { + return BlacklistTableCompanion( + id: id ?? this.id, + name: name ?? this.name, + elementType: elementType ?? this.elementType, + elementId: elementId ?? this.elementId, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (elementType.present) { + map['element_type'] = Variable(elementType.value); + } + if (elementId.present) { + map['element_id'] = Variable(elementId.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('BlacklistTableCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('elementType: $elementType, ') + ..write('elementId: $elementId') + ..write(')')) + .toString(); + } +} + +class PreferencesTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + PreferencesTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn albumColorSync = GeneratedColumn( + 'album_color_sync', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("album_color_sync" IN (0, 1))'), + defaultValue: const Constant(true)); + late final GeneratedColumn amoledDarkTheme = GeneratedColumn( + 'amoled_dark_theme', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("amoled_dark_theme" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn checkUpdate = GeneratedColumn( + 'check_update', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("check_update" IN (0, 1))'), + defaultValue: const Constant(true)); + late final GeneratedColumn normalizeAudio = GeneratedColumn( + 'normalize_audio', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("normalize_audio" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn showSystemTrayIcon = GeneratedColumn( + 'show_system_tray_icon', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("show_system_tray_icon" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn systemTitleBar = GeneratedColumn( + 'system_title_bar', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("system_title_bar" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn skipNonMusic = GeneratedColumn( + 'skip_non_music', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("skip_non_music" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn closeBehavior = GeneratedColumn( + 'close_behavior', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(CloseBehavior.close.name)); + late final GeneratedColumn accentColorScheme = + GeneratedColumn('accent_color_scheme', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("Slate:0xff64748b")); + late final GeneratedColumn layoutMode = GeneratedColumn( + 'layout_mode', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(LayoutMode.adaptive.name)); + late final GeneratedColumn locale = GeneratedColumn( + 'locale', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: + const Constant('{"languageCode":"system","countryCode":"system"}')); + late final GeneratedColumn market = GeneratedColumn( + 'market', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(Market.US.name)); + late final GeneratedColumn searchMode = GeneratedColumn( + 'search_mode', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(SearchMode.youtube.name)); + late final GeneratedColumn downloadLocation = GeneratedColumn( + 'download_location', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("")); + late final GeneratedColumn localLibraryLocation = + GeneratedColumn('local_library_location', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("")); + late final GeneratedColumn themeMode = GeneratedColumn( + 'theme_mode', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(ThemeMode.system.name)); + late final GeneratedColumn audioSourceId = GeneratedColumn( + 'audio_source_id', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn youtubeClientEngine = + GeneratedColumn('youtube_client_engine', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(YoutubeClientEngine.youtubeExplode.name)); + late final GeneratedColumn discordPresence = GeneratedColumn( + 'discord_presence', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("discord_presence" IN (0, 1))'), + defaultValue: const Constant(true)); + late final GeneratedColumn endlessPlayback = GeneratedColumn( + 'endless_playback', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("endless_playback" IN (0, 1))'), + defaultValue: const Constant(true)); + late final GeneratedColumn enableConnect = GeneratedColumn( + 'enable_connect', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("enable_connect" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn connectPort = GeneratedColumn( + 'connect_port', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(-1)); + late final GeneratedColumn cacheMusic = GeneratedColumn( + 'cache_music', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('CHECK ("cache_music" IN (0, 1))'), + defaultValue: const Constant(true)); + @override + List get $columns => [ + id, + albumColorSync, + amoledDarkTheme, + checkUpdate, + normalizeAudio, + showSystemTrayIcon, + systemTitleBar, + skipNonMusic, + closeBehavior, + accentColorScheme, + layoutMode, + locale, + market, + searchMode, + downloadLocation, + localLibraryLocation, + themeMode, + audioSourceId, + youtubeClientEngine, + discordPresence, + endlessPlayback, + enableConnect, + connectPort, + cacheMusic + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'preferences_table'; + @override + Set get $primaryKey => {id}; + @override + PreferencesTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return PreferencesTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + albumColorSync: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}album_color_sync'])!, + amoledDarkTheme: attachedDatabase.typeMapping.read( + DriftSqlType.bool, data['${effectivePrefix}amoled_dark_theme'])!, + checkUpdate: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}check_update'])!, + normalizeAudio: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}normalize_audio'])!, + showSystemTrayIcon: attachedDatabase.typeMapping.read( + DriftSqlType.bool, data['${effectivePrefix}show_system_tray_icon'])!, + systemTitleBar: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}system_title_bar'])!, + skipNonMusic: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}skip_non_music'])!, + closeBehavior: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}close_behavior'])!, + accentColorScheme: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}accent_color_scheme'])!, + layoutMode: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}layout_mode'])!, + locale: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}locale'])!, + market: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}market'])!, + searchMode: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}search_mode'])!, + downloadLocation: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}download_location'])!, + localLibraryLocation: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}local_library_location'])!, + themeMode: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}theme_mode'])!, + audioSourceId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}audio_source_id']), + youtubeClientEngine: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}youtube_client_engine'])!, + discordPresence: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}discord_presence'])!, + endlessPlayback: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}endless_playback'])!, + enableConnect: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}enable_connect'])!, + connectPort: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}connect_port'])!, + cacheMusic: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}cache_music'])!, + ); + } + + @override + PreferencesTable createAlias(String alias) { + return PreferencesTable(attachedDatabase, alias); + } +} + +class PreferencesTableData extends DataClass + implements Insertable { + final int id; + final bool albumColorSync; + final bool amoledDarkTheme; + final bool checkUpdate; + final bool normalizeAudio; + final bool showSystemTrayIcon; + final bool systemTitleBar; + final bool skipNonMusic; + final String closeBehavior; + final String accentColorScheme; + final String layoutMode; + final String locale; + final String market; + final String searchMode; + final String downloadLocation; + final String localLibraryLocation; + final String themeMode; + final String? audioSourceId; + final String youtubeClientEngine; + final bool discordPresence; + final bool endlessPlayback; + final bool enableConnect; + final int connectPort; + final bool cacheMusic; + const PreferencesTableData( + {required this.id, + required this.albumColorSync, + required this.amoledDarkTheme, + required this.checkUpdate, + required this.normalizeAudio, + required this.showSystemTrayIcon, + required this.systemTitleBar, + required this.skipNonMusic, + required this.closeBehavior, + required this.accentColorScheme, + required this.layoutMode, + required this.locale, + required this.market, + required this.searchMode, + required this.downloadLocation, + required this.localLibraryLocation, + required this.themeMode, + this.audioSourceId, + required this.youtubeClientEngine, + required this.discordPresence, + required this.endlessPlayback, + required this.enableConnect, + required this.connectPort, + required this.cacheMusic}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['album_color_sync'] = Variable(albumColorSync); + map['amoled_dark_theme'] = Variable(amoledDarkTheme); + map['check_update'] = Variable(checkUpdate); + map['normalize_audio'] = Variable(normalizeAudio); + map['show_system_tray_icon'] = Variable(showSystemTrayIcon); + map['system_title_bar'] = Variable(systemTitleBar); + map['skip_non_music'] = Variable(skipNonMusic); + map['close_behavior'] = Variable(closeBehavior); + map['accent_color_scheme'] = Variable(accentColorScheme); + map['layout_mode'] = Variable(layoutMode); + map['locale'] = Variable(locale); + map['market'] = Variable(market); + map['search_mode'] = Variable(searchMode); + map['download_location'] = Variable(downloadLocation); + map['local_library_location'] = Variable(localLibraryLocation); + map['theme_mode'] = Variable(themeMode); + if (!nullToAbsent || audioSourceId != null) { + map['audio_source_id'] = Variable(audioSourceId); + } + map['youtube_client_engine'] = Variable(youtubeClientEngine); + map['discord_presence'] = Variable(discordPresence); + map['endless_playback'] = Variable(endlessPlayback); + map['enable_connect'] = Variable(enableConnect); + map['connect_port'] = Variable(connectPort); + map['cache_music'] = Variable(cacheMusic); + return map; + } + + PreferencesTableCompanion toCompanion(bool nullToAbsent) { + return PreferencesTableCompanion( + id: Value(id), + albumColorSync: Value(albumColorSync), + amoledDarkTheme: Value(amoledDarkTheme), + checkUpdate: Value(checkUpdate), + normalizeAudio: Value(normalizeAudio), + showSystemTrayIcon: Value(showSystemTrayIcon), + systemTitleBar: Value(systemTitleBar), + skipNonMusic: Value(skipNonMusic), + closeBehavior: Value(closeBehavior), + accentColorScheme: Value(accentColorScheme), + layoutMode: Value(layoutMode), + locale: Value(locale), + market: Value(market), + searchMode: Value(searchMode), + downloadLocation: Value(downloadLocation), + localLibraryLocation: Value(localLibraryLocation), + themeMode: Value(themeMode), + audioSourceId: audioSourceId == null && nullToAbsent + ? const Value.absent() + : Value(audioSourceId), + youtubeClientEngine: Value(youtubeClientEngine), + discordPresence: Value(discordPresence), + endlessPlayback: Value(endlessPlayback), + enableConnect: Value(enableConnect), + connectPort: Value(connectPort), + cacheMusic: Value(cacheMusic), + ); + } + + factory PreferencesTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return PreferencesTableData( + id: serializer.fromJson(json['id']), + albumColorSync: serializer.fromJson(json['albumColorSync']), + amoledDarkTheme: serializer.fromJson(json['amoledDarkTheme']), + checkUpdate: serializer.fromJson(json['checkUpdate']), + normalizeAudio: serializer.fromJson(json['normalizeAudio']), + showSystemTrayIcon: serializer.fromJson(json['showSystemTrayIcon']), + systemTitleBar: serializer.fromJson(json['systemTitleBar']), + skipNonMusic: serializer.fromJson(json['skipNonMusic']), + closeBehavior: serializer.fromJson(json['closeBehavior']), + accentColorScheme: serializer.fromJson(json['accentColorScheme']), + layoutMode: serializer.fromJson(json['layoutMode']), + locale: serializer.fromJson(json['locale']), + market: serializer.fromJson(json['market']), + searchMode: serializer.fromJson(json['searchMode']), + downloadLocation: serializer.fromJson(json['downloadLocation']), + localLibraryLocation: + serializer.fromJson(json['localLibraryLocation']), + themeMode: serializer.fromJson(json['themeMode']), + audioSourceId: serializer.fromJson(json['audioSourceId']), + youtubeClientEngine: + serializer.fromJson(json['youtubeClientEngine']), + discordPresence: serializer.fromJson(json['discordPresence']), + endlessPlayback: serializer.fromJson(json['endlessPlayback']), + enableConnect: serializer.fromJson(json['enableConnect']), + connectPort: serializer.fromJson(json['connectPort']), + cacheMusic: serializer.fromJson(json['cacheMusic']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'albumColorSync': serializer.toJson(albumColorSync), + 'amoledDarkTheme': serializer.toJson(amoledDarkTheme), + 'checkUpdate': serializer.toJson(checkUpdate), + 'normalizeAudio': serializer.toJson(normalizeAudio), + 'showSystemTrayIcon': serializer.toJson(showSystemTrayIcon), + 'systemTitleBar': serializer.toJson(systemTitleBar), + 'skipNonMusic': serializer.toJson(skipNonMusic), + 'closeBehavior': serializer.toJson(closeBehavior), + 'accentColorScheme': serializer.toJson(accentColorScheme), + 'layoutMode': serializer.toJson(layoutMode), + 'locale': serializer.toJson(locale), + 'market': serializer.toJson(market), + 'searchMode': serializer.toJson(searchMode), + 'downloadLocation': serializer.toJson(downloadLocation), + 'localLibraryLocation': serializer.toJson(localLibraryLocation), + 'themeMode': serializer.toJson(themeMode), + 'audioSourceId': serializer.toJson(audioSourceId), + 'youtubeClientEngine': serializer.toJson(youtubeClientEngine), + 'discordPresence': serializer.toJson(discordPresence), + 'endlessPlayback': serializer.toJson(endlessPlayback), + 'enableConnect': serializer.toJson(enableConnect), + 'connectPort': serializer.toJson(connectPort), + 'cacheMusic': serializer.toJson(cacheMusic), + }; + } + + PreferencesTableData copyWith( + {int? id, + bool? albumColorSync, + bool? amoledDarkTheme, + bool? checkUpdate, + bool? normalizeAudio, + bool? showSystemTrayIcon, + bool? systemTitleBar, + bool? skipNonMusic, + String? closeBehavior, + String? accentColorScheme, + String? layoutMode, + String? locale, + String? market, + String? searchMode, + String? downloadLocation, + String? localLibraryLocation, + String? themeMode, + Value audioSourceId = const Value.absent(), + String? youtubeClientEngine, + bool? discordPresence, + bool? endlessPlayback, + bool? enableConnect, + int? connectPort, + bool? cacheMusic}) => + PreferencesTableData( + id: id ?? this.id, + albumColorSync: albumColorSync ?? this.albumColorSync, + amoledDarkTheme: amoledDarkTheme ?? this.amoledDarkTheme, + checkUpdate: checkUpdate ?? this.checkUpdate, + normalizeAudio: normalizeAudio ?? this.normalizeAudio, + showSystemTrayIcon: showSystemTrayIcon ?? this.showSystemTrayIcon, + systemTitleBar: systemTitleBar ?? this.systemTitleBar, + skipNonMusic: skipNonMusic ?? this.skipNonMusic, + closeBehavior: closeBehavior ?? this.closeBehavior, + accentColorScheme: accentColorScheme ?? this.accentColorScheme, + layoutMode: layoutMode ?? this.layoutMode, + locale: locale ?? this.locale, + market: market ?? this.market, + searchMode: searchMode ?? this.searchMode, + downloadLocation: downloadLocation ?? this.downloadLocation, + localLibraryLocation: localLibraryLocation ?? this.localLibraryLocation, + themeMode: themeMode ?? this.themeMode, + audioSourceId: + audioSourceId.present ? audioSourceId.value : this.audioSourceId, + youtubeClientEngine: youtubeClientEngine ?? this.youtubeClientEngine, + discordPresence: discordPresence ?? this.discordPresence, + endlessPlayback: endlessPlayback ?? this.endlessPlayback, + enableConnect: enableConnect ?? this.enableConnect, + connectPort: connectPort ?? this.connectPort, + cacheMusic: cacheMusic ?? this.cacheMusic, + ); + PreferencesTableData copyWithCompanion(PreferencesTableCompanion data) { + return PreferencesTableData( + id: data.id.present ? data.id.value : this.id, + albumColorSync: data.albumColorSync.present + ? data.albumColorSync.value + : this.albumColorSync, + amoledDarkTheme: data.amoledDarkTheme.present + ? data.amoledDarkTheme.value + : this.amoledDarkTheme, + checkUpdate: + data.checkUpdate.present ? data.checkUpdate.value : this.checkUpdate, + normalizeAudio: data.normalizeAudio.present + ? data.normalizeAudio.value + : this.normalizeAudio, + showSystemTrayIcon: data.showSystemTrayIcon.present + ? data.showSystemTrayIcon.value + : this.showSystemTrayIcon, + systemTitleBar: data.systemTitleBar.present + ? data.systemTitleBar.value + : this.systemTitleBar, + skipNonMusic: data.skipNonMusic.present + ? data.skipNonMusic.value + : this.skipNonMusic, + closeBehavior: data.closeBehavior.present + ? data.closeBehavior.value + : this.closeBehavior, + accentColorScheme: data.accentColorScheme.present + ? data.accentColorScheme.value + : this.accentColorScheme, + layoutMode: + data.layoutMode.present ? data.layoutMode.value : this.layoutMode, + locale: data.locale.present ? data.locale.value : this.locale, + market: data.market.present ? data.market.value : this.market, + searchMode: + data.searchMode.present ? data.searchMode.value : this.searchMode, + downloadLocation: data.downloadLocation.present + ? data.downloadLocation.value + : this.downloadLocation, + localLibraryLocation: data.localLibraryLocation.present + ? data.localLibraryLocation.value + : this.localLibraryLocation, + themeMode: data.themeMode.present ? data.themeMode.value : this.themeMode, + audioSourceId: data.audioSourceId.present + ? data.audioSourceId.value + : this.audioSourceId, + youtubeClientEngine: data.youtubeClientEngine.present + ? data.youtubeClientEngine.value + : this.youtubeClientEngine, + discordPresence: data.discordPresence.present + ? data.discordPresence.value + : this.discordPresence, + endlessPlayback: data.endlessPlayback.present + ? data.endlessPlayback.value + : this.endlessPlayback, + enableConnect: data.enableConnect.present + ? data.enableConnect.value + : this.enableConnect, + connectPort: + data.connectPort.present ? data.connectPort.value : this.connectPort, + cacheMusic: + data.cacheMusic.present ? data.cacheMusic.value : this.cacheMusic, + ); + } + + @override + String toString() { + return (StringBuffer('PreferencesTableData(') + ..write('id: $id, ') + ..write('albumColorSync: $albumColorSync, ') + ..write('amoledDarkTheme: $amoledDarkTheme, ') + ..write('checkUpdate: $checkUpdate, ') + ..write('normalizeAudio: $normalizeAudio, ') + ..write('showSystemTrayIcon: $showSystemTrayIcon, ') + ..write('systemTitleBar: $systemTitleBar, ') + ..write('skipNonMusic: $skipNonMusic, ') + ..write('closeBehavior: $closeBehavior, ') + ..write('accentColorScheme: $accentColorScheme, ') + ..write('layoutMode: $layoutMode, ') + ..write('locale: $locale, ') + ..write('market: $market, ') + ..write('searchMode: $searchMode, ') + ..write('downloadLocation: $downloadLocation, ') + ..write('localLibraryLocation: $localLibraryLocation, ') + ..write('themeMode: $themeMode, ') + ..write('audioSourceId: $audioSourceId, ') + ..write('youtubeClientEngine: $youtubeClientEngine, ') + ..write('discordPresence: $discordPresence, ') + ..write('endlessPlayback: $endlessPlayback, ') + ..write('enableConnect: $enableConnect, ') + ..write('connectPort: $connectPort, ') + ..write('cacheMusic: $cacheMusic') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hashAll([ + id, + albumColorSync, + amoledDarkTheme, + checkUpdate, + normalizeAudio, + showSystemTrayIcon, + systemTitleBar, + skipNonMusic, + closeBehavior, + accentColorScheme, + layoutMode, + locale, + market, + searchMode, + downloadLocation, + localLibraryLocation, + themeMode, + audioSourceId, + youtubeClientEngine, + discordPresence, + endlessPlayback, + enableConnect, + connectPort, + cacheMusic + ]); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is PreferencesTableData && + other.id == this.id && + other.albumColorSync == this.albumColorSync && + other.amoledDarkTheme == this.amoledDarkTheme && + other.checkUpdate == this.checkUpdate && + other.normalizeAudio == this.normalizeAudio && + other.showSystemTrayIcon == this.showSystemTrayIcon && + other.systemTitleBar == this.systemTitleBar && + other.skipNonMusic == this.skipNonMusic && + other.closeBehavior == this.closeBehavior && + other.accentColorScheme == this.accentColorScheme && + other.layoutMode == this.layoutMode && + other.locale == this.locale && + other.market == this.market && + other.searchMode == this.searchMode && + other.downloadLocation == this.downloadLocation && + other.localLibraryLocation == this.localLibraryLocation && + other.themeMode == this.themeMode && + other.audioSourceId == this.audioSourceId && + other.youtubeClientEngine == this.youtubeClientEngine && + other.discordPresence == this.discordPresence && + other.endlessPlayback == this.endlessPlayback && + other.enableConnect == this.enableConnect && + other.connectPort == this.connectPort && + other.cacheMusic == this.cacheMusic); +} + +class PreferencesTableCompanion extends UpdateCompanion { + final Value id; + final Value albumColorSync; + final Value amoledDarkTheme; + final Value checkUpdate; + final Value normalizeAudio; + final Value showSystemTrayIcon; + final Value systemTitleBar; + final Value skipNonMusic; + final Value closeBehavior; + final Value accentColorScheme; + final Value layoutMode; + final Value locale; + final Value market; + final Value searchMode; + final Value downloadLocation; + final Value localLibraryLocation; + final Value themeMode; + final Value audioSourceId; + final Value youtubeClientEngine; + final Value discordPresence; + final Value endlessPlayback; + final Value enableConnect; + final Value connectPort; + final Value cacheMusic; + const PreferencesTableCompanion({ + this.id = const Value.absent(), + this.albumColorSync = const Value.absent(), + this.amoledDarkTheme = const Value.absent(), + this.checkUpdate = const Value.absent(), + this.normalizeAudio = const Value.absent(), + this.showSystemTrayIcon = const Value.absent(), + this.systemTitleBar = const Value.absent(), + this.skipNonMusic = const Value.absent(), + this.closeBehavior = const Value.absent(), + this.accentColorScheme = const Value.absent(), + this.layoutMode = const Value.absent(), + this.locale = const Value.absent(), + this.market = const Value.absent(), + this.searchMode = const Value.absent(), + this.downloadLocation = const Value.absent(), + this.localLibraryLocation = const Value.absent(), + this.themeMode = const Value.absent(), + this.audioSourceId = const Value.absent(), + this.youtubeClientEngine = const Value.absent(), + this.discordPresence = const Value.absent(), + this.endlessPlayback = const Value.absent(), + this.enableConnect = const Value.absent(), + this.connectPort = const Value.absent(), + this.cacheMusic = const Value.absent(), + }); + PreferencesTableCompanion.insert({ + this.id = const Value.absent(), + this.albumColorSync = const Value.absent(), + this.amoledDarkTheme = const Value.absent(), + this.checkUpdate = const Value.absent(), + this.normalizeAudio = const Value.absent(), + this.showSystemTrayIcon = const Value.absent(), + this.systemTitleBar = const Value.absent(), + this.skipNonMusic = const Value.absent(), + this.closeBehavior = const Value.absent(), + this.accentColorScheme = const Value.absent(), + this.layoutMode = const Value.absent(), + this.locale = const Value.absent(), + this.market = const Value.absent(), + this.searchMode = const Value.absent(), + this.downloadLocation = const Value.absent(), + this.localLibraryLocation = const Value.absent(), + this.themeMode = const Value.absent(), + this.audioSourceId = const Value.absent(), + this.youtubeClientEngine = const Value.absent(), + this.discordPresence = const Value.absent(), + this.endlessPlayback = const Value.absent(), + this.enableConnect = const Value.absent(), + this.connectPort = const Value.absent(), + this.cacheMusic = const Value.absent(), + }); + static Insertable custom({ + Expression? id, + Expression? albumColorSync, + Expression? amoledDarkTheme, + Expression? checkUpdate, + Expression? normalizeAudio, + Expression? showSystemTrayIcon, + Expression? systemTitleBar, + Expression? skipNonMusic, + Expression? closeBehavior, + Expression? accentColorScheme, + Expression? layoutMode, + Expression? locale, + Expression? market, + Expression? searchMode, + Expression? downloadLocation, + Expression? localLibraryLocation, + Expression? themeMode, + Expression? audioSourceId, + Expression? youtubeClientEngine, + Expression? discordPresence, + Expression? endlessPlayback, + Expression? enableConnect, + Expression? connectPort, + Expression? cacheMusic, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (albumColorSync != null) 'album_color_sync': albumColorSync, + if (amoledDarkTheme != null) 'amoled_dark_theme': amoledDarkTheme, + if (checkUpdate != null) 'check_update': checkUpdate, + if (normalizeAudio != null) 'normalize_audio': normalizeAudio, + if (showSystemTrayIcon != null) + 'show_system_tray_icon': showSystemTrayIcon, + if (systemTitleBar != null) 'system_title_bar': systemTitleBar, + if (skipNonMusic != null) 'skip_non_music': skipNonMusic, + if (closeBehavior != null) 'close_behavior': closeBehavior, + if (accentColorScheme != null) 'accent_color_scheme': accentColorScheme, + if (layoutMode != null) 'layout_mode': layoutMode, + if (locale != null) 'locale': locale, + if (market != null) 'market': market, + if (searchMode != null) 'search_mode': searchMode, + if (downloadLocation != null) 'download_location': downloadLocation, + if (localLibraryLocation != null) + 'local_library_location': localLibraryLocation, + if (themeMode != null) 'theme_mode': themeMode, + if (audioSourceId != null) 'audio_source_id': audioSourceId, + if (youtubeClientEngine != null) + 'youtube_client_engine': youtubeClientEngine, + if (discordPresence != null) 'discord_presence': discordPresence, + if (endlessPlayback != null) 'endless_playback': endlessPlayback, + if (enableConnect != null) 'enable_connect': enableConnect, + if (connectPort != null) 'connect_port': connectPort, + if (cacheMusic != null) 'cache_music': cacheMusic, + }); + } + + PreferencesTableCompanion copyWith( + {Value? id, + Value? albumColorSync, + Value? amoledDarkTheme, + Value? checkUpdate, + Value? normalizeAudio, + Value? showSystemTrayIcon, + Value? systemTitleBar, + Value? skipNonMusic, + Value? closeBehavior, + Value? accentColorScheme, + Value? layoutMode, + Value? locale, + Value? market, + Value? searchMode, + Value? downloadLocation, + Value? localLibraryLocation, + Value? themeMode, + Value? audioSourceId, + Value? youtubeClientEngine, + Value? discordPresence, + Value? endlessPlayback, + Value? enableConnect, + Value? connectPort, + Value? cacheMusic}) { + return PreferencesTableCompanion( + id: id ?? this.id, + albumColorSync: albumColorSync ?? this.albumColorSync, + amoledDarkTheme: amoledDarkTheme ?? this.amoledDarkTheme, + checkUpdate: checkUpdate ?? this.checkUpdate, + normalizeAudio: normalizeAudio ?? this.normalizeAudio, + showSystemTrayIcon: showSystemTrayIcon ?? this.showSystemTrayIcon, + systemTitleBar: systemTitleBar ?? this.systemTitleBar, + skipNonMusic: skipNonMusic ?? this.skipNonMusic, + closeBehavior: closeBehavior ?? this.closeBehavior, + accentColorScheme: accentColorScheme ?? this.accentColorScheme, + layoutMode: layoutMode ?? this.layoutMode, + locale: locale ?? this.locale, + market: market ?? this.market, + searchMode: searchMode ?? this.searchMode, + downloadLocation: downloadLocation ?? this.downloadLocation, + localLibraryLocation: localLibraryLocation ?? this.localLibraryLocation, + themeMode: themeMode ?? this.themeMode, + audioSourceId: audioSourceId ?? this.audioSourceId, + youtubeClientEngine: youtubeClientEngine ?? this.youtubeClientEngine, + discordPresence: discordPresence ?? this.discordPresence, + endlessPlayback: endlessPlayback ?? this.endlessPlayback, + enableConnect: enableConnect ?? this.enableConnect, + connectPort: connectPort ?? this.connectPort, + cacheMusic: cacheMusic ?? this.cacheMusic, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (albumColorSync.present) { + map['album_color_sync'] = Variable(albumColorSync.value); + } + if (amoledDarkTheme.present) { + map['amoled_dark_theme'] = Variable(amoledDarkTheme.value); + } + if (checkUpdate.present) { + map['check_update'] = Variable(checkUpdate.value); + } + if (normalizeAudio.present) { + map['normalize_audio'] = Variable(normalizeAudio.value); + } + if (showSystemTrayIcon.present) { + map['show_system_tray_icon'] = Variable(showSystemTrayIcon.value); + } + if (systemTitleBar.present) { + map['system_title_bar'] = Variable(systemTitleBar.value); + } + if (skipNonMusic.present) { + map['skip_non_music'] = Variable(skipNonMusic.value); + } + if (closeBehavior.present) { + map['close_behavior'] = Variable(closeBehavior.value); + } + if (accentColorScheme.present) { + map['accent_color_scheme'] = Variable(accentColorScheme.value); + } + if (layoutMode.present) { + map['layout_mode'] = Variable(layoutMode.value); + } + if (locale.present) { + map['locale'] = Variable(locale.value); + } + if (market.present) { + map['market'] = Variable(market.value); + } + if (searchMode.present) { + map['search_mode'] = Variable(searchMode.value); + } + if (downloadLocation.present) { + map['download_location'] = Variable(downloadLocation.value); + } + if (localLibraryLocation.present) { + map['local_library_location'] = + Variable(localLibraryLocation.value); + } + if (themeMode.present) { + map['theme_mode'] = Variable(themeMode.value); + } + if (audioSourceId.present) { + map['audio_source_id'] = Variable(audioSourceId.value); + } + if (youtubeClientEngine.present) { + map['youtube_client_engine'] = + Variable(youtubeClientEngine.value); + } + if (discordPresence.present) { + map['discord_presence'] = Variable(discordPresence.value); + } + if (endlessPlayback.present) { + map['endless_playback'] = Variable(endlessPlayback.value); + } + if (enableConnect.present) { + map['enable_connect'] = Variable(enableConnect.value); + } + if (connectPort.present) { + map['connect_port'] = Variable(connectPort.value); + } + if (cacheMusic.present) { + map['cache_music'] = Variable(cacheMusic.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('PreferencesTableCompanion(') + ..write('id: $id, ') + ..write('albumColorSync: $albumColorSync, ') + ..write('amoledDarkTheme: $amoledDarkTheme, ') + ..write('checkUpdate: $checkUpdate, ') + ..write('normalizeAudio: $normalizeAudio, ') + ..write('showSystemTrayIcon: $showSystemTrayIcon, ') + ..write('systemTitleBar: $systemTitleBar, ') + ..write('skipNonMusic: $skipNonMusic, ') + ..write('closeBehavior: $closeBehavior, ') + ..write('accentColorScheme: $accentColorScheme, ') + ..write('layoutMode: $layoutMode, ') + ..write('locale: $locale, ') + ..write('market: $market, ') + ..write('searchMode: $searchMode, ') + ..write('downloadLocation: $downloadLocation, ') + ..write('localLibraryLocation: $localLibraryLocation, ') + ..write('themeMode: $themeMode, ') + ..write('audioSourceId: $audioSourceId, ') + ..write('youtubeClientEngine: $youtubeClientEngine, ') + ..write('discordPresence: $discordPresence, ') + ..write('endlessPlayback: $endlessPlayback, ') + ..write('enableConnect: $enableConnect, ') + ..write('connectPort: $connectPort, ') + ..write('cacheMusic: $cacheMusic') + ..write(')')) + .toString(); + } +} + +class ScrobblerTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ScrobblerTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime); + late final GeneratedColumn username = GeneratedColumn( + 'username', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn passwordHash = GeneratedColumn( + 'password_hash', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + @override + List get $columns => [id, createdAt, username, passwordHash]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'scrobbler_table'; + @override + Set get $primaryKey => {id}; + @override + ScrobblerTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ScrobblerTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + username: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}username'])!, + passwordHash: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}password_hash'])!, + ); + } + + @override + ScrobblerTable createAlias(String alias) { + return ScrobblerTable(attachedDatabase, alias); + } +} + +class ScrobblerTableData extends DataClass + implements Insertable { + final int id; + final DateTime createdAt; + final String username; + final String passwordHash; + const ScrobblerTableData( + {required this.id, + required this.createdAt, + required this.username, + required this.passwordHash}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['created_at'] = Variable(createdAt); + map['username'] = Variable(username); + map['password_hash'] = Variable(passwordHash); + return map; + } + + ScrobblerTableCompanion toCompanion(bool nullToAbsent) { + return ScrobblerTableCompanion( + id: Value(id), + createdAt: Value(createdAt), + username: Value(username), + passwordHash: Value(passwordHash), + ); + } + + factory ScrobblerTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ScrobblerTableData( + id: serializer.fromJson(json['id']), + createdAt: serializer.fromJson(json['createdAt']), + username: serializer.fromJson(json['username']), + passwordHash: serializer.fromJson(json['passwordHash']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'createdAt': serializer.toJson(createdAt), + 'username': serializer.toJson(username), + 'passwordHash': serializer.toJson(passwordHash), + }; + } + + ScrobblerTableData copyWith( + {int? id, + DateTime? createdAt, + String? username, + String? passwordHash}) => + ScrobblerTableData( + id: id ?? this.id, + createdAt: createdAt ?? this.createdAt, + username: username ?? this.username, + passwordHash: passwordHash ?? this.passwordHash, + ); + ScrobblerTableData copyWithCompanion(ScrobblerTableCompanion data) { + return ScrobblerTableData( + id: data.id.present ? data.id.value : this.id, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + username: data.username.present ? data.username.value : this.username, + passwordHash: data.passwordHash.present + ? data.passwordHash.value + : this.passwordHash, + ); + } + + @override + String toString() { + return (StringBuffer('ScrobblerTableData(') + ..write('id: $id, ') + ..write('createdAt: $createdAt, ') + ..write('username: $username, ') + ..write('passwordHash: $passwordHash') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, createdAt, username, passwordHash); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ScrobblerTableData && + other.id == this.id && + other.createdAt == this.createdAt && + other.username == this.username && + other.passwordHash == this.passwordHash); +} + +class ScrobblerTableCompanion extends UpdateCompanion { + final Value id; + final Value createdAt; + final Value username; + final Value passwordHash; + const ScrobblerTableCompanion({ + this.id = const Value.absent(), + this.createdAt = const Value.absent(), + this.username = const Value.absent(), + this.passwordHash = const Value.absent(), + }); + ScrobblerTableCompanion.insert({ + this.id = const Value.absent(), + this.createdAt = const Value.absent(), + required String username, + required String passwordHash, + }) : username = Value(username), + passwordHash = Value(passwordHash); + static Insertable custom({ + Expression? id, + Expression? createdAt, + Expression? username, + Expression? passwordHash, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (createdAt != null) 'created_at': createdAt, + if (username != null) 'username': username, + if (passwordHash != null) 'password_hash': passwordHash, + }); + } + + ScrobblerTableCompanion copyWith( + {Value? id, + Value? createdAt, + Value? username, + Value? passwordHash}) { + return ScrobblerTableCompanion( + id: id ?? this.id, + createdAt: createdAt ?? this.createdAt, + username: username ?? this.username, + passwordHash: passwordHash ?? this.passwordHash, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (username.present) { + map['username'] = Variable(username.value); + } + if (passwordHash.present) { + map['password_hash'] = Variable(passwordHash.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ScrobblerTableCompanion(') + ..write('id: $id, ') + ..write('createdAt: $createdAt, ') + ..write('username: $username, ') + ..write('passwordHash: $passwordHash') + ..write(')')) + .toString(); + } +} + +class SkipSegmentTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SkipSegmentTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn start = GeneratedColumn( + 'start', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn end = GeneratedColumn( + 'end', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn trackId = GeneratedColumn( + 'track_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime); + @override + List get $columns => [id, start, end, trackId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'skip_segment_table'; + @override + Set get $primaryKey => {id}; + @override + SkipSegmentTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SkipSegmentTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + start: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}start'])!, + end: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}end'])!, + trackId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}track_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SkipSegmentTable createAlias(String alias) { + return SkipSegmentTable(attachedDatabase, alias); + } +} + +class SkipSegmentTableData extends DataClass + implements Insertable { + final int id; + final int start; + final int end; + final String trackId; + final DateTime createdAt; + const SkipSegmentTableData( + {required this.id, + required this.start, + required this.end, + required this.trackId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['start'] = Variable(start); + map['end'] = Variable(end); + map['track_id'] = Variable(trackId); + map['created_at'] = Variable(createdAt); + return map; + } + + SkipSegmentTableCompanion toCompanion(bool nullToAbsent) { + return SkipSegmentTableCompanion( + id: Value(id), + start: Value(start), + end: Value(end), + trackId: Value(trackId), + createdAt: Value(createdAt), + ); + } + + factory SkipSegmentTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SkipSegmentTableData( + id: serializer.fromJson(json['id']), + start: serializer.fromJson(json['start']), + end: serializer.fromJson(json['end']), + trackId: serializer.fromJson(json['trackId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'start': serializer.toJson(start), + 'end': serializer.toJson(end), + 'trackId': serializer.toJson(trackId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SkipSegmentTableData copyWith( + {int? id, + int? start, + int? end, + String? trackId, + DateTime? createdAt}) => + SkipSegmentTableData( + id: id ?? this.id, + start: start ?? this.start, + end: end ?? this.end, + trackId: trackId ?? this.trackId, + createdAt: createdAt ?? this.createdAt, + ); + SkipSegmentTableData copyWithCompanion(SkipSegmentTableCompanion data) { + return SkipSegmentTableData( + id: data.id.present ? data.id.value : this.id, + start: data.start.present ? data.start.value : this.start, + end: data.end.present ? data.end.value : this.end, + trackId: data.trackId.present ? data.trackId.value : this.trackId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SkipSegmentTableData(') + ..write('id: $id, ') + ..write('start: $start, ') + ..write('end: $end, ') + ..write('trackId: $trackId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, start, end, trackId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SkipSegmentTableData && + other.id == this.id && + other.start == this.start && + other.end == this.end && + other.trackId == this.trackId && + other.createdAt == this.createdAt); +} + +class SkipSegmentTableCompanion extends UpdateCompanion { + final Value id; + final Value start; + final Value end; + final Value trackId; + final Value createdAt; + const SkipSegmentTableCompanion({ + this.id = const Value.absent(), + this.start = const Value.absent(), + this.end = const Value.absent(), + this.trackId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SkipSegmentTableCompanion.insert({ + this.id = const Value.absent(), + required int start, + required int end, + required String trackId, + this.createdAt = const Value.absent(), + }) : start = Value(start), + end = Value(end), + trackId = Value(trackId); + static Insertable custom({ + Expression? id, + Expression? start, + Expression? end, + Expression? trackId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (start != null) 'start': start, + if (end != null) 'end': end, + if (trackId != null) 'track_id': trackId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SkipSegmentTableCompanion copyWith( + {Value? id, + Value? start, + Value? end, + Value? trackId, + Value? createdAt}) { + return SkipSegmentTableCompanion( + id: id ?? this.id, + start: start ?? this.start, + end: end ?? this.end, + trackId: trackId ?? this.trackId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (start.present) { + map['start'] = Variable(start.value); + } + if (end.present) { + map['end'] = Variable(end.value); + } + if (trackId.present) { + map['track_id'] = Variable(trackId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SkipSegmentTableCompanion(') + ..write('id: $id, ') + ..write('start: $start, ') + ..write('end: $end, ') + ..write('trackId: $trackId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SourceMatchTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SourceMatchTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn trackId = GeneratedColumn( + 'track_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn sourceInfo = GeneratedColumn( + 'source_info', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("{}")); + late final GeneratedColumn sourceType = GeneratedColumn( + 'source_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime); + @override + List get $columns => + [id, trackId, sourceInfo, sourceType, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'source_match_table'; + @override + Set get $primaryKey => {id}; + @override + SourceMatchTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SourceMatchTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + trackId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}track_id'])!, + sourceInfo: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}source_info'])!, + sourceType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}source_type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SourceMatchTable createAlias(String alias) { + return SourceMatchTable(attachedDatabase, alias); + } +} + +class SourceMatchTableData extends DataClass + implements Insertable { + final int id; + final String trackId; + final String sourceInfo; + final String sourceType; + final DateTime createdAt; + const SourceMatchTableData( + {required this.id, + required this.trackId, + required this.sourceInfo, + required this.sourceType, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['track_id'] = Variable(trackId); + map['source_info'] = Variable(sourceInfo); + map['source_type'] = Variable(sourceType); + map['created_at'] = Variable(createdAt); + return map; + } + + SourceMatchTableCompanion toCompanion(bool nullToAbsent) { + return SourceMatchTableCompanion( + id: Value(id), + trackId: Value(trackId), + sourceInfo: Value(sourceInfo), + sourceType: Value(sourceType), + createdAt: Value(createdAt), + ); + } + + factory SourceMatchTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SourceMatchTableData( + id: serializer.fromJson(json['id']), + trackId: serializer.fromJson(json['trackId']), + sourceInfo: serializer.fromJson(json['sourceInfo']), + sourceType: serializer.fromJson(json['sourceType']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'trackId': serializer.toJson(trackId), + 'sourceInfo': serializer.toJson(sourceInfo), + 'sourceType': serializer.toJson(sourceType), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SourceMatchTableData copyWith( + {int? id, + String? trackId, + String? sourceInfo, + String? sourceType, + DateTime? createdAt}) => + SourceMatchTableData( + id: id ?? this.id, + trackId: trackId ?? this.trackId, + sourceInfo: sourceInfo ?? this.sourceInfo, + sourceType: sourceType ?? this.sourceType, + createdAt: createdAt ?? this.createdAt, + ); + SourceMatchTableData copyWithCompanion(SourceMatchTableCompanion data) { + return SourceMatchTableData( + id: data.id.present ? data.id.value : this.id, + trackId: data.trackId.present ? data.trackId.value : this.trackId, + sourceInfo: + data.sourceInfo.present ? data.sourceInfo.value : this.sourceInfo, + sourceType: + data.sourceType.present ? data.sourceType.value : this.sourceType, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SourceMatchTableData(') + ..write('id: $id, ') + ..write('trackId: $trackId, ') + ..write('sourceInfo: $sourceInfo, ') + ..write('sourceType: $sourceType, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => + Object.hash(id, trackId, sourceInfo, sourceType, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SourceMatchTableData && + other.id == this.id && + other.trackId == this.trackId && + other.sourceInfo == this.sourceInfo && + other.sourceType == this.sourceType && + other.createdAt == this.createdAt); +} + +class SourceMatchTableCompanion extends UpdateCompanion { + final Value id; + final Value trackId; + final Value sourceInfo; + final Value sourceType; + final Value createdAt; + const SourceMatchTableCompanion({ + this.id = const Value.absent(), + this.trackId = const Value.absent(), + this.sourceInfo = const Value.absent(), + this.sourceType = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SourceMatchTableCompanion.insert({ + this.id = const Value.absent(), + required String trackId, + this.sourceInfo = const Value.absent(), + required String sourceType, + this.createdAt = const Value.absent(), + }) : trackId = Value(trackId), + sourceType = Value(sourceType); + static Insertable custom({ + Expression? id, + Expression? trackId, + Expression? sourceInfo, + Expression? sourceType, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (trackId != null) 'track_id': trackId, + if (sourceInfo != null) 'source_info': sourceInfo, + if (sourceType != null) 'source_type': sourceType, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SourceMatchTableCompanion copyWith( + {Value? id, + Value? trackId, + Value? sourceInfo, + Value? sourceType, + Value? createdAt}) { + return SourceMatchTableCompanion( + id: id ?? this.id, + trackId: trackId ?? this.trackId, + sourceInfo: sourceInfo ?? this.sourceInfo, + sourceType: sourceType ?? this.sourceType, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (trackId.present) { + map['track_id'] = Variable(trackId.value); + } + if (sourceInfo.present) { + map['source_info'] = Variable(sourceInfo.value); + } + if (sourceType.present) { + map['source_type'] = Variable(sourceType.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SourceMatchTableCompanion(') + ..write('id: $id, ') + ..write('trackId: $trackId, ') + ..write('sourceInfo: $sourceInfo, ') + ..write('sourceType: $sourceType, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class AudioPlayerStateTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + AudioPlayerStateTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn playing = GeneratedColumn( + 'playing', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('CHECK ("playing" IN (0, 1))')); + late final GeneratedColumn loopMode = GeneratedColumn( + 'loop_mode', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn shuffled = GeneratedColumn( + 'shuffled', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('CHECK ("shuffled" IN (0, 1))')); + late final GeneratedColumn collections = GeneratedColumn( + 'collections', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn tracks = GeneratedColumn( + 'tracks', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("[]")); + late final GeneratedColumn currentIndex = GeneratedColumn( + 'current_index', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0)); + @override + List get $columns => + [id, playing, loopMode, shuffled, collections, tracks, currentIndex]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'audio_player_state_table'; + @override + Set get $primaryKey => {id}; + @override + AudioPlayerStateTableData map(Map data, + {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return AudioPlayerStateTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + playing: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}playing'])!, + loopMode: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}loop_mode'])!, + shuffled: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}shuffled'])!, + collections: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}collections'])!, + tracks: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tracks'])!, + currentIndex: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}current_index'])!, + ); + } + + @override + AudioPlayerStateTable createAlias(String alias) { + return AudioPlayerStateTable(attachedDatabase, alias); + } +} + +class AudioPlayerStateTableData extends DataClass + implements Insertable { + final int id; + final bool playing; + final String loopMode; + final bool shuffled; + final String collections; + final String tracks; + final int currentIndex; + const AudioPlayerStateTableData( + {required this.id, + required this.playing, + required this.loopMode, + required this.shuffled, + required this.collections, + required this.tracks, + required this.currentIndex}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['playing'] = Variable(playing); + map['loop_mode'] = Variable(loopMode); + map['shuffled'] = Variable(shuffled); + map['collections'] = Variable(collections); + map['tracks'] = Variable(tracks); + map['current_index'] = Variable(currentIndex); + return map; + } + + AudioPlayerStateTableCompanion toCompanion(bool nullToAbsent) { + return AudioPlayerStateTableCompanion( + id: Value(id), + playing: Value(playing), + loopMode: Value(loopMode), + shuffled: Value(shuffled), + collections: Value(collections), + tracks: Value(tracks), + currentIndex: Value(currentIndex), + ); + } + + factory AudioPlayerStateTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return AudioPlayerStateTableData( + id: serializer.fromJson(json['id']), + playing: serializer.fromJson(json['playing']), + loopMode: serializer.fromJson(json['loopMode']), + shuffled: serializer.fromJson(json['shuffled']), + collections: serializer.fromJson(json['collections']), + tracks: serializer.fromJson(json['tracks']), + currentIndex: serializer.fromJson(json['currentIndex']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'playing': serializer.toJson(playing), + 'loopMode': serializer.toJson(loopMode), + 'shuffled': serializer.toJson(shuffled), + 'collections': serializer.toJson(collections), + 'tracks': serializer.toJson(tracks), + 'currentIndex': serializer.toJson(currentIndex), + }; + } + + AudioPlayerStateTableData copyWith( + {int? id, + bool? playing, + String? loopMode, + bool? shuffled, + String? collections, + String? tracks, + int? currentIndex}) => + AudioPlayerStateTableData( + id: id ?? this.id, + playing: playing ?? this.playing, + loopMode: loopMode ?? this.loopMode, + shuffled: shuffled ?? this.shuffled, + collections: collections ?? this.collections, + tracks: tracks ?? this.tracks, + currentIndex: currentIndex ?? this.currentIndex, + ); + AudioPlayerStateTableData copyWithCompanion( + AudioPlayerStateTableCompanion data) { + return AudioPlayerStateTableData( + id: data.id.present ? data.id.value : this.id, + playing: data.playing.present ? data.playing.value : this.playing, + loopMode: data.loopMode.present ? data.loopMode.value : this.loopMode, + shuffled: data.shuffled.present ? data.shuffled.value : this.shuffled, + collections: + data.collections.present ? data.collections.value : this.collections, + tracks: data.tracks.present ? data.tracks.value : this.tracks, + currentIndex: data.currentIndex.present + ? data.currentIndex.value + : this.currentIndex, + ); + } + + @override + String toString() { + return (StringBuffer('AudioPlayerStateTableData(') + ..write('id: $id, ') + ..write('playing: $playing, ') + ..write('loopMode: $loopMode, ') + ..write('shuffled: $shuffled, ') + ..write('collections: $collections, ') + ..write('tracks: $tracks, ') + ..write('currentIndex: $currentIndex') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, playing, loopMode, shuffled, collections, tracks, currentIndex); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is AudioPlayerStateTableData && + other.id == this.id && + other.playing == this.playing && + other.loopMode == this.loopMode && + other.shuffled == this.shuffled && + other.collections == this.collections && + other.tracks == this.tracks && + other.currentIndex == this.currentIndex); +} + +class AudioPlayerStateTableCompanion + extends UpdateCompanion { + final Value id; + final Value playing; + final Value loopMode; + final Value shuffled; + final Value collections; + final Value tracks; + final Value currentIndex; + const AudioPlayerStateTableCompanion({ + this.id = const Value.absent(), + this.playing = const Value.absent(), + this.loopMode = const Value.absent(), + this.shuffled = const Value.absent(), + this.collections = const Value.absent(), + this.tracks = const Value.absent(), + this.currentIndex = const Value.absent(), + }); + AudioPlayerStateTableCompanion.insert({ + this.id = const Value.absent(), + required bool playing, + required String loopMode, + required bool shuffled, + required String collections, + this.tracks = const Value.absent(), + this.currentIndex = const Value.absent(), + }) : playing = Value(playing), + loopMode = Value(loopMode), + shuffled = Value(shuffled), + collections = Value(collections); + static Insertable custom({ + Expression? id, + Expression? playing, + Expression? loopMode, + Expression? shuffled, + Expression? collections, + Expression? tracks, + Expression? currentIndex, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (playing != null) 'playing': playing, + if (loopMode != null) 'loop_mode': loopMode, + if (shuffled != null) 'shuffled': shuffled, + if (collections != null) 'collections': collections, + if (tracks != null) 'tracks': tracks, + if (currentIndex != null) 'current_index': currentIndex, + }); + } + + AudioPlayerStateTableCompanion copyWith( + {Value? id, + Value? playing, + Value? loopMode, + Value? shuffled, + Value? collections, + Value? tracks, + Value? currentIndex}) { + return AudioPlayerStateTableCompanion( + id: id ?? this.id, + playing: playing ?? this.playing, + loopMode: loopMode ?? this.loopMode, + shuffled: shuffled ?? this.shuffled, + collections: collections ?? this.collections, + tracks: tracks ?? this.tracks, + currentIndex: currentIndex ?? this.currentIndex, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (playing.present) { + map['playing'] = Variable(playing.value); + } + if (loopMode.present) { + map['loop_mode'] = Variable(loopMode.value); + } + if (shuffled.present) { + map['shuffled'] = Variable(shuffled.value); + } + if (collections.present) { + map['collections'] = Variable(collections.value); + } + if (tracks.present) { + map['tracks'] = Variable(tracks.value); + } + if (currentIndex.present) { + map['current_index'] = Variable(currentIndex.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('AudioPlayerStateTableCompanion(') + ..write('id: $id, ') + ..write('playing: $playing, ') + ..write('loopMode: $loopMode, ') + ..write('shuffled: $shuffled, ') + ..write('collections: $collections, ') + ..write('tracks: $tracks, ') + ..write('currentIndex: $currentIndex') + ..write(')')) + .toString(); + } +} + +class HistoryTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + HistoryTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn itemId = GeneratedColumn( + 'item_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn data = GeneratedColumn( + 'data', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + @override + List get $columns => [id, createdAt, type, itemId, data]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'history_table'; + @override + Set get $primaryKey => {id}; + @override + HistoryTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return HistoryTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + itemId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}item_id'])!, + data: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}data'])!, + ); + } + + @override + HistoryTable createAlias(String alias) { + return HistoryTable(attachedDatabase, alias); + } +} + +class HistoryTableData extends DataClass + implements Insertable { + final int id; + final DateTime createdAt; + final String type; + final String itemId; + final String data; + const HistoryTableData( + {required this.id, + required this.createdAt, + required this.type, + required this.itemId, + required this.data}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['created_at'] = Variable(createdAt); + map['type'] = Variable(type); + map['item_id'] = Variable(itemId); + map['data'] = Variable(data); + return map; + } + + HistoryTableCompanion toCompanion(bool nullToAbsent) { + return HistoryTableCompanion( + id: Value(id), + createdAt: Value(createdAt), + type: Value(type), + itemId: Value(itemId), + data: Value(data), + ); + } + + factory HistoryTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return HistoryTableData( + id: serializer.fromJson(json['id']), + createdAt: serializer.fromJson(json['createdAt']), + type: serializer.fromJson(json['type']), + itemId: serializer.fromJson(json['itemId']), + data: serializer.fromJson(json['data']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'createdAt': serializer.toJson(createdAt), + 'type': serializer.toJson(type), + 'itemId': serializer.toJson(itemId), + 'data': serializer.toJson(data), + }; + } + + HistoryTableData copyWith( + {int? id, + DateTime? createdAt, + String? type, + String? itemId, + String? data}) => + HistoryTableData( + id: id ?? this.id, + createdAt: createdAt ?? this.createdAt, + type: type ?? this.type, + itemId: itemId ?? this.itemId, + data: data ?? this.data, + ); + HistoryTableData copyWithCompanion(HistoryTableCompanion data) { + return HistoryTableData( + id: data.id.present ? data.id.value : this.id, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + type: data.type.present ? data.type.value : this.type, + itemId: data.itemId.present ? data.itemId.value : this.itemId, + data: data.data.present ? data.data.value : this.data, + ); + } + + @override + String toString() { + return (StringBuffer('HistoryTableData(') + ..write('id: $id, ') + ..write('createdAt: $createdAt, ') + ..write('type: $type, ') + ..write('itemId: $itemId, ') + ..write('data: $data') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, createdAt, type, itemId, data); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is HistoryTableData && + other.id == this.id && + other.createdAt == this.createdAt && + other.type == this.type && + other.itemId == this.itemId && + other.data == this.data); +} + +class HistoryTableCompanion extends UpdateCompanion { + final Value id; + final Value createdAt; + final Value type; + final Value itemId; + final Value data; + const HistoryTableCompanion({ + this.id = const Value.absent(), + this.createdAt = const Value.absent(), + this.type = const Value.absent(), + this.itemId = const Value.absent(), + this.data = const Value.absent(), + }); + HistoryTableCompanion.insert({ + this.id = const Value.absent(), + this.createdAt = const Value.absent(), + required String type, + required String itemId, + required String data, + }) : type = Value(type), + itemId = Value(itemId), + data = Value(data); + static Insertable custom({ + Expression? id, + Expression? createdAt, + Expression? type, + Expression? itemId, + Expression? data, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (createdAt != null) 'created_at': createdAt, + if (type != null) 'type': type, + if (itemId != null) 'item_id': itemId, + if (data != null) 'data': data, + }); + } + + HistoryTableCompanion copyWith( + {Value? id, + Value? createdAt, + Value? type, + Value? itemId, + Value? data}) { + return HistoryTableCompanion( + id: id ?? this.id, + createdAt: createdAt ?? this.createdAt, + type: type ?? this.type, + itemId: itemId ?? this.itemId, + data: data ?? this.data, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (itemId.present) { + map['item_id'] = Variable(itemId.value); + } + if (data.present) { + map['data'] = Variable(data.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('HistoryTableCompanion(') + ..write('id: $id, ') + ..write('createdAt: $createdAt, ') + ..write('type: $type, ') + ..write('itemId: $itemId, ') + ..write('data: $data') + ..write(')')) + .toString(); + } +} + +class LyricsTable extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + LyricsTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn trackId = GeneratedColumn( + 'track_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn data = GeneratedColumn( + 'data', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + @override + List get $columns => [id, trackId, data]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'lyrics_table'; + @override + Set get $primaryKey => {id}; + @override + LyricsTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return LyricsTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + trackId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}track_id'])!, + data: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}data'])!, + ); + } + + @override + LyricsTable createAlias(String alias) { + return LyricsTable(attachedDatabase, alias); + } +} + +class LyricsTableData extends DataClass implements Insertable { + final int id; + final String trackId; + final String data; + const LyricsTableData( + {required this.id, required this.trackId, required this.data}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['track_id'] = Variable(trackId); + map['data'] = Variable(data); + return map; + } + + LyricsTableCompanion toCompanion(bool nullToAbsent) { + return LyricsTableCompanion( + id: Value(id), + trackId: Value(trackId), + data: Value(data), + ); + } + + factory LyricsTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return LyricsTableData( + id: serializer.fromJson(json['id']), + trackId: serializer.fromJson(json['trackId']), + data: serializer.fromJson(json['data']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'trackId': serializer.toJson(trackId), + 'data': serializer.toJson(data), + }; + } + + LyricsTableData copyWith({int? id, String? trackId, String? data}) => + LyricsTableData( + id: id ?? this.id, + trackId: trackId ?? this.trackId, + data: data ?? this.data, + ); + LyricsTableData copyWithCompanion(LyricsTableCompanion data) { + return LyricsTableData( + id: data.id.present ? data.id.value : this.id, + trackId: data.trackId.present ? data.trackId.value : this.trackId, + data: data.data.present ? data.data.value : this.data, + ); + } + + @override + String toString() { + return (StringBuffer('LyricsTableData(') + ..write('id: $id, ') + ..write('trackId: $trackId, ') + ..write('data: $data') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, trackId, data); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is LyricsTableData && + other.id == this.id && + other.trackId == this.trackId && + other.data == this.data); +} + +class LyricsTableCompanion extends UpdateCompanion { + final Value id; + final Value trackId; + final Value data; + const LyricsTableCompanion({ + this.id = const Value.absent(), + this.trackId = const Value.absent(), + this.data = const Value.absent(), + }); + LyricsTableCompanion.insert({ + this.id = const Value.absent(), + required String trackId, + required String data, + }) : trackId = Value(trackId), + data = Value(data); + static Insertable custom({ + Expression? id, + Expression? trackId, + Expression? data, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (trackId != null) 'track_id': trackId, + if (data != null) 'data': data, + }); + } + + LyricsTableCompanion copyWith( + {Value? id, Value? trackId, Value? data}) { + return LyricsTableCompanion( + id: id ?? this.id, + trackId: trackId ?? this.trackId, + data: data ?? this.data, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (trackId.present) { + map['track_id'] = Variable(trackId.value); + } + if (data.present) { + map['data'] = Variable(data.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('LyricsTableCompanion(') + ..write('id: $id, ') + ..write('trackId: $trackId, ') + ..write('data: $data') + ..write(')')) + .toString(); + } +} + +class PluginsTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + PluginsTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn name = GeneratedColumn( + 'name', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 50), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'description', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn version = GeneratedColumn( + 'version', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn author = GeneratedColumn( + 'author', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn entryPoint = GeneratedColumn( + 'entry_point', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn apis = GeneratedColumn( + 'apis', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn abilities = GeneratedColumn( + 'abilities', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn selectedForMetadata = GeneratedColumn( + 'selected_for_metadata', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("selected_for_metadata" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn selectedForAudioSource = + GeneratedColumn('selected_for_audio_source', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("selected_for_audio_source" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn repository = GeneratedColumn( + 'repository', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn pluginApiVersion = GeneratedColumn( + 'plugin_api_version', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant('2.0.0')); + @override + List get $columns => [ + id, + name, + description, + version, + author, + entryPoint, + apis, + abilities, + selectedForMetadata, + selectedForAudioSource, + repository, + pluginApiVersion + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'plugins_table'; + @override + Set get $primaryKey => {id}; + @override + PluginsTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return PluginsTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}description'])!, + version: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}version'])!, + author: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}author'])!, + entryPoint: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}entry_point'])!, + apis: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}apis'])!, + abilities: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}abilities'])!, + selectedForMetadata: attachedDatabase.typeMapping.read( + DriftSqlType.bool, data['${effectivePrefix}selected_for_metadata'])!, + selectedForAudioSource: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}selected_for_audio_source'])!, + repository: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}repository']), + pluginApiVersion: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}plugin_api_version'])!, + ); + } + + @override + PluginsTable createAlias(String alias) { + return PluginsTable(attachedDatabase, alias); + } +} + +class PluginsTableData extends DataClass + implements Insertable { + final int id; + final String name; + final String description; + final String version; + final String author; + final String entryPoint; + final String apis; + final String abilities; + final bool selectedForMetadata; + final bool selectedForAudioSource; + final String? repository; + final String pluginApiVersion; + const PluginsTableData( + {required this.id, + required this.name, + required this.description, + required this.version, + required this.author, + required this.entryPoint, + required this.apis, + required this.abilities, + required this.selectedForMetadata, + required this.selectedForAudioSource, + this.repository, + required this.pluginApiVersion}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + map['description'] = Variable(description); + map['version'] = Variable(version); + map['author'] = Variable(author); + map['entry_point'] = Variable(entryPoint); + map['apis'] = Variable(apis); + map['abilities'] = Variable(abilities); + map['selected_for_metadata'] = Variable(selectedForMetadata); + map['selected_for_audio_source'] = Variable(selectedForAudioSource); + if (!nullToAbsent || repository != null) { + map['repository'] = Variable(repository); + } + map['plugin_api_version'] = Variable(pluginApiVersion); + return map; + } + + PluginsTableCompanion toCompanion(bool nullToAbsent) { + return PluginsTableCompanion( + id: Value(id), + name: Value(name), + description: Value(description), + version: Value(version), + author: Value(author), + entryPoint: Value(entryPoint), + apis: Value(apis), + abilities: Value(abilities), + selectedForMetadata: Value(selectedForMetadata), + selectedForAudioSource: Value(selectedForAudioSource), + repository: repository == null && nullToAbsent + ? const Value.absent() + : Value(repository), + pluginApiVersion: Value(pluginApiVersion), + ); + } + + factory PluginsTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return PluginsTableData( + id: serializer.fromJson(json['id']), + name: serializer.fromJson(json['name']), + description: serializer.fromJson(json['description']), + version: serializer.fromJson(json['version']), + author: serializer.fromJson(json['author']), + entryPoint: serializer.fromJson(json['entryPoint']), + apis: serializer.fromJson(json['apis']), + abilities: serializer.fromJson(json['abilities']), + selectedForMetadata: + serializer.fromJson(json['selectedForMetadata']), + selectedForAudioSource: + serializer.fromJson(json['selectedForAudioSource']), + repository: serializer.fromJson(json['repository']), + pluginApiVersion: serializer.fromJson(json['pluginApiVersion']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'name': serializer.toJson(name), + 'description': serializer.toJson(description), + 'version': serializer.toJson(version), + 'author': serializer.toJson(author), + 'entryPoint': serializer.toJson(entryPoint), + 'apis': serializer.toJson(apis), + 'abilities': serializer.toJson(abilities), + 'selectedForMetadata': serializer.toJson(selectedForMetadata), + 'selectedForAudioSource': serializer.toJson(selectedForAudioSource), + 'repository': serializer.toJson(repository), + 'pluginApiVersion': serializer.toJson(pluginApiVersion), + }; + } + + PluginsTableData copyWith( + {int? id, + String? name, + String? description, + String? version, + String? author, + String? entryPoint, + String? apis, + String? abilities, + bool? selectedForMetadata, + bool? selectedForAudioSource, + Value repository = const Value.absent(), + String? pluginApiVersion}) => + PluginsTableData( + id: id ?? this.id, + name: name ?? this.name, + description: description ?? this.description, + version: version ?? this.version, + author: author ?? this.author, + entryPoint: entryPoint ?? this.entryPoint, + apis: apis ?? this.apis, + abilities: abilities ?? this.abilities, + selectedForMetadata: selectedForMetadata ?? this.selectedForMetadata, + selectedForAudioSource: + selectedForAudioSource ?? this.selectedForAudioSource, + repository: repository.present ? repository.value : this.repository, + pluginApiVersion: pluginApiVersion ?? this.pluginApiVersion, + ); + PluginsTableData copyWithCompanion(PluginsTableCompanion data) { + return PluginsTableData( + id: data.id.present ? data.id.value : this.id, + name: data.name.present ? data.name.value : this.name, + description: + data.description.present ? data.description.value : this.description, + version: data.version.present ? data.version.value : this.version, + author: data.author.present ? data.author.value : this.author, + entryPoint: + data.entryPoint.present ? data.entryPoint.value : this.entryPoint, + apis: data.apis.present ? data.apis.value : this.apis, + abilities: data.abilities.present ? data.abilities.value : this.abilities, + selectedForMetadata: data.selectedForMetadata.present + ? data.selectedForMetadata.value + : this.selectedForMetadata, + selectedForAudioSource: data.selectedForAudioSource.present + ? data.selectedForAudioSource.value + : this.selectedForAudioSource, + repository: + data.repository.present ? data.repository.value : this.repository, + pluginApiVersion: data.pluginApiVersion.present + ? data.pluginApiVersion.value + : this.pluginApiVersion, + ); + } + + @override + String toString() { + return (StringBuffer('PluginsTableData(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('description: $description, ') + ..write('version: $version, ') + ..write('author: $author, ') + ..write('entryPoint: $entryPoint, ') + ..write('apis: $apis, ') + ..write('abilities: $abilities, ') + ..write('selectedForMetadata: $selectedForMetadata, ') + ..write('selectedForAudioSource: $selectedForAudioSource, ') + ..write('repository: $repository, ') + ..write('pluginApiVersion: $pluginApiVersion') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + name, + description, + version, + author, + entryPoint, + apis, + abilities, + selectedForMetadata, + selectedForAudioSource, + repository, + pluginApiVersion); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is PluginsTableData && + other.id == this.id && + other.name == this.name && + other.description == this.description && + other.version == this.version && + other.author == this.author && + other.entryPoint == this.entryPoint && + other.apis == this.apis && + other.abilities == this.abilities && + other.selectedForMetadata == this.selectedForMetadata && + other.selectedForAudioSource == this.selectedForAudioSource && + other.repository == this.repository && + other.pluginApiVersion == this.pluginApiVersion); +} + +class PluginsTableCompanion extends UpdateCompanion { + final Value id; + final Value name; + final Value description; + final Value version; + final Value author; + final Value entryPoint; + final Value apis; + final Value abilities; + final Value selectedForMetadata; + final Value selectedForAudioSource; + final Value repository; + final Value pluginApiVersion; + const PluginsTableCompanion({ + this.id = const Value.absent(), + this.name = const Value.absent(), + this.description = const Value.absent(), + this.version = const Value.absent(), + this.author = const Value.absent(), + this.entryPoint = const Value.absent(), + this.apis = const Value.absent(), + this.abilities = const Value.absent(), + this.selectedForMetadata = const Value.absent(), + this.selectedForAudioSource = const Value.absent(), + this.repository = const Value.absent(), + this.pluginApiVersion = const Value.absent(), + }); + PluginsTableCompanion.insert({ + this.id = const Value.absent(), + required String name, + required String description, + required String version, + required String author, + required String entryPoint, + required String apis, + required String abilities, + this.selectedForMetadata = const Value.absent(), + this.selectedForAudioSource = const Value.absent(), + this.repository = const Value.absent(), + this.pluginApiVersion = const Value.absent(), + }) : name = Value(name), + description = Value(description), + version = Value(version), + author = Value(author), + entryPoint = Value(entryPoint), + apis = Value(apis), + abilities = Value(abilities); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? description, + Expression? version, + Expression? author, + Expression? entryPoint, + Expression? apis, + Expression? abilities, + Expression? selectedForMetadata, + Expression? selectedForAudioSource, + Expression? repository, + Expression? pluginApiVersion, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (name != null) 'name': name, + if (description != null) 'description': description, + if (version != null) 'version': version, + if (author != null) 'author': author, + if (entryPoint != null) 'entry_point': entryPoint, + if (apis != null) 'apis': apis, + if (abilities != null) 'abilities': abilities, + if (selectedForMetadata != null) + 'selected_for_metadata': selectedForMetadata, + if (selectedForAudioSource != null) + 'selected_for_audio_source': selectedForAudioSource, + if (repository != null) 'repository': repository, + if (pluginApiVersion != null) 'plugin_api_version': pluginApiVersion, + }); + } + + PluginsTableCompanion copyWith( + {Value? id, + Value? name, + Value? description, + Value? version, + Value? author, + Value? entryPoint, + Value? apis, + Value? abilities, + Value? selectedForMetadata, + Value? selectedForAudioSource, + Value? repository, + Value? pluginApiVersion}) { + return PluginsTableCompanion( + id: id ?? this.id, + name: name ?? this.name, + description: description ?? this.description, + version: version ?? this.version, + author: author ?? this.author, + entryPoint: entryPoint ?? this.entryPoint, + apis: apis ?? this.apis, + abilities: abilities ?? this.abilities, + selectedForMetadata: selectedForMetadata ?? this.selectedForMetadata, + selectedForAudioSource: + selectedForAudioSource ?? this.selectedForAudioSource, + repository: repository ?? this.repository, + pluginApiVersion: pluginApiVersion ?? this.pluginApiVersion, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (description.present) { + map['description'] = Variable(description.value); + } + if (version.present) { + map['version'] = Variable(version.value); + } + if (author.present) { + map['author'] = Variable(author.value); + } + if (entryPoint.present) { + map['entry_point'] = Variable(entryPoint.value); + } + if (apis.present) { + map['apis'] = Variable(apis.value); + } + if (abilities.present) { + map['abilities'] = Variable(abilities.value); + } + if (selectedForMetadata.present) { + map['selected_for_metadata'] = Variable(selectedForMetadata.value); + } + if (selectedForAudioSource.present) { + map['selected_for_audio_source'] = + Variable(selectedForAudioSource.value); + } + if (repository.present) { + map['repository'] = Variable(repository.value); + } + if (pluginApiVersion.present) { + map['plugin_api_version'] = Variable(pluginApiVersion.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('PluginsTableCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('description: $description, ') + ..write('version: $version, ') + ..write('author: $author, ') + ..write('entryPoint: $entryPoint, ') + ..write('apis: $apis, ') + ..write('abilities: $abilities, ') + ..write('selectedForMetadata: $selectedForMetadata, ') + ..write('selectedForAudioSource: $selectedForAudioSource, ') + ..write('repository: $repository, ') + ..write('pluginApiVersion: $pluginApiVersion') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV10 extends GeneratedDatabase { + DatabaseAtV10(QueryExecutor e) : super(e); + late final AuthenticationTable authenticationTable = + AuthenticationTable(this); + late final BlacklistTable blacklistTable = BlacklistTable(this); + late final PreferencesTable preferencesTable = PreferencesTable(this); + late final ScrobblerTable scrobblerTable = ScrobblerTable(this); + late final SkipSegmentTable skipSegmentTable = SkipSegmentTable(this); + late final SourceMatchTable sourceMatchTable = SourceMatchTable(this); + late final AudioPlayerStateTable audioPlayerStateTable = + AudioPlayerStateTable(this); + late final HistoryTable historyTable = HistoryTable(this); + late final LyricsTable lyricsTable = LyricsTable(this); + late final PluginsTable pluginsTable = PluginsTable(this); + late final Index uniqueBlacklist = Index('unique_blacklist', + 'CREATE UNIQUE INDEX unique_blacklist ON blacklist_table (element_type, element_id)'); + late final Index uniqTrackMatch = Index('uniq_track_match', + 'CREATE UNIQUE INDEX uniq_track_match ON source_match_table (track_id, source_info, source_type)'); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + authenticationTable, + blacklistTable, + preferencesTable, + scrobblerTable, + skipSegmentTable, + sourceMatchTable, + audioPlayerStateTable, + historyTable, + lyricsTable, + pluginsTable, + uniqueBlacklist, + uniqTrackMatch + ]; + @override + int get schemaVersion => 10; +} diff --git a/test/drift/app_db/generated/schema_v2.dart b/test/drift/app_db/generated/schema_v2.dart index 4b28750d..c9642f86 100644 --- a/test/drift/app_db/generated/schema_v2.dart +++ b/test/drift/app_db/generated/schema_v2.dart @@ -1,6 +1,6 @@ +// dart format width=80 // GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint -//@dart=2.12 import 'package:drift/drift.dart'; class AuthenticationTable extends Table diff --git a/test/drift/app_db/generated/schema_v3.dart b/test/drift/app_db/generated/schema_v3.dart index 7ddf4d2b..f6416823 100644 --- a/test/drift/app_db/generated/schema_v3.dart +++ b/test/drift/app_db/generated/schema_v3.dart @@ -1,6 +1,6 @@ +// dart format width=80 // GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint -//@dart=2.12 import 'package:drift/drift.dart'; class AuthenticationTable extends Table diff --git a/test/drift/app_db/generated/schema_v4.dart b/test/drift/app_db/generated/schema_v4.dart index c8f07c6e..4206abdb 100644 --- a/test/drift/app_db/generated/schema_v4.dart +++ b/test/drift/app_db/generated/schema_v4.dart @@ -1,6 +1,6 @@ +// dart format width=80 // GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint -//@dart=2.12 import 'package:drift/drift.dart'; class AuthenticationTable extends Table diff --git a/test/drift/app_db/generated/schema_v5.dart b/test/drift/app_db/generated/schema_v5.dart index 72c48612..4283aa98 100644 --- a/test/drift/app_db/generated/schema_v5.dart +++ b/test/drift/app_db/generated/schema_v5.dart @@ -1,6 +1,6 @@ +// dart format width=80 // GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint -//@dart=2.12 import 'package:drift/drift.dart'; class AuthenticationTable extends Table diff --git a/test/drift/app_db/generated/schema_v6.dart b/test/drift/app_db/generated/schema_v6.dart index 9e556976..c0ef0442 100644 --- a/test/drift/app_db/generated/schema_v6.dart +++ b/test/drift/app_db/generated/schema_v6.dart @@ -1,6 +1,6 @@ +// dart format width=80 // GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint -//@dart=2.12 import 'package:drift/drift.dart'; class AuthenticationTable extends Table diff --git a/test/drift/app_db/generated/schema_v7.dart b/test/drift/app_db/generated/schema_v7.dart index b28397ab..b476efbd 100644 --- a/test/drift/app_db/generated/schema_v7.dart +++ b/test/drift/app_db/generated/schema_v7.dart @@ -1,6 +1,6 @@ +// dart format width=80 // GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint -//@dart=2.12 import 'package:drift/drift.dart'; class AuthenticationTable extends Table diff --git a/test/drift/app_db/generated/schema_v8.dart b/test/drift/app_db/generated/schema_v8.dart index 33fb4dad..7008eaff 100644 --- a/test/drift/app_db/generated/schema_v8.dart +++ b/test/drift/app_db/generated/schema_v8.dart @@ -1,6 +1,6 @@ +// dart format width=80 // GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint -//@dart=2.12 import 'package:drift/drift.dart'; class AuthenticationTable extends Table diff --git a/test/drift/app_db/generated/schema_v9.dart b/test/drift/app_db/generated/schema_v9.dart new file mode 100644 index 00000000..cde63c2f --- /dev/null +++ b/test/drift/app_db/generated/schema_v9.dart @@ -0,0 +1,3568 @@ +// dart format width=80 +// GENERATED CODE, DO NOT EDIT BY HAND. +// ignore_for_file: type=lint +import 'package:drift/drift.dart'; + +class AuthenticationTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + AuthenticationTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn cookie = GeneratedColumn( + 'cookie', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn accessToken = GeneratedColumn( + 'access_token', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn expiration = GeneratedColumn( + 'expiration', aliasedName, false, + type: DriftSqlType.dateTime, requiredDuringInsert: true); + @override + List get $columns => [id, cookie, accessToken, expiration]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'authentication_table'; + @override + Set get $primaryKey => {id}; + @override + AuthenticationTableData map(Map data, + {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return AuthenticationTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + cookie: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}cookie'])!, + accessToken: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}access_token'])!, + expiration: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}expiration'])!, + ); + } + + @override + AuthenticationTable createAlias(String alias) { + return AuthenticationTable(attachedDatabase, alias); + } +} + +class AuthenticationTableData extends DataClass + implements Insertable { + final int id; + final String cookie; + final String accessToken; + final DateTime expiration; + const AuthenticationTableData( + {required this.id, + required this.cookie, + required this.accessToken, + required this.expiration}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['cookie'] = Variable(cookie); + map['access_token'] = Variable(accessToken); + map['expiration'] = Variable(expiration); + return map; + } + + AuthenticationTableCompanion toCompanion(bool nullToAbsent) { + return AuthenticationTableCompanion( + id: Value(id), + cookie: Value(cookie), + accessToken: Value(accessToken), + expiration: Value(expiration), + ); + } + + factory AuthenticationTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return AuthenticationTableData( + id: serializer.fromJson(json['id']), + cookie: serializer.fromJson(json['cookie']), + accessToken: serializer.fromJson(json['accessToken']), + expiration: serializer.fromJson(json['expiration']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'cookie': serializer.toJson(cookie), + 'accessToken': serializer.toJson(accessToken), + 'expiration': serializer.toJson(expiration), + }; + } + + AuthenticationTableData copyWith( + {int? id, + String? cookie, + String? accessToken, + DateTime? expiration}) => + AuthenticationTableData( + id: id ?? this.id, + cookie: cookie ?? this.cookie, + accessToken: accessToken ?? this.accessToken, + expiration: expiration ?? this.expiration, + ); + AuthenticationTableData copyWithCompanion(AuthenticationTableCompanion data) { + return AuthenticationTableData( + id: data.id.present ? data.id.value : this.id, + cookie: data.cookie.present ? data.cookie.value : this.cookie, + accessToken: + data.accessToken.present ? data.accessToken.value : this.accessToken, + expiration: + data.expiration.present ? data.expiration.value : this.expiration, + ); + } + + @override + String toString() { + return (StringBuffer('AuthenticationTableData(') + ..write('id: $id, ') + ..write('cookie: $cookie, ') + ..write('accessToken: $accessToken, ') + ..write('expiration: $expiration') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, cookie, accessToken, expiration); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is AuthenticationTableData && + other.id == this.id && + other.cookie == this.cookie && + other.accessToken == this.accessToken && + other.expiration == this.expiration); +} + +class AuthenticationTableCompanion + extends UpdateCompanion { + final Value id; + final Value cookie; + final Value accessToken; + final Value expiration; + const AuthenticationTableCompanion({ + this.id = const Value.absent(), + this.cookie = const Value.absent(), + this.accessToken = const Value.absent(), + this.expiration = const Value.absent(), + }); + AuthenticationTableCompanion.insert({ + this.id = const Value.absent(), + required String cookie, + required String accessToken, + required DateTime expiration, + }) : cookie = Value(cookie), + accessToken = Value(accessToken), + expiration = Value(expiration); + static Insertable custom({ + Expression? id, + Expression? cookie, + Expression? accessToken, + Expression? expiration, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (cookie != null) 'cookie': cookie, + if (accessToken != null) 'access_token': accessToken, + if (expiration != null) 'expiration': expiration, + }); + } + + AuthenticationTableCompanion copyWith( + {Value? id, + Value? cookie, + Value? accessToken, + Value? expiration}) { + return AuthenticationTableCompanion( + id: id ?? this.id, + cookie: cookie ?? this.cookie, + accessToken: accessToken ?? this.accessToken, + expiration: expiration ?? this.expiration, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (cookie.present) { + map['cookie'] = Variable(cookie.value); + } + if (accessToken.present) { + map['access_token'] = Variable(accessToken.value); + } + if (expiration.present) { + map['expiration'] = Variable(expiration.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('AuthenticationTableCompanion(') + ..write('id: $id, ') + ..write('cookie: $cookie, ') + ..write('accessToken: $accessToken, ') + ..write('expiration: $expiration') + ..write(')')) + .toString(); + } +} + +class BlacklistTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + BlacklistTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn name = GeneratedColumn( + 'name', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn elementType = GeneratedColumn( + 'element_type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn elementId = GeneratedColumn( + 'element_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + @override + List get $columns => [id, name, elementType, elementId]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'blacklist_table'; + @override + Set get $primaryKey => {id}; + @override + BlacklistTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return BlacklistTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, + elementType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}element_type'])!, + elementId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}element_id'])!, + ); + } + + @override + BlacklistTable createAlias(String alias) { + return BlacklistTable(attachedDatabase, alias); + } +} + +class BlacklistTableData extends DataClass + implements Insertable { + final int id; + final String name; + final String elementType; + final String elementId; + const BlacklistTableData( + {required this.id, + required this.name, + required this.elementType, + required this.elementId}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + map['element_type'] = Variable(elementType); + map['element_id'] = Variable(elementId); + return map; + } + + BlacklistTableCompanion toCompanion(bool nullToAbsent) { + return BlacklistTableCompanion( + id: Value(id), + name: Value(name), + elementType: Value(elementType), + elementId: Value(elementId), + ); + } + + factory BlacklistTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return BlacklistTableData( + id: serializer.fromJson(json['id']), + name: serializer.fromJson(json['name']), + elementType: serializer.fromJson(json['elementType']), + elementId: serializer.fromJson(json['elementId']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'name': serializer.toJson(name), + 'elementType': serializer.toJson(elementType), + 'elementId': serializer.toJson(elementId), + }; + } + + BlacklistTableData copyWith( + {int? id, String? name, String? elementType, String? elementId}) => + BlacklistTableData( + id: id ?? this.id, + name: name ?? this.name, + elementType: elementType ?? this.elementType, + elementId: elementId ?? this.elementId, + ); + BlacklistTableData copyWithCompanion(BlacklistTableCompanion data) { + return BlacklistTableData( + id: data.id.present ? data.id.value : this.id, + name: data.name.present ? data.name.value : this.name, + elementType: + data.elementType.present ? data.elementType.value : this.elementType, + elementId: data.elementId.present ? data.elementId.value : this.elementId, + ); + } + + @override + String toString() { + return (StringBuffer('BlacklistTableData(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('elementType: $elementType, ') + ..write('elementId: $elementId') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, name, elementType, elementId); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is BlacklistTableData && + other.id == this.id && + other.name == this.name && + other.elementType == this.elementType && + other.elementId == this.elementId); +} + +class BlacklistTableCompanion extends UpdateCompanion { + final Value id; + final Value name; + final Value elementType; + final Value elementId; + const BlacklistTableCompanion({ + this.id = const Value.absent(), + this.name = const Value.absent(), + this.elementType = const Value.absent(), + this.elementId = const Value.absent(), + }); + BlacklistTableCompanion.insert({ + this.id = const Value.absent(), + required String name, + required String elementType, + required String elementId, + }) : name = Value(name), + elementType = Value(elementType), + elementId = Value(elementId); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? elementType, + Expression? elementId, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (name != null) 'name': name, + if (elementType != null) 'element_type': elementType, + if (elementId != null) 'element_id': elementId, + }); + } + + BlacklistTableCompanion copyWith( + {Value? id, + Value? name, + Value? elementType, + Value? elementId}) { + return BlacklistTableCompanion( + id: id ?? this.id, + name: name ?? this.name, + elementType: elementType ?? this.elementType, + elementId: elementId ?? this.elementId, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (elementType.present) { + map['element_type'] = Variable(elementType.value); + } + if (elementId.present) { + map['element_id'] = Variable(elementId.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('BlacklistTableCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('elementType: $elementType, ') + ..write('elementId: $elementId') + ..write(')')) + .toString(); + } +} + +class PreferencesTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + PreferencesTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn audioQuality = GeneratedColumn( + 'audio_quality', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(SourceQualities.high.name)); + late final GeneratedColumn albumColorSync = GeneratedColumn( + 'album_color_sync', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("album_color_sync" IN (0, 1))'), + defaultValue: const Constant(true)); + late final GeneratedColumn amoledDarkTheme = GeneratedColumn( + 'amoled_dark_theme', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("amoled_dark_theme" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn checkUpdate = GeneratedColumn( + 'check_update', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("check_update" IN (0, 1))'), + defaultValue: const Constant(true)); + late final GeneratedColumn normalizeAudio = GeneratedColumn( + 'normalize_audio', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("normalize_audio" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn showSystemTrayIcon = GeneratedColumn( + 'show_system_tray_icon', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("show_system_tray_icon" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn systemTitleBar = GeneratedColumn( + 'system_title_bar', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("system_title_bar" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn skipNonMusic = GeneratedColumn( + 'skip_non_music', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("skip_non_music" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn closeBehavior = GeneratedColumn( + 'close_behavior', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(CloseBehavior.close.name)); + late final GeneratedColumn accentColorScheme = + GeneratedColumn('accent_color_scheme', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("Slate:0xff64748b")); + late final GeneratedColumn layoutMode = GeneratedColumn( + 'layout_mode', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(LayoutMode.adaptive.name)); + late final GeneratedColumn locale = GeneratedColumn( + 'locale', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: + const Constant('{"languageCode":"system","countryCode":"system"}')); + late final GeneratedColumn market = GeneratedColumn( + 'market', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(Market.US.name)); + late final GeneratedColumn searchMode = GeneratedColumn( + 'search_mode', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(SearchMode.youtube.name)); + late final GeneratedColumn downloadLocation = GeneratedColumn( + 'download_location', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("")); + late final GeneratedColumn localLibraryLocation = + GeneratedColumn('local_library_location', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("")); + late final GeneratedColumn pipedInstance = GeneratedColumn( + 'piped_instance', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("https://pipedapi.kavin.rocks")); + late final GeneratedColumn invidiousInstance = + GeneratedColumn('invidious_instance', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("https://inv.nadeko.net")); + late final GeneratedColumn themeMode = GeneratedColumn( + 'theme_mode', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(ThemeMode.system.name)); + late final GeneratedColumn audioSource = GeneratedColumn( + 'audio_source', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(AudioSource.youtube.name)); + late final GeneratedColumn youtubeClientEngine = + GeneratedColumn('youtube_client_engine', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(YoutubeClientEngine.youtubeExplode.name)); + late final GeneratedColumn streamMusicCodec = GeneratedColumn( + 'stream_music_codec', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(SourceCodecs.weba.name)); + late final GeneratedColumn downloadMusicCodec = + GeneratedColumn('download_music_codec', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(SourceCodecs.m4a.name)); + late final GeneratedColumn discordPresence = GeneratedColumn( + 'discord_presence', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("discord_presence" IN (0, 1))'), + defaultValue: const Constant(true)); + late final GeneratedColumn endlessPlayback = GeneratedColumn( + 'endless_playback', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("endless_playback" IN (0, 1))'), + defaultValue: const Constant(true)); + late final GeneratedColumn enableConnect = GeneratedColumn( + 'enable_connect', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("enable_connect" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn connectPort = GeneratedColumn( + 'connect_port', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(-1)); + late final GeneratedColumn cacheMusic = GeneratedColumn( + 'cache_music', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('CHECK ("cache_music" IN (0, 1))'), + defaultValue: const Constant(true)); + @override + List get $columns => [ + id, + audioQuality, + albumColorSync, + amoledDarkTheme, + checkUpdate, + normalizeAudio, + showSystemTrayIcon, + systemTitleBar, + skipNonMusic, + closeBehavior, + accentColorScheme, + layoutMode, + locale, + market, + searchMode, + downloadLocation, + localLibraryLocation, + pipedInstance, + invidiousInstance, + themeMode, + audioSource, + youtubeClientEngine, + streamMusicCodec, + downloadMusicCodec, + discordPresence, + endlessPlayback, + enableConnect, + connectPort, + cacheMusic + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'preferences_table'; + @override + Set get $primaryKey => {id}; + @override + PreferencesTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return PreferencesTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + audioQuality: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}audio_quality'])!, + albumColorSync: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}album_color_sync'])!, + amoledDarkTheme: attachedDatabase.typeMapping.read( + DriftSqlType.bool, data['${effectivePrefix}amoled_dark_theme'])!, + checkUpdate: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}check_update'])!, + normalizeAudio: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}normalize_audio'])!, + showSystemTrayIcon: attachedDatabase.typeMapping.read( + DriftSqlType.bool, data['${effectivePrefix}show_system_tray_icon'])!, + systemTitleBar: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}system_title_bar'])!, + skipNonMusic: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}skip_non_music'])!, + closeBehavior: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}close_behavior'])!, + accentColorScheme: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}accent_color_scheme'])!, + layoutMode: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}layout_mode'])!, + locale: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}locale'])!, + market: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}market'])!, + searchMode: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}search_mode'])!, + downloadLocation: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}download_location'])!, + localLibraryLocation: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}local_library_location'])!, + pipedInstance: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}piped_instance'])!, + invidiousInstance: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}invidious_instance'])!, + themeMode: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}theme_mode'])!, + audioSource: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}audio_source'])!, + youtubeClientEngine: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}youtube_client_engine'])!, + streamMusicCodec: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}stream_music_codec'])!, + downloadMusicCodec: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}download_music_codec'])!, + discordPresence: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}discord_presence'])!, + endlessPlayback: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}endless_playback'])!, + enableConnect: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}enable_connect'])!, + connectPort: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}connect_port'])!, + cacheMusic: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}cache_music'])!, + ); + } + + @override + PreferencesTable createAlias(String alias) { + return PreferencesTable(attachedDatabase, alias); + } +} + +class PreferencesTableData extends DataClass + implements Insertable { + final int id; + final String audioQuality; + final bool albumColorSync; + final bool amoledDarkTheme; + final bool checkUpdate; + final bool normalizeAudio; + final bool showSystemTrayIcon; + final bool systemTitleBar; + final bool skipNonMusic; + final String closeBehavior; + final String accentColorScheme; + final String layoutMode; + final String locale; + final String market; + final String searchMode; + final String downloadLocation; + final String localLibraryLocation; + final String pipedInstance; + final String invidiousInstance; + final String themeMode; + final String audioSource; + final String youtubeClientEngine; + final String streamMusicCodec; + final String downloadMusicCodec; + final bool discordPresence; + final bool endlessPlayback; + final bool enableConnect; + final int connectPort; + final bool cacheMusic; + const PreferencesTableData( + {required this.id, + required this.audioQuality, + required this.albumColorSync, + required this.amoledDarkTheme, + required this.checkUpdate, + required this.normalizeAudio, + required this.showSystemTrayIcon, + required this.systemTitleBar, + required this.skipNonMusic, + required this.closeBehavior, + required this.accentColorScheme, + required this.layoutMode, + required this.locale, + required this.market, + required this.searchMode, + required this.downloadLocation, + required this.localLibraryLocation, + required this.pipedInstance, + required this.invidiousInstance, + required this.themeMode, + required this.audioSource, + required this.youtubeClientEngine, + required this.streamMusicCodec, + required this.downloadMusicCodec, + required this.discordPresence, + required this.endlessPlayback, + required this.enableConnect, + required this.connectPort, + required this.cacheMusic}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['audio_quality'] = Variable(audioQuality); + map['album_color_sync'] = Variable(albumColorSync); + map['amoled_dark_theme'] = Variable(amoledDarkTheme); + map['check_update'] = Variable(checkUpdate); + map['normalize_audio'] = Variable(normalizeAudio); + map['show_system_tray_icon'] = Variable(showSystemTrayIcon); + map['system_title_bar'] = Variable(systemTitleBar); + map['skip_non_music'] = Variable(skipNonMusic); + map['close_behavior'] = Variable(closeBehavior); + map['accent_color_scheme'] = Variable(accentColorScheme); + map['layout_mode'] = Variable(layoutMode); + map['locale'] = Variable(locale); + map['market'] = Variable(market); + map['search_mode'] = Variable(searchMode); + map['download_location'] = Variable(downloadLocation); + map['local_library_location'] = Variable(localLibraryLocation); + map['piped_instance'] = Variable(pipedInstance); + map['invidious_instance'] = Variable(invidiousInstance); + map['theme_mode'] = Variable(themeMode); + map['audio_source'] = Variable(audioSource); + map['youtube_client_engine'] = Variable(youtubeClientEngine); + map['stream_music_codec'] = Variable(streamMusicCodec); + map['download_music_codec'] = Variable(downloadMusicCodec); + map['discord_presence'] = Variable(discordPresence); + map['endless_playback'] = Variable(endlessPlayback); + map['enable_connect'] = Variable(enableConnect); + map['connect_port'] = Variable(connectPort); + map['cache_music'] = Variable(cacheMusic); + return map; + } + + PreferencesTableCompanion toCompanion(bool nullToAbsent) { + return PreferencesTableCompanion( + id: Value(id), + audioQuality: Value(audioQuality), + albumColorSync: Value(albumColorSync), + amoledDarkTheme: Value(amoledDarkTheme), + checkUpdate: Value(checkUpdate), + normalizeAudio: Value(normalizeAudio), + showSystemTrayIcon: Value(showSystemTrayIcon), + systemTitleBar: Value(systemTitleBar), + skipNonMusic: Value(skipNonMusic), + closeBehavior: Value(closeBehavior), + accentColorScheme: Value(accentColorScheme), + layoutMode: Value(layoutMode), + locale: Value(locale), + market: Value(market), + searchMode: Value(searchMode), + downloadLocation: Value(downloadLocation), + localLibraryLocation: Value(localLibraryLocation), + pipedInstance: Value(pipedInstance), + invidiousInstance: Value(invidiousInstance), + themeMode: Value(themeMode), + audioSource: Value(audioSource), + youtubeClientEngine: Value(youtubeClientEngine), + streamMusicCodec: Value(streamMusicCodec), + downloadMusicCodec: Value(downloadMusicCodec), + discordPresence: Value(discordPresence), + endlessPlayback: Value(endlessPlayback), + enableConnect: Value(enableConnect), + connectPort: Value(connectPort), + cacheMusic: Value(cacheMusic), + ); + } + + factory PreferencesTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return PreferencesTableData( + id: serializer.fromJson(json['id']), + audioQuality: serializer.fromJson(json['audioQuality']), + albumColorSync: serializer.fromJson(json['albumColorSync']), + amoledDarkTheme: serializer.fromJson(json['amoledDarkTheme']), + checkUpdate: serializer.fromJson(json['checkUpdate']), + normalizeAudio: serializer.fromJson(json['normalizeAudio']), + showSystemTrayIcon: serializer.fromJson(json['showSystemTrayIcon']), + systemTitleBar: serializer.fromJson(json['systemTitleBar']), + skipNonMusic: serializer.fromJson(json['skipNonMusic']), + closeBehavior: serializer.fromJson(json['closeBehavior']), + accentColorScheme: serializer.fromJson(json['accentColorScheme']), + layoutMode: serializer.fromJson(json['layoutMode']), + locale: serializer.fromJson(json['locale']), + market: serializer.fromJson(json['market']), + searchMode: serializer.fromJson(json['searchMode']), + downloadLocation: serializer.fromJson(json['downloadLocation']), + localLibraryLocation: + serializer.fromJson(json['localLibraryLocation']), + pipedInstance: serializer.fromJson(json['pipedInstance']), + invidiousInstance: serializer.fromJson(json['invidiousInstance']), + themeMode: serializer.fromJson(json['themeMode']), + audioSource: serializer.fromJson(json['audioSource']), + youtubeClientEngine: + serializer.fromJson(json['youtubeClientEngine']), + streamMusicCodec: serializer.fromJson(json['streamMusicCodec']), + downloadMusicCodec: + serializer.fromJson(json['downloadMusicCodec']), + discordPresence: serializer.fromJson(json['discordPresence']), + endlessPlayback: serializer.fromJson(json['endlessPlayback']), + enableConnect: serializer.fromJson(json['enableConnect']), + connectPort: serializer.fromJson(json['connectPort']), + cacheMusic: serializer.fromJson(json['cacheMusic']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'audioQuality': serializer.toJson(audioQuality), + 'albumColorSync': serializer.toJson(albumColorSync), + 'amoledDarkTheme': serializer.toJson(amoledDarkTheme), + 'checkUpdate': serializer.toJson(checkUpdate), + 'normalizeAudio': serializer.toJson(normalizeAudio), + 'showSystemTrayIcon': serializer.toJson(showSystemTrayIcon), + 'systemTitleBar': serializer.toJson(systemTitleBar), + 'skipNonMusic': serializer.toJson(skipNonMusic), + 'closeBehavior': serializer.toJson(closeBehavior), + 'accentColorScheme': serializer.toJson(accentColorScheme), + 'layoutMode': serializer.toJson(layoutMode), + 'locale': serializer.toJson(locale), + 'market': serializer.toJson(market), + 'searchMode': serializer.toJson(searchMode), + 'downloadLocation': serializer.toJson(downloadLocation), + 'localLibraryLocation': serializer.toJson(localLibraryLocation), + 'pipedInstance': serializer.toJson(pipedInstance), + 'invidiousInstance': serializer.toJson(invidiousInstance), + 'themeMode': serializer.toJson(themeMode), + 'audioSource': serializer.toJson(audioSource), + 'youtubeClientEngine': serializer.toJson(youtubeClientEngine), + 'streamMusicCodec': serializer.toJson(streamMusicCodec), + 'downloadMusicCodec': serializer.toJson(downloadMusicCodec), + 'discordPresence': serializer.toJson(discordPresence), + 'endlessPlayback': serializer.toJson(endlessPlayback), + 'enableConnect': serializer.toJson(enableConnect), + 'connectPort': serializer.toJson(connectPort), + 'cacheMusic': serializer.toJson(cacheMusic), + }; + } + + PreferencesTableData copyWith( + {int? id, + String? audioQuality, + bool? albumColorSync, + bool? amoledDarkTheme, + bool? checkUpdate, + bool? normalizeAudio, + bool? showSystemTrayIcon, + bool? systemTitleBar, + bool? skipNonMusic, + String? closeBehavior, + String? accentColorScheme, + String? layoutMode, + String? locale, + String? market, + String? searchMode, + String? downloadLocation, + String? localLibraryLocation, + String? pipedInstance, + String? invidiousInstance, + String? themeMode, + String? audioSource, + String? youtubeClientEngine, + String? streamMusicCodec, + String? downloadMusicCodec, + bool? discordPresence, + bool? endlessPlayback, + bool? enableConnect, + int? connectPort, + bool? cacheMusic}) => + PreferencesTableData( + id: id ?? this.id, + audioQuality: audioQuality ?? this.audioQuality, + albumColorSync: albumColorSync ?? this.albumColorSync, + amoledDarkTheme: amoledDarkTheme ?? this.amoledDarkTheme, + checkUpdate: checkUpdate ?? this.checkUpdate, + normalizeAudio: normalizeAudio ?? this.normalizeAudio, + showSystemTrayIcon: showSystemTrayIcon ?? this.showSystemTrayIcon, + systemTitleBar: systemTitleBar ?? this.systemTitleBar, + skipNonMusic: skipNonMusic ?? this.skipNonMusic, + closeBehavior: closeBehavior ?? this.closeBehavior, + accentColorScheme: accentColorScheme ?? this.accentColorScheme, + layoutMode: layoutMode ?? this.layoutMode, + locale: locale ?? this.locale, + market: market ?? this.market, + searchMode: searchMode ?? this.searchMode, + downloadLocation: downloadLocation ?? this.downloadLocation, + localLibraryLocation: localLibraryLocation ?? this.localLibraryLocation, + pipedInstance: pipedInstance ?? this.pipedInstance, + invidiousInstance: invidiousInstance ?? this.invidiousInstance, + themeMode: themeMode ?? this.themeMode, + audioSource: audioSource ?? this.audioSource, + youtubeClientEngine: youtubeClientEngine ?? this.youtubeClientEngine, + streamMusicCodec: streamMusicCodec ?? this.streamMusicCodec, + downloadMusicCodec: downloadMusicCodec ?? this.downloadMusicCodec, + discordPresence: discordPresence ?? this.discordPresence, + endlessPlayback: endlessPlayback ?? this.endlessPlayback, + enableConnect: enableConnect ?? this.enableConnect, + connectPort: connectPort ?? this.connectPort, + cacheMusic: cacheMusic ?? this.cacheMusic, + ); + PreferencesTableData copyWithCompanion(PreferencesTableCompanion data) { + return PreferencesTableData( + id: data.id.present ? data.id.value : this.id, + audioQuality: data.audioQuality.present + ? data.audioQuality.value + : this.audioQuality, + albumColorSync: data.albumColorSync.present + ? data.albumColorSync.value + : this.albumColorSync, + amoledDarkTheme: data.amoledDarkTheme.present + ? data.amoledDarkTheme.value + : this.amoledDarkTheme, + checkUpdate: + data.checkUpdate.present ? data.checkUpdate.value : this.checkUpdate, + normalizeAudio: data.normalizeAudio.present + ? data.normalizeAudio.value + : this.normalizeAudio, + showSystemTrayIcon: data.showSystemTrayIcon.present + ? data.showSystemTrayIcon.value + : this.showSystemTrayIcon, + systemTitleBar: data.systemTitleBar.present + ? data.systemTitleBar.value + : this.systemTitleBar, + skipNonMusic: data.skipNonMusic.present + ? data.skipNonMusic.value + : this.skipNonMusic, + closeBehavior: data.closeBehavior.present + ? data.closeBehavior.value + : this.closeBehavior, + accentColorScheme: data.accentColorScheme.present + ? data.accentColorScheme.value + : this.accentColorScheme, + layoutMode: + data.layoutMode.present ? data.layoutMode.value : this.layoutMode, + locale: data.locale.present ? data.locale.value : this.locale, + market: data.market.present ? data.market.value : this.market, + searchMode: + data.searchMode.present ? data.searchMode.value : this.searchMode, + downloadLocation: data.downloadLocation.present + ? data.downloadLocation.value + : this.downloadLocation, + localLibraryLocation: data.localLibraryLocation.present + ? data.localLibraryLocation.value + : this.localLibraryLocation, + pipedInstance: data.pipedInstance.present + ? data.pipedInstance.value + : this.pipedInstance, + invidiousInstance: data.invidiousInstance.present + ? data.invidiousInstance.value + : this.invidiousInstance, + themeMode: data.themeMode.present ? data.themeMode.value : this.themeMode, + audioSource: + data.audioSource.present ? data.audioSource.value : this.audioSource, + youtubeClientEngine: data.youtubeClientEngine.present + ? data.youtubeClientEngine.value + : this.youtubeClientEngine, + streamMusicCodec: data.streamMusicCodec.present + ? data.streamMusicCodec.value + : this.streamMusicCodec, + downloadMusicCodec: data.downloadMusicCodec.present + ? data.downloadMusicCodec.value + : this.downloadMusicCodec, + discordPresence: data.discordPresence.present + ? data.discordPresence.value + : this.discordPresence, + endlessPlayback: data.endlessPlayback.present + ? data.endlessPlayback.value + : this.endlessPlayback, + enableConnect: data.enableConnect.present + ? data.enableConnect.value + : this.enableConnect, + connectPort: + data.connectPort.present ? data.connectPort.value : this.connectPort, + cacheMusic: + data.cacheMusic.present ? data.cacheMusic.value : this.cacheMusic, + ); + } + + @override + String toString() { + return (StringBuffer('PreferencesTableData(') + ..write('id: $id, ') + ..write('audioQuality: $audioQuality, ') + ..write('albumColorSync: $albumColorSync, ') + ..write('amoledDarkTheme: $amoledDarkTheme, ') + ..write('checkUpdate: $checkUpdate, ') + ..write('normalizeAudio: $normalizeAudio, ') + ..write('showSystemTrayIcon: $showSystemTrayIcon, ') + ..write('systemTitleBar: $systemTitleBar, ') + ..write('skipNonMusic: $skipNonMusic, ') + ..write('closeBehavior: $closeBehavior, ') + ..write('accentColorScheme: $accentColorScheme, ') + ..write('layoutMode: $layoutMode, ') + ..write('locale: $locale, ') + ..write('market: $market, ') + ..write('searchMode: $searchMode, ') + ..write('downloadLocation: $downloadLocation, ') + ..write('localLibraryLocation: $localLibraryLocation, ') + ..write('pipedInstance: $pipedInstance, ') + ..write('invidiousInstance: $invidiousInstance, ') + ..write('themeMode: $themeMode, ') + ..write('audioSource: $audioSource, ') + ..write('youtubeClientEngine: $youtubeClientEngine, ') + ..write('streamMusicCodec: $streamMusicCodec, ') + ..write('downloadMusicCodec: $downloadMusicCodec, ') + ..write('discordPresence: $discordPresence, ') + ..write('endlessPlayback: $endlessPlayback, ') + ..write('enableConnect: $enableConnect, ') + ..write('connectPort: $connectPort, ') + ..write('cacheMusic: $cacheMusic') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hashAll([ + id, + audioQuality, + albumColorSync, + amoledDarkTheme, + checkUpdate, + normalizeAudio, + showSystemTrayIcon, + systemTitleBar, + skipNonMusic, + closeBehavior, + accentColorScheme, + layoutMode, + locale, + market, + searchMode, + downloadLocation, + localLibraryLocation, + pipedInstance, + invidiousInstance, + themeMode, + audioSource, + youtubeClientEngine, + streamMusicCodec, + downloadMusicCodec, + discordPresence, + endlessPlayback, + enableConnect, + connectPort, + cacheMusic + ]); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is PreferencesTableData && + other.id == this.id && + other.audioQuality == this.audioQuality && + other.albumColorSync == this.albumColorSync && + other.amoledDarkTheme == this.amoledDarkTheme && + other.checkUpdate == this.checkUpdate && + other.normalizeAudio == this.normalizeAudio && + other.showSystemTrayIcon == this.showSystemTrayIcon && + other.systemTitleBar == this.systemTitleBar && + other.skipNonMusic == this.skipNonMusic && + other.closeBehavior == this.closeBehavior && + other.accentColorScheme == this.accentColorScheme && + other.layoutMode == this.layoutMode && + other.locale == this.locale && + other.market == this.market && + other.searchMode == this.searchMode && + other.downloadLocation == this.downloadLocation && + other.localLibraryLocation == this.localLibraryLocation && + other.pipedInstance == this.pipedInstance && + other.invidiousInstance == this.invidiousInstance && + other.themeMode == this.themeMode && + other.audioSource == this.audioSource && + other.youtubeClientEngine == this.youtubeClientEngine && + other.streamMusicCodec == this.streamMusicCodec && + other.downloadMusicCodec == this.downloadMusicCodec && + other.discordPresence == this.discordPresence && + other.endlessPlayback == this.endlessPlayback && + other.enableConnect == this.enableConnect && + other.connectPort == this.connectPort && + other.cacheMusic == this.cacheMusic); +} + +class PreferencesTableCompanion extends UpdateCompanion { + final Value id; + final Value audioQuality; + final Value albumColorSync; + final Value amoledDarkTheme; + final Value checkUpdate; + final Value normalizeAudio; + final Value showSystemTrayIcon; + final Value systemTitleBar; + final Value skipNonMusic; + final Value closeBehavior; + final Value accentColorScheme; + final Value layoutMode; + final Value locale; + final Value market; + final Value searchMode; + final Value downloadLocation; + final Value localLibraryLocation; + final Value pipedInstance; + final Value invidiousInstance; + final Value themeMode; + final Value audioSource; + final Value youtubeClientEngine; + final Value streamMusicCodec; + final Value downloadMusicCodec; + final Value discordPresence; + final Value endlessPlayback; + final Value enableConnect; + final Value connectPort; + final Value cacheMusic; + const PreferencesTableCompanion({ + this.id = const Value.absent(), + this.audioQuality = const Value.absent(), + this.albumColorSync = const Value.absent(), + this.amoledDarkTheme = const Value.absent(), + this.checkUpdate = const Value.absent(), + this.normalizeAudio = const Value.absent(), + this.showSystemTrayIcon = const Value.absent(), + this.systemTitleBar = const Value.absent(), + this.skipNonMusic = const Value.absent(), + this.closeBehavior = const Value.absent(), + this.accentColorScheme = const Value.absent(), + this.layoutMode = const Value.absent(), + this.locale = const Value.absent(), + this.market = const Value.absent(), + this.searchMode = const Value.absent(), + this.downloadLocation = const Value.absent(), + this.localLibraryLocation = const Value.absent(), + this.pipedInstance = const Value.absent(), + this.invidiousInstance = const Value.absent(), + this.themeMode = const Value.absent(), + this.audioSource = const Value.absent(), + this.youtubeClientEngine = const Value.absent(), + this.streamMusicCodec = const Value.absent(), + this.downloadMusicCodec = const Value.absent(), + this.discordPresence = const Value.absent(), + this.endlessPlayback = const Value.absent(), + this.enableConnect = const Value.absent(), + this.connectPort = const Value.absent(), + this.cacheMusic = const Value.absent(), + }); + PreferencesTableCompanion.insert({ + this.id = const Value.absent(), + this.audioQuality = const Value.absent(), + this.albumColorSync = const Value.absent(), + this.amoledDarkTheme = const Value.absent(), + this.checkUpdate = const Value.absent(), + this.normalizeAudio = const Value.absent(), + this.showSystemTrayIcon = const Value.absent(), + this.systemTitleBar = const Value.absent(), + this.skipNonMusic = const Value.absent(), + this.closeBehavior = const Value.absent(), + this.accentColorScheme = const Value.absent(), + this.layoutMode = const Value.absent(), + this.locale = const Value.absent(), + this.market = const Value.absent(), + this.searchMode = const Value.absent(), + this.downloadLocation = const Value.absent(), + this.localLibraryLocation = const Value.absent(), + this.pipedInstance = const Value.absent(), + this.invidiousInstance = const Value.absent(), + this.themeMode = const Value.absent(), + this.audioSource = const Value.absent(), + this.youtubeClientEngine = const Value.absent(), + this.streamMusicCodec = const Value.absent(), + this.downloadMusicCodec = const Value.absent(), + this.discordPresence = const Value.absent(), + this.endlessPlayback = const Value.absent(), + this.enableConnect = const Value.absent(), + this.connectPort = const Value.absent(), + this.cacheMusic = const Value.absent(), + }); + static Insertable custom({ + Expression? id, + Expression? audioQuality, + Expression? albumColorSync, + Expression? amoledDarkTheme, + Expression? checkUpdate, + Expression? normalizeAudio, + Expression? showSystemTrayIcon, + Expression? systemTitleBar, + Expression? skipNonMusic, + Expression? closeBehavior, + Expression? accentColorScheme, + Expression? layoutMode, + Expression? locale, + Expression? market, + Expression? searchMode, + Expression? downloadLocation, + Expression? localLibraryLocation, + Expression? pipedInstance, + Expression? invidiousInstance, + Expression? themeMode, + Expression? audioSource, + Expression? youtubeClientEngine, + Expression? streamMusicCodec, + Expression? downloadMusicCodec, + Expression? discordPresence, + Expression? endlessPlayback, + Expression? enableConnect, + Expression? connectPort, + Expression? cacheMusic, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (audioQuality != null) 'audio_quality': audioQuality, + if (albumColorSync != null) 'album_color_sync': albumColorSync, + if (amoledDarkTheme != null) 'amoled_dark_theme': amoledDarkTheme, + if (checkUpdate != null) 'check_update': checkUpdate, + if (normalizeAudio != null) 'normalize_audio': normalizeAudio, + if (showSystemTrayIcon != null) + 'show_system_tray_icon': showSystemTrayIcon, + if (systemTitleBar != null) 'system_title_bar': systemTitleBar, + if (skipNonMusic != null) 'skip_non_music': skipNonMusic, + if (closeBehavior != null) 'close_behavior': closeBehavior, + if (accentColorScheme != null) 'accent_color_scheme': accentColorScheme, + if (layoutMode != null) 'layout_mode': layoutMode, + if (locale != null) 'locale': locale, + if (market != null) 'market': market, + if (searchMode != null) 'search_mode': searchMode, + if (downloadLocation != null) 'download_location': downloadLocation, + if (localLibraryLocation != null) + 'local_library_location': localLibraryLocation, + if (pipedInstance != null) 'piped_instance': pipedInstance, + if (invidiousInstance != null) 'invidious_instance': invidiousInstance, + if (themeMode != null) 'theme_mode': themeMode, + if (audioSource != null) 'audio_source': audioSource, + if (youtubeClientEngine != null) + 'youtube_client_engine': youtubeClientEngine, + if (streamMusicCodec != null) 'stream_music_codec': streamMusicCodec, + if (downloadMusicCodec != null) + 'download_music_codec': downloadMusicCodec, + if (discordPresence != null) 'discord_presence': discordPresence, + if (endlessPlayback != null) 'endless_playback': endlessPlayback, + if (enableConnect != null) 'enable_connect': enableConnect, + if (connectPort != null) 'connect_port': connectPort, + if (cacheMusic != null) 'cache_music': cacheMusic, + }); + } + + PreferencesTableCompanion copyWith( + {Value? id, + Value? audioQuality, + Value? albumColorSync, + Value? amoledDarkTheme, + Value? checkUpdate, + Value? normalizeAudio, + Value? showSystemTrayIcon, + Value? systemTitleBar, + Value? skipNonMusic, + Value? closeBehavior, + Value? accentColorScheme, + Value? layoutMode, + Value? locale, + Value? market, + Value? searchMode, + Value? downloadLocation, + Value? localLibraryLocation, + Value? pipedInstance, + Value? invidiousInstance, + Value? themeMode, + Value? audioSource, + Value? youtubeClientEngine, + Value? streamMusicCodec, + Value? downloadMusicCodec, + Value? discordPresence, + Value? endlessPlayback, + Value? enableConnect, + Value? connectPort, + Value? cacheMusic}) { + return PreferencesTableCompanion( + id: id ?? this.id, + audioQuality: audioQuality ?? this.audioQuality, + albumColorSync: albumColorSync ?? this.albumColorSync, + amoledDarkTheme: amoledDarkTheme ?? this.amoledDarkTheme, + checkUpdate: checkUpdate ?? this.checkUpdate, + normalizeAudio: normalizeAudio ?? this.normalizeAudio, + showSystemTrayIcon: showSystemTrayIcon ?? this.showSystemTrayIcon, + systemTitleBar: systemTitleBar ?? this.systemTitleBar, + skipNonMusic: skipNonMusic ?? this.skipNonMusic, + closeBehavior: closeBehavior ?? this.closeBehavior, + accentColorScheme: accentColorScheme ?? this.accentColorScheme, + layoutMode: layoutMode ?? this.layoutMode, + locale: locale ?? this.locale, + market: market ?? this.market, + searchMode: searchMode ?? this.searchMode, + downloadLocation: downloadLocation ?? this.downloadLocation, + localLibraryLocation: localLibraryLocation ?? this.localLibraryLocation, + pipedInstance: pipedInstance ?? this.pipedInstance, + invidiousInstance: invidiousInstance ?? this.invidiousInstance, + themeMode: themeMode ?? this.themeMode, + audioSource: audioSource ?? this.audioSource, + youtubeClientEngine: youtubeClientEngine ?? this.youtubeClientEngine, + streamMusicCodec: streamMusicCodec ?? this.streamMusicCodec, + downloadMusicCodec: downloadMusicCodec ?? this.downloadMusicCodec, + discordPresence: discordPresence ?? this.discordPresence, + endlessPlayback: endlessPlayback ?? this.endlessPlayback, + enableConnect: enableConnect ?? this.enableConnect, + connectPort: connectPort ?? this.connectPort, + cacheMusic: cacheMusic ?? this.cacheMusic, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (audioQuality.present) { + map['audio_quality'] = Variable(audioQuality.value); + } + if (albumColorSync.present) { + map['album_color_sync'] = Variable(albumColorSync.value); + } + if (amoledDarkTheme.present) { + map['amoled_dark_theme'] = Variable(amoledDarkTheme.value); + } + if (checkUpdate.present) { + map['check_update'] = Variable(checkUpdate.value); + } + if (normalizeAudio.present) { + map['normalize_audio'] = Variable(normalizeAudio.value); + } + if (showSystemTrayIcon.present) { + map['show_system_tray_icon'] = Variable(showSystemTrayIcon.value); + } + if (systemTitleBar.present) { + map['system_title_bar'] = Variable(systemTitleBar.value); + } + if (skipNonMusic.present) { + map['skip_non_music'] = Variable(skipNonMusic.value); + } + if (closeBehavior.present) { + map['close_behavior'] = Variable(closeBehavior.value); + } + if (accentColorScheme.present) { + map['accent_color_scheme'] = Variable(accentColorScheme.value); + } + if (layoutMode.present) { + map['layout_mode'] = Variable(layoutMode.value); + } + if (locale.present) { + map['locale'] = Variable(locale.value); + } + if (market.present) { + map['market'] = Variable(market.value); + } + if (searchMode.present) { + map['search_mode'] = Variable(searchMode.value); + } + if (downloadLocation.present) { + map['download_location'] = Variable(downloadLocation.value); + } + if (localLibraryLocation.present) { + map['local_library_location'] = + Variable(localLibraryLocation.value); + } + if (pipedInstance.present) { + map['piped_instance'] = Variable(pipedInstance.value); + } + if (invidiousInstance.present) { + map['invidious_instance'] = Variable(invidiousInstance.value); + } + if (themeMode.present) { + map['theme_mode'] = Variable(themeMode.value); + } + if (audioSource.present) { + map['audio_source'] = Variable(audioSource.value); + } + if (youtubeClientEngine.present) { + map['youtube_client_engine'] = + Variable(youtubeClientEngine.value); + } + if (streamMusicCodec.present) { + map['stream_music_codec'] = Variable(streamMusicCodec.value); + } + if (downloadMusicCodec.present) { + map['download_music_codec'] = Variable(downloadMusicCodec.value); + } + if (discordPresence.present) { + map['discord_presence'] = Variable(discordPresence.value); + } + if (endlessPlayback.present) { + map['endless_playback'] = Variable(endlessPlayback.value); + } + if (enableConnect.present) { + map['enable_connect'] = Variable(enableConnect.value); + } + if (connectPort.present) { + map['connect_port'] = Variable(connectPort.value); + } + if (cacheMusic.present) { + map['cache_music'] = Variable(cacheMusic.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('PreferencesTableCompanion(') + ..write('id: $id, ') + ..write('audioQuality: $audioQuality, ') + ..write('albumColorSync: $albumColorSync, ') + ..write('amoledDarkTheme: $amoledDarkTheme, ') + ..write('checkUpdate: $checkUpdate, ') + ..write('normalizeAudio: $normalizeAudio, ') + ..write('showSystemTrayIcon: $showSystemTrayIcon, ') + ..write('systemTitleBar: $systemTitleBar, ') + ..write('skipNonMusic: $skipNonMusic, ') + ..write('closeBehavior: $closeBehavior, ') + ..write('accentColorScheme: $accentColorScheme, ') + ..write('layoutMode: $layoutMode, ') + ..write('locale: $locale, ') + ..write('market: $market, ') + ..write('searchMode: $searchMode, ') + ..write('downloadLocation: $downloadLocation, ') + ..write('localLibraryLocation: $localLibraryLocation, ') + ..write('pipedInstance: $pipedInstance, ') + ..write('invidiousInstance: $invidiousInstance, ') + ..write('themeMode: $themeMode, ') + ..write('audioSource: $audioSource, ') + ..write('youtubeClientEngine: $youtubeClientEngine, ') + ..write('streamMusicCodec: $streamMusicCodec, ') + ..write('downloadMusicCodec: $downloadMusicCodec, ') + ..write('discordPresence: $discordPresence, ') + ..write('endlessPlayback: $endlessPlayback, ') + ..write('enableConnect: $enableConnect, ') + ..write('connectPort: $connectPort, ') + ..write('cacheMusic: $cacheMusic') + ..write(')')) + .toString(); + } +} + +class ScrobblerTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + ScrobblerTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime); + late final GeneratedColumn username = GeneratedColumn( + 'username', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn passwordHash = GeneratedColumn( + 'password_hash', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + @override + List get $columns => [id, createdAt, username, passwordHash]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'scrobbler_table'; + @override + Set get $primaryKey => {id}; + @override + ScrobblerTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return ScrobblerTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + username: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}username'])!, + passwordHash: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}password_hash'])!, + ); + } + + @override + ScrobblerTable createAlias(String alias) { + return ScrobblerTable(attachedDatabase, alias); + } +} + +class ScrobblerTableData extends DataClass + implements Insertable { + final int id; + final DateTime createdAt; + final String username; + final String passwordHash; + const ScrobblerTableData( + {required this.id, + required this.createdAt, + required this.username, + required this.passwordHash}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['created_at'] = Variable(createdAt); + map['username'] = Variable(username); + map['password_hash'] = Variable(passwordHash); + return map; + } + + ScrobblerTableCompanion toCompanion(bool nullToAbsent) { + return ScrobblerTableCompanion( + id: Value(id), + createdAt: Value(createdAt), + username: Value(username), + passwordHash: Value(passwordHash), + ); + } + + factory ScrobblerTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return ScrobblerTableData( + id: serializer.fromJson(json['id']), + createdAt: serializer.fromJson(json['createdAt']), + username: serializer.fromJson(json['username']), + passwordHash: serializer.fromJson(json['passwordHash']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'createdAt': serializer.toJson(createdAt), + 'username': serializer.toJson(username), + 'passwordHash': serializer.toJson(passwordHash), + }; + } + + ScrobblerTableData copyWith( + {int? id, + DateTime? createdAt, + String? username, + String? passwordHash}) => + ScrobblerTableData( + id: id ?? this.id, + createdAt: createdAt ?? this.createdAt, + username: username ?? this.username, + passwordHash: passwordHash ?? this.passwordHash, + ); + ScrobblerTableData copyWithCompanion(ScrobblerTableCompanion data) { + return ScrobblerTableData( + id: data.id.present ? data.id.value : this.id, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + username: data.username.present ? data.username.value : this.username, + passwordHash: data.passwordHash.present + ? data.passwordHash.value + : this.passwordHash, + ); + } + + @override + String toString() { + return (StringBuffer('ScrobblerTableData(') + ..write('id: $id, ') + ..write('createdAt: $createdAt, ') + ..write('username: $username, ') + ..write('passwordHash: $passwordHash') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, createdAt, username, passwordHash); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is ScrobblerTableData && + other.id == this.id && + other.createdAt == this.createdAt && + other.username == this.username && + other.passwordHash == this.passwordHash); +} + +class ScrobblerTableCompanion extends UpdateCompanion { + final Value id; + final Value createdAt; + final Value username; + final Value passwordHash; + const ScrobblerTableCompanion({ + this.id = const Value.absent(), + this.createdAt = const Value.absent(), + this.username = const Value.absent(), + this.passwordHash = const Value.absent(), + }); + ScrobblerTableCompanion.insert({ + this.id = const Value.absent(), + this.createdAt = const Value.absent(), + required String username, + required String passwordHash, + }) : username = Value(username), + passwordHash = Value(passwordHash); + static Insertable custom({ + Expression? id, + Expression? createdAt, + Expression? username, + Expression? passwordHash, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (createdAt != null) 'created_at': createdAt, + if (username != null) 'username': username, + if (passwordHash != null) 'password_hash': passwordHash, + }); + } + + ScrobblerTableCompanion copyWith( + {Value? id, + Value? createdAt, + Value? username, + Value? passwordHash}) { + return ScrobblerTableCompanion( + id: id ?? this.id, + createdAt: createdAt ?? this.createdAt, + username: username ?? this.username, + passwordHash: passwordHash ?? this.passwordHash, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (username.present) { + map['username'] = Variable(username.value); + } + if (passwordHash.present) { + map['password_hash'] = Variable(passwordHash.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('ScrobblerTableCompanion(') + ..write('id: $id, ') + ..write('createdAt: $createdAt, ') + ..write('username: $username, ') + ..write('passwordHash: $passwordHash') + ..write(')')) + .toString(); + } +} + +class SkipSegmentTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SkipSegmentTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn start = GeneratedColumn( + 'start', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn end = GeneratedColumn( + 'end', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + late final GeneratedColumn trackId = GeneratedColumn( + 'track_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime); + @override + List get $columns => [id, start, end, trackId, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'skip_segment_table'; + @override + Set get $primaryKey => {id}; + @override + SkipSegmentTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SkipSegmentTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + start: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}start'])!, + end: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}end'])!, + trackId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}track_id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SkipSegmentTable createAlias(String alias) { + return SkipSegmentTable(attachedDatabase, alias); + } +} + +class SkipSegmentTableData extends DataClass + implements Insertable { + final int id; + final int start; + final int end; + final String trackId; + final DateTime createdAt; + const SkipSegmentTableData( + {required this.id, + required this.start, + required this.end, + required this.trackId, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['start'] = Variable(start); + map['end'] = Variable(end); + map['track_id'] = Variable(trackId); + map['created_at'] = Variable(createdAt); + return map; + } + + SkipSegmentTableCompanion toCompanion(bool nullToAbsent) { + return SkipSegmentTableCompanion( + id: Value(id), + start: Value(start), + end: Value(end), + trackId: Value(trackId), + createdAt: Value(createdAt), + ); + } + + factory SkipSegmentTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SkipSegmentTableData( + id: serializer.fromJson(json['id']), + start: serializer.fromJson(json['start']), + end: serializer.fromJson(json['end']), + trackId: serializer.fromJson(json['trackId']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'start': serializer.toJson(start), + 'end': serializer.toJson(end), + 'trackId': serializer.toJson(trackId), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SkipSegmentTableData copyWith( + {int? id, + int? start, + int? end, + String? trackId, + DateTime? createdAt}) => + SkipSegmentTableData( + id: id ?? this.id, + start: start ?? this.start, + end: end ?? this.end, + trackId: trackId ?? this.trackId, + createdAt: createdAt ?? this.createdAt, + ); + SkipSegmentTableData copyWithCompanion(SkipSegmentTableCompanion data) { + return SkipSegmentTableData( + id: data.id.present ? data.id.value : this.id, + start: data.start.present ? data.start.value : this.start, + end: data.end.present ? data.end.value : this.end, + trackId: data.trackId.present ? data.trackId.value : this.trackId, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SkipSegmentTableData(') + ..write('id: $id, ') + ..write('start: $start, ') + ..write('end: $end, ') + ..write('trackId: $trackId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, start, end, trackId, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SkipSegmentTableData && + other.id == this.id && + other.start == this.start && + other.end == this.end && + other.trackId == this.trackId && + other.createdAt == this.createdAt); +} + +class SkipSegmentTableCompanion extends UpdateCompanion { + final Value id; + final Value start; + final Value end; + final Value trackId; + final Value createdAt; + const SkipSegmentTableCompanion({ + this.id = const Value.absent(), + this.start = const Value.absent(), + this.end = const Value.absent(), + this.trackId = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SkipSegmentTableCompanion.insert({ + this.id = const Value.absent(), + required int start, + required int end, + required String trackId, + this.createdAt = const Value.absent(), + }) : start = Value(start), + end = Value(end), + trackId = Value(trackId); + static Insertable custom({ + Expression? id, + Expression? start, + Expression? end, + Expression? trackId, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (start != null) 'start': start, + if (end != null) 'end': end, + if (trackId != null) 'track_id': trackId, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SkipSegmentTableCompanion copyWith( + {Value? id, + Value? start, + Value? end, + Value? trackId, + Value? createdAt}) { + return SkipSegmentTableCompanion( + id: id ?? this.id, + start: start ?? this.start, + end: end ?? this.end, + trackId: trackId ?? this.trackId, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (start.present) { + map['start'] = Variable(start.value); + } + if (end.present) { + map['end'] = Variable(end.value); + } + if (trackId.present) { + map['track_id'] = Variable(trackId.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SkipSegmentTableCompanion(') + ..write('id: $id, ') + ..write('start: $start, ') + ..write('end: $end, ') + ..write('trackId: $trackId, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class SourceMatchTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + SourceMatchTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn trackId = GeneratedColumn( + 'track_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn sourceId = GeneratedColumn( + 'source_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn sourceType = GeneratedColumn( + 'source_type', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: Constant(SourceType.youtube.name)); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime); + @override + List get $columns => + [id, trackId, sourceId, sourceType, createdAt]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'source_match_table'; + @override + Set get $primaryKey => {id}; + @override + SourceMatchTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return SourceMatchTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + trackId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}track_id'])!, + sourceId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}source_id'])!, + sourceType: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}source_type'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + ); + } + + @override + SourceMatchTable createAlias(String alias) { + return SourceMatchTable(attachedDatabase, alias); + } +} + +class SourceMatchTableData extends DataClass + implements Insertable { + final int id; + final String trackId; + final String sourceId; + final String sourceType; + final DateTime createdAt; + const SourceMatchTableData( + {required this.id, + required this.trackId, + required this.sourceId, + required this.sourceType, + required this.createdAt}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['track_id'] = Variable(trackId); + map['source_id'] = Variable(sourceId); + map['source_type'] = Variable(sourceType); + map['created_at'] = Variable(createdAt); + return map; + } + + SourceMatchTableCompanion toCompanion(bool nullToAbsent) { + return SourceMatchTableCompanion( + id: Value(id), + trackId: Value(trackId), + sourceId: Value(sourceId), + sourceType: Value(sourceType), + createdAt: Value(createdAt), + ); + } + + factory SourceMatchTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return SourceMatchTableData( + id: serializer.fromJson(json['id']), + trackId: serializer.fromJson(json['trackId']), + sourceId: serializer.fromJson(json['sourceId']), + sourceType: serializer.fromJson(json['sourceType']), + createdAt: serializer.fromJson(json['createdAt']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'trackId': serializer.toJson(trackId), + 'sourceId': serializer.toJson(sourceId), + 'sourceType': serializer.toJson(sourceType), + 'createdAt': serializer.toJson(createdAt), + }; + } + + SourceMatchTableData copyWith( + {int? id, + String? trackId, + String? sourceId, + String? sourceType, + DateTime? createdAt}) => + SourceMatchTableData( + id: id ?? this.id, + trackId: trackId ?? this.trackId, + sourceId: sourceId ?? this.sourceId, + sourceType: sourceType ?? this.sourceType, + createdAt: createdAt ?? this.createdAt, + ); + SourceMatchTableData copyWithCompanion(SourceMatchTableCompanion data) { + return SourceMatchTableData( + id: data.id.present ? data.id.value : this.id, + trackId: data.trackId.present ? data.trackId.value : this.trackId, + sourceId: data.sourceId.present ? data.sourceId.value : this.sourceId, + sourceType: + data.sourceType.present ? data.sourceType.value : this.sourceType, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + ); + } + + @override + String toString() { + return (StringBuffer('SourceMatchTableData(') + ..write('id: $id, ') + ..write('trackId: $trackId, ') + ..write('sourceId: $sourceId, ') + ..write('sourceType: $sourceType, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, trackId, sourceId, sourceType, createdAt); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is SourceMatchTableData && + other.id == this.id && + other.trackId == this.trackId && + other.sourceId == this.sourceId && + other.sourceType == this.sourceType && + other.createdAt == this.createdAt); +} + +class SourceMatchTableCompanion extends UpdateCompanion { + final Value id; + final Value trackId; + final Value sourceId; + final Value sourceType; + final Value createdAt; + const SourceMatchTableCompanion({ + this.id = const Value.absent(), + this.trackId = const Value.absent(), + this.sourceId = const Value.absent(), + this.sourceType = const Value.absent(), + this.createdAt = const Value.absent(), + }); + SourceMatchTableCompanion.insert({ + this.id = const Value.absent(), + required String trackId, + required String sourceId, + this.sourceType = const Value.absent(), + this.createdAt = const Value.absent(), + }) : trackId = Value(trackId), + sourceId = Value(sourceId); + static Insertable custom({ + Expression? id, + Expression? trackId, + Expression? sourceId, + Expression? sourceType, + Expression? createdAt, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (trackId != null) 'track_id': trackId, + if (sourceId != null) 'source_id': sourceId, + if (sourceType != null) 'source_type': sourceType, + if (createdAt != null) 'created_at': createdAt, + }); + } + + SourceMatchTableCompanion copyWith( + {Value? id, + Value? trackId, + Value? sourceId, + Value? sourceType, + Value? createdAt}) { + return SourceMatchTableCompanion( + id: id ?? this.id, + trackId: trackId ?? this.trackId, + sourceId: sourceId ?? this.sourceId, + sourceType: sourceType ?? this.sourceType, + createdAt: createdAt ?? this.createdAt, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (trackId.present) { + map['track_id'] = Variable(trackId.value); + } + if (sourceId.present) { + map['source_id'] = Variable(sourceId.value); + } + if (sourceType.present) { + map['source_type'] = Variable(sourceType.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('SourceMatchTableCompanion(') + ..write('id: $id, ') + ..write('trackId: $trackId, ') + ..write('sourceId: $sourceId, ') + ..write('sourceType: $sourceType, ') + ..write('createdAt: $createdAt') + ..write(')')) + .toString(); + } +} + +class AudioPlayerStateTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + AudioPlayerStateTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn playing = GeneratedColumn( + 'playing', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('CHECK ("playing" IN (0, 1))')); + late final GeneratedColumn loopMode = GeneratedColumn( + 'loop_mode', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn shuffled = GeneratedColumn( + 'shuffled', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('CHECK ("shuffled" IN (0, 1))')); + late final GeneratedColumn collections = GeneratedColumn( + 'collections', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn tracks = GeneratedColumn( + 'tracks', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant("[]")); + late final GeneratedColumn currentIndex = GeneratedColumn( + 'current_index', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultValue: const Constant(0)); + @override + List get $columns => + [id, playing, loopMode, shuffled, collections, tracks, currentIndex]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'audio_player_state_table'; + @override + Set get $primaryKey => {id}; + @override + AudioPlayerStateTableData map(Map data, + {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return AudioPlayerStateTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + playing: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}playing'])!, + loopMode: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}loop_mode'])!, + shuffled: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}shuffled'])!, + collections: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}collections'])!, + tracks: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}tracks'])!, + currentIndex: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}current_index'])!, + ); + } + + @override + AudioPlayerStateTable createAlias(String alias) { + return AudioPlayerStateTable(attachedDatabase, alias); + } +} + +class AudioPlayerStateTableData extends DataClass + implements Insertable { + final int id; + final bool playing; + final String loopMode; + final bool shuffled; + final String collections; + final String tracks; + final int currentIndex; + const AudioPlayerStateTableData( + {required this.id, + required this.playing, + required this.loopMode, + required this.shuffled, + required this.collections, + required this.tracks, + required this.currentIndex}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['playing'] = Variable(playing); + map['loop_mode'] = Variable(loopMode); + map['shuffled'] = Variable(shuffled); + map['collections'] = Variable(collections); + map['tracks'] = Variable(tracks); + map['current_index'] = Variable(currentIndex); + return map; + } + + AudioPlayerStateTableCompanion toCompanion(bool nullToAbsent) { + return AudioPlayerStateTableCompanion( + id: Value(id), + playing: Value(playing), + loopMode: Value(loopMode), + shuffled: Value(shuffled), + collections: Value(collections), + tracks: Value(tracks), + currentIndex: Value(currentIndex), + ); + } + + factory AudioPlayerStateTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return AudioPlayerStateTableData( + id: serializer.fromJson(json['id']), + playing: serializer.fromJson(json['playing']), + loopMode: serializer.fromJson(json['loopMode']), + shuffled: serializer.fromJson(json['shuffled']), + collections: serializer.fromJson(json['collections']), + tracks: serializer.fromJson(json['tracks']), + currentIndex: serializer.fromJson(json['currentIndex']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'playing': serializer.toJson(playing), + 'loopMode': serializer.toJson(loopMode), + 'shuffled': serializer.toJson(shuffled), + 'collections': serializer.toJson(collections), + 'tracks': serializer.toJson(tracks), + 'currentIndex': serializer.toJson(currentIndex), + }; + } + + AudioPlayerStateTableData copyWith( + {int? id, + bool? playing, + String? loopMode, + bool? shuffled, + String? collections, + String? tracks, + int? currentIndex}) => + AudioPlayerStateTableData( + id: id ?? this.id, + playing: playing ?? this.playing, + loopMode: loopMode ?? this.loopMode, + shuffled: shuffled ?? this.shuffled, + collections: collections ?? this.collections, + tracks: tracks ?? this.tracks, + currentIndex: currentIndex ?? this.currentIndex, + ); + AudioPlayerStateTableData copyWithCompanion( + AudioPlayerStateTableCompanion data) { + return AudioPlayerStateTableData( + id: data.id.present ? data.id.value : this.id, + playing: data.playing.present ? data.playing.value : this.playing, + loopMode: data.loopMode.present ? data.loopMode.value : this.loopMode, + shuffled: data.shuffled.present ? data.shuffled.value : this.shuffled, + collections: + data.collections.present ? data.collections.value : this.collections, + tracks: data.tracks.present ? data.tracks.value : this.tracks, + currentIndex: data.currentIndex.present + ? data.currentIndex.value + : this.currentIndex, + ); + } + + @override + String toString() { + return (StringBuffer('AudioPlayerStateTableData(') + ..write('id: $id, ') + ..write('playing: $playing, ') + ..write('loopMode: $loopMode, ') + ..write('shuffled: $shuffled, ') + ..write('collections: $collections, ') + ..write('tracks: $tracks, ') + ..write('currentIndex: $currentIndex') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, playing, loopMode, shuffled, collections, tracks, currentIndex); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is AudioPlayerStateTableData && + other.id == this.id && + other.playing == this.playing && + other.loopMode == this.loopMode && + other.shuffled == this.shuffled && + other.collections == this.collections && + other.tracks == this.tracks && + other.currentIndex == this.currentIndex); +} + +class AudioPlayerStateTableCompanion + extends UpdateCompanion { + final Value id; + final Value playing; + final Value loopMode; + final Value shuffled; + final Value collections; + final Value tracks; + final Value currentIndex; + const AudioPlayerStateTableCompanion({ + this.id = const Value.absent(), + this.playing = const Value.absent(), + this.loopMode = const Value.absent(), + this.shuffled = const Value.absent(), + this.collections = const Value.absent(), + this.tracks = const Value.absent(), + this.currentIndex = const Value.absent(), + }); + AudioPlayerStateTableCompanion.insert({ + this.id = const Value.absent(), + required bool playing, + required String loopMode, + required bool shuffled, + required String collections, + this.tracks = const Value.absent(), + this.currentIndex = const Value.absent(), + }) : playing = Value(playing), + loopMode = Value(loopMode), + shuffled = Value(shuffled), + collections = Value(collections); + static Insertable custom({ + Expression? id, + Expression? playing, + Expression? loopMode, + Expression? shuffled, + Expression? collections, + Expression? tracks, + Expression? currentIndex, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (playing != null) 'playing': playing, + if (loopMode != null) 'loop_mode': loopMode, + if (shuffled != null) 'shuffled': shuffled, + if (collections != null) 'collections': collections, + if (tracks != null) 'tracks': tracks, + if (currentIndex != null) 'current_index': currentIndex, + }); + } + + AudioPlayerStateTableCompanion copyWith( + {Value? id, + Value? playing, + Value? loopMode, + Value? shuffled, + Value? collections, + Value? tracks, + Value? currentIndex}) { + return AudioPlayerStateTableCompanion( + id: id ?? this.id, + playing: playing ?? this.playing, + loopMode: loopMode ?? this.loopMode, + shuffled: shuffled ?? this.shuffled, + collections: collections ?? this.collections, + tracks: tracks ?? this.tracks, + currentIndex: currentIndex ?? this.currentIndex, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (playing.present) { + map['playing'] = Variable(playing.value); + } + if (loopMode.present) { + map['loop_mode'] = Variable(loopMode.value); + } + if (shuffled.present) { + map['shuffled'] = Variable(shuffled.value); + } + if (collections.present) { + map['collections'] = Variable(collections.value); + } + if (tracks.present) { + map['tracks'] = Variable(tracks.value); + } + if (currentIndex.present) { + map['current_index'] = Variable(currentIndex.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('AudioPlayerStateTableCompanion(') + ..write('id: $id, ') + ..write('playing: $playing, ') + ..write('loopMode: $loopMode, ') + ..write('shuffled: $shuffled, ') + ..write('collections: $collections, ') + ..write('tracks: $tracks, ') + ..write('currentIndex: $currentIndex') + ..write(')')) + .toString(); + } +} + +class HistoryTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + HistoryTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn createdAt = GeneratedColumn( + 'created_at', aliasedName, false, + type: DriftSqlType.dateTime, + requiredDuringInsert: false, + defaultValue: currentDateAndTime); + late final GeneratedColumn type = GeneratedColumn( + 'type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn itemId = GeneratedColumn( + 'item_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn data = GeneratedColumn( + 'data', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + @override + List get $columns => [id, createdAt, type, itemId, data]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'history_table'; + @override + Set get $primaryKey => {id}; + @override + HistoryTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return HistoryTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + createdAt: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, + type: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!, + itemId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}item_id'])!, + data: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}data'])!, + ); + } + + @override + HistoryTable createAlias(String alias) { + return HistoryTable(attachedDatabase, alias); + } +} + +class HistoryTableData extends DataClass + implements Insertable { + final int id; + final DateTime createdAt; + final String type; + final String itemId; + final String data; + const HistoryTableData( + {required this.id, + required this.createdAt, + required this.type, + required this.itemId, + required this.data}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['created_at'] = Variable(createdAt); + map['type'] = Variable(type); + map['item_id'] = Variable(itemId); + map['data'] = Variable(data); + return map; + } + + HistoryTableCompanion toCompanion(bool nullToAbsent) { + return HistoryTableCompanion( + id: Value(id), + createdAt: Value(createdAt), + type: Value(type), + itemId: Value(itemId), + data: Value(data), + ); + } + + factory HistoryTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return HistoryTableData( + id: serializer.fromJson(json['id']), + createdAt: serializer.fromJson(json['createdAt']), + type: serializer.fromJson(json['type']), + itemId: serializer.fromJson(json['itemId']), + data: serializer.fromJson(json['data']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'createdAt': serializer.toJson(createdAt), + 'type': serializer.toJson(type), + 'itemId': serializer.toJson(itemId), + 'data': serializer.toJson(data), + }; + } + + HistoryTableData copyWith( + {int? id, + DateTime? createdAt, + String? type, + String? itemId, + String? data}) => + HistoryTableData( + id: id ?? this.id, + createdAt: createdAt ?? this.createdAt, + type: type ?? this.type, + itemId: itemId ?? this.itemId, + data: data ?? this.data, + ); + HistoryTableData copyWithCompanion(HistoryTableCompanion data) { + return HistoryTableData( + id: data.id.present ? data.id.value : this.id, + createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, + type: data.type.present ? data.type.value : this.type, + itemId: data.itemId.present ? data.itemId.value : this.itemId, + data: data.data.present ? data.data.value : this.data, + ); + } + + @override + String toString() { + return (StringBuffer('HistoryTableData(') + ..write('id: $id, ') + ..write('createdAt: $createdAt, ') + ..write('type: $type, ') + ..write('itemId: $itemId, ') + ..write('data: $data') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, createdAt, type, itemId, data); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is HistoryTableData && + other.id == this.id && + other.createdAt == this.createdAt && + other.type == this.type && + other.itemId == this.itemId && + other.data == this.data); +} + +class HistoryTableCompanion extends UpdateCompanion { + final Value id; + final Value createdAt; + final Value type; + final Value itemId; + final Value data; + const HistoryTableCompanion({ + this.id = const Value.absent(), + this.createdAt = const Value.absent(), + this.type = const Value.absent(), + this.itemId = const Value.absent(), + this.data = const Value.absent(), + }); + HistoryTableCompanion.insert({ + this.id = const Value.absent(), + this.createdAt = const Value.absent(), + required String type, + required String itemId, + required String data, + }) : type = Value(type), + itemId = Value(itemId), + data = Value(data); + static Insertable custom({ + Expression? id, + Expression? createdAt, + Expression? type, + Expression? itemId, + Expression? data, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (createdAt != null) 'created_at': createdAt, + if (type != null) 'type': type, + if (itemId != null) 'item_id': itemId, + if (data != null) 'data': data, + }); + } + + HistoryTableCompanion copyWith( + {Value? id, + Value? createdAt, + Value? type, + Value? itemId, + Value? data}) { + return HistoryTableCompanion( + id: id ?? this.id, + createdAt: createdAt ?? this.createdAt, + type: type ?? this.type, + itemId: itemId ?? this.itemId, + data: data ?? this.data, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (createdAt.present) { + map['created_at'] = Variable(createdAt.value); + } + if (type.present) { + map['type'] = Variable(type.value); + } + if (itemId.present) { + map['item_id'] = Variable(itemId.value); + } + if (data.present) { + map['data'] = Variable(data.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('HistoryTableCompanion(') + ..write('id: $id, ') + ..write('createdAt: $createdAt, ') + ..write('type: $type, ') + ..write('itemId: $itemId, ') + ..write('data: $data') + ..write(')')) + .toString(); + } +} + +class LyricsTable extends Table with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + LyricsTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn trackId = GeneratedColumn( + 'track_id', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn data = GeneratedColumn( + 'data', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + @override + List get $columns => [id, trackId, data]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'lyrics_table'; + @override + Set get $primaryKey => {id}; + @override + LyricsTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return LyricsTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + trackId: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}track_id'])!, + data: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}data'])!, + ); + } + + @override + LyricsTable createAlias(String alias) { + return LyricsTable(attachedDatabase, alias); + } +} + +class LyricsTableData extends DataClass implements Insertable { + final int id; + final String trackId; + final String data; + const LyricsTableData( + {required this.id, required this.trackId, required this.data}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['track_id'] = Variable(trackId); + map['data'] = Variable(data); + return map; + } + + LyricsTableCompanion toCompanion(bool nullToAbsent) { + return LyricsTableCompanion( + id: Value(id), + trackId: Value(trackId), + data: Value(data), + ); + } + + factory LyricsTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return LyricsTableData( + id: serializer.fromJson(json['id']), + trackId: serializer.fromJson(json['trackId']), + data: serializer.fromJson(json['data']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'trackId': serializer.toJson(trackId), + 'data': serializer.toJson(data), + }; + } + + LyricsTableData copyWith({int? id, String? trackId, String? data}) => + LyricsTableData( + id: id ?? this.id, + trackId: trackId ?? this.trackId, + data: data ?? this.data, + ); + LyricsTableData copyWithCompanion(LyricsTableCompanion data) { + return LyricsTableData( + id: data.id.present ? data.id.value : this.id, + trackId: data.trackId.present ? data.trackId.value : this.trackId, + data: data.data.present ? data.data.value : this.data, + ); + } + + @override + String toString() { + return (StringBuffer('LyricsTableData(') + ..write('id: $id, ') + ..write('trackId: $trackId, ') + ..write('data: $data') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash(id, trackId, data); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is LyricsTableData && + other.id == this.id && + other.trackId == this.trackId && + other.data == this.data); +} + +class LyricsTableCompanion extends UpdateCompanion { + final Value id; + final Value trackId; + final Value data; + const LyricsTableCompanion({ + this.id = const Value.absent(), + this.trackId = const Value.absent(), + this.data = const Value.absent(), + }); + LyricsTableCompanion.insert({ + this.id = const Value.absent(), + required String trackId, + required String data, + }) : trackId = Value(trackId), + data = Value(data); + static Insertable custom({ + Expression? id, + Expression? trackId, + Expression? data, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (trackId != null) 'track_id': trackId, + if (data != null) 'data': data, + }); + } + + LyricsTableCompanion copyWith( + {Value? id, Value? trackId, Value? data}) { + return LyricsTableCompanion( + id: id ?? this.id, + trackId: trackId ?? this.trackId, + data: data ?? this.data, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (trackId.present) { + map['track_id'] = Variable(trackId.value); + } + if (data.present) { + map['data'] = Variable(data.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('LyricsTableCompanion(') + ..write('id: $id, ') + ..write('trackId: $trackId, ') + ..write('data: $data') + ..write(')')) + .toString(); + } +} + +class PluginsTable extends Table + with TableInfo { + @override + final GeneratedDatabase attachedDatabase; + final String? _alias; + PluginsTable(this.attachedDatabase, [this._alias]); + late final GeneratedColumn id = GeneratedColumn( + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + late final GeneratedColumn name = GeneratedColumn( + 'name', aliasedName, false, + additionalChecks: + GeneratedColumn.checkTextLength(minTextLength: 1, maxTextLength: 50), + type: DriftSqlType.string, + requiredDuringInsert: true); + late final GeneratedColumn description = GeneratedColumn( + 'description', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn version = GeneratedColumn( + 'version', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn author = GeneratedColumn( + 'author', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn entryPoint = GeneratedColumn( + 'entry_point', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn apis = GeneratedColumn( + 'apis', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn abilities = GeneratedColumn( + 'abilities', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); + late final GeneratedColumn selectedForMetadata = GeneratedColumn( + 'selected_for_metadata', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("selected_for_metadata" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn selectedForAudioSource = + GeneratedColumn('selected_for_audio_source', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("selected_for_audio_source" IN (0, 1))'), + defaultValue: const Constant(false)); + late final GeneratedColumn repository = GeneratedColumn( + 'repository', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumn pluginApiVersion = GeneratedColumn( + 'plugin_api_version', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: false, + defaultValue: const Constant('2.0.0')); + @override + List get $columns => [ + id, + name, + description, + version, + author, + entryPoint, + apis, + abilities, + selectedForMetadata, + selectedForAudioSource, + repository, + pluginApiVersion + ]; + @override + String get aliasedName => _alias ?? actualTableName; + @override + String get actualTableName => $name; + static const String $name = 'plugins_table'; + @override + Set get $primaryKey => {id}; + @override + PluginsTableData map(Map data, {String? tablePrefix}) { + final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; + return PluginsTableData( + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, + description: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}description'])!, + version: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}version'])!, + author: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}author'])!, + entryPoint: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}entry_point'])!, + apis: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}apis'])!, + abilities: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}abilities'])!, + selectedForMetadata: attachedDatabase.typeMapping.read( + DriftSqlType.bool, data['${effectivePrefix}selected_for_metadata'])!, + selectedForAudioSource: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}selected_for_audio_source'])!, + repository: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}repository']), + pluginApiVersion: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}plugin_api_version'])!, + ); + } + + @override + PluginsTable createAlias(String alias) { + return PluginsTable(attachedDatabase, alias); + } +} + +class PluginsTableData extends DataClass + implements Insertable { + final int id; + final String name; + final String description; + final String version; + final String author; + final String entryPoint; + final String apis; + final String abilities; + final bool selectedForMetadata; + final bool selectedForAudioSource; + final String? repository; + final String pluginApiVersion; + const PluginsTableData( + {required this.id, + required this.name, + required this.description, + required this.version, + required this.author, + required this.entryPoint, + required this.apis, + required this.abilities, + required this.selectedForMetadata, + required this.selectedForAudioSource, + this.repository, + required this.pluginApiVersion}); + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + map['id'] = Variable(id); + map['name'] = Variable(name); + map['description'] = Variable(description); + map['version'] = Variable(version); + map['author'] = Variable(author); + map['entry_point'] = Variable(entryPoint); + map['apis'] = Variable(apis); + map['abilities'] = Variable(abilities); + map['selected_for_metadata'] = Variable(selectedForMetadata); + map['selected_for_audio_source'] = Variable(selectedForAudioSource); + if (!nullToAbsent || repository != null) { + map['repository'] = Variable(repository); + } + map['plugin_api_version'] = Variable(pluginApiVersion); + return map; + } + + PluginsTableCompanion toCompanion(bool nullToAbsent) { + return PluginsTableCompanion( + id: Value(id), + name: Value(name), + description: Value(description), + version: Value(version), + author: Value(author), + entryPoint: Value(entryPoint), + apis: Value(apis), + abilities: Value(abilities), + selectedForMetadata: Value(selectedForMetadata), + selectedForAudioSource: Value(selectedForAudioSource), + repository: repository == null && nullToAbsent + ? const Value.absent() + : Value(repository), + pluginApiVersion: Value(pluginApiVersion), + ); + } + + factory PluginsTableData.fromJson(Map json, + {ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return PluginsTableData( + id: serializer.fromJson(json['id']), + name: serializer.fromJson(json['name']), + description: serializer.fromJson(json['description']), + version: serializer.fromJson(json['version']), + author: serializer.fromJson(json['author']), + entryPoint: serializer.fromJson(json['entryPoint']), + apis: serializer.fromJson(json['apis']), + abilities: serializer.fromJson(json['abilities']), + selectedForMetadata: + serializer.fromJson(json['selectedForMetadata']), + selectedForAudioSource: + serializer.fromJson(json['selectedForAudioSource']), + repository: serializer.fromJson(json['repository']), + pluginApiVersion: serializer.fromJson(json['pluginApiVersion']), + ); + } + @override + Map toJson({ValueSerializer? serializer}) { + serializer ??= driftRuntimeOptions.defaultSerializer; + return { + 'id': serializer.toJson(id), + 'name': serializer.toJson(name), + 'description': serializer.toJson(description), + 'version': serializer.toJson(version), + 'author': serializer.toJson(author), + 'entryPoint': serializer.toJson(entryPoint), + 'apis': serializer.toJson(apis), + 'abilities': serializer.toJson(abilities), + 'selectedForMetadata': serializer.toJson(selectedForMetadata), + 'selectedForAudioSource': serializer.toJson(selectedForAudioSource), + 'repository': serializer.toJson(repository), + 'pluginApiVersion': serializer.toJson(pluginApiVersion), + }; + } + + PluginsTableData copyWith( + {int? id, + String? name, + String? description, + String? version, + String? author, + String? entryPoint, + String? apis, + String? abilities, + bool? selectedForMetadata, + bool? selectedForAudioSource, + Value repository = const Value.absent(), + String? pluginApiVersion}) => + PluginsTableData( + id: id ?? this.id, + name: name ?? this.name, + description: description ?? this.description, + version: version ?? this.version, + author: author ?? this.author, + entryPoint: entryPoint ?? this.entryPoint, + apis: apis ?? this.apis, + abilities: abilities ?? this.abilities, + selectedForMetadata: selectedForMetadata ?? this.selectedForMetadata, + selectedForAudioSource: + selectedForAudioSource ?? this.selectedForAudioSource, + repository: repository.present ? repository.value : this.repository, + pluginApiVersion: pluginApiVersion ?? this.pluginApiVersion, + ); + PluginsTableData copyWithCompanion(PluginsTableCompanion data) { + return PluginsTableData( + id: data.id.present ? data.id.value : this.id, + name: data.name.present ? data.name.value : this.name, + description: + data.description.present ? data.description.value : this.description, + version: data.version.present ? data.version.value : this.version, + author: data.author.present ? data.author.value : this.author, + entryPoint: + data.entryPoint.present ? data.entryPoint.value : this.entryPoint, + apis: data.apis.present ? data.apis.value : this.apis, + abilities: data.abilities.present ? data.abilities.value : this.abilities, + selectedForMetadata: data.selectedForMetadata.present + ? data.selectedForMetadata.value + : this.selectedForMetadata, + selectedForAudioSource: data.selectedForAudioSource.present + ? data.selectedForAudioSource.value + : this.selectedForAudioSource, + repository: + data.repository.present ? data.repository.value : this.repository, + pluginApiVersion: data.pluginApiVersion.present + ? data.pluginApiVersion.value + : this.pluginApiVersion, + ); + } + + @override + String toString() { + return (StringBuffer('PluginsTableData(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('description: $description, ') + ..write('version: $version, ') + ..write('author: $author, ') + ..write('entryPoint: $entryPoint, ') + ..write('apis: $apis, ') + ..write('abilities: $abilities, ') + ..write('selectedForMetadata: $selectedForMetadata, ') + ..write('selectedForAudioSource: $selectedForAudioSource, ') + ..write('repository: $repository, ') + ..write('pluginApiVersion: $pluginApiVersion') + ..write(')')) + .toString(); + } + + @override + int get hashCode => Object.hash( + id, + name, + description, + version, + author, + entryPoint, + apis, + abilities, + selectedForMetadata, + selectedForAudioSource, + repository, + pluginApiVersion); + @override + bool operator ==(Object other) => + identical(this, other) || + (other is PluginsTableData && + other.id == this.id && + other.name == this.name && + other.description == this.description && + other.version == this.version && + other.author == this.author && + other.entryPoint == this.entryPoint && + other.apis == this.apis && + other.abilities == this.abilities && + other.selectedForMetadata == this.selectedForMetadata && + other.selectedForAudioSource == this.selectedForAudioSource && + other.repository == this.repository && + other.pluginApiVersion == this.pluginApiVersion); +} + +class PluginsTableCompanion extends UpdateCompanion { + final Value id; + final Value name; + final Value description; + final Value version; + final Value author; + final Value entryPoint; + final Value apis; + final Value abilities; + final Value selectedForMetadata; + final Value selectedForAudioSource; + final Value repository; + final Value pluginApiVersion; + const PluginsTableCompanion({ + this.id = const Value.absent(), + this.name = const Value.absent(), + this.description = const Value.absent(), + this.version = const Value.absent(), + this.author = const Value.absent(), + this.entryPoint = const Value.absent(), + this.apis = const Value.absent(), + this.abilities = const Value.absent(), + this.selectedForMetadata = const Value.absent(), + this.selectedForAudioSource = const Value.absent(), + this.repository = const Value.absent(), + this.pluginApiVersion = const Value.absent(), + }); + PluginsTableCompanion.insert({ + this.id = const Value.absent(), + required String name, + required String description, + required String version, + required String author, + required String entryPoint, + required String apis, + required String abilities, + this.selectedForMetadata = const Value.absent(), + this.selectedForAudioSource = const Value.absent(), + this.repository = const Value.absent(), + this.pluginApiVersion = const Value.absent(), + }) : name = Value(name), + description = Value(description), + version = Value(version), + author = Value(author), + entryPoint = Value(entryPoint), + apis = Value(apis), + abilities = Value(abilities); + static Insertable custom({ + Expression? id, + Expression? name, + Expression? description, + Expression? version, + Expression? author, + Expression? entryPoint, + Expression? apis, + Expression? abilities, + Expression? selectedForMetadata, + Expression? selectedForAudioSource, + Expression? repository, + Expression? pluginApiVersion, + }) { + return RawValuesInsertable({ + if (id != null) 'id': id, + if (name != null) 'name': name, + if (description != null) 'description': description, + if (version != null) 'version': version, + if (author != null) 'author': author, + if (entryPoint != null) 'entry_point': entryPoint, + if (apis != null) 'apis': apis, + if (abilities != null) 'abilities': abilities, + if (selectedForMetadata != null) + 'selected_for_metadata': selectedForMetadata, + if (selectedForAudioSource != null) + 'selected_for_audio_source': selectedForAudioSource, + if (repository != null) 'repository': repository, + if (pluginApiVersion != null) 'plugin_api_version': pluginApiVersion, + }); + } + + PluginsTableCompanion copyWith( + {Value? id, + Value? name, + Value? description, + Value? version, + Value? author, + Value? entryPoint, + Value? apis, + Value? abilities, + Value? selectedForMetadata, + Value? selectedForAudioSource, + Value? repository, + Value? pluginApiVersion}) { + return PluginsTableCompanion( + id: id ?? this.id, + name: name ?? this.name, + description: description ?? this.description, + version: version ?? this.version, + author: author ?? this.author, + entryPoint: entryPoint ?? this.entryPoint, + apis: apis ?? this.apis, + abilities: abilities ?? this.abilities, + selectedForMetadata: selectedForMetadata ?? this.selectedForMetadata, + selectedForAudioSource: + selectedForAudioSource ?? this.selectedForAudioSource, + repository: repository ?? this.repository, + pluginApiVersion: pluginApiVersion ?? this.pluginApiVersion, + ); + } + + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = Variable(id.value); + } + if (name.present) { + map['name'] = Variable(name.value); + } + if (description.present) { + map['description'] = Variable(description.value); + } + if (version.present) { + map['version'] = Variable(version.value); + } + if (author.present) { + map['author'] = Variable(author.value); + } + if (entryPoint.present) { + map['entry_point'] = Variable(entryPoint.value); + } + if (apis.present) { + map['apis'] = Variable(apis.value); + } + if (abilities.present) { + map['abilities'] = Variable(abilities.value); + } + if (selectedForMetadata.present) { + map['selected_for_metadata'] = Variable(selectedForMetadata.value); + } + if (selectedForAudioSource.present) { + map['selected_for_audio_source'] = + Variable(selectedForAudioSource.value); + } + if (repository.present) { + map['repository'] = Variable(repository.value); + } + if (pluginApiVersion.present) { + map['plugin_api_version'] = Variable(pluginApiVersion.value); + } + return map; + } + + @override + String toString() { + return (StringBuffer('PluginsTableCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('description: $description, ') + ..write('version: $version, ') + ..write('author: $author, ') + ..write('entryPoint: $entryPoint, ') + ..write('apis: $apis, ') + ..write('abilities: $abilities, ') + ..write('selectedForMetadata: $selectedForMetadata, ') + ..write('selectedForAudioSource: $selectedForAudioSource, ') + ..write('repository: $repository, ') + ..write('pluginApiVersion: $pluginApiVersion') + ..write(')')) + .toString(); + } +} + +class DatabaseAtV9 extends GeneratedDatabase { + DatabaseAtV9(QueryExecutor e) : super(e); + late final AuthenticationTable authenticationTable = + AuthenticationTable(this); + late final BlacklistTable blacklistTable = BlacklistTable(this); + late final PreferencesTable preferencesTable = PreferencesTable(this); + late final ScrobblerTable scrobblerTable = ScrobblerTable(this); + late final SkipSegmentTable skipSegmentTable = SkipSegmentTable(this); + late final SourceMatchTable sourceMatchTable = SourceMatchTable(this); + late final AudioPlayerStateTable audioPlayerStateTable = + AudioPlayerStateTable(this); + late final HistoryTable historyTable = HistoryTable(this); + late final LyricsTable lyricsTable = LyricsTable(this); + late final PluginsTable pluginsTable = PluginsTable(this); + late final Index uniqueBlacklist = Index('unique_blacklist', + 'CREATE UNIQUE INDEX unique_blacklist ON blacklist_table (element_type, element_id)'); + late final Index uniqTrackMatch = Index('uniq_track_match', + 'CREATE UNIQUE INDEX uniq_track_match ON source_match_table (track_id, source_id, source_type)'); + @override + Iterable> get allTables => + allSchemaEntities.whereType>(); + @override + List get allSchemaEntities => [ + authenticationTable, + blacklistTable, + preferencesTable, + scrobblerTable, + skipSegmentTable, + sourceMatchTable, + audioPlayerStateTable, + historyTable, + lyricsTable, + pluginsTable, + uniqueBlacklist, + uniqTrackMatch + ]; + @override + int get schemaVersion => 9; +} diff --git a/untranslated_messages.json b/untranslated_messages.json index ba110540..bcde408d 100644 --- a/untranslated_messages.json +++ b/untranslated_messages.json @@ -1,101 +1,203 @@ { "ar": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "bn": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "ca": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "cs": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "de": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "es": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "eu": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "fa": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "fi": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "fr": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "hi": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "id": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "it": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "ja": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "ka": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "ko": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "ne": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" @@ -103,72 +205,144 @@ "nl": [ "audio_source", + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "pl": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "pt": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "ru": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "ta": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "th": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "tl": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "tr": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "uk": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "vi": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "zh": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" ], "zh_TW": [ + "default_metadata_source", + "set_default_metadata_source", + "default_audio_source", + "set_default_audio_source", + "plugins", + "configure_plugins", "source", "uncompressed", "dab_music_source_description" diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index f053614f..95f52491 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("FileSelectorWindows")); FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterInappwebviewWindowsPluginCApi")); + FlutterNewPipeExtractorPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FlutterNewPipeExtractorPluginCApi")); FlutterSecureStorageWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); FlutterTimezonePluginCApiRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index e0d69e09..abbe763a 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -9,6 +9,7 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_webview_window file_selector_windows flutter_inappwebview_windows + flutter_new_pipe_extractor flutter_secure_storage_windows flutter_timezone local_notifier @@ -24,6 +25,7 @@ list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST flutter_discord_rpc + jsf metadata_god smtc_windows )