Skip to content

Commit

Permalink
metadata stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
IrosTheBeggar committed Mar 23, 2022
1 parent 2b73fda commit 8fdf7f6
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 4 deletions.
Binary file added graphics/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import 'package:flutter_slidable/flutter_slidable.dart';
import 'screens/browser.dart';
import 'singletons/server_list.dart';
import 'objects/server.dart';
import 'objects/metadata.dart';
import 'screens/about_screen.dart';
import 'screens/metadata_screen.dart';
import 'screens/auto_dj.dart';
import 'screens/downloads.dart';
import 'singletons/downloads.dart';
Expand Down Expand Up @@ -310,6 +312,33 @@ class NowPlaying extends StatelessWidget {
.removeQueueItemAt(index);
},
),
secondaryActions: <Widget>[
IconSlideAction(
color: Colors.blueGrey,
icon: Icons.info,
caption: 'Info',
onTap: () {
MusicMetadata m = new MusicMetadata(
queue[index].artist,
queue[index].album,
queue[index].title,
null,
null,
queue[index].extras?['year'],
'X',
null,
queue[index].artUri?.toString());
print(queue[index]);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
MeteDataScreen(
meta: m,
path: queue[index]
.extras?['path'])));
}),
],
actions: <Widget>[
// IconSlideAction(
// color: Colors.blueGrey,
Expand Down
5 changes: 4 additions & 1 deletion lib/media/audio_stuff.dart
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,10 @@ class AudioPlayerHandler extends BaseAudioHandler
(autoDJServer?.jwt ?? ''))
: Uri.parse(autoDJServer!.url.toString())
.resolve('/assets/img/default.png'),
extras: {'path': decoded['songs'][0]['filepath']});
extras: {
'path': decoded['songs'][0]['filepath'],
'year': decoded['songs'][0]['year']
});

jsonAutoDJIgnoreList = decoded['ignoreList'];

Expand Down
1 change: 0 additions & 1 deletion lib/objects/display_item.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';

import 'server.dart';
import 'metadata.dart';
Expand Down
12 changes: 10 additions & 2 deletions lib/screens/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ class Browser extends StatelessWidget {
(i.server!.jwt ?? ''))
: Uri.parse(i.server!.url.toString())
.resolve('/assets/img/default.png'),
extras: {'path': i.data, 'localPath': finalString});
extras: {
'path': i.data,
'localPath': finalString,
'year': i.metadata?.year
});
MediaManager().audioHandler.addQueueItem(item);
return;
}
Expand Down Expand Up @@ -179,7 +183,11 @@ class Browser extends StatelessWidget {
(i.server!.jwt ?? ''))
: Uri.parse(i.server!.url.toString())
.resolve('/assets/img/default.png'),
extras: {'server': i.server!.localname, 'path': i.data});
extras: {
'server': i.server!.localname,
'path': i.data,
'year': i.metadata?.year
});

MediaManager().audioHandler.addQueueItem(item);

Expand Down
54 changes: 54 additions & 0 deletions lib/screens/metadata_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import '../objects/metadata.dart';

class MeteDataScreen extends StatelessWidget {
// In the constructor, require a Todo.
const MeteDataScreen({Key? key, required this.meta, required this.path})
: super(key: key);

// Declare a field that holds the Todo.
final MusicMetadata meta;

final String? path;

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF3f3f3f),
appBar: AppBar(
title: Text("Song Info"),
),
body: Container(
// padding: EdgeInsets.all(20.0),
child: ListView(children: [
if (meta.albumArt != null) ...[Image.network(meta.albumArt!)],
Container(height: 20),
if (meta.title != null) ...[
Container(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: Text(meta.title!)),
],
if (meta.artist != null) ...[
Container(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: Text(meta.artist!))
],
if (meta.album != null) ...[
Container(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: Text(meta.album!)),
],
if (meta.year != null) ...[
Container(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: Text(meta.year!.toString()))
],
Container(height: 20),
if (path != null) ...[
Container(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: Text(path!))
]
])));
}
}
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ flutter_icons:
flutter:
assets:
- graphics/mstream-logo.png
- graphics/default.png
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
Expand Down

0 comments on commit 8fdf7f6

Please sign in to comment.