updated live tv + nuget

This commit is contained in:
Luke Pulverenti 2013-12-14 20:17:57 -05:00
parent fadec6653a
commit b2b7584352
16 changed files with 544 additions and 46 deletions

View File

@ -506,20 +506,110 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
}); });
}; };
self.createLiveTvTimer = function (options) { self.createLiveTvTimer = function (item) {
if (!options) { if (!item) {
throw new Error("null options"); throw new Error("null item");
} }
var url = self.getUrl("LiveTv/Timers", options); var url = self.getUrl("LiveTv/Timers");
return self.ajax({ return self.ajax({
type: "POST", type: "POST",
url: url,
data: JSON.stringify(item),
contentType: "application/json"
});
};
self.updateLiveTvTimer = function (item) {
if (!item) {
throw new Error("null item");
}
var url = self.getUrl("LiveTv/Timers/" + item.Id);
return self.ajax({
type: "POST",
url: url,
data: JSON.stringify(item),
contentType: "application/json"
});
};
self.getLiveTvSeriesTimers = function (options) {
var url = self.getUrl("LiveTv/SeriesTimers", options || {});
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getLiveTvSeriesTimer = function (id) {
if (!id) {
throw new Error("null id");
}
var url = self.getUrl("LiveTv/SeriesTimers/" + id);
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.cancelLiveTvSeriesTimer = function (id) {
if (!id) {
throw new Error("null id");
}
var url = self.getUrl("LiveTv/SeriesTimers/" + id);
return self.ajax({
type: "DELETE",
url: url url: url
}); });
}; };
self.createLiveTvSeriesTimer = function (item) {
if (!item) {
throw new Error("null item");
}
var url = self.getUrl("LiveTv/SeriesTimers");
return self.ajax({
type: "POST",
url: url,
data: JSON.stringify(item),
contentType: "application/json"
});
};
self.updateLiveTvSeriesTimer = function (item) {
if (!item) {
throw new Error("null item");
}
var url = self.getUrl("LiveTv/SeriesTimers/" + item.Id);
return self.ajax({
type: "POST",
url: url,
data: JSON.stringify(item),
contentType: "application/json"
});
};
/** /**
* Gets the current server status * Gets the current server status
*/ */

View File

@ -12,7 +12,7 @@
<ul data-role="listview" class="ulForm"> <ul data-role="listview" class="ulForm">
<li> <li>
<input type="checkbox" id="chkRunAtStartup" name="chkRunAtStartup" /> <input type="checkbox" id="chkRunAtStartup" name="chkRunAtStartup" data-mini="true" />
<label for="chkRunAtStartup">Run server at startup</label> <label for="chkRunAtStartup">Run server at startup</label>
<div id="windowsStartupDescription" class="fieldDescription warningFieldDescription" style="display: none;"> <div id="windowsStartupDescription" class="fieldDescription warningFieldDescription" style="display: none;">
This will start the tray icon on windows startup. To start the windows service, uncheck this and run the service from the windows control panel. Please note that you cannot run both at the same time, so you will need to exit the tray icon before starting the service. This will start the tray icon on windows startup. To start the windows service, uncheck this and run the service from the windows control panel. Please note that you cannot run both at the same time, so you will need to exit the tray icon before starting the service.
@ -20,7 +20,7 @@
</li> </li>
<li> <li>
<label for="selectAutomaticUpdateLevel">Automatic update level</label> <label for="selectAutomaticUpdateLevel">Automatic update level</label>
<select name="selectAutomaticUpdateLevel" id="selectAutomaticUpdateLevel"> <select name="selectAutomaticUpdateLevel" id="selectAutomaticUpdateLevel" data-mini="true">
<option value="Release">Official Release</option> <option value="Release">Official Release</option>
<option value="Beta">Beta</option> <option value="Beta">Beta</option>
<option value="Dev">Dev (Unstable)</option> <option value="Dev">Dev (Unstable)</option>
@ -31,36 +31,55 @@
</li> </li>
<li> <li>
<label for="txtPortNumber">Http server port number: </label> <label for="txtPortNumber">Http server port number: </label>
<input type="number" id="txtPortNumber" name="txtPortNumber" pattern="[0-9]*" required="required" min="1" /> <input type="number" id="txtPortNumber" name="txtPortNumber" pattern="[0-9]*" required="required" min="1" data-mini="true" />
</li> </li>
<li id="fldWebSocketPortNumber" style="display: none;"> <li id="fldWebSocketPortNumber" style="display: none;">
<label for="txtWebSocketPortNumber">Web socket port number: </label> <label for="txtWebSocketPortNumber">Web socket port number: </label>
<input type="number" id="txtWebSocketPortNumber" name="txtWebSocketPortNumber" pattern="[0-9]*" required="required" min="1" /> <input type="number" id="txtWebSocketPortNumber" name="txtWebSocketPortNumber" pattern="[0-9]*" required="required" min="1" data-mini="true" />
</li>
</ul>
<h2>Cache Path</h2>
<ul data-role="listview" class="ulForm">
<li>
<input type="checkbox" id="chkEnableCustomCachePath" name="chkEnableCustomCachePath" data-mini="true" />
<label for="chkEnableCustomCachePath">Use custom server cache path</label>
<div class="fieldDescription">
This folder contains server cache files, such as images.
</div>
</li>
<li id="fldEnterCachePath" style="display: none;">
<label for="txtCachePath">Server cache path: </label>
<div style="display: inline-block; width: 92%;">
<input type="text" id="txtCachePath" name="txtCachePath" data-mini="true" />
</div>
<button id="btnSelectCachePath" type="button" data-icon="folder-close" data-iconpos="notext" data-inline="true">Select Directory</button>
<div class="fieldDescription">
Supply a custom cache path. Media Browser Server must have write access to this folder. The location of this folder will directly impact server performance and should ideally be placed on a solid state drive.
</div>
</li> </li>
</ul> </ul>
<h2>Miscellaneous</h2> <h2>Miscellaneous</h2>
<ul data-role="listview" class="ulForm"> <ul data-role="listview" class="ulForm">
<li> <li>
<input type="checkbox" id="chkEnableDeveloperTools" name="chkEnableDeveloperTools" /> <input type="checkbox" id="chkEnableDeveloperTools" name="chkEnableDeveloperTools" data-mini="true" />
<label for="chkEnableDeveloperTools">Enable developer tools</label> <label for="chkEnableDeveloperTools">Enable developer tools</label>
<div class="fieldDescription"> <div class="fieldDescription">
When enabled, developer tools will be available from the system tray. When enabled, developer tools will be available from the system tray.
</div> </div>
</li> </li>
<li> <li>
<input type="checkbox" id="chkDebugLog" name="chkDebugLog" /> <input type="checkbox" id="chkDebugLog" name="chkDebugLog" data-mini="true" />
<label for="chkDebugLog">Enable debug logging </label> <label for="chkDebugLog">Enable debug logging </label>
</li> </li>
<li> <li>
<button type="submit" data-theme="b" data-icon="ok"> <button type="submit" data-theme="b" data-icon="ok" data-mini="true">
Save Save
</button> </button>
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete"> <button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete" data-mini="true">
Cancel Cancel
</button> </button>
</li> </li>
</ul> </ul>
</form> </form>
</div> </div>
</div> </div>

View File

@ -13,9 +13,63 @@
<a href="livetvseriestimers.html" class="ui-btn-active">Series Timers</a> <a href="livetvseriestimers.html" class="ui-btn-active">Series Timers</a>
</div> </div>
<div data-role="content"> <div data-role="content">
<br /> <form id="liveTvSeriesTimerForm" style="margin: 0 auto;">
<div id="items" class="itemsContainer"></div> <p><span class="itemName inlineItemName"></span><span class="itemMiscInfo" style="display: inline;"></span></p>
<p class="channel"></p>
<p class="overview"></p>
<p style="margin-top: 2em;">
<a id="btnCancelTimer" href="#">Cancel Series</a>
</p>
<br />
<br />
<ul data-role="listview" class="ulForm">
<li>
<label for="selectPriority">Priority: </label>
<select id="selectPriority" required="required" data-mini="true">
<option value="0">Highest</option>
<option value="1">Higher</option>
<option value="2">High</option>
<option value="3">Medium</option>
<option value="4">Low</option>
<option value="5">Lower</option>
<option value="6">Lowest</option>
</select>
</li>
<li>
<label for="txtRequestedPrePaddingSeconds">Requested pre-padding seconds: </label>
<input type="number" id="txtRequestedPrePaddingSeconds" pattern="[0-9]*" required="required" min="0" data-mini="true" />
</li>
<li>
<label for="txtRequestedPostPaddingSeconds">Requested post-padding seconds: </label>
<input type="number" id="txtRequestedPostPaddingSeconds" pattern="[0-9]*" required="required" min="0" data-mini="true" />
</li>
<li>
<label for="txtRequiredPrePaddingSeconds">Required pre-padding seconds: </label>
<input type="number" id="txtRequiredPrePaddingSeconds" pattern="[0-9]*" required="required" min="0" data-mini="true" />
</li>
<li>
<label for="txtRequiredPostPaddingSeconds">Required post-padding seconds: </label>
<input type="number" id="txtRequiredPostPaddingSeconds" pattern="[0-9]*" required="required" min="0" data-mini="true" />
</li>
<li>
<button type="submit" data-theme="b" data-icon="ok" data-mini="true">
Save
</button>
<button type="button" onclick="Dashboard.navigate('livetvtimers.html');" data-icon="delete" data-mini="true">
Cancel
</button>
</li>
</ul>
</form>
</div> </div>
<script type="text/javascript">
$('#liveTvSeriesTimerForm').on('submit', LiveTvSeriesTimerPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View File

@ -13,7 +13,7 @@
<a href="livetvseriestimers.html">Series Timers</a> <a href="livetvseriestimers.html">Series Timers</a>
</div> </div>
<div data-role="content"> <div data-role="content">
<form style="margin: 0 auto;"> <form id="liveTvTimerForm" style="margin: 0 auto;">
<p><span class="itemName inlineItemName program"></span><span class="itemMiscInfo" style="display: inline;"></span></p> <p><span class="itemName inlineItemName program"></span><span class="itemMiscInfo" style="display: inline;"></span></p>
<p class="channel"></p> <p class="channel"></p>
@ -56,6 +56,10 @@
</ul> </ul>
</form> </form>
</div> </div>
<script type="text/javascript">
$('#liveTvTimerForm').on('submit', LiveTvTimerPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View File

@ -18,36 +18,36 @@
<form id="metadataConfigurationForm"> <form id="metadataConfigurationForm">
<ul data-role="listview" class="ulForm"> <ul data-role="listview" class="ulForm">
<li> <li>
<input type="checkbox" id="chkEnableInternetProviders" name="chkEnableInternetProviders" /> <input type="checkbox" id="chkEnableInternetProviders" name="chkEnableInternetProviders" data-mini="true" />
<label for="chkEnableInternetProviders">Download metadata from the internet </label> <label for="chkEnableInternetProviders">Download metadata from the internet </label>
</li> </li>
<li> <li>
<input type="checkbox" id="chkSaveLocal" name="chkSaveLocal" /> <input type="checkbox" id="chkSaveLocal" name="chkSaveLocal" data-mini="true" />
<label for="chkSaveLocal">Save metadata within media folders </label> <label for="chkSaveLocal">Save metadata within media folders </label>
</li> </li>
<li> <li>
<label for="selectLanguage">Preferred language: </label> <label for="selectLanguage">Preferred language: </label>
<select name="selectLanguage" id="selectLanguage"></select> <select name="selectLanguage" id="selectLanguage" data-mini="true"></select>
</li> </li>
<li> <li>
<label for="selectCountry">Country: </label> <label for="selectCountry">Country: </label>
<select name="selectCountry" id="selectCountry"></select> <select name="selectCountry" id="selectCountry" data-mini="true"></select>
</li> </li>
<li> <li>
<input type="checkbox" id="chkEnableTmdbPersonUpdates" name="chkEnableTmdbPersonUpdates" /> <input type="checkbox" id="chkEnableTmdbPersonUpdates" name="chkEnableTmdbPersonUpdates" data-mini="true" />
<label for="chkEnableTmdbPersonUpdates">Enable automatic tmdb updates</label> <label for="chkEnableTmdbPersonUpdates">Enable automatic updates from TheMovieDB.org</label>
<div class="fieldDescription">If enabled, movies and people will be updated automatically as they are updated on the themoviedb.org.</div> <div class="fieldDescription">If enabled, movies and people will be updated automatically as they are updated on the TheMovieDB.org.</div>
</li> </li>
<li> <li>
<input type="checkbox" id="chkEnableTvdbUpdates" name="chkEnableTvdbUpdates" /> <input type="checkbox" id="chkEnableTvdbUpdates" name="chkEnableTvdbUpdates" data-mini="true" />
<label for="chkEnableTvdbUpdates">Enable automatic tvdb updates</label> <label for="chkEnableTvdbUpdates">Enable automatic updates from TheTVDB.com</label>
<div class="fieldDescription">If enabled, tv series and episodes will be updated automatically as they are updated on the tvdb.com.</div> <div class="fieldDescription">If enabled, tv series and episodes will be updated automatically as they are updated on the TheTVDB.com.</div>
</li> </li>
<li> <li>
<button type="submit" data-theme="b" data-icon="ok"> <button type="submit" data-theme="b" data-icon="ok" data-mini="true">
Save Save
</button> </button>
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete"> <button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete" data-mini="true">
Cancel Cancel
</button> </button>
</li> </li>

View File

@ -3,13 +3,13 @@
function loadPage(page, config, systemInfo) { function loadPage(page, config, systemInfo) {
var os = systemInfo.OperatingSystem.toLowerCase(); var os = systemInfo.OperatingSystem.toLowerCase();
if (os.indexOf('windows') != -1) { if (os.indexOf('windows') != -1) {
$('#windowsStartupDescription', page).show(); $('#windowsStartupDescription', page).show();
} else { } else {
$('#windowsStartupDescription', page).hide(); $('#windowsStartupDescription', page).hide();
} }
if (systemInfo.SupportsNativeWebSocket) { if (systemInfo.SupportsNativeWebSocket) {
$('#fldWebSocketPortNumber', page).hide(); $('#fldWebSocketPortNumber', page).hide();
@ -26,6 +26,20 @@
$('#chkEnableDeveloperTools', page).checked(config.EnableDeveloperTools).checkboxradio("refresh"); $('#chkEnableDeveloperTools', page).checked(config.EnableDeveloperTools).checkboxradio("refresh");
$('#chkRunAtStartup', page).checked(config.RunAtStartup).checkboxradio("refresh"); $('#chkRunAtStartup', page).checked(config.RunAtStartup).checkboxradio("refresh");
$('#txtCachePath', page).val(config.CachePath || '');
var customCachePath = config.CachePath ? true : false;
$('#chkEnableCustomCachePath', page).checked(customCachePath).checkboxradio("refresh");
if (customCachePath) {
$('#fldEnterCachePath', page).show();
$('#txtCachePath', page).attr("required", "required");
} else {
$('#fldEnterCachePath', page).hide();
$('#txtCachePath', page).removeAttr("required");
}
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
} }
@ -44,7 +58,46 @@
loadPage(page, response1[0], response2[0]); loadPage(page, response1[0], response2[0]);
}); });
$('#btnSelectCachePath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtCachePath', page).val(path);
}
picker.close();
},
header: "Select Server Cache Path",
instruction: "Browse or enter the path to use for Media Browser Server cache. The folder must be writeable."
});
});
$('#chkEnableCustomCachePath', page).on("change.showCachePathText", function () {
if (this.checked) {
$('#fldEnterCachePath', page).show();
$('#txtCachePath', page).attr("required", "required");
} else {
$('#fldEnterCachePath', page).hide();
$('#txtCachePath', page).removeAttr("required");
}
});
}).on('pagehide', "#advancedConfigurationPage", function () {
var page = this;
$('#chkEnableCustomCachePath', page).off("change.showCachePathText");
$('#btnSelectCachePath', page).off("click.selectDirectory");
}).on('pageinit', "#advancedConfigurationPage", function () { }).on('pageinit', "#advancedConfigurationPage", function () {
var page = this; var page = this;
@ -58,7 +111,7 @@
} }
}); });
}); });
function advancedConfigurationPage() { function advancedConfigurationPage() {
@ -72,6 +125,12 @@
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().done(function (config) {
if ($('#chkEnableCustomCachePath', form).checked()) {
config.CachePath = $('#txtCachePath', form).val();
} else {
config.CachePath = '';
}
config.LegacyWebSocketPortNumber = $('#txtWebSocketPortNumber', form).val(); config.LegacyWebSocketPortNumber = $('#txtWebSocketPortNumber', form).val();
config.HttpServerPortNumber = $('#txtPortNumber', form).val(); config.HttpServerPortNumber = $('#txtPortNumber', form).val();

View File

@ -833,7 +833,7 @@
$('#txtDvdSeasonNumber', page).val(('DvdSeasonNumber' in item) ? item.DvdSeasonNumber : ""); $('#txtDvdSeasonNumber', page).val(('DvdSeasonNumber' in item) ? item.DvdSeasonNumber : "");
$('#txtAirsBeforeSeason', page).val(('AirsBeforeSeasonNumber' in item) ? item.AirsBeforeSeasonNumber : ""); $('#txtAirsBeforeSeason', page).val(('AirsBeforeSeasonNumber' in item) ? item.AirsBeforeSeasonNumber : "");
$('#txtAirsAfterSeason', page).val(('AirsAfterSeasonNumber' in item) ? item.AirsAfterSeasonNumber : ""); $('#txtAirsAfterSeason', page).val(('AirsAfterSeasonNumber' in item) ? item.AirsAfterSeasonNumber : "");
$('#txtAirsEpisodeSeason', page).val(('AirsBeforeEpisodeNumber' in item) ? item.AirsBeforeEpisodeNumber : ""); $('#txtAirsBeforeEpisode', page).val(('AirsBeforeEpisodeNumber' in item) ? item.AirsBeforeEpisodeNumber : "");
$('#txtAlbum', page).val(item.Album || ""); $('#txtAlbum', page).val(item.Album || "");
$('#txtAlbumArtist', page).val(item.AlbumArtist || ""); $('#txtAlbumArtist', page).val(item.AlbumArtist || "");
@ -1108,7 +1108,7 @@
DvdSeasonNumber: $('#txtDvdSeasonNumber', form).val(), DvdSeasonNumber: $('#txtDvdSeasonNumber', form).val(),
AirsBeforeSeasonNumber: $('#txtAirsBeforeSeason', form).val(), AirsBeforeSeasonNumber: $('#txtAirsBeforeSeason', form).val(),
AirsAfterSeasonNumber: $('#txtAirsAfterSeason', form).val(), AirsAfterSeasonNumber: $('#txtAirsAfterSeason', form).val(),
AirsBeforeEpisodeNumber: $('#txtAirsEpisodeSeason', form).val(), AirsBeforeEpisodeNumber: $('#txtAirsBeforeEpisode', form).val(),
ParentIndexNumber: $('#txtParentIndexNumber', form).val(), ParentIndexNumber: $('#txtParentIndexNumber', form).val(),
Players: $('#txtPlayers', form).val(), Players: $('#txtPlayers', form).val(),
Album: $('#txtAlbum', form).val(), Album: $('#txtAlbum', form).val(),

View File

@ -2,7 +2,7 @@
function loadPage(page, config) { function loadPage(page, config) {
$('#txtItemsByNamePath', page).val(config.ItemsByNamePath); $('#txtItemsByNamePath', page).val(config.ItemsByNamePath || '');
var customIbn = config.ItemsByNamePath ? true : false; var customIbn = config.ItemsByNamePath ? true : false;
$('#chkEnableCustomIBNPath', page).checked(customIbn).checkboxradio("refresh"); $('#chkEnableCustomIBNPath', page).checked(customIbn).checkboxradio("refresh");
@ -66,8 +66,6 @@
}).on('pagehide', "#librarySettingsPage", function () { }).on('pagehide', "#librarySettingsPage", function () {
Dashboard.showLoadingMsg();
var page = this; var page = this;
$('#chkEnableCustomIBNPath', page).off("change.showIBNText"); $('#chkEnableCustomIBNPath', page).off("change.showIBNText");

View File

@ -90,6 +90,7 @@
function loadPrograms(page) { function loadPrograms(page) {
ApiClient.getLiveTvPrograms({ ApiClient.getLiveTvPrograms({
ChannelIds: currentItem.Id, ChannelIds: currentItem.Id,
UserId: Dashboard.getCurrentUserId() UserId: Dashboard.getCurrentUserId()

View File

@ -37,6 +37,8 @@
html += '<p class="itemMiscInfo">' + channel.Number + '</p>'; html += '<p class="itemMiscInfo">' + channel.Number + '</p>';
html += '<p class="userDataIcons">' + LibraryBrowser.getUserDataIconsHtml(channel) + '</p>';
html += '</div>'; html += '</div>';
html += "</a>"; html += "</a>";

View File

@ -33,7 +33,7 @@
Dashboard.setPageTitle(name); Dashboard.setPageTitle(name);
$('.itemName', page).html(name); $('.itemName', page).html(name);
$('.itemChannelNumber', page).html(item.ChannelName); $('.itemChannelNumber', page).html('<a href="livetvchannel.html?id=' + item.ChannelId + '">' + item.ChannelName + '</a>').trigger('create');
$('.itemEpisodeName', page).html(item.EpisodeTitle); $('.itemEpisodeName', page).html(item.EpisodeTitle);

View File

@ -1 +1,110 @@
 (function (window, $, document, apiClient) {
var currentItem;
function deleteTimer(page, id) {
Dashboard.confirm("Are you sure you wish to cancel this series?", "Confirm Series Timer Cancellation", function (result) {
if (result) {
Dashboard.showLoadingMsg();
ApiClient.cancelLiveTvSeriesTimer(id).done(function () {
Dashboard.alert('Timer cancelled.');
reload(page);
});
}
});
}
function renderTimer(page, item) {
currentItem = item;
$('.itemName', page).html(item.Name);
$('.channel', page).html('<a href="livetvchannel.html?id=' + item.ChannelId + '">' + item.ChannelName + '</a>').trigger('create');
$('.overview', page).html(item.Overview || '');
$('#txtRequestedPrePaddingSeconds', page).val(item.RequestedPrePaddingSeconds);
$('#txtRequestedPostPaddingSeconds', page).val(item.RequestedPostPaddingSeconds);
$('#txtRequiredPrePaddingSeconds', page).val(item.RequiredPrePaddingSeconds);
$('#txtRequiredPostPaddingSeconds', page).val(item.RequiredPostPaddingSeconds);
$('#selectPriority', page).val(item.Priority);
$('.itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(item));
Dashboard.hideLoadingMsg();
}
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
apiClient.getLiveTvSeriesTimer(currentItem.Id).done(function (item) {
item.RequestedPrePaddingSeconds = $('#txtRequestedPrePaddingSeconds', form).val();
item.RequestedPostPaddingSeconds = $('#txtRequestedPostPaddingSeconds', form).val();
item.RequiredPrePaddingSeconds = $('#txtRequiredPrePaddingSeconds', form).val();
item.RequiredPostPaddingSeconds = $('#txtRequiredPostPaddingSeconds', form).val();
item.Priority = $('#selectPriority', form).val();
ApiClient.updateLiveTvSeriesTimer(item).done(function () {
Dashboard.alert('Timer Saved');
});
});
// Disable default form submission
return false;
}
function reload(page) {
Dashboard.showLoadingMsg();
var id = getParameterByName('id');
apiClient.getLiveTvTimer(id).done(function (result) {
renderTimer(page, result);
});
}
$(document).on('pageinit', "#liveTvSeriesTimerPage", function () {
var page = this;
$('#btnCancelTimer', page).on('click', function () {
deleteTimer(page, currentItem.Id);
});
}).on('pagebeforeshow', "#liveTvSeriesTimerPage", function () {
var page = this;
reload(page);
}).on('pagehide', "#liveTvSeriesTimerPage", function () {
currentItem = null;
});
function liveTvSeriesTimerPage() {
var self = this;
self.onSubmit = onSubmit;
}
window.LiveTvSeriesTimerPage = new liveTvSeriesTimerPage();
})(window, jQuery, document, ApiClient);

View File

@ -1 +1,131 @@
 (function ($, document, apiClient) {
function deleteTimer(page, id) {
Dashboard.confirm("Are you sure you wish to cancel this series?", "Confirm Series Timer Cancellation", function (result) {
if (result) {
Dashboard.showLoadingMsg();
ApiClient.cancelLiveTvSeriesTimer(id).done(function () {
Dashboard.alert('Series Timer deleted');
reload(page);
});
}
});
}
function renderTimers(page, timers) {
var html = '';
var cssClass = "detailTable";
html += '<div class="detailTableContainer"><table class="' + cssClass + '">';
html += '<tr>';
html += '<th class="tabletColumn">&nbsp;</th>';
html += '<th>Name</th>';
html += '<th class="desktopColumn">Channel</th>';
html += '<th>Start</th>';
html += '<th>End</th>';
html += '<th class="tabletColumn">Days</th>';
html += '</tr>';
for (var i = 0, length = timers.length; i < length; i++) {
var timer = timers[i];
html += '<tr>';
html += '<td class="tabletColumn">';
html += '<button data-timerid="' + timer.Id + '" class="btnDeleteTimer" type="button" data-icon="delete" data-inline="true" data-mini="true" data-iconpos="notext">Delete</button>';
html += '</td>';
html += '<td>';
html += '<a href="livetvseriestimer.html?id=' + timer.Id + '">' + timer.Name + '</a>';
html += '</td>';
html += '<td class="desktopColumn">';
if (timer.ChannelId) {
html += '<a href="livetvchannel.html?id=' + timer.ChannelId + '">' + timer.ChannelName + '</a>';
}
html += '</td>';
var startDate = timer.StartDate;
var endDate = timer.StartDate;
try {
startDate = parseISO8601Date(startDate, { toLocal: true });
} catch (err) {
}
try {
endDate = parseISO8601Date(endDate, { toLocal: true });
} catch (err) {
}
html += '<td>' + startDate.toLocaleDateString() + '</td>';
html += '<td>' + endDate.toLocaleDateString() + '</td>';
html += '<td class="tabletColumn">';
if (timer.DayPattern) {
html += timer.DayPattern;
}
else {
var days = timer.Days || [];
html += days.join(', ');
}
html += '</td>';
html += '</tr>';
}
html += '</table></div>';
var elem = $('#items', page).html(html).trigger('create');
$('.btnDeleteTimer', elem).on('click', function () {
var id = this.getAttribute('data-timerid');
deleteTimer(page, id);
});
Dashboard.hideLoadingMsg();
}
function reload(page) {
Dashboard.showLoadingMsg();
apiClient.getLiveTvSeriesTimers().done(function (result) {
renderTimers(page, result.Items);
});
}
$(document).on('pagebeforeshow', "#liveTvSeriesTimersPage", function () {
var page = this;
reload(page);
});
})(jQuery, document, ApiClient);

View File

@ -1,4 +1,4 @@
(function ($, document, apiClient) { (function (window, $, document, apiClient) {
var currentItem; var currentItem;
@ -12,7 +12,7 @@
ApiClient.cancelLiveTvTimer(id).done(function () { ApiClient.cancelLiveTvTimer(id).done(function () {
Dashboard.alert('Timer deleted'); Dashboard.alert('Timer cancelled.');
reload(page); reload(page);
}); });
@ -26,7 +26,7 @@
currentItem = item; currentItem = item;
$('.program', page).html(item.Name); $('.program', page).html(item.Name);
$('.channel', page).html(item.ChannelName); $('.channel', page).html('<a href="livetvchannel.html?id=' + item.ChannelId + '">' + item.ChannelName + '</a>').trigger('create');
$('.overview', page).html(item.Overview || ''); $('.overview', page).html(item.Overview || '');
$('#txtRequestedPrePaddingSeconds', page).val(item.RequestedPrePaddingSeconds); $('#txtRequestedPrePaddingSeconds', page).val(item.RequestedPrePaddingSeconds);
@ -47,6 +47,29 @@
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
} }
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
apiClient.getLiveTvTimer(currentItem.Id).done(function (item) {
item.RequestedPrePaddingSeconds = $('#txtRequestedPrePaddingSeconds', form).val();
item.RequestedPostPaddingSeconds = $('#txtRequestedPostPaddingSeconds', form).val();
item.RequiredPrePaddingSeconds = $('#txtRequiredPrePaddingSeconds', form).val();
item.RequiredPostPaddingSeconds = $('#txtRequiredPostPaddingSeconds', form).val();
ApiClient.updateLiveTvTimer(item).done(function() {
Dashboard.alert('Timer Saved');
});
});
// Disable default form submission
return false;
}
function reload(page) { function reload(page) {
@ -81,5 +104,14 @@
currentItem = null; currentItem = null;
}); });
function liveTvTimerPage() {
})(jQuery, document, ApiClient); var self = this;
self.onSubmit = onSubmit;
}
window.LiveTvTimerPage = new liveTvTimerPage();
})(window, jQuery, document, ApiClient);

View File

@ -142,7 +142,7 @@
<label for="chkMissingImdbId">Missing IMDb Id</label> <label for="chkMissingImdbId">Missing IMDb Id</label>
<input class="chkMissingTvdbId" type="checkbox" data-theme="c" name="chkMissingTvdbId" id="chkMissingTvdbId" data-mini="true"> <input class="chkMissingTvdbId" type="checkbox" data-theme="c" name="chkMissingTvdbId" id="chkMissingTvdbId" data-mini="true">
<label for="chkMissingTvdbId">Missing Tvdb Id</label> <label for="chkMissingTvdbId">Missing TheTVDB Id</label>
<input class="chkMissingOverview" type="checkbox" data-theme="c" name="chkMissingOverview" id="chkMissingOverview" data-mini="true"> <input class="chkMissingOverview" type="checkbox" data-theme="c" name="chkMissingOverview" id="chkMissingOverview" data-mini="true">
<label for="chkMissingOverview">Missing Overview</label> <label for="chkMissingOverview">Missing Overview</label>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.204" targetFramework="net45" /> <package id="MediaBrowser.ApiClient.Javascript" version="3.0.206" targetFramework="net45" />
</packages> </packages>