Skip to content

Commit

Permalink
feat: remove SponsorBlock in favor of YT Music and remove pocketbase …
Browse files Browse the repository at this point in the history
…backend track support
  • Loading branch information
Kingkor Roy Tirtho committed May 16, 2023
1 parent b058517 commit fb780da
Show file tree
Hide file tree
Showing 17 changed files with 132 additions and 343 deletions.
4 changes: 0 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
POCKETBASE_URL=
USERNAME=
PASSWORD=

# The format:
# SPOTIFY_SECRETS=clintId1:clientSecret1,clientId2:clientSecret2
SPOTIFY_SECRETS=
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Enhancement suggestions are tracked as [GitHub issues](https://github.com/KRTirt

Do the following:

- Download the latest Flutter SDK (>=2.15.1) & enable desktop support
- Download the latest Flutter SDK (>=3.10.0) & enable desktop support
- Install Development dependencies in linux
- Debian (>=12/Bookworm)/Ubuntu
```bash
Expand All @@ -137,7 +137,7 @@ Do the following:
- Create a `.env` in root of the project following the `.env.example` template
- Now run the following to bootstrap the project
```bash
flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs
flutter pub get && dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns
```
- Finally run these following commands in the root of the project to start the Spotube Locally
```bash
Expand Down
9 changes: 0 additions & 9 deletions lib/collections/env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ part 'env.g.dart';

@Envied(obfuscate: true, requireEnvFile: true, path: ".env")
abstract class Env {
@EnviedField(varName: 'POCKETBASE_URL', defaultValue: 'http://127.0.0.1:8090')
static final pocketbaseUrl = _Env.pocketbaseUrl;

@EnviedField(varName: 'USERNAME', defaultValue: 'root')
static final username = _Env.username;

@EnviedField(varName: 'PASSWORD', defaultValue: '12345678')
static final password = _Env.password;

@EnviedField(varName: 'SPOTIFY_SECRETS')
static final spotifySecrets = _Env.spotifySecrets.split(',').map((e) {
final secrets = e.trim().split(":").map((e) => e.trim());
Expand Down
10 changes: 0 additions & 10 deletions lib/extensions/piped.dart

This file was deleted.

11 changes: 9 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_desktop_tools/flutter_desktop_tools.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:hive/hive.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:media_kit/media_kit.dart';
import 'package:metadata_god/metadata_god.dart';
Expand All @@ -19,11 +20,11 @@ import 'package:spotube/collections/routes.dart';
import 'package:spotube/collections/intents.dart';
import 'package:spotube/l10n/l10n.dart';
import 'package:spotube/models/logger.dart';
import 'package:spotube/models/matched_track.dart';
import 'package:spotube/provider/downloader_provider.dart';
import 'package:spotube/provider/palette_provider.dart';
import 'package:spotube/provider/user_preferences_provider.dart';
import 'package:spotube/services/audio_player/audio_player.dart';
import 'package:spotube/services/pocketbase.dart';
import 'package:spotube/services/youtube.dart';
import 'package:spotube/themes/theme.dart';
import 'package:spotube/utils/persisted_state_notifier.dart';
Expand Down Expand Up @@ -93,6 +94,13 @@ Future<void> main(List<String> rawArgs) async {
cachePrefix: "oss.krtirtho.spotube",
cacheDir: (await getApplicationSupportDirectory()).path,
);
Hive.registerAdapter(MatchedTrackAdapter());

await Hive.openLazyBox<MatchedTrack>(
MatchedTrack.boxName,
path: (await getApplicationSupportDirectory()).path,
);

await PersistedStateNotifier.initializeBoxes();

Catcher(
Expand Down Expand Up @@ -164,7 +172,6 @@ Future<void> main(List<String> rawArgs) async {
);
},
);
await initializePocketBase();
}

class Spotube extends StatefulHookConsumerWidget {
Expand Down
17 changes: 17 additions & 0 deletions lib/models/matched_track.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import "package:hive/hive.dart";

part "matched_track.g.dart";

@HiveType(typeId: 1)
class MatchedTrack {
@HiveField(0)
String youtubeId;
@HiveField(1)
String spotifyId;

static const boxName = "oss.krtirtho.spotube.matched_tracks";

static LazyBox<MatchedTrack> get box => Hive.lazyBox<MatchedTrack>(boxName);

MatchedTrack({required this.youtubeId, required this.spotifyId});
}
44 changes: 44 additions & 0 deletions lib/models/matched_track.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fb780da

Please sign in to comment.