Skip to content

Commit

Permalink
moremetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
IrosTheBeggar committed Mar 12, 2022
1 parent 0b20f14 commit 962d45f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ class BottomBar extends StatelessWidget {
Stream<MediaState> get _mediaStateStream =>
Rx.combineLatest2<MediaItem?, Duration, MediaState>(
MediaManager().audioHandler.mediaItem,
AudioService.positionStream,
AudioService.position,
(mediaItem, position) => MediaState(mediaItem, position));

IconButton playButton() => IconButton(
Expand Down
12 changes: 11 additions & 1 deletion lib/media/audio_stuff.dart
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,17 @@ class AudioPlayerHandler extends BaseAudioHandler

MediaItem item = new MediaItem(
id: lolUrl,
title: decoded['songs'][0]['filepath'].split("/").removeLast(),
title: decoded['songs'][0]['metadata']['title'] ??
decoded['songs'][0]['filepath'].split("/").removeLast(),
album: decoded['songs'][0]['metadata']['album'],
artist: decoded['songs'][0]['metadata']['artist'],
artUri: decoded['songs'][0]['metadata']['album-art'] != null
? Uri.parse(autoDJServer!.url.toString()).resolve('/album-art/' +
decoded['songs'][0]['metadata']['album-art'] +
'?compress=l&token=' +
(autoDJServer?.jwt ?? ''))
: Uri.parse(autoDJServer!.url.toString())
.resolve('/assets/img/default.png'),
extras: {'path': decoded['songs'][0]['filepath']});

jsonAutoDJIgnoreList = decoded['ignoreList'];
Expand Down
24 changes: 21 additions & 3 deletions lib/screens/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Browser extends StatelessWidget {
void addLocalFile(DisplayItem i) {
MediaItem item = new MediaItem(
id: Uuid().v4(),
title: i.name,
title: i.name.split('/').last,
extras: {'path': i.data, 'localPath': i.data!});
MediaManager().audioHandler.addQueueItem(item);
}
Expand All @@ -134,7 +134,16 @@ class Browser extends StatelessWidget {

MediaItem item = new MediaItem(
id: Uuid().v4(),
title: i.name,
title: i.metadata?.title ?? i.name,
album: i.metadata?.album,
artist: i.metadata?.artist,
artUri: i.metadata?.albumArt != null
? Uri.parse(i.server!.url.toString()).resolve('/album-art/' +
i.metadata!.albumArt! +
'?compress=l&token=' +
(i.server!.jwt ?? ''))
: Uri.parse(i.server!.url.toString())
.resolve('/assets/img/default.png'),
extras: {'path': i.data, 'localPath': finalString});
MediaManager().audioHandler.addQueueItem(item);
return;
Expand All @@ -160,7 +169,16 @@ class Browser extends StatelessWidget {

MediaItem item = new MediaItem(
id: lolUrl,
title: i.name,
title: i.metadata?.title ?? i.name,
album: i.metadata?.album,
artist: i.metadata?.artist,
artUri: i.metadata?.albumArt != null
? Uri.parse(i.server!.url.toString()).resolve('/album-art/' +
i.metadata!.albumArt! +
'?compress=l&token=' +
(i.server!.jwt ?? ''))
: Uri.parse(i.server!.url.toString())
.resolve('/assets/img/default.png'),
extras: {'server': i.server!.localname, 'path': i.data});

MediaManager().audioHandler.addQueueItem(item);
Expand Down
7 changes: 4 additions & 3 deletions lib/singletons/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ class ApiManager {
return;
}

String prefix =
TranscodeManager().transcodeOn == true ? '/transcode' : '/media';
// String prefix =
// TranscodeManager().transcodeOn == true ? '/transcode' : '/media';

res.forEach((e) {
String lolUrl = Uri.encodeFull(useThisServer!.url +
prefix +
'/media' +
(e.toString()[0] != '/' ? '/' : '') +
e +
'?app_uuid=' +
Uuid().v4() +
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.13.0+20
version: 0.13.1+21

environment:
sdk: ">=2.15.1 <3.0.0"
Expand Down

0 comments on commit 962d45f

Please sign in to comment.