Update scripts

This commit is contained in:
freearhey 2025-03-09 19:14:12 +03:00
parent b628341520
commit 1b29e05111
6 changed files with 3 additions and 18 deletions

View file

@ -13,7 +13,7 @@ async function main() {
let streams = await parser.parse(files) let streams = await parser.parse(files)
streams = streams streams = streams
.map(data => new Stream(data)) .map(data => new Stream(data))
.orderBy([(stream: Stream) => stream.channel, (stream: Stream) => stream.timeshift]) .orderBy([(stream: Stream) => stream.channel])
.map((stream: Stream) => stream.toJSON()) .map((stream: Stream) => stream.toJSON())
logger.info(`found ${streams.count()} streams`) logger.info(`found ${streams.count()} streams`)

View file

@ -105,7 +105,6 @@ async function loadStreams({
.orderBy( .orderBy(
[ [
(stream: Stream) => stream.channel, (stream: Stream) => stream.channel,
(stream: Stream) => stream.timeshift,
(stream: Stream) => parseInt(stream.quality.replace('p', '')), (stream: Stream) => parseInt(stream.quality.replace('p', '')),
(stream: Stream) => stream.label (stream: Stream) => stream.label
], ],

View file

@ -105,7 +105,6 @@ async function editStreams(loader: IssueLoader) {
if (data.has('label')) stream.label = data.getString('label') if (data.has('label')) stream.label = data.getString('label')
if (data.has('quality')) stream.quality = data.getString('quality') if (data.has('quality')) stream.quality = data.getString('quality')
if (data.has('timeshift')) stream.timeshift = data.getString('timeshift')
if (data.has('user_agent')) stream.userAgent = data.getString('user_agent') if (data.has('user_agent')) stream.userAgent = data.getString('user_agent')
if (data.has('http_referrer')) stream.httpReferrer = data.getString('http_referrer') if (data.has('http_referrer')) stream.httpReferrer = data.getString('http_referrer')
@ -132,7 +131,6 @@ async function addStreams(loader: IssueLoader) {
url: data.getString('stream_url'), url: data.getString('stream_url'),
label: data.getString('label'), label: data.getString('label'),
quality: data.getString('quality'), quality: data.getString('quality'),
timeshift: data.getString('timeshift'),
userAgent: data.getString('user_agent'), userAgent: data.getString('user_agent'),
httpReferrer: data.getString('http_referrer'), httpReferrer: data.getString('http_referrer'),
filepath: `${channel.country.toLowerCase()}.m3u`, filepath: `${channel.country.toLowerCase()}.m3u`,

View file

@ -12,8 +12,6 @@ const FIELDS = new Dictionary({
'Broken Links': 'broken_links', 'Broken Links': 'broken_links',
Label: 'label', Label: 'label',
Quality: 'quality', Quality: 'quality',
Timeshift: 'timeshift',
'Timeshift (optional)': 'timeshift',
'Channel Name': 'channel_name', 'Channel Name': 'channel_name',
'HTTP User-Agent': 'user_agent', 'HTTP User-Agent': 'user_agent',
'HTTP Referrer': 'http_referrer', 'HTTP Referrer': 'http_referrer',

View file

@ -40,8 +40,7 @@ export class PlaylistParser {
line: item.line, line: item.line,
url: item.url, url: item.url,
httpReferrer: item.http.referrer, httpReferrer: item.http.referrer,
userAgent: item.http['user-agent'], userAgent: item.http['user-agent']
timeshift: item.tvg.shift
}) })
streams.add(stream) streams.add(stream)

View file

@ -11,7 +11,6 @@ type StreamProps = {
label?: string label?: string
quality?: string quality?: string
userAgent?: string userAgent?: string
timeshift?: string
} }
export class Stream { export class Stream {
@ -31,7 +30,6 @@ export class Stream {
isNSFW: boolean isNSFW: boolean
groupTitle: string groupTitle: string
removed: boolean = false removed: boolean = false
timeshift: string
constructor({ constructor({
channel, channel,
@ -42,8 +40,7 @@ export class Stream {
name, name,
quality, quality,
url, url,
userAgent, userAgent
timeshift
}: StreamProps) { }: StreamProps) {
this.channel = channel || '' this.channel = channel || ''
this.filepath = filepath this.filepath = filepath
@ -60,7 +57,6 @@ export class Stream {
this.languages = new Collection() this.languages = new Collection()
this.isNSFW = false this.isNSFW = false
this.groupTitle = 'Undefined' this.groupTitle = 'Undefined'
this.timeshift = timeshift || ''
} }
normalizeURL() { normalizeURL() {
@ -149,7 +145,6 @@ export class Stream {
return { return {
channel: this.channel || null, channel: this.channel || null,
url: this.url, url: this.url,
timeshift: this.timeshift || null,
http_referrer: this.httpReferrer || null, http_referrer: this.httpReferrer || null,
user_agent: this.userAgent || null user_agent: this.userAgent || null
} }
@ -158,10 +153,6 @@ export class Stream {
toString(options: { public: boolean }) { toString(options: { public: boolean }) {
let output = `#EXTINF:-1 tvg-id="${this.channel}"` let output = `#EXTINF:-1 tvg-id="${this.channel}"`
if (this.timeshift) {
output += ` tvg-shift="${this.timeshift}"`
}
if (options.public) { if (options.public) {
output += ` tvg-logo="${this.logo}" group-title="${this.groupTitle}"` output += ` tvg-logo="${this.logo}" group-title="${this.groupTitle}"`
} }