Update scripts

This commit is contained in:
freearhey
2025-10-22 02:27:22 +03:00
parent f701e0b830
commit 0b046f1f3c
50 changed files with 1655 additions and 2367 deletions

View File

@@ -1,45 +1,18 @@
import { Dictionary } from '@freearhey/core'
import { SiteConfig, Channel } from 'epg-grabber'
export interface QueueItem {
channel: Channel
date: string
config: SiteConfig
error: string | null
}
export class Queue {
_data: Dictionary
constructor() {
this._data = new Dictionary()
}
missing(key: string): boolean {
return this._data.missing(key)
}
add(
key: string,
{ channel, config, date }: { channel: Channel; date: string | null; config: SiteConfig }
) {
this._data.set(key, {
channel,
date,
config,
error: null
})
}
size(): number {
return Object.values(this._data.data()).length
}
items(): QueueItem[] {
return Object.values(this._data.data()) as QueueItem[]
}
isEmpty(): boolean {
return this.size() === 0
}
}
import { Collection, Dictionary } from '@freearhey/core'
import { QueueItem } from '../types/queue'
export class Queue {
#items: Dictionary<QueueItem> = new Dictionary<QueueItem>()
add(key: string, data: QueueItem) {
this.#items.set(key, data)
}
has(key: string): boolean {
return this.#items.has(key)
}
getItems(): Collection<QueueItem> {
return new Collection<QueueItem>(Object.values(this.#items.data()))
}
}