Work for roadie-vuejs client.

This commit is contained in:
Steven Hildreth 2018-12-06 22:45:09 -06:00
parent 9272fe8a1e
commit 63e4bdad07
13 changed files with 560 additions and 70 deletions

View file

@ -154,17 +154,13 @@ namespace Roadie.Api.Services
foreach (var t in this.DbContext.Tracks.Where(x => x.ReleaseMediaId == releasemedia.Id).OrderBy(x => x.TrackNumber).ToArray())
{
var track = t.Adapt<TrackList>();
DataToken trackArtist = null;
ArtistList trackArtist = null;
if (t.ArtistId.HasValue)
{
var ta = this.DbContext.Artists.FirstOrDefault(x => x.Id == t.ArtistId.Value);
if (ta != null)
{
trackArtist = new DataToken
{
Text = ta.Name,
Value = ta.RoadieId.ToString()
};
trackArtist = ArtistList.FromDataArtist(ta, this.MakeArtistThumbnailImage(ta.RoadieId));
}
}
track.TrackArtist = trackArtist;
@ -183,6 +179,8 @@ namespace Roadie.Api.Services
{
tsw.Restart();
// TODO this should be on artist properties to speed up fetch times
var artistTracks = (from r in this.DbContext.Releases
join rm in this.DbContext.ReleaseMedias on r.Id equals rm.ReleaseId
join t in this.DbContext.Tracks on rm.Id equals t.ReleaseMediaId
@ -200,16 +198,14 @@ namespace Roadie.Api.Services
{
FileSize = artistTracks.Sum(x => (long?)x.size).ToFileSize(),
MissingTrackCount = artistTracks.Where(x => x.isMissing).Count(),
ReleaseCount = this.DbContext.Releases.Count(x => x.ArtistId == artist.Id),
ReleaseCount = artist.ReleaseCount,
ReleaseMediaCount = (from r in this.DbContext.Releases
join rm in this.DbContext.ReleaseMedias on r.Id equals rm.ReleaseId
where r.ArtistId == artist.Id
select rm.Id).Count(),
TrackTime = validCartistTracks.Any() ? TimeSpan.FromSeconds(Math.Floor((double)trackTime / 1000)).ToString(@"dd\:hh\:mm\:ss") : "--:--",
TrackCount = validCartistTracks.Count(),
TrackPlayedCount = (from t in artistTracks
join ut in this.DbContext.UserTracks on t.Id equals ut.TrackId
select ut.PlayedCount).Sum() ?? 0
TrackPlayedCount = artist.PlayedCount
};
tsw.Stop();
timings.Add("stats", tsw.ElapsedMilliseconds);
@ -448,7 +444,7 @@ namespace Roadie.Api.Services
}
else
{
sortBy = string.IsNullOrEmpty(request.Sort) ? request.OrderValue(new Dictionary<string, string> { { "SortName", "ASC" }, { "Artist.Text", "ASC" } }) : request.OrderValue(null);
sortBy = request.OrderValue(new Dictionary<string, string> { { "SortName", "ASC" }, { "Artist.Text", "ASC" } });
}
rows = result.OrderBy(sortBy).Skip(request.SkipValue).Take(request.LimitValue).ToArray();
}

View file

@ -47,6 +47,18 @@ namespace Roadie.Api.Services
select pl.Id
).ToArray();
}
int[] playlistReleaseTrackIds = new int[0];
if(request.FilterToReleaseId.HasValue)
{
playlistReleaseTrackIds = (from pl in this.DbContext.Playlists
join pltr in this.DbContext.PlaylistTracks on pl.Id equals pltr.PlayListId
join t in this.DbContext.Tracks on pltr.TrackId equals t.Id
join rm in this.DbContext.ReleaseMedias on t.ReleaseMediaId equals rm.Id
join r in this.DbContext.Releases on rm.ReleaseId equals r.Id
where r.RoadieId == request.FilterToReleaseId
select pl.Id
).ToArray();
}
var result = (from pl in this.DbContext.Playlists
join u in this.DbContext.Users on pl.UserId equals u.Id
@ -56,6 +68,7 @@ namespace Roadie.Api.Services
select t.Duration).Sum()
where (request.FilterToPlaylistId == null || pl.RoadieId == request.FilterToPlaylistId)
where (request.FilterToArtistId == null || playlistWithArtistTrackIds.Contains(pl.Id))
where (request.FilterToReleaseId == null || playlistReleaseTrackIds.Contains(pl.Id))
where ((roadieUser == null && pl.IsPublic) || (roadieUser != null && u.RoadieId == roadieUser.UserId || pl.IsPublic))
where (request.FilterValue.Length == 0 || (request.FilterValue.Length > 0 && (
pl.Name != null && pl.Name.Contains(request.FilterValue))

View file

@ -8,6 +8,7 @@ using Roadie.Library.Encoding;
using Roadie.Library.Enums;
using Roadie.Library.Extensions;
using Roadie.Library.Models;
using Roadie.Library.Models.Collections;
using Roadie.Library.Models.Pagination;
using Roadie.Library.Models.Releases;
using Roadie.Library.Models.Statistics;
@ -27,6 +28,10 @@ namespace Roadie.Api.Services
{
public class ReleaseService : ServiceBase, IReleaseService
{
private ICollectionService CollectionService { get; } = null;
private IPlaylistService PlaylistService { get; } = null;
private IBookmarkService BookmarkService { get; } = null;
public ReleaseService(IRoadieSettings configuration,
@ -34,10 +39,14 @@ namespace Roadie.Api.Services
IHttpContext httpContext,
data.IRoadieDbContext dbContext,
ICacheManager cacheManager,
ICollectionService collectionService,
IPlaylistService playlistService,
ILogger<ReleaseService> logger,
IBookmarkService bookmarkService)
: base(configuration, httpEncoder, dbContext, cacheManager, logger, httpContext)
{
this.CollectionService = collectionService;
this.PlaylistService = playlistService;
this.BookmarkService = bookmarkService;
}
@ -162,7 +171,7 @@ namespace Roadie.Api.Services
}
}
//
// TODO list should honor disliked artist and albums
// TODO list should honor disliked artist and albums for random
//
var result = (from r in this.DbContext.Releases.Include("Artist")
join a in this.DbContext.Artists on r.ArtistId equals a.Id
@ -218,15 +227,15 @@ namespace Roadie.Api.Services
string sortBy = null;
if (request.ActionValue == User.ActionKeyUserRated)
{
sortBy = string.IsNullOrEmpty(request.Sort) ? request.OrderValue(new Dictionary<string, string> { { "Rating", "DESC" } }) : request.OrderValue(null);
sortBy = request.OrderValue(new Dictionary<string, string> { { "Rating", "DESC" } });
}
else if (request.FilterToArtistId.HasValue)
{
sortBy = string.IsNullOrEmpty(request.Sort) ? request.OrderValue(new Dictionary<string, string> { { "ReleaseDate", "ASC" }, { "Release.Text", "ASC" } }) : request.OrderValue(null);
sortBy = request.OrderValue(new Dictionary<string, string> { { "ReleaseDate", "ASC" }, { "Release.Text", "ASC" } });
}
else
{
sortBy = string.IsNullOrEmpty(request.Sort) ? request.OrderValue(new Dictionary<string, string> { { "Release.Text", "ASC" } }) : request.OrderValue(null);
sortBy = request.OrderValue(new Dictionary<string, string> { { "Release.Text", "ASC" } });
}
if(request.FilterRatedOnly)
{
@ -418,13 +427,9 @@ namespace Roadie.Api.Services
return new OperationResult<Release>(true, string.Format("Release Not Found [{0}]", id));
}
var result = release.Adapt<Release>();
result.Artist = new DataToken
{
Text = release.Artist.Name,
Value = release.Artist.RoadieId.ToString()
};
result.ArtistThumbnail = this.MakeArtistThumbnailImage(release.Artist.RoadieId);
result.Artist = ArtistList.FromDataArtist(release.Artist, this.MakeArtistThumbnailImage(release.Artist.RoadieId));
result.Thumbnail = this.MakeReleaseThumbnailImage(release.RoadieId);
result.MediumThumbnail = base.MakeThumbnailImage(id, "release", this.Configuration.MediumImageSize.Width, this.Configuration.MediumImageSize.Height);
result.ReleasePlayUrl = $"{ this.HttpContext.BaseUrl }/play/release/{ release.RoadieId}";
result.Profile = release.Profile;
result.ReleaseDate = release.ReleaseDate.Value;
@ -456,15 +461,19 @@ namespace Roadie.Api.Services
}
}
}
result.Genres = release.Genres.Select(x => new DataToken
{
Text = x.Genre.Name,
Value = x.Genre.RoadieId.ToString()
});
if (includes != null && includes.Any())
{
if(includes.Contains("genres"))
{
result.Genres = release.Genres.Select(x => new DataToken
{
Text = x.Genre.Name,
Value = x.Genre.RoadieId.ToString()
});
}
if (includes.Contains("stats"))
{
// TODO move these to release properties to speed up fetch times
var releaseTracks = (from r in this.DbContext.Releases
join rm in this.DbContext.ReleaseMedias on r.Id equals rm.ReleaseId
join t in this.DbContext.Tracks on rm.Id equals t.ReleaseMediaId
@ -487,12 +496,10 @@ namespace Roadie.Api.Services
var releaseTime = releaseTracks.Sum(x => x.time);
var releaseStats = new ReleaseStatistics
{
MediaCount = releaseMedias.Count(),
MediaCount = release.MediaCount,
MissingTrackCount = releaseTracks.Where(x => x.isMissing).Count(),
TrackCount = releaseTracks.Count(),
TrackPlayedCount = (from t in releaseTracks
join ut in this.DbContext.UserTracks on t.id equals ut.TrackId
select ut.PlayedCount).Sum(),
TrackCount = release.TrackCount,
TrackPlayedCount = release.PlayedCount,
TrackSize = releaseTracks.Sum(x => (long?)x.size).ToFileSize(),
TrackTime = releaseTracks.Any() ? TimeSpan.FromSeconds(Math.Floor((double)releaseTime / 1000)).ToString(@"hh\:mm\:ss") : "--:--"
};
@ -508,6 +515,18 @@ namespace Roadie.Api.Services
result.Images = releaseImages;
}
}
if(includes.Contains("playlists"))
{
var pg = new PagedRequest
{
FilterToReleaseId = release.RoadieId
};
var r = await this.PlaylistService.List(pg);
if (r.IsSuccess)
{
result.Playlists = r.Rows.ToArray();
}
}
if (includes.Contains("labels"))
{
var releaseLabels = (from l in this.DbContext.Labels
@ -529,10 +548,21 @@ namespace Roadie.Api.Services
BeginDate = releaseLabel.rl.BeginDate,
EndDate = releaseLabel.rl.EndDate,
CatalogNumber = releaseLabel.rl.CatalogNumber,
Label = new DataToken
Label = new LabelList
{
Text = releaseLabel.l.Name,
Value = releaseLabel.l.RoadieId.ToString()
Id = releaseLabel.rl.RoadieId,
Label = new DataToken
{
Text = releaseLabel.l.Name,
Value = releaseLabel.l.RoadieId.ToString()
},
SortName = releaseLabel.l.SortName,
CreatedDate = releaseLabel.l.CreatedDate,
LastUpdated = releaseLabel.l.LastUpdated,
ArtistCount = releaseLabel.l.ArtistCount,
ReleaseCount = releaseLabel.l.ReleaseCount,
TrackCount = releaseLabel.l.TrackCount,
Thumbnail = MakeLabelThumbnailImage(releaseLabel.l.RoadieId)
}
};
labels.Add(rl);
@ -550,13 +580,24 @@ namespace Roadie.Api.Services
{
collections.Add(new ReleaseInCollection
{
Collection = new DataToken
Collection = new CollectionList
{
Text = releaseCollection.Collection.Name,
Value = releaseCollection.Collection.RoadieId.ToString()
DatabaseId = releaseCollection.Collection.Id,
Collection = new DataToken
{
Text = releaseCollection.Collection.Name,
Value = releaseCollection.Collection.RoadieId.ToString()
},
Id = releaseCollection.Collection.RoadieId,
CollectionCount = releaseCollection.Collection.CollectionCount,
CollectionType = (releaseCollection.Collection.CollectionType ?? CollectionType.Unknown).ToString(),
CollectionFoundCount = (from crc in this.DbContext.CollectionReleases
where crc.CollectionId == releaseCollection.Collection.Id
select crc.Id).Count(),
CreatedDate = releaseCollection.Collection.CreatedDate,
LastUpdated = releaseCollection.Collection.LastUpdated,
Thumbnail = MakeCollectionThumbnailImage(releaseCollection.Collection.RoadieId)
},
CollectionImage = this.MakeCollectionThumbnailImage(releaseCollection.Collection.RoadieId),
CollectionType = releaseCollection.Collection.CollectionType,
ListNumber = releaseCollection.ListNumber
});
}
@ -588,12 +629,7 @@ namespace Roadie.Api.Services
Text = track.Title,
Value = track.RoadieId.ToString()
};
t.TrackArtist = track.TrackArtist != null ? new DataToken
{
Text = track.TrackArtist.Name,
Value = track.TrackArtist.RoadieId.ToString()
} : null;
t.TrackArtistThumbnail = track.TrackArtist != null ? this.MakeArtistThumbnailImage(track.TrackArtist.RoadieId) : null;
t.TrackArtist = track.TrackArtist != null ? ArtistList.FromDataArtist(track.TrackArtist, this.MakeArtistThumbnailImage(track.TrackArtist.RoadieId)) : null;
t.TrackPlayUrl = $"{ this.HttpContext.BaseUrl }/play/track/{ t.Id}.mp3";
rmTracks.Add(t);
}

