« get me outta code hell

Move redundant things into processSmartPlaylist - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src/general-util.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-03-19 23:03:00 -0300
committerFlorrie <towerofnix@gmail.com>2018-03-19 23:03:00 -0300
commitbf0a68349b69fb5b8bd50b7e38ad6a88540e431a (patch)
treec5e5e818414110f8e042b63397fc6b953f0b2bda /src/general-util.js
parentbf69e4afd6515954128f5d9129396c56553005e3 (diff)
Move redundant things into processSmartPlaylist
Diffstat (limited to 'src/general-util.js')
-rw-r--r--src/general-util.js18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/general-util.js b/src/general-util.js
index 278eea6..b37f516 100644
--- a/src/general-util.js
+++ b/src/general-util.js
@@ -100,25 +100,17 @@ module.exports.makePlaylistOptions = function() {
     // Takes an actual playlist object and sets it up as the source and active
     // playlist.
 
-    const openedPlaylist = updatePlaylistFormat(importedPlaylist)
-
-    // We also want to de-smart-ify (stupidify? - simplify?) the playlist.
-    const processedPlaylist = await processSmartPlaylist(openedPlaylist)
-
-    // ..And finally, we have to update the playlist format again, since
-    // processSmartPlaylist might have added new (un-updated) items:
-    const finalPlaylist = updatePlaylistFormat(processedPlaylist, true)
-    // We also pass true so that the playlist-format-updater knows that this
-    // is the source playlist.
-
-    sourcePlaylist = finalPlaylist
+    // We want to de-smart-ify (stupidify? - simplify?) the playlist.
+    // This also automatically updates the playlist format for us, which is
+    // handy.
+    sourcePlaylist = await processSmartPlaylist(importedPlaylist)
 
     // The active playlist is a clone of the source playlist; after all it's
     // quite possible we'll be messing with the value of the active playlist,
     // and we don't want to reflect those changes in the source playlist.
     activePlaylist = clone(sourcePlaylist)
 
-    await processArgv(processedPlaylist.options, optionFunctions)
+    await processArgv(sourcePlaylist.options, optionFunctions)
   }
 
   const requiresOpenPlaylist = async function() {