From e02f90272a805f85f94adec8d790eaf45dcf9c3f Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 27 Jul 2017 00:05:21 -0300 Subject: Add new "apply" feature to playlists See https://gist.github.com/liam4/cd7465a82c8b367eef221e61c3b6186e. Though not tested, this should work even on old/mixed playlists, e.g.: https://gist.github.com/liam4/2cad8630d5df4cf0014cb9acd0d76115 --- src/playlist-utils.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/playlist-utils.js') diff --git a/src/playlist-utils.js b/src/playlist-utils.js index 55638ed..5efd478 100644 --- a/src/playlist-utils.js +++ b/src/playlist-utils.js @@ -56,6 +56,16 @@ function updateGroupFormat(group) { // isn't a string.. if (typeof item[1] === 'string' || item.downloaderArg) { item = updateTrackFormat(item) + + // TODO: Should this also apply to groups? Is recursion good? Probably + // not! + // + // TODO: How should saving/serializing handle this? For now it just saves + // the result, after applying. (I.e., "apply": {"foo": "baz"} will save + // child tracks with {"foo": "baz"}.) + if (groupObj.apply) { + Object.assign(item, groupObj.apply) + } } else { item = updateGroupFormat(item) } -- cgit 1.3.0-6-gf8a5