mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Made the album search 10x faster. We are now loading the images in a seperate call. #32
This commit is contained in:
parent
4e1a668d3c
commit
9211f3db4f
3 changed files with 12 additions and 4 deletions
|
@ -244,6 +244,7 @@ $(function () {
|
||||||
|
|
||||||
var html = musicTemplate(context);
|
var html = musicTemplate(context);
|
||||||
$("#musicList").append(html);
|
$("#musicList").append(html);
|
||||||
|
getCoverArt(context.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -253,6 +254,14 @@ $(function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getCoverArt(artistId) {
|
||||||
|
$.ajax("/search/music/coverart/" + artistId).success(function (result) {
|
||||||
|
if (result) {
|
||||||
|
$('#' + artistId + "imageDiv").html(" <img class='img-responsive' src='" + result + "' width='150' alt='poster'>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function buildMovieContext(result) {
|
function buildMovieContext(result) {
|
||||||
var date = new Date(result.releaseDate);
|
var date = new Date(result.releaseDate);
|
||||||
var year = date.getFullYear();
|
var year = date.getFullYear();
|
||||||
|
|
|
@ -80,6 +80,7 @@ namespace PlexRequests.UI.Modules
|
||||||
Get["movie/{searchTerm}"] = parameters => SearchMovie((string)parameters.searchTerm);
|
Get["movie/{searchTerm}"] = parameters => SearchMovie((string)parameters.searchTerm);
|
||||||
Get["tv/{searchTerm}"] = parameters => SearchTvShow((string)parameters.searchTerm);
|
Get["tv/{searchTerm}"] = parameters => SearchTvShow((string)parameters.searchTerm);
|
||||||
Get["music/{searchTerm}"] = parameters => SearchMusic((string)parameters.searchTerm);
|
Get["music/{searchTerm}"] = parameters => SearchMusic((string)parameters.searchTerm);
|
||||||
|
Get["music/coverArt/{id}"] = p => GetMusicBrainzCoverArt((string)p.id);
|
||||||
|
|
||||||
Get["movie/upcoming"] = parameters => UpcomingMovies();
|
Get["movie/upcoming"] = parameters => UpcomingMovies();
|
||||||
Get["movie/playing"] = parameters => CurrentlyPlayingMovies();
|
Get["movie/playing"] = parameters => CurrentlyPlayingMovies();
|
||||||
|
@ -168,7 +169,6 @@ namespace PlexRequests.UI.Modules
|
||||||
var model = new List<SearchMusicViewModel>();
|
var model = new List<SearchMusicViewModel>();
|
||||||
foreach (var a in releases)
|
foreach (var a in releases)
|
||||||
{
|
{
|
||||||
var img = GetMusicBrainzCoverArt(a.id);
|
|
||||||
model.Add(new SearchMusicViewModel
|
model.Add(new SearchMusicViewModel
|
||||||
{
|
{
|
||||||
Title = a.title,
|
Title = a.title,
|
||||||
|
@ -177,7 +177,6 @@ namespace PlexRequests.UI.Modules
|
||||||
Overview = a.disambiguation,
|
Overview = a.disambiguation,
|
||||||
ReleaseDate = a.date,
|
ReleaseDate = a.date,
|
||||||
TrackCount = a.TrackCount,
|
TrackCount = a.TrackCount,
|
||||||
CoverArtUrl = img,
|
|
||||||
ReleaseType = a.status,
|
ReleaseType = a.status,
|
||||||
Country = a.country
|
Country = a.country
|
||||||
});
|
});
|
||||||
|
|
|
@ -159,9 +159,9 @@
|
||||||
<!-- Music Results template -->
|
<!-- Music Results template -->
|
||||||
<script id="music-template" type="text/x-handlebars-template">
|
<script id="music-template" type="text/x-handlebars-template">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-2">
|
<div id="{{id}}imageDiv" class="col-sm-2">
|
||||||
{{#if coverArtUrl}}
|
{{#if coverArtUrl}}
|
||||||
<img class="img-responsive" src="{{coverArtUrl}}" width="150" alt="poster">
|
<img id="{{id}}cover" class="img-responsive" src="{{coverArtUrl}}" width="150" alt="poster">
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-5 ">
|
<div class="col-sm-5 ">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue