From 820b7940db2f1d533848f024fbb1d6f4841ce598 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 18 Feb 2018 19:31:30 -0400 Subject: Move downloadPlaylistFromOptionValue into general-util --- src/play.js | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/play.js') diff --git a/src/play.js b/src/play.js index d5df591..158c887 100755 --- a/src/play.js +++ b/src/play.js @@ -19,6 +19,10 @@ const { flattenGrouplike } = require('./playlist-utils') +const { + downloadPlaylistFromOptionValue +} = require('./general-util') + const { compileKeybindings, getComboForCommand, stringifyCombo } = require('./keybinder') @@ -26,23 +30,6 @@ const { const readFile = promisify(fs.readFile) const writeFile = promisify(fs.writeFile) -function downloadPlaylistFromURL(url) { - return fetch(url).then(res => res.text()) -} - -function downloadPlaylistFromLocalPath(path) { - return readFile(path) -} - -function downloadPlaylistFromOptionValue(arg) { - // TODO: Verify things! - if (arg.startsWith('http://') || arg.startsWith('https://')) { - return downloadPlaylistFromURL(arg) - } else { - return downloadPlaylistFromLocalPath(arg) - } -} - function clearConsoleLine() { process.stdout.write('\x1b[1K\r') } -- cgit 1.3.0-6-gf8a5