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
41 lines
1.3 KiB
Dart
41 lines
1.3 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
|
import 'package:spotube/models/database/database.dart';
|
|
import 'package:spotube/modules/settings/youtube_engine_not_installed_dialog.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';
|
|
|
|
void useCheckYtDlpInstalled(WidgetRef ref) {
|
|
final context = useContext();
|
|
|
|
useEffect(() {
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
final youtubeEngine = ref.read(
|
|
userPreferencesProvider.select(
|
|
(value) => value.youtubeClientEngine,
|
|
),
|
|
);
|
|
|
|
final customPath =
|
|
KVStoreService.getYoutubeEnginePath(YoutubeClientEngine.ytDlp);
|
|
|
|
if (youtubeEngine == YoutubeClientEngine.ytDlp &&
|
|
!await YtDlpEngine.isInstalled() &&
|
|
(customPath == null || !await File(customPath).exists()) &&
|
|
context.mounted) {
|
|
await showDialog(
|
|
context: context,
|
|
builder: (context) =>
|
|
YouTubeEngineNotInstalledDialog(engine: youtubeEngine),
|
|
);
|
|
}
|
|
});
|
|
|
|
return null;
|
|
}, []);
|
|
}
|