Merge branch 'master' into dev

This commit is contained in:
Kingkor Roy Tirtho 2023-11-21 20:11:08 +06:00
parent ed63032a82
commit 75c0c4fff4
9 changed files with 24 additions and 180 deletions

View File

@ -82,8 +82,6 @@ jobs:
name: Generate .env file name: Generate .env file
command: | command: |
echo "SPOTIFY_SECRETS=${SPOTIFY_SECRETS}" >> .env echo "SPOTIFY_SECRETS=${SPOTIFY_SECRETS}" >> .env
echo "SUPABASE_URL=${SUPABASE_URL}" >> .env
echo "SUPABASE_API_KEY=${SUPABASE_API_KEY}" >> .env
- run: - run:
name: Replace Version in files name: Replace Version in files

View File

@ -1,6 +1,3 @@
SUPABASE_URL=
SUPABASE_API_KEY=
# The format: # The format:
# SPOTIFY_SECRETS=clintId1:clientSecret1,clientId2:clientSecret2 # SPOTIFY_SECRETS=clintId1:clientSecret1,clientId2:clientSecret2
SPOTIFY_SECRETS= SPOTIFY_SECRETS=

View File

@ -108,7 +108,7 @@ This handy table lists all methods you can use to install Spotube:
<a href="https://github.com/KRTirtho/spotube/releases/latest/download/Spotube-linux-x86_64.deb"> <a href="https://github.com/KRTirtho/spotube/releases/latest/download/Spotube-linux-x86_64.deb">
<img width="220" alt="Debian/Ubuntu Download" src="https://user-images.githubusercontent.com/61944859/169097994-e92aff78-fd75-4c93-b6e4-f072a4b5a7ed.png"> <img width="220" alt="Debian/Ubuntu Download" src="https://user-images.githubusercontent.com/61944859/169097994-e92aff78-fd75-4c93-b6e4-f072a4b5a7ed.png">
</a> </a>
<p>Then run: <code>sudo apt install Spotube-linux-x86_64.deb</code></p> <p>Then run: <code>sudo apt install ./Spotube-linux-x86_64.deb</code></p>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -5,12 +5,6 @@ part 'env.g.dart';
@Envied(obfuscate: true, requireEnvFile: true, path: ".env") @Envied(obfuscate: true, requireEnvFile: true, path: ".env")
abstract class Env { abstract class Env {
@EnviedField(varName: 'SUPABASE_URL')
static final String? supabaseUrl = _Env.supabaseUrl;
@EnviedField(varName: 'SUPABASE_API_KEY')
static final String? supabaseAnonKey = _Env.supabaseAnonKey;
@EnviedField(varName: 'SPOTIFY_SECRETS') @EnviedField(varName: 'SPOTIFY_SECRETS')
static final String rawSpotifySecrets = _Env.rawSpotifySecrets; static final String rawSpotifySecrets = _Env.rawSpotifySecrets;

View File

@ -14,7 +14,6 @@ import 'package:spotube/models/local_track.dart';
import 'package:spotube/models/logger.dart'; import 'package:spotube/models/logger.dart';
import 'package:spotube/models/skip_segment.dart'; import 'package:spotube/models/skip_segment.dart';
import 'package:spotube/models/source_match.dart';
import 'package:spotube/provider/blacklist_provider.dart'; import 'package:spotube/provider/blacklist_provider.dart';
import 'package:spotube/provider/palette_provider.dart'; import 'package:spotube/provider/palette_provider.dart';
@ -28,7 +27,6 @@ import 'package:spotube/services/audio_services/audio_services.dart';
import 'package:spotube/services/sourced_track/exceptions.dart'; import 'package:spotube/services/sourced_track/exceptions.dart';
import 'package:spotube/services/sourced_track/models/source_info.dart'; import 'package:spotube/services/sourced_track/models/source_info.dart';
import 'package:spotube/services/sourced_track/sourced_track.dart'; import 'package:spotube/services/sourced_track/sourced_track.dart';
import 'package:spotube/services/supabase.dart';
import 'package:spotube/utils/persisted_state_notifier.dart'; import 'package:spotube/utils/persisted_state_notifier.dart';
import 'package:spotube/utils/type_conversion_utils.dart'; import 'package:spotube/utils/type_conversion_utils.dart';
@ -134,21 +132,11 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
try { try {
isPreSearching.value = true; isPreSearching.value = true;
final oldTrack =
mapSourcesToTracks([audioPlayer.nextSource!]).firstOrNull;
final track = await ensureSourcePlayable(audioPlayer.nextSource!); final track = await ensureSourcePlayable(audioPlayer.nextSource!);
if (track != null) { if (track != null) {
state = state.copyWith(tracks: mergeTracks([track], state.tracks)); state = state.copyWith(tracks: mergeTracks([track], state.tracks));
} }
if (oldTrack != null && track != null) {
await storeTrack(
oldTrack,
track,
);
}
} catch (e, stackTrace) { } catch (e, stackTrace) {
// Removing tracks that were not found to avoid queue interruption // Removing tracks that were not found to avoid queue interruption
// TODO: Add a flag to enable/disable skip not found tracks // TODO: Add a flag to enable/disable skip not found tracks
@ -350,10 +338,6 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
collections: {}, collections: {},
); );
await notificationService.addTrack(addableTrack); await notificationService.addTrack(addableTrack);
await storeTrack(
tracks.elementAt(initialIndex),
addableTrack,
);
} }
await audioPlayer.openPlaylist( await audioPlayer.openPlaylist(
@ -383,13 +367,6 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
if (oldTrack != null || track != null) { if (oldTrack != null || track != null) {
await notificationService.addTrack(track ?? oldTrack!); await notificationService.addTrack(track ?? oldTrack!);
} }
if (oldTrack != null && track != null) {
await storeTrack(
oldTrack,
track,
);
}
} }
Future<void> jumpToTrack(Track track) async { Future<void> jumpToTrack(Track track) async {
@ -492,12 +469,6 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
if (oldTrack != null || track != null) { if (oldTrack != null || track != null) {
await notificationService.addTrack(track ?? oldTrack!); await notificationService.addTrack(track ?? oldTrack!);
} }
if (oldTrack != null && track != null) {
await storeTrack(
oldTrack,
track,
);
}
} }
Future<void> previous() async { Future<void> previous() async {
@ -523,12 +494,6 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
if (oldTrack != null || track != null) { if (oldTrack != null || track != null) {
await notificationService.addTrack(track ?? oldTrack!); await notificationService.addTrack(track ?? oldTrack!);
} }
if (oldTrack != null && track != null) {
await storeTrack(
oldTrack,
track,
);
}
} }
Future<void> stop() async { Future<void> stop() async {
@ -625,30 +590,6 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
} }
} }
/// This method must be called after any playback operation as
/// it can increase the latency
Future<void> storeTrack(Track track, SourcedTrack sourcedTrack) async {
try {
if (track is! SourcedTrack) {
await supabase.insertTrack(
SourceMatch(
id: sourcedTrack.id!,
createdAt: DateTime.now(),
sourceId: sourcedTrack.sourceInfo.id,
sourceType: preferences.audioSource == AudioSource.jiosaavn
? SourceType.jiosaavn
: preferences.searchMode == SearchMode.youtube
? SourceType.youtube
: SourceType.youtubeMusic,
),
);
}
} catch (e, stackTrace) {
logger.e(e.toString());
logger.t(stackTrace);
}
}
@override @override
set state(state) { set state(state) {
super.state = state; super.state = state;

View File

@ -1,18 +0,0 @@
import 'package:spotube/collections/env.dart';
import 'package:spotube/models/source_match.dart';
import 'package:supabase/supabase.dart';
class SupabaseService {
static final api = SupabaseClient(
Env.supabaseUrl ?? "",
Env.supabaseAnonKey ?? "",
);
Future<void> insertTrack(SourceMatch track) async {
return null;
// TODO: Fix this
await api.from("tracks").insert(track.toJson());
}
}
final supabase = SupabaseService();

View File

@ -325,10 +325,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: collection name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.17.2" version: "1.18.0"
color: color:
dependency: transitive dependency: transitive
description: description:
@ -953,14 +953,6 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
functions_client:
dependency: transitive
description:
name: functions_client
sha256: "3b157b4d3ae9e38614fd80fab76d1ef1e0e39ff3412a45de2651f27cecb9d2d2"
url: "https://pub.dev"
source: hosted
version: "1.3.2"
fuzzywuzzy: fuzzywuzzy:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1001,14 +993,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.1.0" version: "5.1.0"
gotrue:
dependency: transitive
description:
name: gotrue
sha256: af61c5c6a2374d9032b7e4b388de0bb0442f4bedc56372d5382c1ef61c85f1f3
url: "https://pub.dev"
source: hosted
version: "1.12.1"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
@ -1231,14 +1215,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.2" version: "0.4.2"
jwt_decode:
dependency: transitive
description:
name: jwt_decode
sha256: d2e9f68c052b2225130977429d30f187aa1981d789c76ad104a32243cfdebfbb
url: "https://pub.dev"
source: hosted
version: "0.3.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
@ -1363,10 +1339,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.9.1" version: "1.10.0"
metadata_god: metadata_god:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1579,10 +1555,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: platform name: platform
sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.0" version: "3.1.2"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -1615,14 +1591,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.8+2" version: "0.2.8+2"
postgrest:
dependency: transitive
description:
name: postgrest
sha256: d6cc0f60c7dc761f84d1c6d11d9e02b3ad90399bd84639a28c1c024adbaa9bde
url: "https://pub.dev"
source: hosted
version: "1.5.0"
process: process:
dependency: transitive dependency: transitive
description: description:
@ -1687,22 +1655,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.2.1" version: "3.2.1"
realtime_client:
dependency: transitive
description:
name: realtime_client
sha256: b4b7bb293417dafc73943ed639209b2dcb796db8495e56bba29a4e26fadef5cd
url: "https://pub.dev"
source: hosted
version: "1.2.1"
retry:
dependency: transitive
description:
name: retry
sha256: "822e118d5b3aafed083109c72d5f484c6dc66707885e07c0fbcb8b986bba7efc"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
riverpod: riverpod:
dependency: transitive dependency: transitive
description: description:
@ -1937,10 +1889,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.11.0" version: "1.11.1"
state_notifier: state_notifier:
dependency: transitive dependency: transitive
description: description:
@ -1949,22 +1901,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.2+1" version: "0.7.2+1"
storage_client:
dependency: transitive
description:
name: storage_client
sha256: "4bf2fc76f09c3698f0ba3f1a44d567995796f6aef76501f194631d0c03752ab7"
url: "https://pub.dev"
source: hosted
version: "1.5.2"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
stream_transform: stream_transform:
dependency: transitive dependency: transitive
description: description:
@ -1989,14 +1933,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.0.2" version: "0.0.2"
supabase:
dependency: "direct main"
description:
name: supabase
sha256: "4bfa8f673b39c036ed82829a2ddc462dcacfc36fe168b680664ab954c7d91ccd"
url: "https://pub.dev"
source: hosted
version: "1.11.3"
sync_http: sync_http:
dependency: transitive dependency: transitive
description: description:
@ -2049,10 +1985,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.0" version: "0.6.1"
time: time:
dependency: transitive dependency: transitive
description: description:
@ -2233,10 +2169,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: c620a6f783fa22436da68e42db7ebbf18b8c44b9a46ab911f666ff09ffd9153f sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "11.7.1" version: "11.10.0"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:
@ -2249,10 +2185,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: web name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.4-beta" version: "0.3.0"
web_socket_channel: web_socket_channel:
dependency: transitive dependency: transitive
description: description:
@ -2326,14 +2262,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.2" version: "3.1.2"
yet_another_json_isolate:
dependency: transitive
description:
name: yet_another_json_isolate
sha256: "86fad76026c4241a32831d6c7febd8f9bded5019e2cd36c5b148499808d8307d"
url: "https://pub.dev"
source: hosted
version: "1.1.1"
youtube_explode_dart: youtube_explode_dart:
dependency: "direct main" dependency: "direct main"
description: description:
@ -2343,5 +2271,5 @@ packages:
source: hosted source: hosted
version: "2.0.2" version: "2.0.2"
sdks: sdks:
dart: ">=3.1.0 <4.0.0" dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.13.0" flutter: ">=3.13.0"

View File

@ -89,7 +89,6 @@ dependencies:
smtc_windows: ^0.1.1 smtc_windows: ^0.1.1
spotify: ^0.12.0 spotify: ^0.12.0
stroke_text: ^0.0.2 stroke_text: ^0.0.2
supabase: ^1.9.9
system_theme: ^2.1.0 system_theme: ^2.1.0
titlebar_buttons: ^1.0.0 titlebar_buttons: ^1.0.0
url_launcher: ^6.1.7 url_launcher: ^6.1.7

View File

@ -9,6 +9,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
# https://github.com/flutter/flutter/issues/57146. # https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
# Set fallback configurations for older versions of the flutter tool.
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
set(FLUTTER_TARGET_PLATFORM "windows-x64")
endif()
# === Flutter Library === # === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
@ -91,7 +96,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E env COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT} ${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG> ${FLUTTER_TARGET_PLATFORM} $<CONFIG>
VERBATIM VERBATIM
) )
add_custom_target(flutter_assemble DEPENDS add_custom_target(flutter_assemble DEPENDS