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

add subtitle profiles to dlna profile editor

This commit is contained in:
Luke Pulverenti 2014-09-17 21:26:23 -04:00
parent fc4f9788fa
commit 1f6ce6a409
7 changed files with 224 additions and 78 deletions

Binary file not shown.

Binary file not shown.

View file

@ -65,8 +65,7 @@
font-family: 'MBLogo';
font-style: normal;
font-weight: 200;
src: url('fonts/mblogo.eot');
src: url('fonts/mblogo.eot?#iefix') format('embedded-opentype'), url('fonts/mblogo.woff') format('woff'), url('fonts/mblogo.ttf') format('truetype');
src: url('fonts/mblogo.woff') format('woff');
}
* {

View file

@ -278,6 +278,16 @@
</div>
</div>
<div data-role="collapsible">
<h2>${HeaderSubtitleProfiles}</h2>
<div>
<p>${HeaderSubtitleProfilesHelp}</p>
<p><button type="button" class="btnAddSubtitleProfile" data-icon="plus">${ButtonAdd}</button></p>
<div class="subtitleProfileList"></div>
<br />
</div>
</div>
<div data-role="collapsible">
<h2>${HeaderXmlSettings}</h2>
<div>
@ -687,6 +697,52 @@
</div>
</div>
<div data-role="popup" id="subtitleProfilePopup" class="popup">
<div class="ui-bar-a" style="text-align: center; padding: 0 20px;">
<h3>${HeaderSubtitleProfile}</h3>
</div>
<div data-role="content">
<form class="subtitleProfileForm">
<div style="margin: 1em 0;">
<label for="txtSubtitleProfileFormat">${LabelFormat}</label>
<input type="text" id="txtSubtitleProfileFormat" data-mini="true" required="required" />
<div class="fieldDescription">${LabelSubtitleFormatHelp}</div>
</div>
<div style="margin: 1em 0;">
<label for="selectSubtitleProfileMethod">${LabelMethod}</label>
<select id="selectSubtitleProfileMethod" data-mini="true" required="required">
<option value="Embed">${OptionEmbedSubtitles}</option>
<option value="External">${OptionExternallyDownloaded}</option>
<option value="Hls">${OptionHlsSegmentedSubtitles}</option>
</select>
</div>
<div style="margin: 1em 0;">
<label for="selectSubtitleProfileDidlMode">${LabelDidlMode}</label>
<select id="selectSubtitleProfileDidlMode" data-mini="true">
<option value="">${OptionResElement}</option>
<option value="CaptionInfoEx">${OptionCaptionInfoExSamsung}</option>
</select>
</div>
<p>
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
${ButtonOk}
</button>
<button type="button" data-icon="delete" onclick="$(this).parents('.popup').popup('close');" data-mini="true">
${ButtonCancel}
</button>
</p>
</form>
</div>
</div>
<script type="text/javascript">
$('.dlnaProfileForm').off('submit', DlnaProfilePage.onSubmit).on('submit', DlnaProfilePage.onSubmit);
$('.editDirectPlayProfileForm').off('submit', DlnaProfilePage.onDirectPlayFormSubmit).on('submit', DlnaProfilePage.onDirectPlayFormSubmit);
@ -696,6 +752,7 @@
$('.editResponseProfileForm').off('submit', DlnaProfilePage.onResponseProfileFormSubmit).on('submit', DlnaProfilePage.onResponseProfileFormSubmit);
$('.identificationHeaderForm').off('submit', DlnaProfilePage.onIdentificationHeaderFormSubmit).on('submit', DlnaProfilePage.onIdentificationHeaderFormSubmit);
$('.xmlAttributeForm').off('submit', DlnaProfilePage.onXmlAttributeFormSubmit).on('submit', DlnaProfilePage.onXmlAttributeFormSubmit);
$('.subtitleProfileForm').off('submit', DlnaProfilePage.onSubtitleProfileFormSubmit).on('submit', DlnaProfilePage.onSubtitleProfileFormSubmit);
</script>
</div>
</body>

View file

@ -50,6 +50,7 @@
var idInfo = profile.Identification || {};
renderIdentificationHeaders(page, idInfo.Headers || []);
renderSubtitleProfiles(page, profile.SubtitleProfiles || []);
$('#txtInfoFriendlyName', page).val(profile.FriendlyName || '');
$('#txtInfoModelName', page).val(profile.ModelName || '');
@ -242,6 +243,82 @@
$('#xmlAttributePopup', page).popup('close');
}
function renderSubtitleProfiles(page, profiles) {
var index = 0;
var html = '<ul data-role="listview" data-inset="true" data-split-icon="delete">' + profiles.map(function (h) {
var li = '<li>';
li += '<a href="#" class="lnkEditSubProfile" data-index="' + index + '">';
li += '<div style="font-weight:normal;">' + (h.Format || '') + '</div>';
li += '</a>';
li += '<a class="btnDeleteProfile" href="#" data-index="' + index + '"></a>';
li += '</li>';
index++;
return li;
}).join('') + '</ul>';
var elem = $('.subtitleProfileList', page).html(html).trigger('create');
$('.btnDeleteProfile', elem).on('click', function () {
var itemIndex = parseInt(this.getAttribute('data-index'));
currentProfile.SubtitleProfiles.splice(itemIndex, 1);
renderSubtitleProfiles(page, currentProfile.SubtitleProfiles);
});
$('.lnkEditSubProfile', elem).on('click', function () {
var itemIndex = parseInt(this.getAttribute('data-index'));
editSubtitleProfile(page, currentProfile.SubtitleProfiles[itemIndex]);
});
}
function editSubtitleProfile(page, profile) {
isSubProfileNew = profile == null;
profile = profile || {};
currentSubProfile = profile;
var popup = $('#subtitleProfilePopup', page);
$('#txtSubtitleProfileFormat', popup).val(profile.Format || '');
$('#selectSubtitleProfileMethod', popup).val(profile.Method || '').selectmenu('refresh');
$('#selectSubtitleProfileDidlMode', popup).val(profile.DidlMode || '').selectmenu('refresh');
popup.popup('open');
}
function saveSubtitleProfile(page) {
currentSubProfile.Format = $('#txtSubtitleProfileFormat', page).val();
currentSubProfile.Method = $('#selectSubtitleProfileMethod', page).val();
currentSubProfile.DidlMode = $('#selectSubtitleProfileDidlMode', page).val();
if (isSubProfileNew) {
currentProfile.SubtitleProfiles.push(currentSubProfile);
}
renderSubtitleProfiles(page, currentProfile.SubtitleProfiles);
currentSubProfile = null;
$('#subtitleProfilePopup', page).popup('close');
}
function renderSubProfiles(page, profile) {
renderDirectPlayProfiles(page, profile.DirectPlayProfiles);
@ -981,6 +1058,11 @@
editXmlDocumentAttribute(page);
});
$('.btnAddSubtitleProfile', page).on('click', function () {
editSubtitleProfile(page);
});
}).on('pageshow', "#dlnaProfilePage", function () {
var page = this;
@ -1075,6 +1157,16 @@
saveXmlDocumentAttribute(page);
return false;
},
onSubtitleProfileFormSubmit: function () {
var form = this;
var page = $(form).parents('.page');
saveSubtitleProfile(page);
return false;
}
};

