mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
chore: remove predownload option
This commit is contained in:
parent
dfea195ec1
commit
b041887402
@ -1,7 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:piped_client/piped_client.dart';
|
||||
import 'package:spotify/spotify.dart';
|
||||
import 'package:spotube/extensions/album_simple.dart';
|
||||
@ -142,25 +140,6 @@ class SpotubeTrack extends Track {
|
||||
final PipedAudioStream ytStream =
|
||||
getStreamInfo(ytVideo, preferences.audioQuality);
|
||||
|
||||
if (preferences.predownload &&
|
||||
ytVideo.duration < const Duration(minutes: 15)) {
|
||||
await DefaultCacheManager().getFileFromCache(track.id!).then(
|
||||
(file) async {
|
||||
if (file != null) return file.file;
|
||||
|
||||
final res = await get(Uri.parse(ytStream.url));
|
||||
|
||||
final cached = await DefaultCacheManager().putFile(
|
||||
track.id!,
|
||||
res.bodyBytes,
|
||||
fileExtension: ytStream.mimeType.split("/").last,
|
||||
);
|
||||
|
||||
return cached;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return SpotubeTrack.fromTrack(
|
||||
track: track,
|
||||
ytTrack: ytVideo,
|
||||
@ -193,25 +172,6 @@ class SpotubeTrack extends Track {
|
||||
);
|
||||
}
|
||||
|
||||
if (preferences.predownload &&
|
||||
video.duration < const Duration(minutes: 15)) {
|
||||
await DefaultCacheManager().getFileFromCache(id!).then(
|
||||
(file) async {
|
||||
if (file != null) return file.file;
|
||||
|
||||
final res = await get(Uri.parse(ytStream.url));
|
||||
|
||||
final cached = await DefaultCacheManager().putFile(
|
||||
id!,
|
||||
res.bodyBytes,
|
||||
fileExtension: ytStream.mimeType.split("/").last,
|
||||
);
|
||||
|
||||
return cached;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return SpotubeTrack.fromTrack(
|
||||
track: this,
|
||||
ytTrack: ytVideo,
|
||||
|
@ -367,16 +367,6 @@ class SettingsPage extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
SwitchListTile(
|
||||
secondary: const Icon(SpotubeIcons.download),
|
||||
title: Text(context.l10n.pre_download_play),
|
||||
subtitle:
|
||||
Text(context.l10n.pre_download_play_description),
|
||||
value: preferences.predownload,
|
||||
onChanged: (state) {
|
||||
preferences.setPredownload(state);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(SpotubeIcons.playlistRemove),
|
||||
title: Text(context.l10n.blacklist),
|
||||
|
@ -51,8 +51,6 @@ class UserPreferences extends PersistedChangeNotifier {
|
||||
|
||||
LayoutMode layoutMode;
|
||||
|
||||
bool predownload;
|
||||
|
||||
CloseBehavior closeBehavior;
|
||||
|
||||
bool showSystemTrayIcon;
|
||||
@ -72,7 +70,6 @@ class UserPreferences extends PersistedChangeNotifier {
|
||||
required this.recommendationMarket,
|
||||
required this.themeMode,
|
||||
required this.layoutMode,
|
||||
required this.predownload,
|
||||
required this.accentColorScheme,
|
||||
this.albumColorSync = true,
|
||||
this.saveTrackLyrics = false,
|
||||
@ -95,12 +92,6 @@ class UserPreferences extends PersistedChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
void setPredownload(bool value) {
|
||||
predownload = value;
|
||||
notifyListeners();
|
||||
updatePersistence();
|
||||
}
|
||||
|
||||
void setThemeMode(ThemeMode mode) {
|
||||
themeMode = mode;
|
||||
notifyListeners();
|
||||
@ -231,8 +222,6 @@ class UserPreferences extends PersistedChangeNotifier {
|
||||
orElse: () => kIsDesktop ? LayoutMode.extended : LayoutMode.compact,
|
||||
);
|
||||
|
||||
predownload = map["predownload"] ?? predownload;
|
||||
|
||||
closeBehavior = map["closeBehavior"] != null
|
||||
? CloseBehavior.values[map["closeBehavior"]]
|
||||
: closeBehavior;
|
||||
@ -265,7 +254,6 @@ class UserPreferences extends PersistedChangeNotifier {
|
||||
"audioQuality": audioQuality.index,
|
||||
"downloadLocation": downloadLocation,
|
||||
"layoutMode": layoutMode.name,
|
||||
"predownload": predownload,
|
||||
"closeBehavior": closeBehavior.index,
|
||||
"showSystemTrayIcon": showSystemTrayIcon,
|
||||
"locale":
|
||||
@ -284,6 +272,5 @@ final userPreferencesProvider = ChangeNotifierProvider(
|
||||
recommendationMarket: 'US',
|
||||
themeMode: ThemeMode.system,
|
||||
layoutMode: kIsMobile ? LayoutMode.compact : LayoutMode.adaptive,
|
||||
predownload: false,
|
||||
),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user