Add: List support for kodi

pull/16/head
Juraj Nyíri 3 years ago
parent 8f42c4fe49
commit 74fe0bae96

@ -18808,7 +18808,7 @@ class PlayController {
const entity = this.getPlayService(data);
switch (entity.key) {
case 'kodi':
await this.playViaKodi(data, data.type);
await this.playViaKodi(entity.value, data, data.type);
break;
case 'androidtv':
await this.playViaAndroidTV(entity.value, data.key.split('/')[3], instantPlay);
@ -18867,12 +18867,12 @@ class PlayController {
}
}
};
this.playViaKodi = async (data, type) => {
this.playViaKodi = async (entityName, data, type) => {
if (type === 'movie') {
const kodiData = await this.getKodiSearch(data.title);
await this.hass.callService('kodi', 'call_method', {
// eslint-disable-next-line @typescript-eslint/camelcase
entity_id: this.entity.kodi,
entity_id: entityName,
method: 'Player.Open',
item: {
movieid: kodiData.movieid
@ -18894,7 +18894,7 @@ class PlayController {
}
await this.hass.callService('kodi', 'call_method', {
// eslint-disable-next-line @typescript-eslint/camelcase
entity_id: this.entity.kodi,
entity_id: entityName,
method: 'Player.Open',
item: {
episodeid: foundEpisode.episodeid
@ -18906,7 +18906,6 @@ class PlayController {
}
};
this.playViaAndroidTV = async (entityName, mediaID, instantPlay = false) => {
console.log(entityName);
const serverID = await this.plex.getServerID();
let command = `am start`;
if (instantPlay) {
@ -18951,8 +18950,6 @@ class PlayController {
}
}
});
console.log('service');
console.log(service);
return service;
};
this.isPlexPlayerSupported = (entityName) => {
@ -18998,7 +18995,6 @@ class PlayController {
this.hass = hass;
this.plex = plex;
this.entity = entity;
console.log(entity);
}
}
@ -19732,7 +19728,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
};
this.renderMovieElems = () => {
if (this.data[this.config.libraryName] && this.renderedItems < this.data[this.config.libraryName].length) {
console.log('renderMovieElems');
let count = 0;
// eslint-disable-next-line consistent-return
const searchValues = lodash.split(this.searchValue, ' ');
@ -20241,26 +20236,20 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}
};
this.resizeBackground = () => {
console.log('resizeBackground');
if (this.seasonsElem && this.episodesElem && this.card) {
const contentbg = this.getElementsByClassName('contentbg')[0];
console.log(contentbg);
if (this.contentBGHeight === 0) {
this.contentBGHeight = getHeight(contentbg);
}
const requiredSeasonBodyHeight = parseInt(this.seasonsElem.style.top.replace('px', ''), 10) + this.seasonsElem.scrollHeight;
const requiredEpisodeBodyHeight = parseInt(this.episodesElem.style.top.replace('px', ''), 10) + this.episodesElem.scrollHeight;
if (requiredSeasonBodyHeight > this.contentBGHeight && !this.seasonsElemHidden) {
console.log(`${requiredSeasonBodyHeight} > ${this.contentBGHeight}`);
console.log('1');
this.card.style.height = `${requiredSeasonBodyHeight + 16}px`;
}
else if (requiredEpisodeBodyHeight > this.contentBGHeight && !this.episodesElemHidden) {
console.log('2');
this.card.style.height = `${requiredEpisodeBodyHeight + 16}px`;
}
else {
console.log('3');
this.card.style.height = '100%';
}
}

@ -21,7 +21,6 @@ class PlayController {
this.hass = hass;
this.plex = plex;
this.entity = entity;
console.log(entity);
}
private getState = async (entityID: string): Promise<Record<string, any>> => {
@ -87,7 +86,7 @@ class PlayController {
const entity = this.getPlayService(data);
switch (entity.key) {
case 'kodi':
await this.playViaKodi(data, data.type);
await this.playViaKodi(entity.value, data, data.type);
break;
case 'androidtv':
await this.playViaAndroidTV(entity.value, data.key.split('/')[3], instantPlay);
@ -155,12 +154,12 @@ class PlayController {
}
};
private playViaKodi = async (data: Record<string, any>, type: string): Promise<void> => {
private playViaKodi = async (entityName: string, data: Record<string, any>, type: string): Promise<void> => {
if (type === 'movie') {
const kodiData = await this.getKodiSearch(data.title);
await this.hass.callService('kodi', 'call_method', {
// eslint-disable-next-line @typescript-eslint/camelcase
entity_id: this.entity.kodi,
entity_id: entityName,
method: 'Player.Open',
item: {
movieid: kodiData.movieid
@ -184,7 +183,7 @@ class PlayController {
}
await this.hass.callService('kodi', 'call_method', {
// eslint-disable-next-line @typescript-eslint/camelcase
entity_id: this.entity.kodi,
entity_id: entityName,
method: 'Player.Open',
item: {
episodeid: foundEpisode.episodeid
@ -196,7 +195,6 @@ class PlayController {
};
private playViaAndroidTV = async (entityName: string, mediaID: number, instantPlay = false): Promise<void> => {
console.log(entityName);
const serverID = await this.plex.getServerID();
let command = `am start`;
@ -248,8 +246,6 @@ class PlayController {
}
}
});
console.log('service');
console.log(service);
return service;
};

@ -196,7 +196,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
renderMovieElems = (): void => {
if (this.data[this.config.libraryName] && this.renderedItems < this.data[this.config.libraryName].length) {
console.log('renderMovieElems');
let count = 0;
// eslint-disable-next-line consistent-return
const searchValues = _.split(this.searchValue, ' ');
@ -765,10 +764,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
};
resizeBackground = (): void => {
console.log('resizeBackground');
if (this.seasonsElem && this.episodesElem && this.card) {
const contentbg = this.getElementsByClassName('contentbg')[0] as HTMLElement;
console.log(contentbg);
if (this.contentBGHeight === 0) {
this.contentBGHeight = getHeight(contentbg);
}
@ -778,14 +775,10 @@ class PlexMeetsHomeAssistant extends HTMLElement {
parseInt(this.episodesElem.style.top.replace('px', ''), 10) + this.episodesElem.scrollHeight;
if (requiredSeasonBodyHeight > this.contentBGHeight && !this.seasonsElemHidden) {
console.log(`${requiredSeasonBodyHeight} > ${this.contentBGHeight}`);
console.log('1');
this.card.style.height = `${requiredSeasonBodyHeight + 16}px`;
} else if (requiredEpisodeBodyHeight > this.contentBGHeight && !this.episodesElemHidden) {
console.log('2');
this.card.style.height = `${requiredEpisodeBodyHeight + 16}px`;
} else {
console.log('3');
this.card.style.height = '100%';
}
}

Loading…
Cancel
Save