View file

@ -183,9 +183,9 @@
function setPeopleHeader(page, item) {
if (item.Type == "Audio" || item.Type == "MusicAlbum" || item.MediaType == "Book" || item.MediaType == "Photo") {
$('#peopleHeader', page).html('People');
$('#peopleHeader', page).html(Globalize.translate('HeaderPeople'));
} else {
$('#peopleHeader', page).html('Cast & Crew');
$('#peopleHeader', page).html(Globalize.translate('HeaderCastAndCrew'));
}
}
@ -426,54 +426,54 @@
var attributes = [];
if (item.CameraMake) {
attributes.push(createAttribute("Camera make", item.CameraMake));
attributes.push(createAttribute(Globalize.translate('MediaInfoCameraMake'), item.CameraMake));
}
if (item.CameraModel) {
attributes.push(createAttribute("Camera model", item.CameraModel));
attributes.push(createAttribute(Globalize.translate('MediaInfoCameraModel'), item.CameraModel));
}
if (item.Altitude) {
attributes.push(createAttribute("Altitude", item.Altitude.toFixed(1)));
attributes.push(createAttribute(Globalize.translate('MediaInfoAltitude'), item.Altitude.toFixed(1)));
}
if (item.Aperture) {
attributes.push(createAttribute("Aperture", 'F' + item.Aperture.toFixed(1)));
attributes.push(createAttribute(Globalize.translate('MediaInfoAperture'), 'F' + item.Aperture.toFixed(1)));
}
if (item.ExposureTime) {
var val = 1 / item.ExposureTime;
attributes.push(createAttribute("Exposure time", '1/' + val + ' s'));
attributes.push(createAttribute(Globalize.translate('MediaInfoExposureTime'), '1/' + val + ' s'));
}
if (item.FocalLength) {
attributes.push(createAttribute("Focal length", item.FocalLength.toFixed(1) + ' mm'));
attributes.push(createAttribute(Globalize.translate('MediaInfoFocalLength'), item.FocalLength.toFixed(1) + ' mm'));
}
if (item.ImageOrientation) {
attributes.push(createAttribute("Orientation", item.ImageOrientation));
attributes.push(createAttribute(Globalize.translate('MediaInfoOrientation'), item.ImageOrientation));
}
if (item.IsoSpeedRating) {
attributes.push(createAttribute("Iso Speed Rating", item.IsoSpeedRating));
attributes.push(createAttribute(Globalize.translate('MediaInfoIsoSpeedRating'), item.IsoSpeedRating));
}
if (item.Latitude) {
attributes.push(createAttribute("Latitude", item.Latitude.toFixed(1)));
attributes.push(createAttribute(Globalize.translate('MediaInfoLatitude'), item.Latitude.toFixed(1)));
}
if (item.Longitude) {
attributes.push(createAttribute("Longitude", item.Longitude.toFixed(1)));
attributes.push(createAttribute(Globalize.translate('MediaInfoLongitude'), item.Longitude.toFixed(1)));
}
if (item.ShutterSpeed) {
attributes.push(createAttribute("ShutterSpeed", item.ShutterSpeed));
attributes.push(createAttribute(Globalize.translate('MediaInfoShutterSpeed'), item.ShutterSpeed));
}
if (item.Software) {
attributes.push(createAttribute("Software", item.Software));
attributes.push(createAttribute(Globalize.translate('MediaInfoSoftware'), item.Software));
}
html += attributes.join('<br/>');
@ -510,10 +510,10 @@
html = html.join(' / ');
if (artists.length == 1) {
return 'Artist:&nbsp;&nbsp;' + html;
return Globalize.translate('ValueArtist', html);
}
if (artists.length > 1) {
return 'Artists:&nbsp;&nbsp;' + html;
return Globalize.translate('ValueArtists', html);
}
return html;
@ -619,7 +619,7 @@
var elem = $('#similarCollapsible', page).show();
$('.detailSectionHeader', elem).html('If you like ' + item.Name + ', check these out...');
$('.detailSectionHeader', elem).html(Globalize.translate('HeaderIfYouLikeCheckTheseOut', item.Name));
var html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
@ -674,7 +674,7 @@
if (item.Tags && item.Tags.length) {
var html = '';
html += '<p>Tags</p>';
html += '<p>' + Globalize.translate('HeaderTags') + '</p>';
for (var i = 0, length = item.Tags.length; i < length; i++) {
html += '<div class="itemTag">' + item.Tags[i] + '</div>';
@ -693,7 +693,7 @@
if (item.Keywords && item.Keywords.length) {
var html = '';
html += '<p>Plot Keywords</p>';
html += '<p>' + Globalize.translate('HeaderPlotKeywords') + '</p>';
for (var i = 0, length = item.Keywords.length; i < length; i++) {
html += '<div class="itemTag">' + item.Keywords[i] + '</div>';
@ -800,11 +800,11 @@
if (item.Type == "BoxSet") {
var collectionItemTypes = [
{ name: 'Movies', type: 'Movie' },
{ name: 'Series', type: 'Series' },
{ name: 'Albums', type: 'MusicAlbum' },
{ name: 'Games', type: 'Game' },
{ name: 'Books', type: 'Book' }
{ name: Globalize.translate('HeaderMovies'), type: 'Movie' },
{ name: Globalize.translate('HeaderSeries'), type: 'Series' },
{ name: Globalize.translate('HeaderAlbums'), type: 'MusicAlbum' },
{ name: Globalize.translate('HeaderGames'), type: 'Game' },
{ name: Globalize.translate('HeaderBooks'), type: 'Book' }
];
renderCollectionItems(page, collectionItemTypes, result.Items, user, context);
@ -812,19 +812,19 @@
});
if (item.Type == "Season") {
$('#childrenTitle', page).html('Episodes');
$('#childrenTitle', page).html(Globalize.translate('HeaderEpisodes'));
}
else if (item.Type == "Series") {
$('#childrenTitle', page).html('Seasons');
$('#childrenTitle', page).html(Globalize.translate('HeaderSeasons'));
}
else if (item.Type == "MusicAlbum") {
$('#childrenTitle', page).html('Tracks');
$('#childrenTitle', page).html(Globalize.translate('HeaderTracks'));
}
else if (item.Type == "GameSystem") {
$('#childrenTitle', page).html('Games');
$('#childrenTitle', page).html(Globalize.translate('HeaderGames'));
}
else {
$('#childrenTitle', page).html('Items');
$('#childrenTitle', page).html(Globalize.translate('HeaderItems'));
}
}
@ -840,14 +840,12 @@
});
if (!typeItems.length) {
continue;
}
if (typeItems.length) {
renderCollectionItemType(page, type, typeItems, user);
}
}
var otherType = { name: 'Other Items' };
var otherType = { name: Globalize.translate('HeaderOtherItems') };
var otherTypeItems = items.filter(function (curr) {
@ -864,7 +862,7 @@
}
if (!items.length) {
renderCollectionItemType(page, { name: 'Titles' }, items, user);
renderCollectionItemType(page, { name: Globalize.translate('HeaderItems') }, items, user);
}
$('.collectionItems', page).trigger('create').createCardMenus();
@ -880,7 +878,7 @@
html += '<span>' + type.name + '</span>';
if (user.Configuration.IsAdministrator) {
html += '<a class="detailSectionHeaderButton" href="editcollectionitems.html?id=' + currentItem.Id + '" data-role="button" data-icon="edit" data-iconpos="notext" data-inline="true">Edit</a>';
html += '<a class="detailSectionHeaderButton" href="editcollectionitems.html?id=' + currentItem.Id + '" data-role="button" data-icon="edit" data-iconpos="notext" data-inline="true">' + Globalize.translate('ButtonEdit') + '</a>';
}
html += '</div>';
@ -991,14 +989,14 @@
html += '</div>';
if (review.Url) {
html += '<div class="reviewLink"><a class="textlink" href="' + review.Url + '" target="_blank">Full review</a></div>';
html += '<div class="reviewLink"><a class="textlink" href="' + review.Url + '" target="_blank">' + Globalize.translate('ButtonFullReview') + '</a></div>';
}
html += '</div>';
}
if (limit && result.TotalRecordCount > limit) {
html += '<p style="margin: 0;padding-left: .5em;"><button class="moreCriticReviews" data-inline="true" data-mini="true">More ...</button></p>';
html += '<p style="margin: 0;padding-left: .5em;"><button class="moreCriticReviews" data-inline="true" data-mini="true">' + Globalize.translate('ButtonMoreItems') + '</button></p>';
}
$('#criticReviewsContent', page).html(html).trigger('create');
@ -1154,7 +1152,7 @@
}
if (limit && chapters.length > limit) {
html += '<p style="margin: 0;padding-left: .5em;"><button class="moreScenes" data-inline="true" data-mini="true">More ...</button></p>';
html += '<p style="margin: 0;padding-left: .5em;"><button class="moreScenes" data-inline="true" data-mini="true">' + Globalize.translate('ButtonMoreItems') + '</button></p>';
}
$('#scenesContent', page).html(html).trigger('create');
@ -1191,83 +1189,83 @@
continue;
}
var type = stream.Type.replace('EmbeddedImage', 'Embedded Image');
html += '<div class="mediaInfoStream">';
html += '<div class="mediaInfoStreamType">' + type + '</div>';
var displayType = Globalize.translate('MediaInfoStreamType' + stream.Type);
html += '<div class="mediaInfoStreamType">' + displayType + '</div>';
var attributes = [];
if (stream.Language && stream.Type != "Video") {
attributes.push(createAttribute("Language", stream.Language));
attributes.push(createAttribute(Globalize.translate('MediaInfoLanguage'), stream.Language));
}
if (stream.Codec) {
attributes.push(createAttribute("Codec", stream.Codec.toUpperCase()));
attributes.push(createAttribute(Globalize.translate('MediaInfoCodec'), stream.Codec.toUpperCase()));
}
if (stream.Profile) {
attributes.push(createAttribute("Profile", stream.Profile));
attributes.push(createAttribute(Globalize.translate('MediaInfoProfile'), stream.Profile));
}
if (stream.Level) {
attributes.push(createAttribute("Level", stream.Level));
attributes.push(createAttribute(Globalize.translate('MediaInfoLevel'), stream.Level));
}
if (stream.Width || stream.Height) {
attributes.push(createAttribute("Resolution", stream.Width + 'x' + stream.Height));
attributes.push(createAttribute(Globalize.translate('MediaInfoResolution'), stream.Width + 'x' + stream.Height));
}
if (stream.AspectRatio && stream.Codec != "mjpeg") {
attributes.push(createAttribute("Aspect Ratio", stream.AspectRatio));
attributes.push(createAttribute(Globalize.translate('MediaInfoAspectRatio'), stream.AspectRatio));
}
if (type == "Video") {
if (stream.Type == "Video") {
if (stream.IsAnamorphic != null) {
attributes.push(createAttribute("Anamorphic", (stream.IsAnamorphic ? 'Yes' : 'No')));
attributes.push(createAttribute(Globalize.translate('MediaInfoAnamorphic'), (stream.IsAnamorphic ? 'Yes' : 'No')));
}
attributes.push(createAttribute("Interlaced", (stream.IsInterlaced ? 'Yes' : 'No')));
attributes.push(createAttribute(Globalize.translate('MediaInfoInterlaced'), (stream.IsInterlaced ? 'Yes' : 'No')));
}
if (stream.AverageFrameRate || stream.RealFrameRate) {
attributes.push(createAttribute("Framerate", (stream.AverageFrameRate || stream.RealFrameRate)));
attributes.push(createAttribute(Globalize.translate('MediaInfoFramerate'), (stream.AverageFrameRate || stream.RealFrameRate)));
}
if (stream.ChannelLayout) {
attributes.push(createAttribute("Layout", stream.ChannelLayout));
attributes.push(createAttribute(Globalize.translate('MediaInfoLayout'), stream.ChannelLayout));
}
else if (stream.Channels) {
attributes.push(createAttribute("Channels", stream.Channels + ' ch'));
attributes.push(createAttribute(Globalize.translate('MediaInfoChannels'), stream.Channels + ' ch'));
}
if (stream.BitRate && stream.Codec != "mjpeg") {
attributes.push(createAttribute("Bitrate", (parseInt(stream.BitRate / 1024)) + ' kbps'));
attributes.push(createAttribute(Globalize.translate('MediaInfoBitrate'), (parseInt(stream.BitRate / 1024)) + ' kbps'));
}
if (stream.SampleRate) {
attributes.push(createAttribute("Sample Rate", stream.SampleRate + ' khz'));
attributes.push(createAttribute(Globalize.translate('MediaInfoSampleRate'), stream.SampleRate + ' khz'));
}
if (stream.BitDepth) {
attributes.push(createAttribute("Bit Depth", stream.BitDepth + ' bit'));
attributes.push(createAttribute(Globalize.translate('MediaInfoBitDepth'), stream.BitDepth + ' bit'));
}
if (stream.PixelFormat) {
attributes.push(createAttribute("Pixel Format", stream.PixelFormat));
attributes.push(createAttribute(Globalize.translate('MediaInfoPixelFormat'), stream.PixelFormat));
}
if (stream.Type != "Video") {
attributes.push(createAttribute("Default", (stream.IsDefault ? 'Yes' : 'No')));
attributes.push(createAttribute(Globalize.translate('MediaInfoDefault'), (stream.IsDefault ? 'Yes' : 'No')));
}
if (stream.Type == "Subtitle") {
attributes.push(createAttribute("Forced", (stream.IsForced ? 'Yes' : 'No')));
attributes.push(createAttribute("External", (stream.IsExternal ? 'Yes' : 'No')));
attributes.push(createAttribute(Globalize.translate('MediaInfoForced'), (stream.IsForced ? 'Yes' : 'No')));
attributes.push(createAttribute(Globalize.translate('MediaInfoExternal'), (stream.IsExternal ? 'Yes' : 'No')));
}
if (stream.Type == "Video" && version.Timestamp) {
attributes.push(createAttribute("Timestamp", version.Timestamp));
attributes.push(createAttribute(Globalize.translate('MediaInfoTimestamp'), version.Timestamp));
}
html += attributes.join('<br/>');
@ -1276,22 +1274,22 @@
}
if (version.Container) {
html += '<div><span class="mediaInfoLabel">Container</span><span class="mediaInfoAttribute">' + version.Container + '</span></div>';
html += '<div><span class="mediaInfoLabel">' + Globalize.translate('MediaInfoContainer') + '</span><span class="mediaInfoAttribute">' + version.Container + '</span></div>';
}
if (version.Formats && version.Formats.length) {
//html += '<div><span class="mediaInfoLabel">Format</span><span class="mediaInfoAttribute">' + version.Formats.join(',') + '</span></div>';
//html += '<div><span class="mediaInfoLabel">'+Globalize.translate('MediaInfoFormat')+'</span><span class="mediaInfoAttribute">' + version.Formats.join(',') + '</span></div>';
}
if (version.Path) {
html += '<div style="max-width:600px;overflow:hidden;"><span class="mediaInfoLabel">Path</span><span class="mediaInfoAttribute">' + version.Path + '</span></div>';
html += '<div style="max-width:600px;overflow:hidden;"><span class="mediaInfoLabel">' + Globalize.translate('MediaInfoPath') + '</span><span class="mediaInfoAttribute">' + version.Path + '</span></div>';
}
if (version.Size) {
var size = (version.Size / (1024 * 1024)).toFixed(0);
html += '<div><span class="mediaInfoLabel">Size</span><span class="mediaInfoAttribute">' + size + ' MB</span></div>';
html += '<div><span class="mediaInfoLabel">' + Globalize.translate('MediaInfoSize') + '</span><span class="mediaInfoAttribute">' + size + ' MB</span></div>';
}
return html;
@ -1372,7 +1370,7 @@
}
if (limit && items.length > limit) {
html += '<p style="margin: 0;padding-left: .5em;"><button class="' + moreButtonClass + '" data-inline="true" data-mini="true">More ...</button></p>';
html += '<p style="margin: 0;padding-left: .5em;"><button class="' + moreButtonClass + '" data-inline="true" data-mini="true">' + Globalize.translate('ButtonMoreItems') + '</button></p>';
}
return html;
@ -1426,10 +1424,10 @@
html += '<p>' + cast.Name + '</p>';
var role = cast.Role ? "as " + cast.Role : cast.Type;
var role = cast.Role ? Globalize.translate('ValueAsRole', cast.Role) : cast.Type;
if (role == "GuestStar") {
role = "Guest star";
role = Globalize.translate('ValueGuestStar');
}
role = role || "";
@ -1448,7 +1446,7 @@
}
if (limit && casts.length > limit) {
html += '<p style="margin: 0;padding-left: .5em;"><button class="morePeople" data-inline="true" data-mini="true">More ...</button></p>';
html += '<p style="margin: 0;padding-left: .5em;"><button class="morePeople" data-inline="true" data-mini="true">' + Globalize.translate('ButtonMoreItems') + '</button></p>';
}
$('#castContent', page).html(html).trigger('create');

View file

@ -21,7 +21,7 @@
}
if (user.Id && loggedInUser.Configuration.IsAdministrator) {
$('#fldConnectInfo', page).hide();
$('#fldConnectInfo', page).show();
} else {
$('#fldConnectInfo', page).hide();
}