mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-05 23:19:42 +00:00
fix: streaming not working
This commit is contained in:
parent
6311831902
commit
4b5108e54e
@ -19,6 +19,7 @@ import 'package:spotube/services/kv_store/kv_store.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/logger/logger.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';
|
||||
@ -211,13 +212,26 @@ class AppDatabase extends _$AppDatabase {
|
||||
);
|
||||
},
|
||||
from9To10: (m, schema) async {
|
||||
await m.dropColumn(schema.preferencesTable, "piped_instance");
|
||||
await m.dropColumn(schema.preferencesTable, "invidious_instance");
|
||||
await m.addColumn(
|
||||
try {
|
||||
await m
|
||||
.dropColumn(schema.preferencesTable, "piped_instance")
|
||||
.catchError((e) {});
|
||||
await m
|
||||
.dropColumn(schema.preferencesTable, "invidious_instance")
|
||||
.catchError((e) {});
|
||||
await m
|
||||
.addColumn(
|
||||
schema.sourceMatchTable,
|
||||
sourceMatchTable.sourceInfo,
|
||||
);
|
||||
await m.dropColumn(schema.sourceMatchTable, "source_id");
|
||||
)
|
||||
.catchError((e) {});
|
||||
await m
|
||||
.dropColumn(schema.sourceMatchTable, "source_id")
|
||||
.catchError((e) {});
|
||||
} catch (e) {
|
||||
AppLogger.log.e(e);
|
||||
return;
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart' show ListTile;
|
||||
@ -7,11 +9,15 @@ 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/section_card_with_heading.dart';
|
||||
import 'package:spotube/extensions/context.dart';
|
||||
import 'package:spotube/modules/settings/youtube_engine_not_installed_dialog.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/youtube_engine/yt_dlp_engine.dart';
|
||||
|
||||
import 'package:spotube/utils/platform.dart';
|
||||
|
||||
@ -30,6 +36,35 @@ class SettingsPlaybackSection extends HookConsumerWidget {
|
||||
return SectionCardWithHeading(
|
||||
heading: context.l10n.playback,
|
||||
children: [
|
||||
AdaptiveSelectTile<YoutubeClientEngine>(
|
||||
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<bool>(
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
YouTubeEngineNotInstalledDialog(engine: value),
|
||||
);
|
||||
if (hasInstalled != true) return;
|
||||
}
|
||||
}
|
||||
preferencesNotifier.setYoutubeClientEngine(value);
|
||||
},
|
||||
),
|
||||
if (sourcePresets.presets.isNotEmpty) ...[
|
||||
AdaptiveSelectTile(
|
||||
secondary: const Icon(SpotubeIcons.api),
|
||||
|
||||
@ -7,7 +7,6 @@ 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';
|
||||
@ -400,7 +399,7 @@ class AudioPlayerNotifier extends Notifier<AudioPlayerState> {
|
||||
// because of timeout
|
||||
final intendedActiveTrack = medias.elementAt(initialIndex);
|
||||
if (intendedActiveTrack.track is! SpotubeLocalTrackObject) {
|
||||
await ref.read(
|
||||
ref.read(
|
||||
sourcedTrackProvider(
|
||||
intendedActiveTrack.track as SpotubeFullTrackObject,
|
||||
).future,
|
||||
|
||||
@ -3,10 +3,10 @@ import 'package:spotube/provider/metadata_plugin/audio_source/quality_presets.da
|
||||
|
||||
final audioSourceQualityLabelProvider = Provider<String>((ref) {
|
||||
final sourceQuality = ref.watch(audioSourcePresetsProvider);
|
||||
final sourceContainer =
|
||||
sourceQuality.presets[sourceQuality.selectedStreamingContainerIndex];
|
||||
final quality =
|
||||
sourceContainer.qualities[sourceQuality.selectedStreamingQualityIndex];
|
||||
final sourceContainer = sourceQuality.presets
|
||||
.elementAtOrNull(sourceQuality.selectedStreamingContainerIndex);
|
||||
final quality = sourceContainer?.qualities
|
||||
.elementAtOrNull(sourceQuality.selectedStreamingQualityIndex);
|
||||
|
||||
return "${sourceContainer.name} • ${quality.toString()}";
|
||||
return "${sourceContainer?.name ?? "Unknown"} • ${quality?.toString() ?? "Unknown"}";
|
||||
});
|
||||
|
||||
@ -543,7 +543,7 @@ final audioSourcePluginProvider = FutureProvider<MetadataPlugin?>(
|
||||
metadataPluginsProvider
|
||||
.selectAsync((data) => data.defaultAudioSourcePluginConfig),
|
||||
);
|
||||
final youtubeEngine = ref.read(youtubeEngineProvider);
|
||||
final youtubeEngine = ref.watch(youtubeEngineProvider);
|
||||
|
||||
if (defaultPlugin == null) {
|
||||
return null;
|
||||
|
||||
@ -22,7 +22,7 @@ class MetadataPluginAudioSourceEndpoint {
|
||||
SpotubeFullTrackObject track,
|
||||
) async {
|
||||
final raw = await hetuMetadataAudioSource
|
||||
.invoke("matches", positionalArgs: [track]) as List;
|
||||
.invoke("matches", positionalArgs: [track.toJson()]) as List;
|
||||
|
||||
return raw.map((e) => SpotubeAudioSourceMatchObject.fromJson(e)).toList();
|
||||
}
|
||||
@ -31,7 +31,7 @@ class MetadataPluginAudioSourceEndpoint {
|
||||
SpotubeAudioSourceMatchObject match,
|
||||
) async {
|
||||
final raw = await hetuMetadataAudioSource
|
||||
.invoke("streams", positionalArgs: [match]) as List;
|
||||
.invoke("streams", positionalArgs: [match.toJson()]) as List;
|
||||
|
||||
return raw.map((e) => SpotubeAudioSourceStreamObject.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
17
pubspec.lock
17
pubspec.lock
@ -458,15 +458,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
dab_music_api:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: main
|
||||
resolved-ref: "55f96368b7465eec2e5e81774f9f2a7b18acc4ab"
|
||||
url: "https://github.com/KRTirtho/dab_music_api.git"
|
||||
source: git
|
||||
version: "0.1.0"
|
||||
dart_mappable:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -2023,14 +2014,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.0"
|
||||
retrofit:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: retrofit
|
||||
sha256: "699cf44ec6c7fc7d248740932eca75d334e36bdafe0a8b3e9ff93100591c8a25"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.7.2"
|
||||
riverpod:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user