Added album info change stuff

This commit is contained in:
gballan1 2016-11-28 21:23:55 -05:00
parent 9aff68ca86
commit b6915c242d
3 changed files with 21 additions and 6 deletions

View File

@ -20,12 +20,12 @@
<!-- left album stuff --> <!-- left album stuff -->
<article class="col-sm-5 col-xs-12"> <article class="col-sm-5 col-xs-12">
<div class="thumbnail shadow-1"> <div class="thumbnail shadow-1">
<img class="image-responsive album-art" src="{{ albums[0].album_art }}" alt="{{ albums[0].title }}"> <img id="album-artwork" class="image-responsive album-art" src="{{ albums[0].album_art }}" alt="{{ albums[0].title }}">
<div class="caption"> <div class="caption">
<h3>{{ albums[0].title }}</h3> <h3 id="album-title">{{ albums[0].title }}</h3>
{% if albums[0].description %} {% if albums[0].description %}
<hr /> <hr />
<p>{{ albums[0].description }}</p> <p id="album-description">{{ albums[0].description }}</p>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -20,12 +20,12 @@
<!-- left album stuff --> <!-- left album stuff -->
<article class="col-sm-5 col-xs-12"> <article class="col-sm-5 col-xs-12">
<div class="thumbnail shadow-1"> <div class="thumbnail shadow-1">
<img class="image-responsive album-art" src="{{ albums[0].album_art }}" alt="{{ albums[0].title }}"> <img id="album-artwork" class="image-responsive album-art" src="{{ albums[0].album_art }}" alt="{{ albums[0].title }}">
<div class="caption"> <div class="caption">
<h3>{{ albums[0].title }}</h3> <h3 id="album-title">{{ albums[0].title }}</h3>
{% if albums[0].description %} {% if albums[0].description %}
<hr /> <hr />
<p>{{ albums[0].description }}</p> <p id="album-description">{{ albums[0].description }}</p>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -29,6 +29,21 @@ function changeSelectedAlbum(albumElem) {
} }
} }
function getAlbumInfo(albumElem) {
albumElem = $(albumElem);
$.get('/apiv1/music/album-info/' + albumElem.data('albumid'), function(data) {
var json = $.parseJSON(data);
// change album artwork
$('#album-artwork').attr('src', json.album_art);
// change album title
$('#album-title').text(json.title);
// change album description
$('#album-description').text(json.description);
});
}
function changeSelectedTrack(trackElem) { function changeSelectedTrack(trackElem) {
var oldSelected = $('.now-playing-list .music-track.selected'); var oldSelected = $('.now-playing-list .music-track.selected');
var newSelected = $(trackElem); var newSelected = $(trackElem);