2020-04-15 10:16:41 +02:00
|
|
|
/* eslint-disable indent */
|
2020-10-17 19:08:56 +01:00
|
|
|
import ServerConnections from '../../components/ServerConnections';
|
2023-03-08 11:03:48 -05:00
|
|
|
import { PluginType } from '../../types/plugin.ts';
|
2020-04-15 10:16:41 +02:00
|
|
|
|
|
|
|
class BackdropScreensaver {
|
|
|
|
constructor() {
|
2020-05-05 23:51:00 +02:00
|
|
|
this.name = 'Backdrop ScreenSaver';
|
2023-03-08 11:03:48 -05:00
|
|
|
this.type = PluginType.Screensaver;
|
2020-05-05 23:51:00 +02:00
|
|
|
this.id = 'backdropscreensaver';
|
2020-04-15 10:16:41 +02:00
|
|
|
this.supportsAnonymous = false;
|
|
|
|
}
|
|
|
|
show() {
|
|
|
|
const query = {
|
2020-05-05 23:51:00 +02:00
|
|
|
ImageTypes: 'Backdrop',
|
|
|
|
EnableImageTypes: 'Backdrop',
|
|
|
|
IncludeItemTypes: 'Movie,Series,MusicArtist',
|
|
|
|
SortBy: 'Random',
|
2019-11-23 23:00:44 +03:00
|
|
|
Recursive: true,
|
2020-05-05 23:51:00 +02:00
|
|
|
Fields: 'Taglines',
|
2019-11-23 23:00:44 +03:00
|
|
|
ImageTypeLimit: 1,
|
|
|
|
StartIndex: 0,
|
|
|
|
Limit: 200
|
|
|
|
};
|
|
|
|
|
2020-10-17 19:08:56 +01:00
|
|
|
const apiClient = ServerConnections.currentApiClient();
|
2020-05-26 23:59:58 +02:00
|
|
|
apiClient.getItems(apiClient.getCurrentUserId(), query).then((result) => {
|
2019-11-23 23:00:44 +03:00
|
|
|
if (result.Items.length) {
|
2020-08-16 20:24:45 +02:00
|
|
|
import('../../components/slideshow/slideshow').then(({default: Slideshow}) => {
|
2020-05-28 23:06:36 +02:00
|
|
|
const newSlideShow = new Slideshow({
|
2019-11-23 23:00:44 +03:00
|
|
|
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-10-31 22:39:30 +03:00
|
|
|
return Promise.resolve();
|
2020-04-15 10:16:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* eslint-enable indent */
|
|
|
|
|
|
|
|
export default BackdropScreensaver;
|