View file

@ -337,11 +337,7 @@ namespace Roadie.Api.Services
Text = x.releaseArtist.Name,
Value = x.releaseArtist.RoadieId.ToString()
},
TrackArtist = x.trackArtist != null ? new DataToken
{
Text = x.trackArtist.Name,
Value = x.trackArtist.RoadieId.ToString()
} : null,
TrackArtist = x.trackArtist != null ? ArtistList.FromDataArtist(x.trackArtist, this.MakeArtistThumbnailImage(x.trackArtist.RoadieId)) : null,
TrackNumber = playListTrackPositions.ContainsKey(x.t.Id) ? playListTrackPositions[x.t.Id] : x.t.TrackNumber,
MediaNumber = x.rm.MediaNumber,
CreatedDate = x.t.CreatedDate,
@ -354,7 +350,6 @@ namespace Roadie.Api.Services
Rating = x.t.Rating,
ArtistThumbnail = this.MakeArtistThumbnailImage(x.releaseArtist.RoadieId),
Title = x.t.Title,
TrackArtistThumbnail = x.trackArtist != null ? this.MakeArtistThumbnailImage(x.trackArtist.RoadieId) : null,
TrackPlayUrl = $"{ this.HttpContext.BaseUrl }/play/track/{ x.t.RoadieId }.mp3",
Thumbnail = this.MakeTrackThumbnailImage(x.t.RoadieId)
});

