mirror of
https://github.com/iptv-org/iptv
synced 2025-12-17 02:47:33 -05:00
Update scripts
This commit is contained in:
@@ -31,18 +31,19 @@ export class BroadcastArea {
|
||||
const city: City = citiesKeyByCode.get(code)
|
||||
if (!city) return
|
||||
citiesIncluded.add(city)
|
||||
if (city.subdivision) subdivisionsIncluded.add(city.subdivision)
|
||||
regionsIncluded = regionsIncluded.concat(city.getRegions())
|
||||
}
|
||||
case 's': {
|
||||
const subdivision: Subdivision = subdivisionsKeyByCode.get(code)
|
||||
if (!subdivision) return
|
||||
citiesIncluded = citiesIncluded.concat(subdivision.getCities())
|
||||
subdivisionsIncluded.add(subdivision)
|
||||
regionsIncluded = regionsIncluded.concat(subdivision.getRegions())
|
||||
}
|
||||
case 'c': {
|
||||
const country: Country = countriesKeyByCode.get(code)
|
||||
if (!country) return
|
||||
countriesIncluded.add(country)
|
||||
regionsIncluded = regionsIncluded.concat(country.getRegions())
|
||||
}
|
||||
case 'r': {
|
||||
const region: Region = regionsKeyByCode.get(code)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Country, Language, Region, Channel, Subdivision, BroadcastArea } from './index'
|
||||
import { Country, Language, Region, Channel, Subdivision, BroadcastArea, City } from './index'
|
||||
import { Collection, Dictionary } from '@freearhey/core'
|
||||
import type { FeedData } from '../types/feed'
|
||||
|
||||
@@ -120,6 +120,12 @@ export class Feed {
|
||||
)
|
||||
}
|
||||
|
||||
isBroadcastInCity(city: City): boolean {
|
||||
if (!this.broadcastArea) return false
|
||||
|
||||
return this.broadcastArea.includesCity(city)
|
||||
}
|
||||
|
||||
isBroadcastInSubdivision(subdivision: Subdivision): boolean {
|
||||
if (!this.broadcastArea) return false
|
||||
|
||||
@@ -129,13 +135,19 @@ export class Feed {
|
||||
isBroadcastInCountry(country: Country): boolean {
|
||||
if (!this.broadcastArea) return false
|
||||
|
||||
return this.broadcastArea?.includesCountry(country)
|
||||
return this.broadcastArea.includesCountry(country)
|
||||
}
|
||||
|
||||
isBroadcastInRegion(region: Region): boolean {
|
||||
if (!this.broadcastArea) return false
|
||||
|
||||
return this.broadcastArea?.includesRegion(region)
|
||||
return this.broadcastArea.includesRegion(region)
|
||||
}
|
||||
|
||||
isInternational(): boolean {
|
||||
if (!this.broadcastArea) return false
|
||||
|
||||
return this.broadcastArea.codes.join(',').includes('r/')
|
||||
}
|
||||
|
||||
getGuides(): Collection {
|
||||
|
||||
@@ -78,6 +78,10 @@ export class Region {
|
||||
return this.countryCodes.includes((countryCode: string) => countryCode === code)
|
||||
}
|
||||
|
||||
isWorldwide(): boolean {
|
||||
return ['INT', 'WW'].includes(this.code)
|
||||
}
|
||||
|
||||
serialize(): RegionSerializedData {
|
||||
return {
|
||||
code: this.code,
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
import { Feed, Channel, Category, Region, Subdivision, Country, Language, Logo } from './index'
|
||||
import {
|
||||
Feed,
|
||||
Channel,
|
||||
Category,
|
||||
Region,
|
||||
Subdivision,
|
||||
Country,
|
||||
Language,
|
||||
Logo,
|
||||
City
|
||||
} from './index'
|
||||
import { URL, Collection, Dictionary } from '@freearhey/core'
|
||||
import type { StreamData } from '../types/stream'
|
||||
import parser from 'iptv-playlist-parser'
|
||||
@@ -330,6 +340,10 @@ export class Stream {
|
||||
return this.feed ? this.feed.broadcastAreaCodes : new Collection()
|
||||
}
|
||||
|
||||
isBroadcastInCity(city: City): boolean {
|
||||
return this.feed ? this.feed.isBroadcastInCity(city) : false
|
||||
}
|
||||
|
||||
isBroadcastInSubdivision(subdivision: Subdivision): boolean {
|
||||
return this.feed ? this.feed.isBroadcastInSubdivision(subdivision) : false
|
||||
}
|
||||
@@ -342,6 +356,10 @@ export class Stream {
|
||||
return this.feed ? this.feed.isBroadcastInRegion(region) : false
|
||||
}
|
||||
|
||||
isInternational(): boolean {
|
||||
return this.feed ? this.feed.isInternational() : false
|
||||
}
|
||||
|
||||
getLogos(): Collection {
|
||||
function format(logo: Logo): number {
|
||||
const levelByFormat = { SVG: 0, PNG: 3, APNG: 1, WebP: 1, AVIF: 1, JPEG: 2, GIF: 1 }
|
||||
|
||||
Reference in New Issue
Block a user