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

#680 - episode organization

This commit is contained in:
Luke Pulverenti 2014-01-22 12:05:06 -05:00
parent 807141cbce
commit 9db90f464a
8 changed files with 283 additions and 46 deletions

View file

@ -687,6 +687,16 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
}); });
}; };
self.clearOrganizationLog = function () {
var url = self.getUrl("Library/FileOrganizations");
return self.ajax({
type: "DELETE",
url: url
});
};
self.performOrganization = function (id) { self.performOrganization = function (id) {
var url = self.getUrl("Library/FileOrganizations/" + id + "/Organize"); var url = self.getUrl("Library/FileOrganizations/" + id + "/Organize");
@ -697,6 +707,16 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
}); });
}; };
self.performEpisodeOrganization = function (id, options) {
var url = self.getUrl("Library/FileOrganizations/" + id + "/Episode/Organize", options || {});
return self.ajax({
type: "POST",
url: url
});
};
self.getLiveTvSeriesTimer = function (id) { self.getLiveTvSeriesTimer = function (id) {
if (!id) { if (!id) {
@ -2984,7 +3004,14 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
throw new Error("null userId"); throw new Error("null userId");
} }
var url = self.getUrl("Users/" + userId + "/Items", options); var url;
if ((typeof userId).toString().toLowerCase() == 'string') {
url = self.getUrl("Users/" + userId + "/Items", options);
} else {
options = userId;
url = self.getUrl("Items", options || {});
}
return self.ajax({ return self.ajax({
type: "GET", type: "GET",

View file

@ -828,7 +828,7 @@ progress {
} }
.latestNewsItems { .latestNewsItems {
max-width: 300px; max-width: 280px;
} }
.dashboardHomeRightColumn { .dashboardHomeRightColumn {
@ -836,6 +836,13 @@ progress {
} }
} }
@media all and (min-width: 1500px) {
.latestNewsItems {
max-width: 300px;
}
}
@media all and (min-width: 1600px) { @media all and (min-width: 1600px) {
.latestNewsItems { .latestNewsItems {
@ -854,4 +861,13 @@ progress {
.organizerButton { .organizerButton {
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
} }
.btnShowStatusMessage {
font-weight: normal!important;
text-decoration: none;
}
.btnShowStatusMessage:hover {
text-decoration: underline;
}

View file

@ -157,10 +157,6 @@
<div data-role="content"> <div data-role="content">
<div class="detailPageContent"> <div class="detailPageContent">
<div id="childrenCollapsible" class="hide detailSection">
<div class="detailSectionHeader"><span id="childrenTitle"></span></div>
<div id="childrenContent" class="detailSectionContent"></div>
</div>
<div id="detailsSection" class="detailSection hide"> <div id="detailsSection" class="detailSection hide">
<div class="detailSectionHeader" style="margin-top: 0;"> <div class="detailSectionHeader" style="margin-top: 0;">
Details Details
@ -179,6 +175,10 @@
<p class="itemTags"></p> <p class="itemTags"></p>
</div> </div>
</div> </div>
<div id="childrenCollapsible" class="hide detailSection">
<div class="detailSectionHeader"><span id="childrenTitle"></span></div>
<div id="childrenContent" class="detailSectionContent"></div>
</div>
<div id="trailersCollapsible" class="detailSection hide"> <div id="trailersCollapsible" class="detailSection hide">
<div id="trailerSectionHeader" class="detailSectionHeader"> <div id="trailerSectionHeader" class="detailSectionHeader">
Trailers Trailers

View file

@ -14,28 +14,89 @@
<a href="libraryfileorganizer.html" data-role="button">TV Settings</a> <a href="libraryfileorganizer.html" data-role="button">TV Settings</a>
</div> </div>
<div style="margin: -15px 0 1em;text-align:left;"> <div style="margin: -15px 0 1em; text-align: right;">
<div class="listTopPaging"> <div class="listTopPaging" style="float: left; position: relative; top: 15px;">
</div> </div>
<button style="display: none;" class="btnClearLog" type="button" data-inline="true" data-icon="forbidden" data-mini="true">Clear</button>
<div style="clear: both;"></div>
</div> </div>
<table id="movie-table" data-role="table" data-mode="reflow" class="tblOrganizationResults stripedTable ui-responsive table-stroke"> <table data-role="table" data-mode="reflow" class="tblOrganizationResults stripedTable ui-responsive table-stroke" style="display: table;">
<thead> <thead>
<tr> <tr>
<th data-priority="1"></th>
<th data-priority="2">Date</th> <th data-priority="2">Date</th>
<th data-priority="1">Source</th> <th data-priority="1">Source</th>
<th data-priority="3">Destination</th> <th data-priority="3">Destination</th>
<th data-priority="1">Result</th>
<th data-priority="1"></th>
</tr> </tr>
</thead> </thead>
<tbody class="resultBody"> <tbody class="resultBody">
</tbody> </tbody>
</table> </table>
<br /> <br />
<div style="text-align: right;" class="legend">
<div style="display: inline-block; height: 10px; width: 10px; background: green;"></div>
<span>Completed</span>
<div style="display: inline-block; height: 10px; width: 10px; background: red; margin-left: 1em;"></div>
<span>Failed</span>
<div style="display: inline-block; height: 10px; width: 10px; background: blue; margin-left: 1em;"></div>
<span>Skipped</span>
</div>
<div class="listBottomPaging"> <div class="listBottomPaging">
</div> </div>
</div> </div>
</div> </div>
<div data-role="popup" data-transition="slidefade" class="popup episodeCorrectionPopup">
<div class="ui-bar-a" style="text-align: center; padding: 0 20px;">
<h3>Episode Organization</h3>
</div>
<div data-role="content">
<form class="episodeCorrectionForm">
<p><span class="inputFile"></span></p>
<div style="margin: 1em 0 1em; min-width: 250px;">
<label for="selectSeries">Series:</label>
<select id="selectSeries" data-mini="true" required="required"></select>
</div>
<div style="margin: 1em 0;">
<label for="txtSeason">Season number:</label>
<input id="txtSeason" type="number" data-mini="true" pattern="[0-9]*" required="required" min="0" />
</div>
<div style="margin: 1em 0;">
<label for="txtEpisode">Episode number:</label>
<input id="txtEpisode" type="number" data-mini="true" pattern="[0-9]*" required="required" min="0" />
</div>
<div style="margin: 1em 0;">
<label for="txtEndingEpisode">Ending episode number:</label>
<input id="txtEndingEpisode" type="number" data-mini="true" pattern="[0-9]*" min="0" />
<div class="fieldDescription">Only required for multi-episode files</div>
</div>
<div style="margin: 1em 0;" id="fldRememberCorrection">
<label for="chkRememberEpisodeCorrection">Remember this correction future episodes of the same series.</label>
<input id="chkRememberEpisodeCorrection" type="checkbox" data-mini="true" />
</div>
<p>
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
Ok
</button>
<button type="button" data-icon="delete" onclick="$(this).parents('.popup').popup('close');" data-mini="true">
Cancel
</button>
</p>
<input id="hfResultId" type="hidden" />
</form>
</div>
</div>
<script type="text/javascript">
$('.episodeCorrectionForm').off('submit', OrganizerLogPage.onEpisodeCorrectionFormSubmit).on('submit', OrganizerLogPage.onEpisodeCorrectionFormSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View file

@ -30,14 +30,14 @@
})[0]; })[0];
var message = 'The following file will be deleted:<p>' + item.OriginalPath + '</p><p>Are you sure you wish to proceed?</p>'; var message = 'The following file will be deleted:<p style="word-wrap:break-word;">' + item.OriginalPath + '</p><p>Are you sure you wish to proceed?</p>';
Dashboard.confirm(message, "Delete File", function (confirmResult) { Dashboard.confirm(message, "Delete File", function (confirmResult) {
if (confirmResult) { if (confirmResult) {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.deleteOriginalFileFromOrganizationResult(id).done(function () { ApiClient.deleteOriginalFileFromOrganizationResult(id).done(function () {
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
@ -50,6 +50,55 @@
}); });
} }
function organizeEpsiodeWithCorrections(page, item) {
Dashboard.showLoadingMsg();
ApiClient.getItems({
recursive: true,
includeItemTypes: 'Series',
sortBy: 'SortName'
}).done(function (result) {
Dashboard.hideLoadingMsg();
showEpisodeCorrectionPopup(page, item, result.Items);
});
}
function showEpisodeCorrectionPopup(page, item, allSeries) {
var popup = $('.episodeCorrectionPopup', page).popup("open");
$('.inputFile', popup).html(item.OriginalFileName);
$('#txtSeason', popup).val(item.ExtractedSeasonNumber);
$('#txtEpisode', popup).val(item.ExtractedEpisodeNumber);
$('#txtEndingEpisode', popup).val(item.ExtractedEndingEpisodeNumber);
$('#hfResultId', popup).val(item.Id);
if (item.ExtractedName) {
$('#fldRememberCorrection', popup).hide();
} else {
$('#fldRememberCorrection', popup).hide();
}
$('#chkRememberEpisodeCorrection', popup).checked(false).checkboxradio('refresh');
var seriesHtml = allSeries.map(function (s) {
return '<option value="' + s.Id + '">' + s.Name + '</option>';
}).join('');
seriesHtml = '<option value=""></option>' + seriesHtml;
$('#selectSeries', popup).html(seriesHtml).selectmenu('refresh');
}
function organizeFile(page, id) { function organizeFile(page, id) {
var item = currentResult.Items.filter(function (i) { var item = currentResult.Items.filter(function (i) {
@ -57,7 +106,16 @@
})[0]; })[0];
var message = 'The following file will be moved from:<p>' + item.OriginalPath + '</p><p>to:</p><p>' + item.TargetPath + '</p><p>Are you sure you wish to proceed?</p>'; if (!item.TargetPath) {
if (item.Type == "Episode") {
organizeEpsiodeWithCorrections(page, item);
}
return;
}
var message = 'The following file will be moved from:<p style="word-wrap:break-word;">' + item.OriginalPath + '</p><p>to:</p><p style="word-wrap:break-word;">' + item.TargetPath + '</p><p>Are you sure you wish to proceed?</p>';
Dashboard.confirm(message, "Organize File", function (confirmResult) { Dashboard.confirm(message, "Organize File", function (confirmResult) {
@ -76,7 +134,34 @@
} }
}); });
}
function submitEpisodeForm(form) {
Dashboard.showLoadingMsg();
var page = $(form).parents('.page');
var resultId = $('#hfResultId', form).val();
var options = {
SeriesId: $('#selectSeries', form).val(),
SeasonNumber: $('#txtSeason', form).val(),
EpisodeNumber: $('#txtEpisode', form).val(),
EndingEpisodeNumber: $('#txtEndingEpisode', form).val(),
RememberCorrection: $('#chkRememberEpisodeCorrection', form).checked()
};
ApiClient.performEpisodeOrganization(resultId, options).done(function () {
Dashboard.hideLoadingMsg();
$('.episodeCorrectionPopup', page).popup("close");
reloadItems(page);
});
} }
function reloadItems(page) { function reloadItems(page) {
@ -133,6 +218,16 @@
html += '<tr>'; html += '<tr>';
html += '<td class="organizerButtonCell">';
if (item.Status != 'Success') {
html += '<button data-resultid="' + item.Id + '" type="button" data-inline="true" data-icon="delete" data-mini="true" data-iconpos="notext" class="btnDeleteResult organizerButton" title="Delete File">Delete File</button>';
html += '<button data-resultid="' + item.Id + '" type="button" data-inline="true" data-icon="action" data-mini="true" data-iconpos="notext" class="btnProcessResult organizerButton" title="Organize File">Process</button>';
}
html += '</td>';
html += '<td>'; html += '<td>';
var date = parseISO8601Date(item.Date, { toLocal: true }); var date = parseISO8601Date(item.Date, { toLocal: true });
@ -141,32 +236,28 @@
html += '</td>'; html += '</td>';
html += '<td>'; html += '<td>';
html += item.OriginalFileName || ''; var status = item.Status;
if (status == 'SkippedExisting') {
html += '<div style="color:blue;">';
html += item.OriginalFileName;
html += '</div>';
}
else if (status == 'Failure') {
html += '<a data-resultid="' + item.Id + '" style="color:red;" href="#" class="btnShowStatusMessage">';
html += item.OriginalFileName;
html += '</a>';
} else {
html += '<div style="color:green;">';
html += item.OriginalFileName;
html += '</div>';
}
html += '</td>'; html += '</td>';
html += '<td>'; html += '<td>';
html += item.TargetPath || ''; html += item.TargetPath || '';
html += '</td>'; html += '</td>';
html += '<td>';
html += getStatusText(item, true);
html += '</td>';
html += '<td class="organizerButtonCell">';
if (item.Status == 'SkippedExisting') {
html += '<button data-resultid="' + item.Id + '" type="button" data-inline="true" data-icon="action" data-mini="true" data-iconpos="notext" class="btnProcessResult organizerButton" title="Organize File">Process</button>';
} else {
html += '<button style="visibility:hidden;" type="button" data-inline="true" data-icon="info" data-mini="true" data-iconpos="notext" class="organizerButton"></button>';
}
if (item.Status != 'Success') {
html += '<button data-resultid="' + item.Id + '" type="button" data-inline="true" data-icon="delete" data-mini="true" data-iconpos="notext" class="btnDeleteResult organizerButton" title="Delete">Delete File</button>';
}
html += '</td>';
html += '</tr>'; html += '</tr>';
return html; return html;
@ -218,9 +309,29 @@
query.StartIndex -= query.Limit; query.StartIndex -= query.Limit;
reloadItems(page); reloadItems(page);
}); });
if (result.TotalRecordCount) {
$('.btnClearLog', page).show();
$('.legend', page).show();
} else {
$('.btnClearLog', page).hide();
$('.legend', page).hide();
}
} }
$(document).on('pageshow', "#libraryFileOrganizerLogPage", function () { $(document).on('pageinit', "#libraryFileOrganizerLogPage", function () {
var page = this;
$('.btnClearLog', page).on('click', function () {
ApiClient.clearOrganizationLog().done(function () {
reloadItems(page);
});
});
}).on('pageshow', "#libraryFileOrganizerLogPage", function () {
var page = this; var page = this;
@ -231,4 +342,13 @@
currentResult = null; currentResult = null;
}); });
window.OrganizerLogPage = {
onEpisodeCorrectionFormSubmit: function () {
submitEpisodeForm(this);
return false;
}
};
})(jQuery, document, window); })(jQuery, document, window);