423
RoadieApi/logs/release.json Normal file
View file

@ -0,0 +1,423 @@
{
"data": {
"amgId": "mw0000190990",
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"collections": [
{
"collection": {
"text": "Greatest of All Time Billboard 200 Albums",
"value": "3516bb27-a43c-47dc-81bc-57ff0759d90e",
"tooltip": "Greatest of All Time Billboard 200 Albums"
},
"collectionImage": {
"url": "http://192.168.1.177:5123/images/collection/3516bb27-a43c-47dc-81bc-57ff0759d90e",
"userBookmarked": false
},
"collectionType": 3,
"listNumber": 102
}
],
"discogsId": "3208075",
"genres": [
{
"text": "Adult Alternative",
"value": "3b3b4412-f3a2-451c-ac69-9431542a563f",
"tooltip": "Adult Alternative"
},
{
"text": "top40",
"value": "70a3910c-e88d-11e8-bdc1-24be052801e5",
"tooltip": "top40"
}
],
"iTunesId": "282960957",
"labels": [
{
"catalogNumber": "CBS 450449 1",
"label": {
"text": "CBS",
"value": "4ba9d29d-a380-4edb-9ed9-9dde59c4035b",
"tooltip": "CBS"
},
"userBookmarked": false
},
{
"catalogNumber": "FC 37978",
"label": {
"text": "Columbia",
"value": "9b6c2299-6096-4cb0-a3ff-88aa8f4a798c",
"tooltip": "Columbia"
},
"userBookmarked": false
},
{
"catalogNumber": "EPC 450887 2",
"label": {
"text": "Epic",
"value": "f55246e3-ee89-4a5e-a3c0-f9b824dce725",
"tooltip": "Epic"
},
"userBookmarked": false
},
{
"catalogNumber": "461023 2",
"label": {
"text": "Sony BMG Music Entertainment",
"value": "f02ac3c9-1891-4e96-a332-98bd5a70cf3c",
"tooltip": "Sony BMG Music Entertainment"
},
"userBookmarked": false
}
],
"lastFMId": "Men+at+Work/Business+As+Usual",
"lastFMSummary": "<p>\n \n \n \n Business as Usual is the debut album of Australian new wave band Men at Work, which was released in November 1981 in Australia, and April 1982 in the United States.<span style=\"color: rgb(34, 34, 34); font-family: &quot;Open Sans&quot;, &quot;Lucida Grande&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;\"><br></span></p>",
"libraryStatus": "Complete",
"mediaCount": 1,
"medias": [
{
"mediaNumber": 1,
"trackCount": 10,
"tracks": [
{
"trackNumber": 1,
"track": {
"text": "Who Can It Be Now?",
"value": "77d14e1e-98c6-4932-9825-b94e5c14260f",
"tooltip": "Who Can It Be Now?"
},
"release": {
"text": "Business As Usual",
"value": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"tooltip": "Business As Usual"
},
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"title": "Who Can It Be Now?",
"duration": 205000,
"durationTime": "00:03:25",
"durationTimeShort": "03:25",
"rating": 0,
"playedCount": 4,
"trackPlayUrl": "http://192.168.1.177:5123/play/track/77d14e1e-98c6-4932-9825-b94e5c14260f.mp3",
"fileSize": 8193438,
"id": "77d14e1e-98c6-4932-9825-b94e5c14260f",
"createdDate": "2015-11-07T16:08:54",
"lastUpdated": "2016-01-31T16:44:54"
},
{
"trackNumber": 2,
"track": {
"text": "I Can See It In Your Eyes",
"value": "22622449-7766-4900-b143-d76e801d1a83",
"tooltip": "I Can See It In Your Eyes"
},
"release": {
"text": "Business As Usual",
"value": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"tooltip": "Business As Usual"
},
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"title": "I Can See It In Your Eyes",
"duration": 212000,
"durationTime": "00:03:32",
"durationTimeShort": "03:32",
"rating": 0,
"playedCount": 1,
"trackPlayUrl": "http://192.168.1.177:5123/play/track/22622449-7766-4900-b143-d76e801d1a83.mp3",
"fileSize": 8515274,
"id": "22622449-7766-4900-b143-d76e801d1a83",
"createdDate": "2015-11-07T16:08:54",
"lastUpdated": "2016-01-31T16:44:54"
},
{
"trackNumber": 3,
"track": {
"text": "Down Under",
"value": "78e0c876-58ea-4504-8b34-9edbafe7975b",
"tooltip": "Down Under"
},
"release": {
"text": "Business As Usual",
"value": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"tooltip": "Business As Usual"
},
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"title": "Down Under",
"duration": 225000,
"durationTime": "00:03:45",
"durationTimeShort": "03:45",
"rating": 0,
"playedCount": 2,
"trackPlayUrl": "http://192.168.1.177:5123/play/track/78e0c876-58ea-4504-8b34-9edbafe7975b.mp3",
"fileSize": 9040842,
"id": "78e0c876-58ea-4504-8b34-9edbafe7975b",
"createdDate": "2015-11-07T16:08:54",
"lastUpdated": "2016-01-31T16:44:54"
},
{
"trackNumber": 4,
"track": {
"text": "Underground",
"value": "6504eeb1-3a64-446d-b245-9f6c99d7c404",
"tooltip": "Underground"
},
"release": {
"text": "Business As Usual",
"value": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"tooltip": "Business As Usual"
},
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"title": "Underground",
"duration": 187000,
"durationTime": "00:03:07",
"durationTimeShort": "03:07",
"rating": 0,
"playedCount": 1,
"trackPlayUrl": "http://192.168.1.177:5123/play/track/6504eeb1-3a64-446d-b245-9f6c99d7c404.mp3",
"fileSize": 7509023,
"id": "6504eeb1-3a64-446d-b245-9f6c99d7c404",
"createdDate": "2015-11-07T16:08:54",
"lastUpdated": "2016-01-31T16:44:54"
},
{
"trackNumber": 5,
"track": {
"text": "Helpless Automaton",
"value": "0d0eeedb-2e7a-4c41-b4ba-6708e2d26972",
"tooltip": "Helpless Automaton"
},
"release": {
"text": "Business As Usual",
"value": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"tooltip": "Business As Usual"
},
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"title": "Helpless Automaton",
"duration": 203000,
"durationTime": "00:03:23",
"durationTimeShort": "03:23",
"rating": 0,
"playedCount": 1,
"trackPlayUrl": "http://192.168.1.177:5123/play/track/0d0eeedb-2e7a-4c41-b4ba-6708e2d26972.mp3",
"fileSize": 8165226,
"id": "0d0eeedb-2e7a-4c41-b4ba-6708e2d26972",
"createdDate": "2015-11-07T16:08:54",
"lastUpdated": "2016-01-31T16:44:54"
},
{
"trackNumber": 6,
"track": {
"text": "People Just Love To Play With Words",
"value": "96b99fc8-3fde-44db-a26e-2aff6a9aa8f6",
"tooltip": "People Just Love To Play With Words"
},
"release": {
"text": "Business As Usual",
"value": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"tooltip": "Business As Usual"
},
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"title": "People Just Love To Play With Words",
"duration": 213000,
"durationTime": "00:03:33",
"durationTimeShort": "03:33",
"rating": 2,
"playedCount": 4,
"trackPlayUrl": "http://192.168.1.177:5123/play/track/96b99fc8-3fde-44db-a26e-2aff6a9aa8f6.mp3",
"fileSize": 8537226,
"id": "96b99fc8-3fde-44db-a26e-2aff6a9aa8f6",
"createdDate": "2015-11-07T16:08:54",
"lastUpdated": "2017-07-18T20:28:00"
},
{
"trackNumber": 7,
"track": {
"text": "Be Good Johnny",
"value": "e20d7fdb-e5f1-49de-80b6-86e9dc8690d8",
"tooltip": "Be Good Johnny"
},
"release": {
"text": "Business As Usual",
"value": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"tooltip": "Business As Usual"
},
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"title": "Be Good Johnny",
"duration": 219000,
"durationTime": "00:03:39",
"durationTimeShort": "03:39",
"rating": 0,
"playedCount": 1,
"trackPlayUrl": "http://192.168.1.177:5123/play/track/e20d7fdb-e5f1-49de-80b6-86e9dc8690d8.mp3",
"fileSize": 8784846,
"id": "e20d7fdb-e5f1-49de-80b6-86e9dc8690d8",
"createdDate": "2015-11-07T16:08:54",
"lastUpdated": "2016-01-31T16:44:54"
},
{
"trackNumber": 8,
"track": {
"text": "Touching The Untouchables",
"value": "8b5e8859-2bda-4e5e-8d76-0b2f6626e915",
"tooltip": "Touching The Untouchables"
},
"release": {
"text": "Business As Usual",
"value": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"tooltip": "Business As Usual"
},
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"title": "Touching The Untouchables",
"duration": 221000,
"durationTime": "00:03:41",
"durationTimeShort": "03:41",
"rating": 1,
"playedCount": 8,
"trackPlayUrl": "http://192.168.1.177:5123/play/track/8b5e8859-2bda-4e5e-8d76-0b2f6626e915.mp3",
"fileSize": 8879943,
"id": "8b5e8859-2bda-4e5e-8d76-0b2f6626e915",
"createdDate": "2015-11-07T16:08:54",
"lastUpdated": "2016-02-05T14:19:12"
},
{
"trackNumber": 9,
"track": {
"text": "Catch A Star",
"value": "0b0a651b-2c3d-40de-adb5-82f360b9aab2",
"tooltip": "Catch A Star"
},
"release": {
"text": "Business As Usual",
"value": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"tooltip": "Business As Usual"
},
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"title": "Catch A Star",
"duration": 211000,
"durationTime": "00:03:31",
"durationTimeShort": "03:31",
"rating": 0,
"playedCount": 1,
"trackPlayUrl": "http://192.168.1.177:5123/play/track/0b0a651b-2c3d-40de-adb5-82f360b9aab2.mp3",
"fileSize": 8476599,
"id": "0b0a651b-2c3d-40de-adb5-82f360b9aab2",
"createdDate": "2015-11-07T16:08:54",
"lastUpdated": "2016-01-31T16:44:55"
},
{
"trackNumber": 10,
"track": {
"text": "Down By The Sea",
"value": "41197dc3-b0d0-4402-b4e2-460f025f34d4",
"tooltip": "Down By The Sea"
},
"release": {
"text": "Business As Usual",
"value": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"tooltip": "Business As Usual"
},
"artist": {
"text": "Men At Work",
"value": "e9415243-515e-4595-b574-e4357712b715",
"tooltip": "Men At Work"
},
"title": "Down By The Sea",
"duration": 413000,
"durationTime": "00:06:53",
"durationTimeShort": "06:53",
"rating": 2,
"playedCount": 4,
"trackPlayUrl": "http://192.168.1.177:5123/play/track/41197dc3-b0d0-4402-b4e2-460f025f34d4.mp3",
"fileSize": 16542166,
"id": "41197dc3-b0d0-4402-b4e2-460f025f34d4",
"createdDate": "2016-01-31T16:44:55",
"lastUpdated": "2017-07-18T20:28:07"
}
],
"id": "8a1e98b0-7fb5-4558-9f58-da4c5a9ecf7f",
"createdDate": "2015-11-01T14:32:32"
}
],
"musicBrainzId": "0c77657d-6f77-4e6a-a220-b3bfeb5bfaf9",
"profile": "<p>Business as Usual is the debut studio album by Australian new wave band Men at Work, which was released in November 1981 in Australia, and April 1982 in the United States. It spent nine weeks at the top of the Australian Kent Music Report Albums Chart from December 1981 through to March 1982. The Australian version had a black and white cover design; overseas releases had a similar design, but in a black and yellow colour scheme. Business as Usual was one of the most successful albums internationally by an Australian group. It spent an unprecedented 15 weeks at No. 1 on the US Billboard 200 from late 1982 to early 1983; and five weeks at No. 1 in the United Kingdom Albums Chart in early 1983. Business as Usual was also one of the highest selling Australian albums in the early 1980s, with 6 million copies sold in the US,[2] and 15 million sold worldwide.[citation needed] Surprisingly, the disc also made it to #31 on Billboard's Black Albums chart.<br><br>The first single from the album, \"Who Can It Be Now?\", was released in Australia in June 1981, prior to the recording of the rest of the album. It reached No. 2 on the Australian Kent Music Report Singles Chart in August that year. The second single, \"Down Under\", which was issued in October peaked at No. 1 for six weeks. A third single, \"Be Good Johnny\", appeared in April the following year and reached No. 8.<br><br>In February 2010 a Federal Court judge in Sydney found that the flute riff from \"Down Under\" had been plagiarised from the Australian song \"Kookaburra Sits in the Old Gum Tree\", written in 1934 by Marion Sinclair. The Federal Court determined that the copyright was still current (Sinclair died in 1988) and had been assigned to Larrikin Music. The judge found that \"a substantial amount of the original song\" had been reproduced in \"Down Under\". Larrikin Music had suggested 60% of the royalties would be appropriate compensation, but the court decreed they shall receive only 5%, and only on mechanical rights for the song since 2002, and on future profits.<br><br>In October 2010, Business as Usual was listed in the book, 100 Best Australian Albums.[3]<br></p>",
"releaseDate": "1981-01-01T00:00:00",
"releaseType": "Unknown",
"spotifyId": "4HDJMKkwAMVFewqfZcmf84",
"thumbnail": {
"url": "http://192.168.1.177:5123/images/release/1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"userBookmarked": false
},
"artistThumbnail": {
"url": "http://192.168.1.177:5123/images/artist/e9415243-515e-4595-b574-e4357712b715",
"userBookmarked": false
},
"title": "Business As Usual",
"trackCount": 10,
"releasePlayUrl": "http://192.168.1.177:5123/play/release/1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"maxMediaNumber": 1,
"statistics": {
"mediaCount": 1,
"missingTrackCount": 0,
"trackCount": 10,
"trackPlayedCount": 25,
"trackSize": "88.35MB",
"trackTime": "00:38:29"
},
"alternateNamesList": [
"businessasusual"
],
"createdDate": "2015-11-01T14:32:32",
"id": "1fbf92fe-b3e3-45ba-9b6a-aacc68aaad62",
"isLocked": true,
"lastUpdated": "2018-12-06T21:29:59",
"status": 0,
"tagsList": [
"6x Platinum"
],
"urLsList": [
"https://en.wikipedia.org/wiki/Business_as_Usual_(Men_at_Work_album)"
],
"userBookmarked": false
},
"isSuccess": true,
"operationTime": 1046
}

