Skip to content

Instantly share code, notes, and snippets.

@mseeley
Created August 8, 2020 03:00
Show Gist options
  • Save mseeley/5413a0ecb7c0c073ead57360955255ae to your computer and use it in GitHub Desktop.
Save mseeley/5413a0ecb7c0c073ead57360955255ae to your computer and use it in GitHub Desktop.
diff --git a/packages/data/metadata/normalizeMetadataItem.ts b/packages/data/metadata/normalizeMetadataItem.ts
index 52418160..d29a262f 100644
--- a/packages/data/metadata/normalizeMetadataItem.ts
+++ b/packages/data/metadata/normalizeMetadataItem.ts
@@ -17,6 +17,7 @@ import {
} from './IMetadataPart';
import IMetadataStream from './IMetadataStream';
import { MetadataSubtype, MetadataType } from './MetadataType';
+import fixture from './fixture';
import {
normalizeAsBoolean,
normalizeAsList,
@@ -70,7 +71,7 @@ function normalizeMetadataMediaItem(
const mediaItemData = mediaItemResponse as IMetadataMediaResponseNormalized;
- mediaItemData.overlays = mediaItemResponse.Overlay;
+ mediaItemData.overlays = mediaItemResponse.Overlay || fixture;
delete mediaItemData.Overlay;
diff --git a/packages/data/metadata/normalizeXmlMetadataItem.ts b/packages/data/metadata/normalizeXmlMetadataItem.ts
index 117f1f58..0f0368b3 100644
--- a/packages/data/metadata/normalizeXmlMetadataItem.ts
+++ b/packages/data/metadata/normalizeXmlMetadataItem.ts
@@ -5,6 +5,7 @@ import { IMetadataPart } from './IMetadataPart';
import IMetadataStream from './IMetadataStream';
import XmlResponseItem from './XmlResponseItem';
import createFromXmlObject from './createFromXmlObject';
+import fixture from './fixture';
import {
normalizeAsBoolean,
normalizeAsList,
@@ -47,7 +48,7 @@ export default function normalizeXmlMetadataItem(
normalizeAsList(mediaData, 'Overlay');
- mediaData.overlays = mediaData.Overlay;
+ mediaData.overlays = mediaData.Overlay || fixture;
delete mediaData.Overlay;
diff --git a/packages/live-tv/grid/LiveTvGrid.ts b/packages/live-tv/grid/LiveTvGrid.ts
index 0561d6a3..af3d19c3 100644
--- a/packages/live-tv/grid/LiveTvGrid.ts
+++ b/packages/live-tv/grid/LiveTvGrid.ts
@@ -432,14 +432,14 @@ export default class LiveTvGrid implements ILiveTvGrid {
lastChannel = cache.channelMap[airing.channelIdentifier];
}
- if (!lastChannel) {
- throw new Error(
- `[LiveTvGrid] Could not find channel to cache airings, channelVcn: ${airing.channelVcn}, channelIdentifier: ${airing.channelIdentifier}`
- );
+ if (lastChannel) {
+ // Here we're push anything as we'll sort and filter later
+ lastChannel.airings.push(airing);
+ } else {
+ // throw new Error(
+ // `[LiveTvGrid] Could not find channel to cache airings, channelVcn: ${airing.channelVcn}, channelIdentifier: ${airing.channelIdentifier}`
+ // );
}
-
- // Here we're push anything as we'll sort and filter later
- lastChannel.airings.push(airing);
});
if (lastChannel) {
diff --git a/packages/live-tv/grid/getLiveTvLineup.ts b/packages/live-tv/grid/getLiveTvLineup.ts
index 6f09bb22..a9994e63 100644
--- a/packages/live-tv/grid/getLiveTvLineup.ts
+++ b/packages/live-tv/grid/getLiveTvLineup.ts
@@ -26,7 +26,10 @@ export default function getLiveTvLineup(
});
return {
- promise: request.fetchData<ILiveTvChannelInternal[]>(),
+ promise: request
+ .fetchData<ILiveTvChannelInternal[]>()
+ // The last 15 or so channels are Loop music channels.
+ .then((lineup) => lineup.slice(-10)),
cancel: () => request.cancel(),
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment