Update update-playlists.js

This commit is contained in:
Aleksandr Statciuk 2022-02-07 09:25:14 +03:00
parent f81108040a
commit 10971f3751
1 changed files with 9 additions and 1 deletions

View File

@ -10,10 +10,18 @@ async function main() {
const files = _.groupBy(items, 'filepath') const files = _.groupBy(items, 'filepath')
for (const filepath in files) { for (const filepath in files) {
const items = files[filepath] let items = files[filepath]
items = items.sort(naturalOrder)
const playlist = createPlaylist(items, { public: false }) const playlist = createPlaylist(items, { public: false })
await file.create(filepath, playlist.toString()) await file.create(filepath, playlist.toString())
} }
} }
main() main()
function naturalOrder(a, b) {
return a.channel_name.localeCompare(b.channel_name, undefined, {
numeric: true,
sensitivity: 'base'
})
}