ocarina2/lib/api/subsonic/album.dart

40 lines
985 B
Dart

import 'package:json_annotation/json_annotation.dart';
import 'package:ocarina/api/subsonic/subsonic.dart';
part 'album.g.dart';
@JsonSerializable()
class Album {
Album({
required this.id,
required this.name,
required this.coverArtId,
required this.playCount,
required this.artistName,
required this.artistId,
required this.year,
required this.songCount,
required this.genres,
required this.duration,
});
final String id;
final String name;
@JsonKey(name: "coverArt")
final String coverArtId;
@JsonKey(defaultValue: 0)
final int playCount;
@JsonKey(name: "artist")
final String artistName;
final String artistId;
final int year;
final int songCount;
final List<String> genres;
final int duration;
String get coverArtUrl => SubsonicApiService().getCoverArtUrl(coverArtId);
factory Album.fromJson(Map<String, dynamic> json) => _$AlbumFromJson(json);
Map<String, dynamic> toJson() => _$AlbumToJson(this);
}