Skip to content

Commit

Permalink
print more accurate music playlist info on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
doodlezucc committed Dec 20, 2022
1 parent 352b30e commit 52db21a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ambience/meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"modified": 1671363997000,
"modified": 1671570872000,
"tracks": [
{
"id": "F-CU7SomBvo",
Expand Down
12 changes: 9 additions & 3 deletions bin/audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ import 'package:ambience/server/playlists.dart';
final PlaylistCollection collection = PlaylistCollection(Directory('ambience'));

Future<void> loadAmbience() async {
await collection.reload();
await collection.sync();
_customTrackMeta();
await collection.loadMeta();
try {
await collection.readSource();
await collection.sync();
_customTrackMeta();
} on ProcessException catch (e) {
print('Unable to refresh playlists because '
'"${e.executable}" is not installed or outdated.');
}
}

void _customTrackMeta() {
Expand Down
13 changes: 3 additions & 10 deletions bin/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,10 @@ void run(List<String> args) async {
await createAssetPreview('web/images/assets/scene', zoomIn: true);

if (Environment.enableMusic) {
try {
await loadAmbience();
print('Background music up to date');
} on Exception catch (e) {
print(e.toString());
print('Failed to extract background music sources.'
' If you require the integrated music player,'
' make sure you have yt-dlp and ffmpeg installed.');
}
await loadAmbience();
print('Loaded music playlists');
} else {
print('Music player not enabled');
print('Music playlists not enabled');
}

print('''\nDungeon Club is ready!
Expand Down

0 comments on commit 52db21a

Please sign in to comment.