diff --git a/dashboard-ui/playlist.html b/dashboard-ui/playlist.html new file mode 100644 index 0000000000..7419ca5bee --- /dev/null +++ b/dashboard-ui/playlist.html @@ -0,0 +1,35 @@ + + + + + + +
+

+ Playlist

+ +
+ + + + + + + + + + + + + + + + + +
NameSeries/Album/YearTimeRating
+ + +
+
+ + diff --git a/dashboard-ui/scripts/playlist.js b/dashboard-ui/scripts/playlist.js index 2b4046e816..c99f8af9bb 100644 --- a/dashboard-ui/scripts/playlist.js +++ b/dashboard-ui/scripts/playlist.js @@ -3,26 +3,75 @@ function playlist() { var self = this; - self.queue = []; + if (typeof(self.queue) == 'undefined') { + self.queue = []; + } self.add = function (item) { - queue.push(item); + self.queue.push(item); + }; self.remove = function (index) { - queue.splice(index, 1); + self.queue.splice(index, 1); }; - self.play = function (index) { + self.play = function (elem) { + var index = $(elem).attr("data-queue-index"); - MediaPlayer.play(queue[index]); - queue.shift(); + MediaPlayer.play(new Array(self.queue[index])); + self.queue.shift(); }; return self; } window.Playlist = new playlist(); -})(window); \ No newline at end of file +})(window); + +(function ($, document) { + + $(document).on('pagebeforeshow', "#playlistPage", function () { + + var page = this; + + Dashboard.showLoadingMsg(); + + $.each(Playlist.queue, function(i, item){ + var html = ''; + var name = item.Name; + + if (item.IndexNumber != null) { + name = item.IndexNumber + " - " + name; + } + if (item.ParentIndexNumber != null) { + name = item.ParentIndexNumber + "." + name; + } + + //$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item)); + + if (item.SeriesName || item.Album) { + var seriesName = item.SeriesName || item.Album; + }else { + var seriesName = item.ProductionYear; + } + + html += ''; + html += ''; + html += '' + name + ''; + html += '' + seriesName + ''; + html += '' + ticks_to_human(item.RunTimeTicks) + ''; + html += ''; + html += ''; + + $("#queueTable").append(html); + }); + + + Dashboard.hideLoadingMsg(); + }); + + +})(jQuery, document); \ No newline at end of file