Add: Live TV support in Kodi

live_tv_play
Juraj Nyíri 3 years ago
parent 8e42b969f5
commit 30f26257f3

@ -17204,7 +17204,7 @@ const CSS_STYLE = {
minimumEpisodeWidth: 300 minimumEpisodeWidth: 300
}; };
const supported = { const supported = {
kodi: ['movie', 'episode'], kodi: ['movie', 'episode', 'epg'],
androidtv: ['movie', 'show', 'season', 'episode', 'clip', 'epg'], androidtv: ['movie', 'show', 'season', 'episode', 'clip', 'epg'],
plexPlayer: ['movie', 'show', 'season', 'episode', 'clip'], plexPlayer: ['movie', 'show', 'season', 'episode', 'clip'],
cast: ['movie', 'episode', 'epg'] cast: ['movie', 'episode', 'epg']
@ -19402,7 +19402,7 @@ class PlayController {
} }
switch (entity.key) { switch (entity.key) {
case 'kodi': case 'kodi':
await this.playViaKodi(entity.value, processData, processData.type); await this.playViaKodi(entity.value, data, processData.type);
break; break;
case 'androidtv': case 'androidtv':
if (!lodash.isNil(data.epg)) { if (!lodash.isNil(data.epg)) {
@ -19548,7 +19548,18 @@ class PlayController {
} }
}; };
this.playViaKodi = async (entityName, data, type) => { this.playViaKodi = async (entityName, data, type) => {
if (type === 'movie') { if (!lodash.isNil(lodash.get(data, 'epg.Media[0].channelCallSign'))) {
const streamLink = `${this.plex.getBasicURL()}${await this.plex.tune(data.channelIdentifier, 'todo')}`;
await this.hass.callService('kodi', 'call_method', {
// eslint-disable-next-line @typescript-eslint/camelcase
entity_id: entityName,
method: 'Player.Open',
item: {
file: streamLink
}
});
}
else if (type === 'movie') {
const kodiData = await this.getKodiSearch(data.title); const kodiData = await this.getKodiSearch(data.title);
await this.hass.callService('kodi', 'call_method', { await this.hass.callService('kodi', 'call_method', {
// eslint-disable-next-line @typescript-eslint/camelcase // eslint-disable-next-line @typescript-eslint/camelcase
@ -19755,7 +19766,8 @@ class PlayController {
hasKodiMediaSearchInstalled) || hasKodiMediaSearchInstalled) ||
(!lodash.isEqual(this.runBefore, false) && hasKodiMediaSearchInstalled)); (!lodash.isEqual(this.runBefore, false) && hasKodiMediaSearchInstalled));
} }
return false; return true; // temp
// return false;
}; };
this.isCastSupported = (entityName) => { this.isCastSupported = (entityName) => {
return ((this.hass.states[entityName] && return ((this.hass.states[entityName] &&

@ -9,7 +9,7 @@ const CSS_STYLE: any = {
}; };
const supported: any = { const supported: any = {
kodi: ['movie', 'episode'], kodi: ['movie', 'episode', 'epg'],
androidtv: ['movie', 'show', 'season', 'episode', 'clip', 'epg'], androidtv: ['movie', 'show', 'season', 'episode', 'clip', 'epg'],
plexPlayer: ['movie', 'show', 'season', 'episode', 'clip'], plexPlayer: ['movie', 'show', 'season', 'episode', 'clip'],
cast: ['movie', 'episode', 'epg'] cast: ['movie', 'episode', 'epg']

@ -122,7 +122,7 @@ class PlayController {
} }
switch (entity.key) { switch (entity.key) {
case 'kodi': case 'kodi':
await this.playViaKodi(entity.value, processData, processData.type); await this.playViaKodi(entity.value, data, processData.type);
break; break;
case 'androidtv': case 'androidtv':
if (!_.isNil(data.epg)) { if (!_.isNil(data.epg)) {
@ -279,7 +279,17 @@ class PlayController {
}; };
private playViaKodi = async (entityName: string, data: Record<string, any>, type: string): Promise<void> => { private playViaKodi = async (entityName: string, data: Record<string, any>, type: string): Promise<void> => {
if (type === 'movie') { if (!_.isNil(_.get(data, 'epg.Media[0].channelCallSign'))) {
const streamLink = `${this.plex.getBasicURL()}${await this.plex.tune(data.channelIdentifier, 'todo')}`;
await this.hass.callService('kodi', 'call_method', {
// eslint-disable-next-line @typescript-eslint/camelcase
entity_id: entityName,
method: 'Player.Open',
item: {
file: streamLink
}
});
} else if (type === 'movie') {
const kodiData = await this.getKodiSearch(data.title); const kodiData = await this.getKodiSearch(data.title);
await this.hass.callService('kodi', 'call_method', { await this.hass.callService('kodi', 'call_method', {
// eslint-disable-next-line @typescript-eslint/camelcase // eslint-disable-next-line @typescript-eslint/camelcase
@ -528,7 +538,8 @@ class PlayController {
(!_.isEqual(this.runBefore, false) && hasKodiMediaSearchInstalled) (!_.isEqual(this.runBefore, false) && hasKodiMediaSearchInstalled)
); );
} }
return false; return true; // temp
// return false;
}; };
private isCastSupported = (entityName: string): boolean => { private isCastSupported = (entityName: string): boolean => {

Loading…
Cancel
Save