sync updates

This commit is contained in:
Luke Pulverenti 2015-02-10 22:28:34 -05:00
parent 47d9d8259e
commit d3b42303eb
4 changed files with 27 additions and 39 deletions

View File

@ -347,6 +347,12 @@
return false;
}
if (mediaSource.Protocol == 'Http') {
if (Dashboard.isConnectMode()) {
return false;
}
}
if (extension == 'm4v' || extension == 'mkv') {
return $.browser.chrome != null;
}

View File

@ -126,6 +126,21 @@ var Dashboard = {
var address = store.getItem('serverAddress');
if (!address && !Dashboard.isConnectMode()) {
// Try to get the server address from the browser url
// This will preserve protocol, hostname, port and subdirectory
var urlLower = getWindowUrl().toLowerCase();
var index = urlLower.indexOf('/web');
if (index == -1) {
index = urlLower.index('/dashboard');
}
if (index != -1) {
address = urlLower.substring(0, index);
return address;
}
// If the above failed, just piece it together manually
var loc = window.location;
address = loc.protocol + '//' + loc.hostname;

View File

@ -110,7 +110,10 @@
}).join('');
html += '</select>';
if (!targets.length) {
html += '<div class="fieldDescription">' + Globalize.translate('LabelSyncNoTargetsHelp') + '</div>';
html += '<div class="fieldDescription"><a href="https://github.com/MediaBrowser/Wiki/wiki/Sync" target="_blank">' + Globalize.translate('ButtonLearnMore') + '</a></div>';
}
html += '</div>';
html += '<br/>';
@ -187,33 +190,6 @@
});
}
function showUnwatchedFilter(items) {
return items.filter(function (i) {
return i.MediaType == "Video" || i.IsFolder || i.Type == "Person" || i.Type == "Genre" || i.Type == "MusicGenre" || i.Type == "GameGenre" || i.Type == "Studio" || i.Type == "MusicArtist";
}).length > 0;
}
function showItemLimit(items) {
return items.length > 1 || items.filter(function (i) {
return i.IsFolder || i.Type == "Person" || i.Type == "Genre" || i.Type == "MusicGenre" || i.Type == "GameGenre" || i.Type == "Studio" || i.Type == "MusicArtist";
}).length > 0;
}
function showSyncNew(items) {
return items.filter(function (i) {
return i.IsFolder || i.Type == "Person" || i.Type == "Genre" || i.Type == "MusicGenre" || i.Type == "GameGenre" || i.Type == "Studio" || i.Type == "MusicArtist";
}).length > 0;
}
function isAvailable(item, user) {
return item.SupportsSync;

View File

@ -47,11 +47,6 @@
return serverAddress;
};
self.apiPrefix = function () {
return "";
};
self.serverInfo = function (info) {
serverInfo = info || serverInfo;
@ -311,9 +306,7 @@
throw new Error("Url name cannot be empty");
}
var url = serverAddress;
url += self.apiPrefix() + "/" + name;
var url = serverAddress + "/" + name;
if (params) {
url += "?" + $.param(params);
@ -341,9 +334,7 @@
self.openWebSocket = function () {
var url = serverAddress + self.apiPrefix();
url = url.replace('http', 'ws');
var url = serverAddress.replace('http', 'ws');
webSocket = new WebSocket(url);