View file

@ -57,7 +57,7 @@ namespace Roadie.Library.Data
.HasConversion(
v => v.ToString(),
v => string.IsNullOrEmpty(v) ? ReleaseType.Unknown : (ReleaseType)Enum.Parse(typeof(ReleaseType), v))
.HasDefaultValue(ReleaseType.Unknown);
.HasDefaultValue(ReleaseType.Release);
builder
.Entity<Release>()

View file

@ -16,5 +16,28 @@ namespace Roadie.Library.Models
public int? PlayedCount { get; set; }
public Image Thumbnail { get; set; }
public DateTime? LastPlayed { get; set; }
public static ArtistList FromDataArtist(Data.Artist artist, Image thumbnail)
{
return new ArtistList
{
DatabaseId = artist.Id,
Id = artist.RoadieId,
Artist = new DataToken
{
Text = artist.Name,
Value = artist.RoadieId.ToString()
},
Thumbnail = thumbnail, // this.MakeArtistThumbnailImage(a.RoadieId),
Rating = artist.Rating,
CreatedDate = artist.CreatedDate,
LastUpdated = artist.LastUpdated,
LastPlayed = artist.LastPlayed,
PlayedCount = artist.PlayedCount,
ReleaseCount = artist.ReleaseCount,
TrackCount = artist.TrackCount,
SortName = artist.SortName
};
}
}
}

