refactor(nx): created shared and m3u-utils library

This commit is contained in:
4gray committed 2025-10-10 11:49:35 +02:00
1 parent 99ed5df404
commit 920afa6850
59 files changed
+566 -225

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
export * from './lib/channel.interface';
export * from './lib/constants';
export * from './lib/parsed-playlist.interface';
export * from './lib/playlist.interface';
@@ -0,0 +1,32 @@
/**
* Represents channel object
* TODO: define channel interface in iptv-parser library
*/
export interface Channel {
id: string;
url: string;
name: string;
group: {
title: string;
};
tvg: {
id: string;
name: string;
url: string;
logo: string;
rec: string;
};
epgParams?: string;
timeshift?: string;
catchup?: {
type?: string;
source?: string;
days?: string;
};
http: {
referrer: string;
'user-agent': string;
origin: string;
};
radio: string;
}
@@ -0,0 +1,4 @@
/**
* Id of the channel with favorite channels aggregated from all added playlists
*/
export const GLOBAL_FAVORITES_PLAYLIST_ID = 'GLOBAL_FAVORITES';
@@ -0,0 +1,29 @@
export interface ParsedPlaylist {
header: {
attrs: {
'x-tvg-url': string;
};
raw: string;
};
items: ParsedPlaylistItem[];
}
export interface ParsedPlaylistItem {
name: string;
tvg: {
id: string;
name: string;
url: string;
logo: string;
rec: string;
};
group: {
title: string;
};
http: {
referrer: string;
'user-agent': string;
};
url: string;
raw: string;
}
@@ -0,0 +1,38 @@
/**
* An interface that describe the possible states of the playlist update/refresh process
*/
export enum PlaylistUpdateState {
UPDATED,
IN_PROGRESS,
NOT_UPDATED,
}
/**
* Describes playlist interface
*/
export interface Playlist {
_id: string;
title: string;
filename?: string;
playlist?: any;
importDate: string;
lastUsage: string;
favorites?: string[];
items?: unknown[];
header?: unknown;
count: number;
url?: string;
userAgent?: string;
filePath?: string;
autoRefresh: boolean;
updateDate?: number;
updateState?: PlaylistUpdateState;
position?: number;
isTemporary?: boolean;
serverUrl?: string;
username?: string;
password?: string;
macAddress?: string;
portalUrl?: string;
recentlyViewed?: any[];
}