Fixes "formatter doesn't fill tags" issue #4097

This commit is contained in:
Aleksandr Statciuk 2021-08-16 12:35:13 +03:00
parent dd3dc20a55
commit 67dc65a434
3 changed files with 11 additions and 7 deletions

View File

@ -61,7 +61,7 @@ async function updatePlaylist(playlist) {
} }
for (const channel of playlist.channels) { for (const channel of playlist.channels) {
addMissingData(channel) addMissingData(channel, playlist)
updateGroupTitle(channel) updateGroupTitle(channel)
normalizeUrl(channel) normalizeUrl(channel)
@ -122,7 +122,8 @@ function updateStatus(channel, status) {
} }
} }
function addMissingData(channel) { function addMissingData(channel, playlist) {
const code = playlist.country.code
// tvg-name // tvg-name
if (!channel.tvg.name && channel.name) { if (!channel.tvg.name && channel.name) {
channel.tvg.name = channel.name.replace(/\"/gi, '') channel.tvg.name = channel.name.replace(/\"/gi, '')

View File

@ -211,10 +211,10 @@ db.playlists = {
return this.list return this.list
}, },
only(list = []) { only(list = []) {
return this.list.filter(playlist => list.includes(playlist.name)) return this.list.filter(playlist => list.includes(playlist.filename))
}, },
except(list = []) { except(list = []) {
return this.list.filter(playlist => !list.includes(playlist.name)) return this.list.filter(playlist => !list.includes(playlist.filename))
}, },
sortBy(fields) { sortBy(fields) {
this.list = utils.sortBy(this.list, fields) this.list = utils.sortBy(this.list, fields)

View File

@ -15,10 +15,13 @@ parser.parseIndex = function () {
parser.parsePlaylist = async function (url) { parser.parsePlaylist = async function (url) {
const content = file.read(url) const content = file.read(url)
const result = playlistParser.parse(content) const result = playlistParser.parse(content)
const name = file.getFilename(url) const filename = file.getFilename(url)
const country = utils.code2name(name) const country = {
code: filename,
name: utils.code2name(filename)
}
return new Playlist({ header: result.header, items: result.items, url, country, name }) return new Playlist({ header: result.header, items: result.items, url, filename, country })
} }
module.exports = parser module.exports = parser