mirror of
https://github.com/iptv-org/epg
synced 2025-12-23 05:46:40 -05:00
Update scripts
This commit is contained in:
@@ -1,24 +1,47 @@
|
||||
import { Dictionary } from '@freearhey/core'
|
||||
import { OWNER, REPO } from '../constants'
|
||||
|
||||
interface IssueProps {
|
||||
number: number
|
||||
labels: string[]
|
||||
data: Dictionary
|
||||
}
|
||||
|
||||
export class Issue {
|
||||
number: number
|
||||
labels: string[]
|
||||
data: Dictionary
|
||||
|
||||
constructor({ number, labels, data }: IssueProps) {
|
||||
this.number = number
|
||||
this.labels = labels
|
||||
this.data = data
|
||||
}
|
||||
|
||||
getURL() {
|
||||
return `https://github.com/${OWNER}/${REPO}/issues/${this.number}`
|
||||
}
|
||||
}
|
||||
import { EOL, OWNER, REPO } from '../constants'
|
||||
import { Dictionary } from '@freearhey/core'
|
||||
|
||||
const FIELDS = new Dictionary({
|
||||
Site: 'site'
|
||||
})
|
||||
|
||||
interface IssueData {
|
||||
number: number
|
||||
body: string
|
||||
labels: { name: string }[]
|
||||
}
|
||||
|
||||
export class Issue {
|
||||
number: number
|
||||
labels: string[]
|
||||
data: Dictionary<string>
|
||||
|
||||
constructor(issue: IssueData) {
|
||||
const fields = typeof issue.body === 'string' ? issue.body.split('###') : []
|
||||
|
||||
this.data = new Dictionary<string>()
|
||||
fields.forEach((field: string) => {
|
||||
const parsed = field.split(/\r?\n/).filter(Boolean)
|
||||
let _label = parsed.shift()
|
||||
_label = _label ? _label.trim() : ''
|
||||
let _value = parsed.join(EOL)
|
||||
_value = _value ? _value.trim() : ''
|
||||
|
||||
if (!_label || !_value) return
|
||||
|
||||
const id: string | undefined = FIELDS.get(_label)
|
||||
const value: string = _value === '_No response_' || _value === 'None' ? '' : _value
|
||||
|
||||
if (!id) return
|
||||
|
||||
this.data.set(id, value)
|
||||
})
|
||||
|
||||
this.labels = issue.labels.map(label => label.name)
|
||||
this.number = issue.number
|
||||
}
|
||||
|
||||
getURL() {
|
||||
return `https://github.com/${OWNER}/${REPO}/issues/${this.number}`
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user