All files / src m3u-playlist.ts

100% Statements 17/17
100% Branches 2/2
100% Functions 4/4
100% Lines 17/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 391x   1x 1x 1x 1x 1x 1x 1x     1x 2x 2x     1x       1x       8x 8x   8x     1x                
import {M3uGenerator} from "./m3u-generator";
 
export const M3U_COMMENT = '#'
export const DEFAULT_MEDIA_DURATION = -1;
export enum M3uDirectives {
  EXTM3U = '#EXTM3U',
  EXTINF = '#EXTINF',
  PLAYLIST = '#PLAYLIST',
  EXTGRP = '#EXTGRP',
}
 
export class M3uPlaylist {
  title: string = '';
  medias: M3uMedia[] = [];
 
  getM3uString(): string {
    return M3uGenerator.generate(this);
  }
}
 
export class M3uMedia {
 
  name?: string;
  group?: string;
  duration: number = DEFAULT_MEDIA_DURATION;
  attributes: M3uAttributes = new M3uAttributes();
 
  constructor(public location: string) {}
}
 
export class M3uAttributes {
  'tvg-id'?: string;
  'tvg-language'?: string;
  'tvg-country'?: string;
  'tvg-logo'?: string;
  'group-title'?: string;
  [key: string]: string | undefined;
}