2020-04-15 10:16:41 +02:00
|
|
|
/* eslint-disable indent */
|
|
|
|
import connectionManager from "connectionManager";
|
|
|
|
|
|
|
|
class BackdropScreensaver {
|
|
|
|
constructor() {
|
|
|
|
this.name = "Backdrop ScreenSaver";
|
|
|
|
this.type = "screensaver";
|
|
|
|
this.id = "backdropscreensaver";
|
|
|
|
this.supportsAnonymous = false;
|
|
|
|
}
|
|
|
|
show() {
|
|
|
|
const query = {
|
|
|
|
ImageTypes: "Backdrop",
|
|
|
|
EnableImageTypes: "Backdrop",
|
|
|
|
IncludeItemTypes: "Movie,Series,MusicArtist",
|
|
|
|
SortBy: "Random",
|
2019-11-23 23:00:44 +03:00
|
|
|
Recursive: true,
|
2020-04-15 10:16:41 +02:00
|
|
|
Fields: "Taglines",
|
2019-11-23 23:00:44 +03:00
|
|
|
ImageTypeLimit: 1,
|
|
|
|
StartIndex: 0,
|
|
|
|
Limit: 200
|
|
|
|
};
|
|
|
|
|
2020-04-15 10:16:41 +02:00
|
|
|
const apiClient = connectionManager.currentApiClient();
|
2019-11-23 23:25:10 +03:00
|
|
|
apiClient.getItems(apiClient.getCurrentUserId(), query).then(function (result) {
|
2019-11-23 23:00:44 +03:00
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
2020-04-15 10:16:41 +02:00
|
|
|
import("slideshow").then(slideshow => {
|
2019-11-23 23:00:44 +03:00
|
|
|
|
|
|
|
var newSlideShow = new slideshow({
|
|
|
|
showTitle: true,
|
|
|
|
cover: true,
|
|
|
|
items: result.Items
|
|
|
|
});
|
|
|
|
|
|
|
|
newSlideShow.show();
|
2020-04-15 10:16:41 +02:00
|
|
|
this.currentSlideshow = newSlideShow;
|
|
|
|
}).catch(console.error);
|
2019-11-23 23:00:44 +03:00
|
|
|
}
|
|
|
|
});
|
2020-04-15 10:16:41 +02:00
|
|
|
}
|
2019-11-23 23:00:44 +03:00
|
|
|
|
2020-04-15 10:16:41 +02:00
|
|
|
hide() {
|
|
|
|
if (this.currentSlideshow) {
|
|
|
|
this.currentSlideshow.hide();
|
|
|
|
this.currentSlideshow = null;
|
2019-11-23 23:00:44 +03:00
|
|
|
}
|
2020-04-15 10:16:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* eslint-enable indent */
|
|
|
|
|
|
|
|
export default BackdropScreensaver;
|