2015-08-12 14:39:02 -07:00
|
|
|
|
(function () {
|
|
|
|
|
|
2015-09-10 11:28:22 -07:00
|
|
|
|
var syncPromise;
|
|
|
|
|
|
2015-08-12 14:39:02 -07:00
|
|
|
|
window.LocalSync = {
|
|
|
|
|
|
|
|
|
|
isSupported: function () {
|
2015-09-10 11:28:22 -07:00
|
|
|
|
return AppInfo.isNativeApp;
|
2015-08-12 14:39:02 -07:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
startSync: function () {
|
|
|
|
|
|
2015-09-10 11:28:22 -07:00
|
|
|
|
if (!syncPromise) {
|
|
|
|
|
require(['multiserversync'], function () {
|
|
|
|
|
|
|
|
|
|
syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync().done(function () {
|
|
|
|
|
|
|
|
|
|
syncPromise = null;
|
|
|
|
|
|
|
|
|
|
}).fail(function () {
|
|
|
|
|
|
|
|
|
|
syncPromise = null;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
2015-08-12 14:39:02 -07:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getSyncStatus: function () {
|
2015-09-10 11:28:22 -07:00
|
|
|
|
|
|
|
|
|
if (syncPromise != null) {
|
|
|
|
|
return 'Syncing';
|
|
|
|
|
}
|
2015-08-12 14:39:02 -07:00
|
|
|
|
return 'Idle';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2015-09-10 11:28:22 -07:00
|
|
|
|
Dashboard.ready(function () {
|
|
|
|
|
if (LocalSync.isSupported) {
|
|
|
|
|
setInterval(function () {
|
|
|
|
|
|
|
|
|
|
LocalSync.startSync();
|
|
|
|
|
|
|
|
|
|
}, 3600000);
|
|
|
|
|
}
|
2015-09-14 14:24:54 -07:00
|
|
|
|
//LocalSync.startSync();
|
2015-09-10 11:28:22 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-08-12 14:39:02 -07:00
|
|
|
|
})();
|