From 755f6fc79c2cc49f46507fe97268ea822a499b28 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 3 Jun 2015 11:26:39 -0400 Subject: [PATCH] add more sync indicators --- dashboard-ui/css/librarybrowser.css | 10 ++-- dashboard-ui/css/librarymenu.css | 2 +- dashboard-ui/scripts/librarybrowser.js | 2 + .../thirdparty/apiclient/connectionmanager.js | 48 +++++++++---------- .../thirdparty/cordova/android/filesystem.js | 3 +- .../cordova/android/localassetmanager.js | 6 +++ dashboard-ui/thirdparty/cordova/filesystem.js | 2 +- dashboard-ui/thirdparty/filesystem.js | 2 +- 8 files changed, 42 insertions(+), 33 deletions(-) diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index af5357bcbc..89023c72e3 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -933,7 +933,6 @@ span.itemCommunityRating:not(:empty) + .userDataIcons { position: absolute; top: 32px; right: 29px; - text-align: center; vertical-align: middle; } @@ -953,7 +952,7 @@ span.itemCommunityRating:not(:empty) + .userDataIcons { color: #fff; z-index: 4; position: absolute; - margin: 5px 0 0 6px; + margin: 4px 0 0 6px; } .pie { @@ -965,7 +964,7 @@ span.itemCommunityRating:not(:empty) + .userDataIcons { -o-border-radius: 50px; border-radius: 50px; clip: rect(0px, 12px, 24px, 0px); - background-color: rgba(31, 31, 31, .8); + background-color: rgba(10, 10, 10, .9); z-index: 2; } @@ -1385,7 +1384,10 @@ span.itemCommunityRating:not(:empty) + .userDataIcons { .itemsListview .playedIndicator { left: 55px; top: 2px; - background: rgba(82, 181, 75, .8); + } + + .itemsListview .syncIndicator, .itemsListview .pieIndicator { + left: 55px; } .listviewImage { diff --git a/dashboard-ui/css/librarymenu.css b/dashboard-ui/css/librarymenu.css index 895a2923e4..fdbe317dd0 100644 --- a/dashboard-ui/css/librarymenu.css +++ b/dashboard-ui/css/librarymenu.css @@ -282,7 +282,7 @@ } } -@media all and (max-width: 1280px) { +@media all and (max-width: 1200px) { /* They can use the left menu */ .dashboardEntryHeaderButton { diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 59d459ff6e..9ce49b885a 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -868,6 +868,8 @@ html += textlines[verticalTextLines] || LibraryBrowser.getRatingHtml(item, false); html += ''; + html += LibraryBrowser.getSyncIndicator(item); + if (item.Type == 'Series' || item.Type == 'Season' || item.Type == 'BoxSet' || item.MediaType == 'Video') { if (item.UserData.UnplayedItemCount) { //html += '' + item.UserData.UnplayedItemCount + ''; diff --git a/dashboard-ui/thirdparty/apiclient/connectionmanager.js b/dashboard-ui/thirdparty/apiclient/connectionmanager.js index e56ddc1884..a29f44b75d 100644 --- a/dashboard-ui/thirdparty/apiclient/connectionmanager.js +++ b/dashboard-ui/thirdparty/apiclient/connectionmanager.js @@ -130,44 +130,44 @@ apiClients.push(apiClient); - var existingServer = credentialProvider.credentials().Servers.filter(function (s) { + var existingServers = credentialProvider.credentials().Servers.filter(function (s) { - return stringEqualsIgnoreCase(s.ManualAddress, apiClient.serverAddress()); + return stringEqualsIgnoreCase(s.ManualAddress, apiClient.serverAddress()) || + stringEqualsIgnoreCase(s.LocalAddress, apiClient.serverAddress()) || + stringEqualsIgnoreCase(s.RemoteAddress, apiClient.serverAddress()); - })[0]; + }); - if (existingServer) { + var existingServer = existingServers.length ? existingServers[0] : {}; - existingServer.DateLastAccessed = new Date().getTime(); - existingServer.LastConnectionMode = MediaBrowser.ConnectionMode.Manual; - apiClient.serverInfo(existingServer); - } + existingServer.DateLastAccessed = new Date().getTime(); + existingServer.LastConnectionMode = MediaBrowser.ConnectionMode.Manual; + existingServer.ManualAddress = apiClient.serverAddress(); + apiClient.serverInfo(existingServer); Events.on(apiClient, 'authenticated', function (e, result) { onAuthenticated(this, result, {}, true); }); + if (!existingServers.length) { + var credentials = credentialProvider.credentials(); + credentials.Servers = [existingServer]; + credentialProvider.credentials(credentials); + } + Events.trigger(self, 'apiclientcreated', [apiClient]); - return apiClient.getPublicSystemInfo().done(function (systemInfo) { + if (existingServer.Id) { + return; + } + + apiClient.getPublicSystemInfo().done(function (systemInfo) { var credentials = credentialProvider.credentials(); + existingServer.Id = systemInfo.Id; + apiClient.serverInfo(existingServer); - var server = credentials.Servers.filter(function (s) { - - return s.Id == systemInfo.Id; - - })[0] || {}; - - updateServerInfo(server, systemInfo); - - server.DateLastAccessed = new Date().getTime(); - server.LastConnectionMode = MediaBrowser.ConnectionMode.Manual; - server.ManualAddress = apiClient.serverAddress(); - - apiClient.serverInfo(server); - - credentialProvider.addOrUpdateServer(credentials.Servers, server); + credentials.Servers = [existingServer]; credentialProvider.credentials(credentials); }); }; diff --git a/dashboard-ui/thirdparty/cordova/android/filesystem.js b/dashboard-ui/thirdparty/cordova/android/filesystem.js index b139ba67da..c4193a0575 100644 --- a/dashboard-ui/thirdparty/cordova/android/filesystem.js +++ b/dashboard-ui/thirdparty/cordova/android/filesystem.js @@ -3,12 +3,11 @@ window.FileSystem = { fileExists: function (path) { - return false; return NativeFileSystem.fileExists(path); }, translateFilePath: function (path) { - return NativeFileSystem.translateFilePath(path); + return 'file://' + NativeFileSystem.translateFilePath(path); } }; diff --git a/dashboard-ui/thirdparty/cordova/android/localassetmanager.js b/dashboard-ui/thirdparty/cordova/android/localassetmanager.js index 749e5286f3..abba977519 100644 --- a/dashboard-ui/thirdparty/cordova/android/localassetmanager.js +++ b/dashboard-ui/thirdparty/cordova/android/localassetmanager.js @@ -1,6 +1,12 @@ (function () { function getLocalMediaSource(serverId, itemId) { + var json = ApiClientBridge.getLocalMediaSource(serverId, itemId); + + if (json) { + return JSON.parse(json); + } + return null; } diff --git a/dashboard-ui/thirdparty/cordova/filesystem.js b/dashboard-ui/thirdparty/cordova/filesystem.js index bfae5efb1a..5984a52cd7 100644 --- a/dashboard-ui/thirdparty/cordova/filesystem.js +++ b/dashboard-ui/thirdparty/cordova/filesystem.js @@ -7,7 +7,7 @@ }, translateFilePath: function (path) { - return path; + return 'file://' + path; } }; diff --git a/dashboard-ui/thirdparty/filesystem.js b/dashboard-ui/thirdparty/filesystem.js index bfae5efb1a..5984a52cd7 100644 --- a/dashboard-ui/thirdparty/filesystem.js +++ b/dashboard-ui/thirdparty/filesystem.js @@ -7,7 +7,7 @@ }, translateFilePath: function (path) { - return path; + return 'file://' + path; } };