Skip to content

Commit

Permalink
Fixed init bug, added listening now support
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmicRaptor committed Nov 25, 2024
1 parent a724eae commit 80cab9e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/app/app_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class AppModel extends SafeChangeNotifier {
apiSecret: apiSecret,
);

void initListenBrains() => _exposeService.initListenBrains();

final GitHub _gitHub;
final SettingsService _settingsService;
final bool _allowManualUpdates;
Expand Down
2 changes: 2 additions & 0 deletions lib/expose/expose_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class ExposeService {
);
}

void initListenBrains() => _listenBrainzService.init();

Future<void> _exposeTitleToDiscord({
required String title,
required String artist,
Expand Down
4 changes: 3 additions & 1 deletion lib/expose/listenbrainz_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ class ListenBrainzService {
try {
if (_listenBrainz != null &&
_settingsService.enableListenBrainzScrobbling) {
final track = Track(title: title, artist: artist);
await _listenBrainz!.submitSingle(
Track(title: title, artist: artist),
track,
DateTime.now(),
);
await _listenBrainz!.submitPlayingNow(track);
}
} on Exception catch (e) {
printMessageInDebugMode(e);
Expand Down
1 change: 1 addition & 0 deletions lib/settings/view/expose_online_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ class _ExposeOnlineSectionState extends State<ExposeOnlineSection> {
di<SettingsModel>().setListenBrainzApiKey(
_listenBrainzApiKeyController.text,
);
di<AppModel>().initListenBrains();
},
child: Text(l10n.save),
),
Expand Down

0 comments on commit 80cab9e

Please sign in to comment.