mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
fix(playback): skipping tracks with unplayable sources instead of falling back #1492
This commit is contained in:
parent
56241f773a
commit
c607a330ed
@ -135,16 +135,10 @@ abstract class SourcedTrack extends Track {
|
||||
return await PipedSourcedTrack.fetchFromTrack(track: track, ref: ref);
|
||||
} catch (e) {
|
||||
if (e is DioException || e is ClientException || e is SocketException) {
|
||||
if (preferences.audioSource == AudioSource.jiosaavn) {
|
||||
return await JioSaavnSourcedTrack.fetchFromTrack(
|
||||
track: track,
|
||||
ref: ref,
|
||||
weakMatch: true,
|
||||
);
|
||||
}
|
||||
return await JioSaavnSourcedTrack.fetchFromTrack(
|
||||
track: track,
|
||||
ref: ref,
|
||||
weakMatch: preferences.audioSource == AudioSource.jiosaavn,
|
||||
);
|
||||
}
|
||||
rethrow;
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:catcher_2/core/catcher_2.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:http/http.dart';
|
||||
@ -221,14 +222,19 @@ class YoutubeSourcedTrack extends SourcedTrack {
|
||||
final ytLink = links.firstWhereOrNull((link) => link.platform == "youtube");
|
||||
|
||||
if (ytLink?.url != null) {
|
||||
return [
|
||||
await toSiblingType(
|
||||
0,
|
||||
YoutubeVideoInfo.fromVideo(
|
||||
await youtubeClient.videos.get(ytLink!.url!),
|
||||
),
|
||||
)
|
||||
];
|
||||
try {
|
||||
return [
|
||||
await toSiblingType(
|
||||
0,
|
||||
YoutubeVideoInfo.fromVideo(
|
||||
await youtubeClient.videos.get(ytLink!.url!),
|
||||
),
|
||||
)
|
||||
];
|
||||
} on VideoUnplayableException catch (e, stack) {
|
||||
// Ignore this error and continue with the search
|
||||
Catcher2.reportCheckedError(e, stack);
|
||||
}
|
||||
}
|
||||
|
||||
final query = SourcedTrack.getSearchTerm(track);
|
||||
|
@ -24,7 +24,13 @@ ThemeData theme(Color seed, Brightness brightness, bool isAmoled) {
|
||||
horizontalTitleGap: 5,
|
||||
iconColor: scheme.onSurface,
|
||||
),
|
||||
appBarTheme: const AppBarTheme(surfaceTintColor: Colors.transparent),
|
||||
appBarTheme: const AppBarTheme(
|
||||
surfaceTintColor: Colors.transparent,
|
||||
scrolledUnderElevation: 0,
|
||||
shadowColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
|
Loading…
Reference in New Issue
Block a user