From 062e381521175116312a1a160449b552c15b5ad1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 11 May 2016 13:12:09 -0400 Subject: [PATCH 1/4] fix directory browser button --- .../bower_components/iron-a11y-announcer/.bower.json | 6 +++--- dashboard-ui/bower_components/polymer/.bower.json | 2 +- .../components/directorybrowser/directorybrowser.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json b/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json index 1baafa970..d0996a061 100644 --- a/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json +++ b/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json @@ -30,14 +30,14 @@ "web-component-tester": "polymer/web-component-tester#^3.4.0" }, "ignore": [], - "homepage": "https://github.com/polymerelements/iron-a11y-announcer", + "homepage": "https://github.com/PolymerElements/iron-a11y-announcer", "_release": "1.0.4", "_resolution": { "type": "version", "tag": "v1.0.4", "commit": "5ce3eb8c4282bb53cd72e348858dc6be6b4c50b9" }, - "_source": "git://github.com/polymerelements/iron-a11y-announcer.git", + "_source": "git://github.com/PolymerElements/iron-a11y-announcer.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-a11y-announcer" + "_originalSource": "PolymerElements/iron-a11y-announcer" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/polymer/.bower.json b/dashboard-ui/bower_components/polymer/.bower.json index bbad7fe7b..3e8a4009a 100644 --- a/dashboard-ui/bower_components/polymer/.bower.json +++ b/dashboard-ui/bower_components/polymer/.bower.json @@ -34,6 +34,6 @@ "commit": "11c987b2eb3c73b388a79fc8aaea8ca01624f514" }, "_source": "git://github.com/Polymer/polymer.git", - "_target": "^1.1.0", + "_target": "^1.0.0", "_originalSource": "Polymer/polymer" } \ No newline at end of file diff --git a/dashboard-ui/components/directorybrowser/directorybrowser.js b/dashboard-ui/components/directorybrowser/directorybrowser.js index 8b03808ce..f7e603021 100644 --- a/dashboard-ui/components/directorybrowser/directorybrowser.js +++ b/dashboard-ui/components/directorybrowser/directorybrowser.js @@ -137,7 +137,7 @@ html += '
'; html += ''; - html += ''; + html += ''; html += '
'; html += '
'; From 31cb9f8d017731eb453302b55313270f7bce1725 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 11 May 2016 13:46:44 -0400 Subject: [PATCH 2/4] use shared itemHelper --- .../emby-webcomponents/.bower.json | 8 +-- .../emby-webcomponents/itemhelper.js | 54 +++++++++++++++++ .../emby-webcomponents/router.js | 12 ++-- .../iron-a11y-announcer/.bower.json | 6 +- .../bower_components/iron-meta/.bower.json | 6 +- .../bower_components/polymer/.bower.json | 2 +- dashboard-ui/scripts/librarybrowser.js | 60 ++++--------------- dashboard-ui/scripts/librarylist.js | 4 +- dashboard-ui/scripts/site.js | 1 + 9 files changed, 86 insertions(+), 67 deletions(-) create mode 100644 dashboard-ui/bower_components/emby-webcomponents/itemhelper.js diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 538e02d14..daed02ab6 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -16,12 +16,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.2.72", - "_release": "1.2.72", + "version": "1.2.73", + "_release": "1.2.73", "_resolution": { "type": "version", - "tag": "1.2.72", - "commit": "bd5ee371f1d5340371aedff26b6ad8b7912c66f3" + "tag": "1.2.73", + "commit": "f6722bdc762cd5cc372010f6c812dcd7bf8d89c5" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/itemhelper.js b/dashboard-ui/bower_components/emby-webcomponents/itemhelper.js new file mode 100644 index 000000000..6df165474 --- /dev/null +++ b/dashboard-ui/bower_components/emby-webcomponents/itemhelper.js @@ -0,0 +1,54 @@ +define([], function () { + + function getDisplayName(item, options) { + + if (!item) { + throw new Error("null item passed into getDisplayName"); + } + + options = options || {}; + + var name = item.EpisodeTitle || item.Name || ''; + + if (item.Type == "TvChannel") { + + if (item.Number) { + return item.Number + ' ' + name; + } + return name; + } + if (/*options.isInlineSpecial &&*/ item.Type == "Episode" && item.ParentIndexNumber == 0) { + + name = Globalize.translate('core#ValueSpecialEpisodeName', name); + + } else if ((item.Type == "Episode" || item.Type == 'Program') && item.IndexNumber != null && item.ParentIndexNumber != null) { + + var displayIndexNumber = item.IndexNumber; + + var number = "E" + displayIndexNumber; + + if (options.includeParentInfo !== false) { + number = "S" + item.ParentIndexNumber + ", " + number; + } + + if (item.IndexNumberEnd) { + + displayIndexNumber = item.IndexNumberEnd; + number += "-" + displayIndexNumber; + } + + name = number + " - " + name; + + } + + if (item.EpisodeTitle) { + name = item.Name + ' ' + name; + } + + return name; + } + + return { + getDisplayName: getDisplayName + }; +}); \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/router.js b/dashboard-ui/bower_components/emby-webcomponents/router.js index cda661f27..7736bba83 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/router.js +++ b/dashboard-ui/bower_components/emby-webcomponents/router.js @@ -167,6 +167,11 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b var currentViewLoadRequest; function sendRouteToViewManager(ctx, next, route, controllerFactory) { + if (isDummyBackToHome && route.type == 'home') { + isDummyBackToHome = false; + return; + } + cancelCurrentLoadRequest(); var isBackNav = ctx.isBack; @@ -203,7 +208,6 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b return; } } - viewManager.tryRestoreView(currentRequest).then(function () { // done @@ -331,21 +335,21 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b } var isHandlingBackToDefault; + var isDummyBackToHome; + function handleBackToDefault() { + isDummyBackToHome = true; skinManager.loadUserSkin(); if (isHandlingBackToDefault) { return; } - isHandlingBackToDefault = true; - // This must result in a call to either // skinManager.loadUserSkin(); // Logout // Or exit app - skinManager.getCurrentSkin().showBackMenu().then(function () { isHandlingBackToDefault = false; diff --git a/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json b/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json index d0996a061..1baafa970 100644 --- a/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json +++ b/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json @@ -30,14 +30,14 @@ "web-component-tester": "polymer/web-component-tester#^3.4.0" }, "ignore": [], - "homepage": "https://github.com/PolymerElements/iron-a11y-announcer", + "homepage": "https://github.com/polymerelements/iron-a11y-announcer", "_release": "1.0.4", "_resolution": { "type": "version", "tag": "v1.0.4", "commit": "5ce3eb8c4282bb53cd72e348858dc6be6b4c50b9" }, - "_source": "git://github.com/PolymerElements/iron-a11y-announcer.git", + "_source": "git://github.com/polymerelements/iron-a11y-announcer.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/iron-a11y-announcer" + "_originalSource": "polymerelements/iron-a11y-announcer" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-meta/.bower.json b/dashboard-ui/bower_components/iron-meta/.bower.json index f4bfef4a7..e1304d174 100644 --- a/dashboard-ui/bower_components/iron-meta/.bower.json +++ b/dashboard-ui/bower_components/iron-meta/.bower.json @@ -26,14 +26,14 @@ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, "main": "iron-meta.html", - "homepage": "https://github.com/polymerelements/iron-meta", + "homepage": "https://github.com/PolymerElements/iron-meta", "_release": "1.1.1", "_resolution": { "type": "version", "tag": "v1.1.1", "commit": "e171ee234b482219c9514e6f9551df48ef48bd9f" }, - "_source": "git://github.com/polymerelements/iron-meta.git", + "_source": "git://github.com/PolymerElements/iron-meta.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-meta" + "_originalSource": "PolymerElements/iron-meta" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/polymer/.bower.json b/dashboard-ui/bower_components/polymer/.bower.json index 3e8a4009a..bbad7fe7b 100644 --- a/dashboard-ui/bower_components/polymer/.bower.json +++ b/dashboard-ui/bower_components/polymer/.bower.json @@ -34,6 +34,6 @@ "commit": "11c987b2eb3c73b388a79fc8aaea8ca01624f514" }, "_source": "git://github.com/Polymer/polymer.git", - "_target": "^1.0.0", + "_target": "^1.1.0", "_originalSource": "Polymer/polymer" } \ No newline at end of file diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index e752a3fd2..b83e00ef7 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -1,4 +1,4 @@ -define(['playlistManager', 'appSettings', 'appStorage', 'apphost', 'datetime', 'jQuery', 'scrollStyles'], function (playlistManager, appSettings, appStorage, appHost, datetime, $) { +define(['playlistManager', 'appSettings', 'appStorage', 'apphost', 'datetime', 'jQuery', 'itemHelper', 'scrollStyles'], function (playlistManager, appSettings, appStorage, appHost, datetime, $, itemHelper) { function parentWithClass(elem, className) { @@ -695,8 +695,8 @@ return commands; }, - canIdentify: function(user, itemType) { - + canIdentify: function (user, itemType) { + if (itemType == "Movie" || itemType == "Trailer" || itemType == "Series" || @@ -1332,7 +1332,7 @@ textlines.push(item.AlbumArtist || ' '); } - var displayName = LibraryBrowser.getPosterViewDisplayName(item); + var displayName = itemHelper.getDisplayName(item); if (options.showIndexNumber && item.IndexNumber != null) { displayName = item.IndexNumber + ". " + displayName; @@ -1359,7 +1359,7 @@ else if (item.Type == 'TvChannel') { if (item.CurrentProgram) { - textlines.push(LibraryBrowser.getPosterViewDisplayName(item.CurrentProgram)); + textlines.push(itemHelper.getDisplayName(item.CurrentProgram)); } } else { @@ -2281,7 +2281,7 @@ html += ""; } - var name = options.showTitle == 'auto' && !item.IsFolder && item.MediaType == 'Photo' ? '' : LibraryBrowser.getPosterViewDisplayName(item, options.displayAsSpecial); + var name = options.showTitle == 'auto' && !item.IsFolder && item.MediaType == 'Photo' ? '' : itemHelper.getDisplayName(item); if (!imgUrl && !showTitle) { html += "
"; @@ -2384,7 +2384,7 @@ if (item.Type == 'TvChannel') { if (item.CurrentProgram) { - lines.push(LibraryBrowser.getPosterViewDisplayName(item.CurrentProgram)); + lines.push(itemHelper.getDisplayName(item.CurrentProgram)); } else { lines.push(''); } @@ -2541,48 +2541,6 @@ return day; }, - getPosterViewDisplayName: function (item, displayAsSpecial, includeParentInfo) { - - if (!item) { - throw new Error("null item passed into getPosterViewDisplayName"); - } - - var name = item.EpisodeTitle || item.Name || ''; - - if (item.Type == "TvChannel") { - - if (item.Number) { - return item.Number + ' ' + name; - } - return name; - } - if (displayAsSpecial && item.Type == "Episode" && item.ParentIndexNumber == 0) { - - name = Globalize.translate('ValueSpecialEpisodeName', name); - - } else if (item.Type == "Episode" && item.IndexNumber != null && item.ParentIndexNumber != null) { - - var displayIndexNumber = item.IndexNumber; - - var number = "E" + displayIndexNumber; - - if (includeParentInfo !== false) { - number = "S" + item.ParentIndexNumber + ", " + number; - } - - if (item.IndexNumberEnd) { - - displayIndexNumber = item.IndexNumberEnd; - number += "-" + displayIndexNumber; - } - - name = number + " - " + name; - - } - - return name; - }, - getOfflineIndicatorHtml: function (item) { if (item.LocationType == "Offline") { @@ -2735,7 +2693,9 @@ renderName: function (item, nameElem, linkToElement, context) { - var name = LibraryBrowser.getPosterViewDisplayName(item, false, false); + var name = itemHelper.getDisplayName(item, { + includeParentInfo: false + }); Dashboard.setPageTitle(name); diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index a98a88e34..e4e9c317f 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -1,4 +1,4 @@ -define(['appSettings', 'appStorage', 'libraryBrowser', 'apphost', 'jQuery'], function (appSettings, appStorage, LibraryBrowser, appHost, $) { +define(['appSettings', 'appStorage', 'libraryBrowser', 'apphost', 'jQuery', 'itemHelper'], function (appSettings, appStorage, LibraryBrowser, appHost, $, itemHelper) { var showOverlayTimeout; @@ -81,7 +81,7 @@ var isSquare = className.indexOf('square') != -1; var parentName = isSmallItem || isMiniItem || isPortrait ? null : item.SeriesName; - var name = LibraryBrowser.getPosterViewDisplayName(item, true); + var name = itemHelper.getDisplayName(item); html += '
'; var logoHeight = isSmallItem || isMiniItem ? 20 : 26; diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index a13e4eeec..e70672d38 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1790,6 +1790,7 @@ var AppInfo = {}; focusManager: embyWebComponentsBowerPath + "/focusmanager", datetime: embyWebComponentsBowerPath + "/datetime", globalize: embyWebComponentsBowerPath + "/globalize", + itemHelper: embyWebComponentsBowerPath + '/itemhelper', itemShortcuts: embyWebComponentsBowerPath + "/shortcuts", imageLoader: embyWebComponentsBowerPath + "/images/imagehelper" }; From 014d70f5d7daea4905fccc5228f8ed236d2a25d2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 11 May 2016 18:08:19 -0400 Subject: [PATCH 3/4] import shared media info component --- .../emby-webcomponents/.bower.json | 8 +- .../actionsheet/actionsheet.js | 4 +- .../emby-webcomponents/alert/alert.js | 4 +- .../emby-webcomponents/guide/guide.js | 8 +- .../guide/tvguide.template.html | 2 +- .../icons.html => icons/mediainfo.html} | 5 +- .../{prompt/icons.html => icons/nav.html} | 2 +- .../emby-webcomponents/mediainfo/mediainfo.js | 451 ++++++++++++++++++ .../emby-webcomponents/prompt/prompt.js | 4 +- .../emby-webcomponents/router.js | 4 +- .../iron-selector/.bower.json | 4 +- .../paper-behaviors/.bower.json | 4 +- .../bower_components/paper-ripple/.bower.json | 6 +- .../metadataeditor/metadataeditor.js | 2 - .../metadataeditor.template.html | 2 +- dashboard-ui/scripts/editorsidebar.js | 7 +- dashboard-ui/scripts/livetvrecordings.js | 2 +- dashboard-ui/scripts/site.js | 1 + 18 files changed, 489 insertions(+), 31 deletions(-) rename dashboard-ui/bower_components/emby-webcomponents/{guide/icons.html => icons/mediainfo.html} (73%) rename dashboard-ui/bower_components/emby-webcomponents/{prompt/icons.html => icons/nav.html} (97%) create mode 100644 dashboard-ui/bower_components/emby-webcomponents/mediainfo/mediainfo.js diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index daed02ab6..a4f225487 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -16,12 +16,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.2.73", - "_release": "1.2.73", + "version": "1.2.75", + "_release": "1.2.75", "_resolution": { "type": "version", - "tag": "1.2.73", - "commit": "f6722bdc762cd5cc372010f6c812dcd7bf8d89c5" + "tag": "1.2.75", + "commit": "122d3aaefc1fe36b22916f03dac5eea73fbb2ba7" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js b/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js index 2eda46f1c..093bb2e76 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js +++ b/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.js @@ -1,4 +1,4 @@ -define(['dialogHelper', 'layoutManager', 'dialogText', 'paper-button', 'css!./actionsheet'], function (dialogHelper, layoutManager, dialogText) { +define(['dialogHelper', 'layoutManager', 'dialogText', 'paper-button', 'css!./actionsheet', 'html!./../icons/nav.html'], function (dialogHelper, layoutManager, dialogText) { function parentWithClass(elem, className) { @@ -132,7 +132,7 @@ html += '
'; options.items.forEach(function (o) { - o.ironIcon = o.selected ? 'check' : null; + o.ironIcon = o.selected ? 'nav:check' : null; }); var itemsWithIcons = options.items.filter(function (o) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/alert/alert.js b/dashboard-ui/bower_components/emby-webcomponents/alert/alert.js index 5bb807da8..1495722b4 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/alert/alert.js +++ b/dashboard-ui/bower_components/emby-webcomponents/alert/alert.js @@ -1,4 +1,4 @@ -define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./../prompt/icons.html', 'css!./../prompt/style.css', 'paper-button', 'paper-icon-button-light', 'paper-input'], function (dialogHelper, layoutManager, dialogText) { +define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./../icons/nav.html', 'css!./../prompt/style.css', 'paper-button', 'paper-icon-button-light', 'paper-input'], function (dialogHelper, layoutManager, dialogText) { function getIcon(icon, cssClass, canFocus, autoFocus) { @@ -72,7 +72,7 @@ define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./../prompt/icons.h var buttonText = options.type == 'error' ? 'Ok' : 'GotIt'; if (raisedButtons) { - html += '' + dialogText.get(buttonText) + ''; + html += '' + dialogText.get(buttonText) + ''; } else { html += '
'; html += '' + dialogText.get(buttonText) + ''; diff --git a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js index 17ae30de9..6a3a2611c 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js +++ b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js @@ -1,4 +1,4 @@ -define(['globalize', 'connectionManager', 'loading', 'scrollHelper', 'datetime', 'focusManager', 'imageLoader', 'events', 'layoutManager', 'itemShortcuts', 'registrationservices', 'clearButtonStyle', 'css!./guide.css', 'html!./icons.html', 'scrollStyles'], function (globalize, connectionManager, loading, scrollHelper, datetime, focusManager, imageLoader, events, layoutManager, itemShortcuts, registrationServices) { +define(['globalize', 'connectionManager', 'loading', 'scrollHelper', 'datetime', 'focusManager', 'imageLoader', 'events', 'layoutManager', 'itemShortcuts', 'registrationservices', 'clearButtonStyle', 'css!./guide.css', 'html!./../icons/mediainfo.html', 'html!./../icons/nav.html', 'scrollStyles'], function (globalize, connectionManager, loading, scrollHelper, datetime, focusManager, imageLoader, events, layoutManager, itemShortcuts, registrationServices) { var baseUrl; @@ -271,14 +271,14 @@ html += '
'; if (program.IsHD) { - html += ''; + html += ''; } if (program.SeriesTimerId) { - html += ''; + html += ''; } else if (program.TimerId) { - html += ''; + html += ''; } if (addAccent) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/guide/tvguide.template.html b/dashboard-ui/bower_components/emby-webcomponents/guide/tvguide.template.html index 523e8dd41..33b8a7406 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/guide/tvguide.template.html +++ b/dashboard-ui/bower_components/emby-webcomponents/guide/tvguide.template.html @@ -18,5 +18,5 @@

- ${ButtonUnlockGuide} + ${ButtonUnlockGuide}
\ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/guide/icons.html b/dashboard-ui/bower_components/emby-webcomponents/icons/mediainfo.html similarity index 73% rename from dashboard-ui/bower_components/emby-webcomponents/guide/icons.html rename to dashboard-ui/bower_components/emby-webcomponents/icons/mediainfo.html index 242d27d4e..b0805324c 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/guide/icons.html +++ b/dashboard-ui/bower_components/emby-webcomponents/icons/mediainfo.html @@ -31,12 +31,15 @@ See [iron-iconset](#iron-iconset) and [iron-iconset-svg](#iron-iconset-svg) for @demo demo/index.html --> - + + + + diff --git a/dashboard-ui/bower_components/emby-webcomponents/prompt/icons.html b/dashboard-ui/bower_components/emby-webcomponents/icons/nav.html similarity index 97% rename from dashboard-ui/bower_components/emby-webcomponents/prompt/icons.html rename to dashboard-ui/bower_components/emby-webcomponents/icons/nav.html index 5b719d386..85ea90078 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/prompt/icons.html +++ b/dashboard-ui/bower_components/emby-webcomponents/icons/nav.html @@ -31,7 +31,7 @@ See [iron-iconset](#iron-iconset) and [iron-iconset-svg](#iron-iconset-svg) for @demo demo/index.html --> - + diff --git a/dashboard-ui/bower_components/emby-webcomponents/mediainfo/mediainfo.js b/dashboard-ui/bower_components/emby-webcomponents/mediainfo/mediainfo.js new file mode 100644 index 000000000..17bcf4b60 --- /dev/null +++ b/dashboard-ui/bower_components/emby-webcomponents/mediainfo/mediainfo.js @@ -0,0 +1,451 @@ +define(['datetime', 'globalize', 'embyRouter', 'html!./../icons/mediainfo.html'], function (datetime, globalize, embyRouter) { + + function getProgramInfoHtml(item, options) { + var html = ''; + + var miscInfo = []; + var text, date; + + if (item.ChannelName) { + + if (options.interactive && item.ChannelId) { + miscInfo.push('' + item.ChannelName + ''); + } else { + miscInfo.push(item.ChannelName); + } + } + + if (item.StartDate) { + + try { + date = datetime.parseISO8601Date(item.StartDate); + + text = date.toLocaleDateString(); + + text += ', ' + datetime.getDisplayTime(date); + + if (item.EndDate) { + date = datetime.parseISO8601Date(item.EndDate); + text += ' - ' + datetime.getDisplayTime(date); + } + + miscInfo.push(text); + } + catch (e) { + console.log("Error parsing date: " + item.PremiereDate); + } + } + + if (item.ChannelNumber) { + miscInfo.push('CH ' + item.ChannelNumber); + } + + html += miscInfo.map(function (m) { + return getMediaInfoItem(m); + }).join(''); + + return html; + } + + function getMediaInfoHtml(item, options) { + var html = ''; + + var miscInfo = []; + options = options || {}; + var text, date, minutes; + + if (item.Type == "MusicAlbum" || item.MediaType == 'MusicArtist' || item.MediaType == 'Playlist' || item.MediaType == 'MusicGenre') { + + var count = item.SongCount || item.ChildCount; + + if (count) { + + miscInfo.push(globalize.translate('core#TrackCount', count)); + } + + if (item.CumulativeRunTimeTicks) { + + miscInfo.push(datetime.getDisplayRunningTime(item.CumulativeRunTimeTicks)); + } + } + + else if (item.Type == "PhotoAlbum" || item.Type == "BoxSet") { + + var count = item.ChildCount; + + if (count) { + + miscInfo.push(globalize.translate('core#ItemCount', count)); + } + } + + if (item.Type == "Episode" || item.MediaType == 'Photo') { + + if (item.PremiereDate) { + + try { + date = datetime.parseISO8601Date(item.PremiereDate); + + text = date.toLocaleDateString(); + miscInfo.push(text); + } + catch (e) { + console.log("Error parsing date: " + item.PremiereDate); + } + } + } + + if (item.StartDate && item.Type != 'Program') { + + try { + date = datetime.parseISO8601Date(item.StartDate); + + text = date.toLocaleDateString(); + miscInfo.push(text); + + if (item.Type != "Recording") { + text = datetime.getDisplayTime(date); + miscInfo.push(text); + } + } + catch (e) { + console.log("Error parsing date: " + item.PremiereDate); + } + } + + if (item.ProductionYear && item.Type == "Series") { + + if (item.Status == "Continuing") { + miscInfo.push(globalize.translate('core#ValueSeriesYearToPresent', item.ProductionYear)); + + } + else if (item.ProductionYear) { + + text = item.ProductionYear; + + if (item.EndDate) { + + try { + + var endYear = datetime.parseISO8601Date(item.EndDate).getFullYear(); + + if (endYear != item.ProductionYear) { + text += "-" + datetime.parseISO8601Date(item.EndDate).getFullYear(); + } + + } + catch (e) { + console.log("Error parsing date: " + item.EndDate); + } + } + + miscInfo.push(text); + } + } + + if (item.Type == 'Program') { + + if (item.PremiereDate) { + + try { + date = datetime.parseISO8601Date(item.PremiereDate); + text = globalize.translate('core#OriginalAirDateValue', date.toLocaleDateString()); + miscInfo.push(text); + } + catch (e) { + console.log("Error parsing date: " + item.PremiereDate); + } + } else if (item.ProductionYear) { + text = globalize.translate('core#ReleaseYearValue', item.ProductionYear); + miscInfo.push(text); + } + } + + if (item.Type != "Series" && item.Type != "Episode" && item.Type != "Person" && item.MediaType != 'Photo' && item.Type != 'Program') { + + if (item.ProductionYear) { + + miscInfo.push(item.ProductionYear); + } + else if (item.PremiereDate) { + + try { + text = datetime.parseISO8601Date(item.PremiereDate).getFullYear(); + miscInfo.push(text); + } + catch (e) { + console.log("Error parsing date: " + item.PremiereDate); + } + } + } + + if (item.RunTimeTicks && item.Type != "Series" && item.Type != 'Program' && options.runtime !== false) { + + if (item.Type == "Audio") { + + miscInfo.push(datetime.getDisplayRunningTime(item.RunTimeTicks)); + + } else { + minutes = item.RunTimeTicks / 600000000; + + minutes = minutes || 1; + + miscInfo.push(Math.round(minutes) + " mins"); + } + } + + if (item.OfficialRating && item.Type !== "Season" && item.Type !== "Episode") { + miscInfo.push({ + text: item.OfficialRating, + cssClass: 'mediaInfoOfficialRating' + }); + } + + if (item.HasSubtitles && options.subtitles !== false) { + miscInfo.push({ + html: '' + }); + } + + if (item.Video3DFormat) { + miscInfo.push("3D"); + } + + if (item.MediaType == 'Photo' && item.Width && item.Height) { + miscInfo.push(item.Width + "x" + item.Height); + } + + html += miscInfo.map(function (m) { + return getMediaInfoItem(m); + }).join(''); + + html += getStarIconsHtml(item); + + if (item.CriticRating && options.criticRating !== false) { + + if (item.CriticRating >= 60) { + html += '
' + item.CriticRating + '
'; + } else { + html += '
' + item.CriticRating + '
'; + } + } + + if (options.endsAt !== false) { + + var endsAt = getEndsAt(item); + if (endsAt) { + html += getMediaInfoItem(endsAt, 'endsAt'); + } + } + + return html; + } + + function getEndsAt(item) { + + if (item.MediaType == 'Video' && item.RunTimeTicks) { + + if (!item.StartDate) { + var endDate = new Date().getTime() + (item.RunTimeTicks / 10000); + endDate = new Date(endDate); + + var displayTime = datetime.getDisplayTime(endDate); + return globalize.translate('core#EndsAtValue', displayTime); + } + } + + return null; + } + + function getEndsAtFromPosition(runtimeTicks, positionTicks, includeText) { + + var endDate = new Date().getTime() + ((runtimeTicks - (positionTicks || 0)) / 10000); + endDate = new Date(endDate); + + var displayTime = datetime.getDisplayTime(endDate); + + if (includeText === false) { + return displayTime; + } + return globalize.translate('core#EndsAtValue', displayTime); + } + + function getMediaInfoItem(m, cssClass) { + + cssClass = cssClass ? (cssClass + ' mediaInfoItem') : 'mediaInfoItem'; + var mediaInfoText = m; + + if (typeof (m) !== 'string' && typeof (m) !== 'number') { + + if (m.html) { + return m.html; + } + mediaInfoText = m.text; + cssClass += ' ' + m.cssClass; + } + return '
' + mediaInfoText + '
'; + } + + function getStarIconsHtml(item) { + + var html = ''; + + var rating = item.CommunityRating; + + if (rating) { + html += '
'; + + for (var i = 0; i < 5; i++) { + var starValue = (i + 1) * 2; + + if (rating < starValue - 2) { + html += ''; + } + else if (rating < starValue) { + html += ''; + } + else { + html += ''; + } + } + + html += '
'; + } + + return html; + } + + function dynamicEndTime(elem, item) { + + var interval = setInterval(function () { + + if (!document.body.contains(elem)) { + + clearInterval(interval); + return; + } + + elem.innerHTML = getEndsAt(item); + + }, 60000); + } + + function fillPrimaryMediaInfo(elem, item, options) { + var html = getPrimaryMediaInfoHtml(item, options); + + elem.innerHTML = html; + afterFill(elem, item, options); + } + + function fillSecondaryMediaInfo(elem, item, options) { + var html = getSecondaryMediaInfoHtml(item, options); + + elem.innerHTML = html; + afterFill(elem, item, options); + } + + function afterFill(elem, item, options) { + + var endsAtElem = elem.querySelector('.endsAt'); + if (endsAtElem) { + dynamicEndTime(endsAtElem, item); + } + + var lnkChannel = elem.querySelector('.lnkChannel'); + if (lnkChannel) { + lnkChannel.addEventListener('click', onChannelLinkClick); + } + } + + function onChannelLinkClick(e) { + + var channelId = this.getAttribute('data-id'); + var serverId = this.getAttribute('data-serverid'); + + embyRouter.showItem(channelId, serverId); + + e.preventDefault(); + return false; + } + + function getDisplayName(item, options) { + + if (!item) { + throw new Error("null item passed into getDisplayName"); + } + + options = options || {}; + + var name = item.EpisodeTitle || item.Name || ''; + + if (item.Type == "TvChannel") { + + if (item.Number) { + return item.Number + ' ' + name; + } + return name; + } + if (options.isInlineSpecial && item.Type == "Episode" && item.ParentIndexNumber == 0) { + + name = globalize.translate('core#ValueSpecialEpisodeName', name); + + } else if (item.Type == "Episode" && item.IndexNumber != null && item.ParentIndexNumber != null) { + + var displayIndexNumber = item.IndexNumber; + + var number = "E" + displayIndexNumber; + + if (options.includeParentInfo !== false) { + number = "S" + item.ParentIndexNumber + ", " + number; + } + + if (item.IndexNumberEnd) { + + displayIndexNumber = item.IndexNumberEnd; + number += "-" + displayIndexNumber; + } + + name = number + " - " + name; + + } + + return name; + } + + function getPrimaryMediaInfoHtml(item, options) { + + options = options || {}; + if (options.interactive == null) { + options.interactive = false; + } + if (item.Type == 'Program') { + return getProgramInfoHtml(item, options); + } + + return getMediaInfoHtml(item, options); + } + + function getSecondaryMediaInfoHtml(item, options) { + + options = options || {}; + if (options.interactive == null) { + options.interactive = false; + } + if (item.Type == 'Program') { + return getMediaInfoHtml(item, options); + } + + return ''; + } + + return { + getMediaInfoHtml: getPrimaryMediaInfoHtml, + fill: fillPrimaryMediaInfo, + getEndsAt: getEndsAt, + getEndsAtFromPosition: getEndsAtFromPosition, + getPrimaryMediaInfoHtml: getPrimaryMediaInfoHtml, + getSecondaryMediaInfoHtml: getSecondaryMediaInfoHtml, + fillPrimaryMediaInfo: fillPrimaryMediaInfo, + fillSecondaryMediaInfo: fillSecondaryMediaInfo + }; +}); \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/prompt/prompt.js b/dashboard-ui/bower_components/emby-webcomponents/prompt/prompt.js index ef629db1c..d23b840a0 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/prompt/prompt.js +++ b/dashboard-ui/bower_components/emby-webcomponents/prompt/prompt.js @@ -1,4 +1,4 @@ -define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./icons.html', 'css!./style.css', 'paper-button', 'paper-icon-button-light', 'paper-input'], function (dialogHelper, layoutManager, dialogText) { +define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./../icons/nav.html', 'css!./style.css', 'paper-button', 'paper-icon-button-light', 'paper-input'], function (dialogHelper, layoutManager, dialogText) { function getIcon(icon, cssClass, canFocus, autoFocus) { @@ -64,7 +64,7 @@ define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./icons.html', 'css html += '
'; if (raisedButtons) { - html += '' + dialogText.get('Ok') + ''; + html += '' + dialogText.get('Ok') + ''; } else { html += '
'; html += '' + dialogText.get('Ok') + ''; diff --git a/dashboard-ui/bower_components/emby-webcomponents/router.js b/dashboard-ui/bower_components/emby-webcomponents/router.js index 7736bba83..1d1e3370b 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/router.js +++ b/dashboard-ui/bower_components/emby-webcomponents/router.js @@ -485,11 +485,11 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b return show(pluginManager.mapRoute(skin, homeRoute)); } - function showItem(item) { + function showItem(item, serverId) { if (typeof (item) === 'string') { require(['connectionManager'], function (connectionManager) { - var apiClient = connectionManager.currentApiClient(); + var apiClient = serverId ? connectionManager.getApiClient(serverId) : connectionManager.currentApiClient(); apiClient.getItem(apiClient.getCurrentUserId(), item).then(showItem); }); } else { diff --git a/dashboard-ui/bower_components/iron-selector/.bower.json b/dashboard-ui/bower_components/iron-selector/.bower.json index e5306ccfc..1da99816d 100644 --- a/dashboard-ui/bower_components/iron-selector/.bower.json +++ b/dashboard-ui/bower_components/iron-selector/.bower.json @@ -36,7 +36,7 @@ "tag": "v1.5.1", "commit": "e3e34408fad8f7cde59c4255cf3fe90f7dcf91d8" }, - "_source": "git://github.com/PolymerElements/iron-selector.git", + "_source": "git://github.com/polymerelements/iron-selector.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/iron-selector" + "_originalSource": "polymerelements/iron-selector" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/paper-behaviors/.bower.json b/dashboard-ui/bower_components/paper-behaviors/.bower.json index a6b333d33..2b04bf9f8 100644 --- a/dashboard-ui/bower_components/paper-behaviors/.bower.json +++ b/dashboard-ui/bower_components/paper-behaviors/.bower.json @@ -45,7 +45,7 @@ "tag": "v1.0.11", "commit": "e3c1ab0c72905b58fb4d9adc2921ea73b5c085a5" }, - "_source": "git://github.com/polymerelements/paper-behaviors.git", + "_source": "git://github.com/PolymerElements/paper-behaviors.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/paper-behaviors" + "_originalSource": "PolymerElements/paper-behaviors" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/paper-ripple/.bower.json b/dashboard-ui/bower_components/paper-ripple/.bower.json index 2f654d71c..157225ee7 100644 --- a/dashboard-ui/bower_components/paper-ripple/.bower.json +++ b/dashboard-ui/bower_components/paper-ripple/.bower.json @@ -32,14 +32,14 @@ "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0" }, "ignore": [], - "homepage": "https://github.com/polymerelements/paper-ripple", + "homepage": "https://github.com/PolymerElements/paper-ripple", "_release": "1.0.5", "_resolution": { "type": "version", "tag": "v1.0.5", "commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5" }, - "_source": "git://github.com/polymerelements/paper-ripple.git", + "_source": "git://github.com/PolymerElements/paper-ripple.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/paper-ripple" + "_originalSource": "PolymerElements/paper-ripple" } \ No newline at end of file diff --git a/dashboard-ui/components/metadataeditor/metadataeditor.js b/dashboard-ui/components/metadataeditor/metadataeditor.js index acb1f402b..836b5ca5a 100644 --- a/dashboard-ui/components/metadataeditor/metadataeditor.js +++ b/dashboard-ui/components/metadataeditor/metadataeditor.js @@ -669,14 +669,12 @@ $('#tagsCollapsible', context).hide(); $('#metadataSettingsCollapsible', context).hide(); $('#fldPremiereDate', context).hide(); - $('#fldSortName', context).hide(); $('#fldDateAdded', context).hide(); $('#fldYear', context).hide(); } else { $('#tagsCollapsible', context).show(); $('#metadataSettingsCollapsible', context).show(); $('#fldPremiereDate', context).show(); - $('#fldSortName', context).show(); $('#fldDateAdded', context).show(); $('#fldYear', context).show(); } diff --git a/dashboard-ui/components/metadataeditor/metadataeditor.template.html b/dashboard-ui/components/metadataeditor/metadataeditor.template.html index dc87f3bb8..3489e3d8c 100644 --- a/dashboard-ui/components/metadataeditor/metadataeditor.template.html +++ b/dashboard-ui/components/metadataeditor/metadataeditor.template.html @@ -29,7 +29,7 @@
-