Skip to content

Commit

Permalink
fix: show redirect programming properly in xmltv
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbenincasa committed Jan 11, 2025
1 parent f166552 commit 16eff87
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
19 changes: 17 additions & 2 deletions server/src/services/TvGuideService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import duration, { Duration } from 'dayjs/plugin/duration.js';
import {
compact,
filter,
find,
first,
flatMap,
inRange,
Expand Down Expand Up @@ -71,6 +72,7 @@ type GuideItem = {
index?: number;
// Start time of the program in this guide generation
startTimeMs: number;
redirectChannelId?: string;
};

export type TvGuideChannel = {
Expand Down Expand Up @@ -554,6 +556,7 @@ export class TVGuideService {
index: playing.index,
startTimeMs: start,
lineupItem: program2,
redirectChannelId: channel2.channel.uuid,
};
}
}
Expand Down Expand Up @@ -954,8 +957,8 @@ export class TVGuideService {
const icon = isNonEmptyString(materializedItem.icon)
? materializedItem.icon
: isNonEmptyString(channel.icon?.path)
? channel.icon.path
: makeLocalUrl('/images/tunarr.png');
? channel.icon.path
: makeLocalUrl('/images/tunarr.png');

return match(materializedItem)
.returnType<TvGuideProgram>()
Expand Down Expand Up @@ -1000,6 +1003,18 @@ export class TVGuideService {
channel,
currentProgram.lineupItem,
allChannels,
currentProgram.lineupItem.type === 'content'
? find(
this.channelsById[
isNonEmptyString(currentProgram.redirectChannelId)
? currentProgram.redirectChannelId
: channel.uuid
]?.channel.programs,
(p) =>
currentProgram.lineupItem.type === 'content' &&
p.uuid === currentProgram.lineupItem.id,
)
: undefined,
),
);
}
Expand Down
9 changes: 2 additions & 7 deletions server/src/services/XmlTvWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ export class XmlTvWriter {
},
];
}
} else {
console.log(program);
}

return partial;
Expand All @@ -189,13 +191,6 @@ export class XmlTvWriter {
return (channelIdCache[channel.uuid] = getChannelId(channel.number));
}

// private static titleExtractor = forProgramType({
// custom: (program) => program.program?.title ?? 'Custom Program',
// content: (program) => program.title,
// redirect: (program) => `Redirect to Channel ${program.channel}`,
// flex: program => ,
// });

isWriting() {
return lock.isLocked();
}
Expand Down

0 comments on commit 16eff87

Please sign in to comment.