From 10971f375152e3afbb8a37765c51849edaaf696f Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 7 Feb 2022 09:25:14 +0300 Subject: [PATCH] Update update-playlists.js --- scripts/commands/update-playlists.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/commands/update-playlists.js b/scripts/commands/update-playlists.js index 782f1b1f9..7b8cd1fd5 100644 --- a/scripts/commands/update-playlists.js +++ b/scripts/commands/update-playlists.js @@ -10,10 +10,18 @@ async function main() { const files = _.groupBy(items, 'filepath') for (const filepath in files) { - const items = files[filepath] + let items = files[filepath] + items = items.sort(naturalOrder) const playlist = createPlaylist(items, { public: false }) await file.create(filepath, playlist.toString()) } } main() + +function naturalOrder(a, b) { + return a.channel_name.localeCompare(b.channel_name, undefined, { + numeric: true, + sensitivity: 'base' + }) +}