2019-11-23 23:25:10 +03:00
|
|
|
define(["connectionManager"], function (connectionManager) {
|
2019-11-23 23:00:44 +03:00
|
|
|
|
|
|
|
return function () {
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
2019-11-23 23:25:10 +03:00
|
|
|
self.name = "Backdrop ScreenSaver";
|
|
|
|
self.type = "screensaver";
|
|
|
|
self.id = "backdropscreensaver";
|
2019-11-23 23:00:44 +03:00
|
|
|
self.supportsAnonymous = false;
|
|
|
|
|
|
|
|
var currentSlideshow;
|
|
|
|
|
|
|
|
self.show = function () {
|
|
|
|
|
|
|
|
var query = {
|
|
|
|
ImageTypes: "Backdrop",
|
|
|
|
EnableImageTypes: "Backdrop",
|
2019-11-23 23:25:10 +03:00
|
|
|
IncludeItemTypes: "Movie,Series,MusicArtist",
|
2019-11-23 23:00:44 +03:00
|
|
|
SortBy: "Random",
|
|
|
|
Recursive: true,
|
|
|
|
Fields: "Taglines",
|
|
|
|
ImageTypeLimit: 1,
|
|
|
|
StartIndex: 0,
|
|
|
|
Limit: 200
|
|
|
|
};
|
|
|
|
|
2019-11-23 23:25:10 +03:00
|
|
|
var apiClient = connectionManager.currentApiClient();
|
|
|
|
apiClient.getItems(apiClient.getCurrentUserId(), query).then(function (result) {
|
2019-11-23 23:00:44 +03:00
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
2019-11-23 23:25:10 +03:00
|
|
|
require(["slideshow"], function (slideshow) {
|
2019-11-23 23:00:44 +03:00
|
|
|
|
|
|
|
var newSlideShow = new slideshow({
|
|
|
|
showTitle: true,
|
|
|
|
cover: true,
|
|
|
|
items: result.Items
|
|
|
|
});
|
|
|
|
|
|
|
|
newSlideShow.show();
|
|
|
|
currentSlideshow = newSlideShow;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
self.hide = function () {
|
|
|
|
|
|
|
|
if (currentSlideshow) {
|
|
|
|
currentSlideshow.hide();
|
|
|
|
currentSlideshow = null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2019-11-23 23:25:10 +03:00
|
|
|
});
|