1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

support deleting and canceling live tv recordings and timers

This commit is contained in:
Luke Pulverenti 2013-11-29 11:58:24 -05:00
parent 8dd607af86
commit ac0cc84f9d
14 changed files with 181 additions and 75 deletions

View file

@ -399,7 +399,7 @@
var options = {
userId: Dashboard.getCurrentUserId(),
limit: item.Type == "MusicAlbum" ? 6 : 8,
limit: item.Type == "MusicAlbum" ? 6 : 6,
fields: "PrimaryImageAspectRatio,DateCreated,UserData"
};

View file

@ -1506,9 +1506,9 @@
if ((item.MediaType || item.IsFolder) && item.Type != "Channel" && item.Type != "MusicArtist") {
if (userData.Played) {
html += '<img data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgPlayed" src="css/images/userdata/playedon.png" alt="Played" title="Played" onclick="LibraryBrowser.markPlayed(this);return false;" />';
html += '<img data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgPlayed" src="css/images/userdata/checkedon.png" alt="Played" title="Played" onclick="LibraryBrowser.markPlayed(this);return false;" />';
} else {
html += '<img data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgPlayedOff" src="css/images/userdata/playedoff.png" alt="Played" title="Played" onclick="LibraryBrowser.markPlayed(this);return false;" />';
html += '<img data-type="' + type + '" data-itemid="' + itemId + '" class="imgUserItemRating imgPlayedOff" src="css/images/userdata/checkedoff.png" alt="Played" title="Played" onclick="LibraryBrowser.markPlayed(this);return false;" />';
}
}
@ -1549,10 +1549,10 @@
}
if (markAsPlayed) {
link.src = "css/images/userdata/playedon.png";
link.src = "css/images/userdata/checkedon.png";
$link.addClass('imgPlayed').removeClass('imgPlayedOff');
} else {
link.src = "css/images/userdata/playedoff.png";
link.src = "css/images/userdata/checkedoff.png";
$link.addClass('imgPlayedOff').removeClass('imgPlayed');
}
},
@ -1713,53 +1713,55 @@
var url;
var imageHeight = 510;
if (imageTags.Primary) {
if (item.Type == "Channel") {
url = ApiClient.getUrl("LiveTV/Channels/" + item.Id + "/Images/Primary", {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Primary,
type: "Primary"
});
}
else if (item.Type == "Person") {
url = ApiClient.getPersonImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Primary,
type: "Primary"
});
}
else if (item.Type == "Genre") {
url = ApiClient.getGenreImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Primary,
type: "Primary"
});
}
else if (item.Type == "MusicGenre") {
url = ApiClient.getMusicGenreImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Primary,
type: "Primary"
});
}
else if (item.Type == "GameGenre") {
url = ApiClient.getGameGenreImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Primary,
type: "Primary"
});
}
else if (item.Type == "Studio") {
url = ApiClient.getStudioImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Primary,
type: "Primary"
});
}
else if (item.Type == "MusicArtist") {
url = ApiClient.getArtistImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Primary,
type: "Primary"
});
@ -1767,7 +1769,7 @@
else {
url = ApiClient.getImageUrl(item.Id, {
type: "Primary",
maxheight: 480,
maxheight: imageHeight,
tag: item.ImageTags.Primary
});
}
@ -1776,42 +1778,42 @@
if (item.Type == "Person") {
url = ApiClient.getPersonImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: item.BackdropImageTags[0],
type: "Backdrop"
});
}
else if (item.Type == "Genre") {
url = ApiClient.getGenreImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: item.BackdropImageTags[0],
type: "Backdrop"
});
}
else if (item.Type == "MusicGenre") {
url = ApiClient.getMusicGenreImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: item.BackdropImageTags[0],
type: "Backdrop"
});
}
else if (item.Type == "GameGenre") {
url = ApiClient.getGameGenreImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: item.BackdropImageTags[0],
type: "Backdrop"
});
}
else if (item.Type == "Studio") {
url = ApiClient.getStudioImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: item.BackdropImageTags[0],
type: "Backdrop"
});
}
else if (item.Type == "MusicArtist") {
url = ApiClient.getArtistImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: item.BackdropImageTags[0],
type: "Backdrop"
});
@ -1819,7 +1821,7 @@
else {
url = ApiClient.getImageUrl(item.Id, {
type: "Backdrop",
maxheight: 480,
maxheight: imageHeight,
tag: item.BackdropImageTags[0]
});
}
@ -1828,42 +1830,42 @@
if (item.Type == "Person") {
url = ApiClient.getPersonImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Thumb,
type: "Thumb"
});
}
else if (item.Type == "Genre") {
url = ApiClient.getGenreImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Thumb,
type: "Thumb"
});
}
else if (item.Type == "MusicGenre") {
url = ApiClient.getMusicGenreImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Thumb,
type: "Thumb"
});
}
else if (item.Type == "GameGenre") {
url = ApiClient.getGameGenreImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Thumb,
type: "Thumb"
});
}
else if (item.Type == "Studio") {
url = ApiClient.getStudioImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Thumb,
type: "Thumb"
});
}
else if (item.Type == "MusicArtist") {
url = ApiClient.getArtistImageUrl(item.Name, {
maxheight: 480,
maxheight: imageHeight,
tag: imageTags.Thumb,
type: "Thumb"
});
@ -1871,7 +1873,7 @@
else {
url = ApiClient.getImageUrl(item.Id, {
type: "Thumb",
maxheight: 480,
maxheight: imageHeight,
tag: item.ImageTags.Thumb
});
}
@ -1880,7 +1882,7 @@
url = ApiClient.getImageUrl(item.Id, {
type: "Disc",
maxheight: 480,
maxheight: imageHeight,
tag: item.ImageTags.Disc
});
}
@ -1888,7 +1890,7 @@
url = ApiClient.getImageUrl(item.AlbumId, {
type: "Primary",
maxheight: 480,
maxheight: imageHeight,
tag: item.AlbumPrimaryImageTag
});
@ -2007,7 +2009,7 @@
}
}
if (item.RunTimeTicks) {
if (item.RunTimeTicks && item.Type != "Series") {
if (item.Type == "Audio") {
@ -2349,7 +2351,7 @@
if (user.PrimaryImageTag) {
var url = ApiClient.getUserImageUrl(user.Id, {
width: 225,
height: 40,
tag: user.PrimaryImageTag,
type: "Primary"
});

View file

@ -1,7 +1,30 @@
(function ($, document, apiClient) {
function playRecording(page, id) {
}
function deleteRecording(page, id) {
Dashboard.confirm("Are you sure you wish to delete this recording?", "Confirm Recording Deletion", function (result) {
if (result) {
Dashboard.showLoadingMsg();
ApiClient.deleteLiveTvRecording(id).done(function () {
Dashboard.alert('Recording deleted');
reload(page);
});
}
});
}
function renderRecordings(page, recordings) {
var html = '';
var cssClass = "detailTable";
@ -28,7 +51,6 @@
html += '<td>';
html += '<button data-recordingid="' + recording.Id + '" class="btnPlayRecording" type="button" data-icon="play" data-inline="true" data-mini="true" data-iconpos="notext">Play</button>';
html += '<button data-recordingid="' + recording.Id + '" class="btnEditRecording" type="button" data-icon="pencil" data-inline="true" data-mini="true" data-iconpos="notext">Edit</button>';
html += '<button data-recordingid="' + recording.Id + '" class="btnDeleteRecording" type="button" data-icon="delete" data-inline="true" data-mini="true" data-iconpos="notext">Delete</button>';
html += '</td>';
@ -59,17 +81,35 @@
html += '</table></div>';
var elem = $('#items', page).html(html).trigger('create');
$('.btnPlayRecording', elem).on('click', function () {
var recordingId = this.getAttribute('data-recordingid');
playRecording(page, recordingId);
});
$('.btnDeleteRecording', elem).on('click', function () {
var recordingId = this.getAttribute('data-recordingid');
deleteRecording(page, recordingId);
});
Dashboard.hideLoadingMsg();
}
function reload(page) {
apiClient.getLiveTvRecordings().done(function(result) {
Dashboard.showLoadingMsg();
apiClient.getLiveTvRecordings().done(function (result) {
renderRecordings(page, result.Items);
});
}
$(document).on('pagebeforeshow', "#liveTvRecordingsPage", function () {
var page = this;

View file

@ -1,5 +1,28 @@
(function ($, document, apiClient) {
function editTimer(page, id) {
}
function deleteTimer(page, id) {
Dashboard.confirm("Are you sure you wish to delete this timer?", "Confirm Timer Deletion", function (result) {
if (result) {
Dashboard.showLoadingMsg();
ApiClient.cancelLiveTvTimer(id).done(function () {
Dashboard.alert('Timer deleted');
reload(page);
});
}
});
}
function renderTimers(page, timers) {
var html = '';
@ -61,6 +84,20 @@
html += '</table></div>';
var elem = $('#items', page).html(html).trigger('create');
$('.btnEditTimer', elem).on('click', function () {
var id = this.getAttribute('data-timerid');
editTimer(page, id);
});
$('.btnDeleteTimer', elem).on('click', function () {
var id = this.getAttribute('data-timerid');
deleteTimer(page, id);
});
}
function reload(page) {

View file

@ -6,7 +6,7 @@
stopInterval();
}
ApiClient.getScheduledTasks().done(function (tasks) {
ApiClient.getScheduledTasks({isHidden: false}).done(function (tasks) {
if (updateInterval) {
populateList(page, tasks);