View file

@ -74,10 +74,16 @@ namespace Roadie.Library.Models.Pagination
return this.Filter ?? string.Empty;
}
}
/// <summary>
/// Sort first with the given (if any) parameter then apply default sorting. Example is "rating" supplied then sort by sortName
/// </summary>
public string OrderValue(Dictionary<string, string> orderBy = null, string defaultSortBy = null, string defaultOrderBy = null)
{
var result = new StringBuilder();
if(!string.IsNullOrEmpty(this.Sort))
{
result.AppendFormat("{0} {1}", this.Sort ?? defaultSortBy, this.Order ?? defaultOrderBy ?? PagedRequest.OrderAscDirection);
}
if (orderBy != null && orderBy.Any())
{
foreach (var kp in orderBy)
@ -89,16 +95,13 @@ namespace Roadie.Library.Models.Pagination
result.AppendFormat("{0} {1}", kp.Key, kp.Value);
}
}
else
{
result.AppendFormat("{0} {1}", this.Sort ?? defaultSortBy, this.Order ?? defaultOrderBy ?? PagedRequest.OrderAscDirection);
}
return result.ToString();
}
public bool? FilterOnlyMissing { get; set; }
public Guid? FilterToArtistId { get; set; }
public Guid? FilterToReleaseId { get; set; }
public Guid? FilterToTrackId { get; set; }
public Guid? FilterToCollectionId { get; set; }
public Guid? FilterToPlaylistId { get; set; }

