mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00

* feat: add youtube engine abstraction and yt-dlp integration * chore: add yt-dlp as optional dependency * feat: implement custom path support for youtube engines * chore: check for custom path in setting engine select dropdown * chore: update yt_dlp_dart * chore: setting video url instead of video id in fetchSiblings * feat: implement NewPipe engine * chore: update local path to git url for flutter_new_pipe_extractor package * chore: fix android build isn't working * chore: fix routes not working when initially signing in * refactor: drop fallback support to different sources
23 lines
878 B
Dart
23 lines
878 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:spotube/models/database/database.dart';
|
|
import 'package:spotube/provider/user_preferences/user_preferences_provider.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';
|
|
|
|
final youtubeEngineProvider = Provider((ref) {
|
|
final engineMode = ref.watch(
|
|
userPreferencesProvider.select((value) => value.youtubeClientEngine),
|
|
);
|
|
|
|
if (engineMode == YoutubeClientEngine.newPipe &&
|
|
NewPipeEngine.isAvailableForPlatform) {
|
|
return NewPipeEngine();
|
|
} else if (engineMode == YoutubeClientEngine.ytDlp &&
|
|
YtDlpEngine.isAvailableForPlatform) {
|
|
return YtDlpEngine();
|
|
} else {
|
|
return YouTubeExplodeEngine();
|
|
}
|
|
});
|