jellyfin-web/dashboard-ui/scripts/livetvseriestimer.js

67 lines
2.0 KiB
JavaScript
Raw Normal View History

2016-09-30 11:43:59 -07:00
define(['datetime', 'dom', 'seriesRecordingEditor', 'emby-itemscontainer'], function (datetime, dom, seriesRecordingEditor) {
2013-12-15 07:19:24 -07:00
2016-08-11 15:41:25 -07:00
return function (view, params) {
2013-12-14 18:17:57 -07:00
2016-08-11 15:41:25 -07:00
function renderTimer(page, item) {
2013-12-14 18:17:57 -07:00
2016-08-11 15:41:25 -07:00
page.querySelector('.itemName').innerHTML = item.Name;
2013-12-14 18:17:57 -07:00
2016-08-11 15:41:25 -07:00
Dashboard.hideLoadingMsg();
}
2013-12-14 18:17:57 -07:00
2016-10-01 00:06:00 -07:00
function renderSchedule(page) {
2014-01-07 22:25:21 -07:00
2016-10-01 00:06:00 -07:00
ApiClient.getLiveTvPrograms({
UserId: ApiClient.getCurrentUserId(),
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Thumb",
SortBy: "StartDate",
EnableTotalRecordCount: false,
EnableUserData: false,
SeriesTimerId: params.id,
Fields: "ChannelInfo"
2014-01-07 22:25:21 -07:00
2016-10-01 00:06:00 -07:00
}).then(function (result) {
2014-01-07 22:25:21 -07:00
2016-10-01 00:06:00 -07:00
LiveTvHelpers.getProgramScheduleHtml(result.Items).then(function (html) {
2013-12-14 18:17:57 -07:00
2016-10-01 00:06:00 -07:00
var scheduleTab = page.querySelector('.scheduleTab');
scheduleTab.innerHTML = html;
ImageLoader.lazyChildren(scheduleTab);
});
2016-08-11 15:41:25 -07:00
});
2016-10-01 00:06:00 -07:00
//var timers = result.Items;
//LiveTvHelpers.getTimersHtml(timers).then(function (html) {
// var scheduleTab = page.querySelector('.scheduleTab');
// scheduleTab.innerHTML = html;
// ImageLoader.lazyChildren(scheduleTab);
//});
2016-08-11 15:41:25 -07:00
}
2014-01-07 22:25:21 -07:00
2016-08-11 15:41:25 -07:00
function reload() {
2014-01-07 22:25:21 -07:00
2016-08-11 15:41:25 -07:00
var id = params.id;
Dashboard.showLoadingMsg();
2014-01-07 22:25:21 -07:00
2016-08-11 15:41:25 -07:00
ApiClient.getLiveTvSeriesTimer(id).then(function (result) {
2014-01-07 22:25:21 -07:00
2016-08-11 15:41:25 -07:00
renderTimer(view, result);
2014-01-07 22:25:21 -07:00
2016-08-11 15:41:25 -07:00
});
2015-06-08 14:32:20 -07:00
2016-10-01 00:06:00 -07:00
renderSchedule(view);
2016-08-11 15:41:25 -07:00
}
2013-12-14 18:17:57 -07:00
2016-09-30 11:43:59 -07:00
seriesRecordingEditor.embed(params.id, ApiClient.serverId(), {
context: view.querySelector('.recordingEditor')
2016-08-11 15:41:25 -07:00
});
2013-12-14 18:17:57 -07:00
2016-08-11 15:41:25 -07:00
view.querySelector('.scheduleTab').addEventListener('timercancelled', reload);
view.addEventListener('viewbeforeshow', reload);
};
});