Files
iptvnator/libs/shared/interfaces/src/lib/playlist-recently-viewed.interface.ts
T
4gray 1e9f5d9d05 feat(global-widgets): add M3U recently-viewed and favs support
- Introduced M3uRecentlyViewedItem interface to define structure for recently viewed items.
- Implemented utility functions to handle mapping and building of recently viewed items from playlists.
- Updated Playlist interface to use PlaylistRecentlyViewedItem type for recently viewed items.
- Enhanced PortalActivityItem interface to include 'm3u' as a possible source.
- Added UI components for displaying recently viewed channels, including clear functionality.
- Integrated recent view functionality into the channel list container and sidebar components.
- Updated dashboard data service to manage M3U favorites and recently viewed items.
- Added tests to ensure correct behavior of recently viewed items in the dashboard data service.
2026-03-11 23:57:13 +01:00

35 lines
833 B
TypeScript

import { StalkerPortalItem } from './stalker-portal-item.interface';
export interface M3uRecentlyViewedItem {
source: 'm3u';
id: string;
url: string;
title: string;
channel_id?: string;
poster_url?: string;
tvg_id?: string;
tvg_name?: string;
group_title?: string;
category_id: 'live';
added_at: string | number;
}
export type PlaylistRecentlyViewedItem =
| M3uRecentlyViewedItem
| StalkerPortalItem;
export function isM3uRecentlyViewedItem(
item: unknown
): item is M3uRecentlyViewedItem {
if (!item || typeof item !== 'object') {
return false;
}
const candidate = item as Record<string, unknown>;
return (
candidate['source'] === 'm3u' &&
typeof candidate['url'] === 'string' &&
candidate['url'].trim().length > 0
);
}