View file

@ -21,6 +21,8 @@
var timeout; var timeout;
var idleState = true; var idleState = true;
var msieWebmMessage = "For more reliable video playback with Internet Explorer desktop edition, please install google's webm plugin for IE.<br/><br/><a target='_blank' href='https://tools.google.com/dlpage/webmmf'>https://tools.google.com/dlpage/webmmf</a>";
self.playlist = []; self.playlist = [];
var currentPlaylistIndex = 0; var currentPlaylistIndex = 0;
@ -180,6 +182,11 @@
currentProgressInterval = null; currentProgressInterval = null;
} }
} }
function canPlayWebm() {
return testableVideoElement.canPlayType('video/webm').replace(/no/, '');
}
function getTranscodingExtension() { function getTranscodingExtension() {
@ -192,7 +199,7 @@
} }
// Chrome or IE with plugin installed // Chrome or IE with plugin installed
if (media.canPlayType('video/webm').replace(/no/, '') && !$.browser.mozilla) { if (canPlayWebm() && !$.browser.mozilla) {
return '.webm'; return '.webm';
} }
@ -896,6 +903,10 @@
if (item.Type == "Channel") { if (item.Type == "Channel") {
errorMsg += " Please ensure there is an open tuner availalble."; errorMsg += " Please ensure there is an open tuner availalble.";
} }
if ($.browser.msie && !canPlayWebm()) {
errorMsg += " " + msieWebmMessage;
}
Dashboard.alert({ Dashboard.alert({
title: 'Video Error', title: 'Video Error',
@ -1079,9 +1090,9 @@
return; return;
} }
} }
else if ($.browser.msie && videoType) { else if ($.browser.msie && videoType && !canPlayWebm()) {
self.playWithWarning(items, startPosition, user, "iewebmplugin", "Internet Explorer Playback", "For optimal video playback of Internet Explorer desktop edition, please install google's webm plugin for IE.<br/><br/><a target='_blank' href='https://tools.google.com/dlpage/webmmf'>https://tools.google.com/dlpage/webmmf</a>"); self.playWithWarning(items, startPosition, user, "iewebmplugin", "Internet Explorer Playback", msieWebmMessage);
return; return;
} }
@ -1093,7 +1104,9 @@
self.playWithWarning = function (items, startPosition, user, localStorageKeyName, header, text) { self.playWithWarning = function (items, startPosition, user, localStorageKeyName, header, text) {
localStorageKeyName += new Date().getMonth(); // Increment this version when changes are made and we want users to see the prompts again
var warningVersion = "2";
localStorageKeyName += new Date().getMonth() + warningVersion;
if (localStorage.getItem(localStorageKeyName) == "1") { if (localStorage.getItem(localStorageKeyName) == "1") {

View file

@ -393,9 +393,9 @@ var Dashboard = {
confirmInternal: function (message, title, showCancel, callback) { confirmInternal: function (message, title, showCancel, callback) {
$('#confirmFlyout').popup("close").remove(); $('.confirmFlyout').popup("close").remove();
var html = '<div data-role="popup" data-transition="slidefade" id="confirmFlyout" style="max-width:500px;" data-theme="a">'; var html = '<div data-role="popup" data-transition="slidefade" class="confirmFlyout" style="max-width:500px;" data-theme="a">';
html += '<div class="ui-bar-a" style="text-align:center;">'; html += '<div class="ui-bar-a" style="text-align:center;">';
html += '<h3>' + title + '</h3>'; html += '<h3>' + title + '</h3>';
@ -407,10 +407,10 @@ var Dashboard = {
html += message; html += message;
html += '</div>'; html += '</div>';
html += '<p><button type="button" data-icon="check" onclick="$(\'#confirmFlyout\')[0].confirm=true;$(\'#confirmFlyout\').popup(\'close\');" data-theme="b">Ok</button></p>'; html += '<p><button type="button" data-icon="check" onclick="$(\'.confirmFlyout\')[0].confirm=true;$(\'.confirmFlyout\').popup(\'close\');" data-theme="b">Ok</button></p>';
if (showCancel) { if (showCancel) {
html += '<p><button type="button" data-icon="delete" onclick="$(\'#confirmFlyout\').popup(\'close\');" data-theme="a">Cancel</button></p>'; html += '<p><button type="button" data-icon="delete" onclick="$(\'.confirmFlyout\').popup(\'close\');" data-theme="a">Cancel</button></p>';
} }
html += '</div>'; html += '</div>';
@ -419,7 +419,7 @@ var Dashboard = {
$(document.body).append(html); $(document.body).append(html);
$('#confirmFlyout').popup({ history: false }).trigger('create').popup("open").on("popupafterclose", function () { $('.confirmFlyout').popup({ history: false }).trigger('create').popup("open").on("popupafterclose", function () {
if (callback) { if (callback) {
callback(this.confirm == true); callback(this.confirm == true);

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.240" targetFramework="net45" /> <package id="MediaBrowser.ApiClient.Javascript" version="3.0.243" targetFramework="net45" />
</packages> </packages>