View file

@ -40,7 +40,7 @@ namespace Roadie.Library.Models.Player
{
get
{
return this.Track.TrackArtist?.Text ?? this.Artist.Artist.Text;
return this.Track.TrackArtist?.Artist.Text ?? this.Artist.Artist.Text;
}
}
@ -50,7 +50,7 @@ namespace Roadie.Library.Models.Player
{
if (this.Track.TrackArtist != null)
{
return this.Track.TrackArtist.Text;
return this.Track.TrackArtist.Artist.Text;
}
return this.Artist.Artist.Text;
}

View file

@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Roadie.Library.Models.Playlists;
using Roadie.Library.Models.Statistics;
using Roadie.Library.Models.Users;
using System;
@ -10,13 +11,13 @@ namespace Roadie.Library.Models.Releases
[Serializable]
public class Release : EntityModelBase
{
public const string DefaultIncludes = "tracks,stats,images,collections,labels";
public const string DefaultIncludes = "tracks,stats,images,collections,labels,playlists,genres";
public const string DefaultListIncludes = "";
[MaxLength(50)]
public string AmgId { get; set; }
public DataToken Artist { get; set; }
public ArtistList Artist { get; set; }
public List<ReleaseInCollection> Collections { get; set; }
@ -46,9 +47,13 @@ namespace Roadie.Library.Models.Releases
[MaxLength(100)]
public string MusicBrainzId { get; set; }
public IEnumerable<PlaylistList> Playlists { get; set; }
[MaxLength(65535)]
public string Profile { get; set; }
public short? Rating { get; set; }
[Required]
public DateTime ReleaseDate { get; set; }
@ -61,7 +66,6 @@ namespace Roadie.Library.Models.Releases
public Image Thumbnail { get; set; }
public Image ArtistThumbnail { get; set; }
[MaxLength(250)]
[Required]
@ -73,6 +77,6 @@ namespace Roadie.Library.Models.Releases
public ReleaseStatistics Statistics { get; set; }
public IEnumerable<Image> Images { get; set; }
public UserRelease UserRating { get; set; }
public Image MediumThumbnail { get; set; }
}
}

View file

@ -1,4 +1,5 @@
using Roadie.Library.Enums;
using Roadie.Library.Models.Collections;
using System;
namespace Roadie.Library.Models.Releases
@ -6,10 +7,7 @@ namespace Roadie.Library.Models.Releases
[Serializable]
public class ReleaseInCollection
{
public DataToken Collection { get; set; }
public Image CollectionImage { get; set; }
public CollectionType? CollectionType { get; set; }
public CollectionList Collection { get; set; }
public int ListNumber { get; set; }
}
}

View file

@ -7,7 +7,7 @@ namespace Roadie.Library.Models.Releases
{
public string CatalogNumber { get; set; }
public DataToken Label { get; set; }
public LabelList Label { get; set; }
public ReleaseLabel()
{

View file

@ -18,8 +18,7 @@ namespace Roadie.Library.Models
public Image ReleaseThumbnail { get; set; }
public DataToken Artist { get; set; }
public Image ArtistThumbnail { get; set; }
public DataToken TrackArtist { get; set; }
public Image TrackArtistThumbnail { get; set; }
public ArtistList TrackArtist { get; set; }
public string Title { get; set; }
public int? Duration { get; set; }
public string DurationTime