Update scripts

This commit is contained in:
freearhey 2025-03-26 06:22:33 +03:00
parent adc7c71c0d
commit 43ed983480
4 changed files with 3 additions and 48 deletions

View file

@ -116,10 +116,7 @@ async function editFeeds() {
broadcast_area: data.getArray('broadcast_area'),
timezones: data.getArray('timezones'),
languages: data.getArray('languages'),
video_format: data.getString('video_format'),
launched: data.getString('launched'),
closed: data.getString('closed'),
replaced_by: data.getString('replaced_by')
video_format: data.getString('video_format')
})
found.merge(updated)
@ -169,10 +166,7 @@ async function addFeeds() {
broadcast_area: data.getArray('broadcast_area'),
timezones: data.getArray('timezones'),
languages: data.getArray('languages'),
video_format: data.getString('video_format'),
launched: data.getString('launched'),
closed: data.getString('closed'),
replaced_by: data.getString('replaced_by')
video_format: data.getString('video_format')
})
)
@ -381,12 +375,6 @@ function onFeedIdChange(channelId: string, feedId: string, newFeedId: string) {
channel.replaced_by = `${channelId}@${newFeedId}`
}
})
feeds.forEach((feed: Feed) => {
if (feed.replaced_by && feed.replaced_by === `${channelId}@${feedId}`) {
feed.replaced_by = `${channelId}@${newFeedId}`
}
})
}
function onFeedNewMain(channelId: string, feedId: string) {
@ -403,12 +391,6 @@ function onFeedRemoval(channelId: string, feedId: string) {
channel.replaced_by = ''
}
})
feeds.forEach((feed: Feed) => {
if (feed.replaced_by && feed.replaced_by === `${channelId}@${feedId}`) {
feed.replaced_by = ''
}
})
}
function onChannelIdChange(channelId: string, newChannelId: string) {
@ -422,10 +404,6 @@ function onChannelIdChange(channelId: string, newChannelId: string) {
if (feed.channel === channelId) {
feed.channel = newChannelId
}
if (feed.replaced_by && feed.replaced_by.includes(channelId)) {
feed.replaced_by = feed.replaced_by.replace(channelId, newChannelId)
}
})
blocklist.forEach((blocked: Blocked) => {
@ -443,9 +421,4 @@ function onChannelRemoval(channelId: string) {
})
feeds.remove((feed: Feed) => feed.channel === channelId)
feeds.forEach((feed: Feed) => {
if (feed.replaced_by && feed.replaced_by.includes(channelId)) {
feed.replaced_by = ''
}
})
}

View file

@ -115,7 +115,6 @@ async function main() {
for (const [i, row] of rowsCopy.entries()) {
fileErrors = fileErrors.concat(validateChannel(row.channel, i))
fileErrors = fileErrors.concat(validateTimezones(row, i))
fileErrors = fileErrors.concat(validateReplacedBy(row, i))
}
break
case 'blocklist':

View file

@ -7,9 +7,6 @@ type FeedProps = {
timezones?: string[]
languages?: string[]
video_format?: string
launched?: string
closed?: string
replaced_by?: string
}
export class Feed {
@ -21,9 +18,6 @@ export class Feed {
timezones: string[]
languages: string[]
video_format?: string
launched?: string
closed?: string
replaced_by?: string
constructor({
channel,
@ -33,10 +27,7 @@ export class Feed {
broadcast_area,
timezones,
languages,
video_format,
launched,
closed,
replaced_by
video_format
}: FeedProps) {
this.channel = channel
this.id = id
@ -46,9 +37,6 @@ export class Feed {
this.timezones = timezones || []
this.languages = languages || []
this.video_format = video_format
this.launched = launched
this.closed = closed
this.replaced_by = replaced_by
}
data() {

View file

@ -32,10 +32,5 @@ export default {
),
video_format: Joi.string()
.regex(/^\d+(i|p)$/)
.allow(null),
launched: Joi.date().format('YYYY-MM-DD').raw().allow(null),
closed: Joi.date().format('YYYY-MM-DD').raw().allow(null).greater(Joi.ref('launched')),
replaced_by: Joi.string()
.regex(/^[A-Za-z0-9]+\.[a-z]{2}($|@[A-Za-z0-9]+$)/)
.allow(null)
}