mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
Compare commits
6 Commits
e27f58666e
...
3539b6f38b
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3539b6f38b | ||
![]() |
8ff90bafd7 | ||
![]() |
9190af92ef | ||
![]() |
ff252d6b14 | ||
![]() |
195cad8f39 | ||
![]() |
19f525fa3c |
@ -137,16 +137,16 @@
|
||||
"pre_download_play_description": "Anzi che effettuare lo stream dell'audio, scarica invece i byte e li riproduce (raccomandato per gli utenti con banda più alta)",
|
||||
"skip_non_music": "Salta i segmenti non di musica (SponsorBlock)",
|
||||
"blacklist_description": "Tracce e artisti in blacklist",
|
||||
"wait_for_download_to_finish": "Prego attendere che lo scaricamento corrente finisca",
|
||||
"wait_for_download_to_finish": "Prego attendere che il download corrente finisca",
|
||||
"desktop": "Desktop",
|
||||
"close_behavior": "Comportamento Chiusura",
|
||||
"close": "Chiudi",
|
||||
"minimize_to_tray": "Minimizza in tray",
|
||||
"show_tray_icon": "Mostra icona in tray di sistema",
|
||||
"about": "A proposito di",
|
||||
"about": "Informazioni su",
|
||||
"u_love_spotube": "Sappiamo che ami Spotube",
|
||||
"check_for_updates": "Controlla aggiornamenti",
|
||||
"about_spotube": "A proposito di Spotube",
|
||||
"about_spotube": "Informazioni su Spotube",
|
||||
"blacklist": "Blacklist",
|
||||
"please_sponsor": "Per favore sponsorizza/dona",
|
||||
"spotube_description": "Spotube, un client spotify gratis per tutti, multipiattaforma e leggero",
|
||||
@ -187,7 +187,7 @@
|
||||
"generate_playlist": "Genera Playlist",
|
||||
"track_exists": "La traccia {track} esiste già",
|
||||
"replace_downloaded_tracks": "Sostituisci tutte le tracce scaricate",
|
||||
"skip_download_tracks": "Salta lo scaricamento di tutte le tracce scaricate",
|
||||
"skip_download_tracks": "Salta il download di tutte le tracce scaricate",
|
||||
"do_you_want_to_replace": "Vuoi sovrascrivere la traccia esistente??",
|
||||
"replace": "Sovrascrivi",
|
||||
"skip": "Salta",
|
||||
@ -256,7 +256,7 @@
|
||||
"querying_info": "Richiesta informazioni...",
|
||||
"piped_api_down": "Le Piped API non funzionano",
|
||||
"piped_down_error_instructions": "L'istanza di Piped {pipedInstance} è correntemente offline\n\nCambia istanza o cambia 'Tipo API' alle API ufficiali YouTube\n\nAssicurati di riavviare l'app dopo il cambio",
|
||||
"you_are_offline": "Sei correntemente offline",
|
||||
"you_are_offline": "Al momento sei offline",
|
||||
"connection_restored": "Connessione ad internet ripristinata",
|
||||
"use_system_title_bar": "Usa la barra del titolo di sistema",
|
||||
"crunching_results": "Elaborazione risultati...",
|
||||
@ -267,15 +267,15 @@
|
||||
"change_cover": "Cambia copertina",
|
||||
"add_cover": "Aggiungi copertina",
|
||||
"restore_defaults": "Ripristina default",
|
||||
"download_music_codec": "Codec musicale scaricamento",
|
||||
"streaming_music_codec": "Codec musicale streaming",
|
||||
"login_with_lastfm": "Accesso a Last.fm",
|
||||
"connect": "Connetti",
|
||||
"disconnect_lastfm": "Disconnetti Last.fm",
|
||||
"download_music_codec": "Codec download musica",
|
||||
"streaming_music_codec": "Codec streaming musica",
|
||||
"login_with_lastfm": "Accedi con Last.fm",
|
||||
"connect": "Connettiti",
|
||||
"disconnect_lastfm": "Disconnettiti da Last.fm",
|
||||
"disconnect": "Disconnetti",
|
||||
"username": "Nome utente",
|
||||
"password": "Password",
|
||||
"login": "Accesso",
|
||||
"login": "Accedi",
|
||||
"login_with_your_lastfm": "Accedi con il tuo account Last.fm",
|
||||
"scrobble_to_lastfm": "Invia a Last.fm",
|
||||
"audio_source": "Fonte audio",
|
||||
@ -299,7 +299,7 @@
|
||||
"song_link": "Link della Canzone",
|
||||
"skip_this_nonsense": "Salta questa sciocchezza",
|
||||
"freedom_of_music": "“Libertà della Musica”",
|
||||
"freedom_of_music_palm": "“Libertà della Musica nel palmo della tua mano”",
|
||||
"freedom_of_music_palm": "“Libertà della Musica nelle tue mani”",
|
||||
"get_started": "Cominciamo",
|
||||
"youtube_source_description": "Consigliato e funziona meglio.",
|
||||
"piped_source_description": "Ti senti libero? Come YouTube ma molto più gratuito.",
|
||||
|
@ -147,21 +147,29 @@ class AudioPlayerNotifier extends Notifier<AudioPlayerState> {
|
||||
try {
|
||||
// Playlist and state has to be in sync. This is only meant for
|
||||
// the shuffle/re-ordering indices to be in sync
|
||||
if (playlist.medias.length != state.tracks.length) return;
|
||||
|
||||
final queries = playlist.medias
|
||||
.map((media) => TrackSourceQuery.parseUri(media.uri))
|
||||
.toList();
|
||||
if (playlist.medias.length != state.tracks.length) {
|
||||
AppLogger.log.w(
|
||||
"Playlist length does not match state tracks length. Ignoring... "
|
||||
"Playlist length: ${playlist.medias.length}, "
|
||||
"State tracks length: ${state.tracks.length}",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final trackGroupedById = groupBy(
|
||||
state.tracks,
|
||||
(query) => query.id,
|
||||
);
|
||||
|
||||
final tracks = queries
|
||||
.map((query) => trackGroupedById[query.id]?.firstOrNull)
|
||||
.nonNulls
|
||||
.toList();
|
||||
final tracks = <SpotubeTrackObject>[];
|
||||
|
||||
for (final media in playlist.medias) {
|
||||
final trackQuery = TrackSourceQuery.parseUri(media.uri);
|
||||
final track = trackGroupedById[trackQuery.id]?.firstOrNull;
|
||||
if (track != null) {
|
||||
tracks.add(track);
|
||||
}
|
||||
}
|
||||
|
||||
if (tracks.length != state.tracks.length) {
|
||||
AppLogger.log.w("Mismatch in tracks after reordering/shuffling.");
|
||||
|
@ -146,7 +146,5 @@ mixin SpotubeAudioPlayersStreams on AudioPlayerInterface {
|
||||
|
||||
Stream<String> get errorStream => _mkPlayer.stream.error;
|
||||
|
||||
Stream<mk.Playlist> get playlistStream => _mkPlayer.stream.playlist.map((s) {
|
||||
return s;
|
||||
});
|
||||
Stream<mk.Playlist> get playlistStream => _mkPlayer.stream.playlist;
|
||||
}
|
||||
|
@ -12,19 +12,15 @@ import 'package:spotube/utils/platform.dart';
|
||||
/// This class adds a state stream to the [Player] class.
|
||||
class CustomPlayer extends Player {
|
||||
final StreamController<AudioPlaybackState> _playerStateStream;
|
||||
final StreamController<bool> _shuffleStream;
|
||||
|
||||
late final List<StreamSubscription> _subscriptions;
|
||||
|
||||
bool _shuffled;
|
||||
int _androidAudioSessionId = 0;
|
||||
String _packageName = "";
|
||||
AndroidAudioManager? _androidAudioManager;
|
||||
|
||||
CustomPlayer({super.configuration})
|
||||
: _playerStateStream = StreamController.broadcast(),
|
||||
_shuffleStream = StreamController.broadcast(),
|
||||
_shuffled = false {
|
||||
: _playerStateStream = StreamController.broadcast() {
|
||||
nativePlayer.setProperty("network-timeout", "120");
|
||||
|
||||
_subscriptions = [
|
||||
@ -86,10 +82,10 @@ class CustomPlayer extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
bool get shuffled => _shuffled;
|
||||
bool get shuffled => state.shuffle;
|
||||
|
||||
Stream<AudioPlaybackState> get playerStateStream => _playerStateStream.stream;
|
||||
Stream<bool> get shuffleStream => _shuffleStream.stream;
|
||||
Stream<bool> get shuffleStream => stream.shuffle;
|
||||
Stream<int> get indexChangeStream {
|
||||
int oldIndex = state.playlist.index;
|
||||
return stream.playlist.map((event) => event.index).where((newIndex) {
|
||||
@ -103,22 +99,14 @@ class CustomPlayer extends Player {
|
||||
|
||||
@override
|
||||
Future<void> setShuffle(bool shuffle) async {
|
||||
_shuffled = shuffle;
|
||||
await super.setShuffle(shuffle);
|
||||
_shuffleStream.add(shuffle);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (shuffle) {
|
||||
await move(state.playlist.index, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> stop() async {
|
||||
await super.stop();
|
||||
|
||||
_shuffled = false;
|
||||
_playerStateStream.add(AudioPlaybackState.stopped);
|
||||
_shuffleStream.add(false);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -134,7 +122,8 @@ class CustomPlayer extends Player {
|
||||
|
||||
Future<void> insert(int index, Media media) async {
|
||||
await add(media);
|
||||
await move(state.playlist.medias.length, index);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
await move(state.playlist.medias.length - 1, index);
|
||||
}
|
||||
|
||||
Future<void> setAudioNormalization(bool normalize) async {
|
||||
|
73
pubspec.lock
73
pubspec.lock
@ -1570,58 +1570,65 @@ packages:
|
||||
media_kit:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: media_kit
|
||||
sha256: "48c10c3785df5d88f0eef970743f8c99b2e5da2b34b9d8f9876e598f62d9e776"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: media_kit
|
||||
ref: HEAD
|
||||
resolved-ref: c9617f570b8c0ba02857e721997f78c053a856c1
|
||||
url: "https://github.com/media-kit/media-kit"
|
||||
source: git
|
||||
version: "1.2.0"
|
||||
media_kit_libs_android_audio:
|
||||
dependency: transitive
|
||||
dependency: "direct overridden"
|
||||
description:
|
||||
name: media_kit_libs_android_audio
|
||||
sha256: d0923d251c1232880e755b44555ce31b9e7068a29f05e01ed2fb510956bba851
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: "libs/android/media_kit_libs_android_audio"
|
||||
ref: HEAD
|
||||
resolved-ref: c9617f570b8c0ba02857e721997f78c053a856c1
|
||||
url: "https://github.com/media-kit/media-kit"
|
||||
source: git
|
||||
version: "1.3.7"
|
||||
media_kit_libs_audio:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: media_kit_libs_audio
|
||||
sha256: f5ea1eb414c4ee4994f36de36c7ce11577a249e058e907e7eb6e656513bccbfb
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: "libs/universal/media_kit_libs_audio"
|
||||
ref: HEAD
|
||||
resolved-ref: c9617f570b8c0ba02857e721997f78c053a856c1
|
||||
url: "https://github.com/media-kit/media-kit"
|
||||
source: git
|
||||
version: "1.0.6"
|
||||
media_kit_libs_ios_audio:
|
||||
dependency: transitive
|
||||
dependency: "direct overridden"
|
||||
description:
|
||||
name: media_kit_libs_ios_audio
|
||||
sha256: "78ccf04e27d6b4ba00a355578ccb39b772f00d48269a6ac3db076edf2d51934f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: "libs/ios/media_kit_libs_ios_audio"
|
||||
ref: HEAD
|
||||
resolved-ref: c9617f570b8c0ba02857e721997f78c053a856c1
|
||||
url: "https://github.com/media-kit/media-kit"
|
||||
source: git
|
||||
version: "1.1.4"
|
||||
media_kit_libs_linux:
|
||||
dependency: transitive
|
||||
dependency: "direct overridden"
|
||||
description:
|
||||
name: media_kit_libs_linux
|
||||
sha256: "2b473399a49ec94452c4d4ae51cfc0f6585074398d74216092bf3d54aac37ecf"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: "libs/linux/media_kit_libs_linux"
|
||||
ref: HEAD
|
||||
resolved-ref: c9617f570b8c0ba02857e721997f78c053a856c1
|
||||
url: "https://github.com/media-kit/media-kit"
|
||||
source: git
|
||||
version: "1.2.1"
|
||||
media_kit_libs_macos_audio:
|
||||
dependency: transitive
|
||||
dependency: "direct overridden"
|
||||
description:
|
||||
name: media_kit_libs_macos_audio
|
||||
sha256: "3be21844df98f286de32808592835073cdef2c1a10078bac135da790badca950"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: "libs/macos/media_kit_libs_macos_audio"
|
||||
ref: HEAD
|
||||
resolved-ref: c9617f570b8c0ba02857e721997f78c053a856c1
|
||||
url: "https://github.com/media-kit/media-kit"
|
||||
source: git
|
||||
version: "1.1.4"
|
||||
media_kit_libs_windows_audio:
|
||||
dependency: transitive
|
||||
dependency: "direct overridden"
|
||||
description:
|
||||
name: media_kit_libs_windows_audio
|
||||
sha256: c2fd558cc87b9d89a801141fcdffe02e338a3b21a41a18fbd63d5b221a1b8e53
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: "libs/windows/media_kit_libs_windows_audio"
|
||||
ref: HEAD
|
||||
resolved-ref: c9617f570b8c0ba02857e721997f78c053a856c1
|
||||
url: "https://github.com/media-kit/media-kit"
|
||||
source: git
|
||||
version: "1.0.9"
|
||||
menu_base:
|
||||
dependency: transitive
|
||||
|
30
pubspec.yaml
30
pubspec.yaml
@ -84,8 +84,14 @@ dependencies:
|
||||
logger: ^2.0.2
|
||||
logging: ^1.3.0
|
||||
lrc: ^1.0.2
|
||||
media_kit: ^1.1.10+1
|
||||
media_kit_libs_audio: ^1.0.4
|
||||
media_kit:
|
||||
git:
|
||||
url: https://github.com/media-kit/media-kit
|
||||
path: media_kit
|
||||
media_kit_libs_audio:
|
||||
git:
|
||||
url: https://github.com/media-kit/media-kit
|
||||
path: libs/universal/media_kit_libs_audio
|
||||
metadata_god: ^1.1.0
|
||||
mime: ^2.0.0
|
||||
open_file: ^3.5.10
|
||||
@ -194,6 +200,26 @@ dependency_overrides:
|
||||
ref: patch-2
|
||||
path: flutter_secure_storage_linux
|
||||
flutter_secure_storage_platform_interface: 2.0.0
|
||||
media_kit_libs_android_audio:
|
||||
git:
|
||||
url: https://github.com/media-kit/media-kit
|
||||
path: libs/android/media_kit_libs_android_audio
|
||||
media_kit_libs_ios_audio:
|
||||
git:
|
||||
url: https://github.com/media-kit/media-kit
|
||||
path: libs/ios/media_kit_libs_ios_audio
|
||||
media_kit_libs_macos_audio:
|
||||
git:
|
||||
url: https://github.com/media-kit/media-kit
|
||||
path: libs/macos/media_kit_libs_macos_audio
|
||||
media_kit_libs_windows_audio:
|
||||
git:
|
||||
url: https://github.com/media-kit/media-kit
|
||||
path: libs/windows/media_kit_libs_windows_audio
|
||||
media_kit_libs_linux:
|
||||
git:
|
||||
url: https://github.com/media-kit/media-kit
|
||||
path: libs/linux/media_kit_libs_linux
|
||||
|
||||
flutter:
|
||||
generate: true
|
||||
|
Loading…
Reference in New Issue
Block a user