Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Nov 21, 2023
1 parent ed63032 commit 75c0c4f
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 180 deletions.
2 changes: 0 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ jobs:
name: Generate .env file
command: |
echo "SPOTIFY_SECRETS=${SPOTIFY_SECRETS}" >> .env
echo "SUPABASE_URL=${SUPABASE_URL}" >> .env
echo "SUPABASE_API_KEY=${SUPABASE_API_KEY}" >> .env
- run:
name: Replace Version in files
Expand Down
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
SUPABASE_URL=
SUPABASE_API_KEY=

# The format:
# SPOTIFY_SECRETS=clintId1:clientSecret1,clientId2:clientSecret2
SPOTIFY_SECRETS=
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<img width="220" alt="Debian/Ubuntu Download" src="https://user-images.githubusercontent.com/61944859/169097994-e92aff78-fd75-4c93-b6e4-f072a4b5a7ed.png">
</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>
</tr>
<tr>
Expand Down
6 changes: 0 additions & 6 deletions lib/collections/env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ part 'env.g.dart';

@Envied(obfuscate: true, requireEnvFile: true, path: ".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')
static final String rawSpotifySecrets = _Env.rawSpotifySecrets;

Expand Down
59 changes: 0 additions & 59 deletions lib/provider/proxy_playlist/proxy_playlist_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:spotube/models/local_track.dart';
import 'package:spotube/models/logger.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/palette_provider.dart';
Expand All @@ -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/models/source_info.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/type_conversion_utils.dart';
Expand Down Expand Up @@ -134,21 +132,11 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
try {
isPreSearching.value = true;

final oldTrack =
mapSourcesToTracks([audioPlayer.nextSource!]).firstOrNull;

final track = await ensureSourcePlayable(audioPlayer.nextSource!);

if (track != null) {
state = state.copyWith(tracks: mergeTracks([track], state.tracks));
}

if (oldTrack != null && track != null) {
await storeTrack(
oldTrack,
track,
);
}
} catch (e, stackTrace) {
// Removing tracks that were not found to avoid queue interruption
// TODO: Add a flag to enable/disable skip not found tracks
Expand Down Expand Up @@ -350,10 +338,6 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
collections: {},
);
await notificationService.addTrack(addableTrack);
await storeTrack(
tracks.elementAt(initialIndex),
addableTrack,
);
}

await audioPlayer.openPlaylist(
Expand Down Expand Up @@ -383,13 +367,6 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
if (oldTrack != null || track != null) {
await notificationService.addTrack(track ?? oldTrack!);
}

if (oldTrack != null && track != null) {
await storeTrack(
oldTrack,
track,
);
}
}

Future<void> jumpToTrack(Track track) async {
Expand Down Expand Up @@ -492,12 +469,6 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
if (oldTrack != null || track != null) {
await notificationService.addTrack(track ?? oldTrack!);
}
if (oldTrack != null && track != null) {
await storeTrack(
oldTrack,
track,
);
}
}

Future<void> previous() async {
Expand All @@ -523,12 +494,6 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
if (oldTrack != null || track != null) {
await notificationService.addTrack(track ?? oldTrack!);
}
if (oldTrack != null && track != null) {
await storeTrack(
oldTrack,
track,
);
}
}

Future<void> stop() async {
Expand Down Expand Up @@ -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
set state(state) {
super.state = state;
Expand Down
18 changes: 0 additions & 18 deletions lib/services/supabase.dart

This file was deleted.

Loading

0 comments on commit 75c0c4f

Please sign in to comment.