Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
removes details file
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobg committed Aug 18, 2020
1 parent 8489b24 commit 60afa91
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 33 deletions.
10 changes: 0 additions & 10 deletions lib/downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const isOverwrite = flags.includes('--overwrite')
// First, look for the download link.
let dir, filePath
const defaultBin = path.join(__dirname, '..', 'bin')
const defaultPath = path.join(defaultBin, 'details')
const url = process.env.YOUTUBE_DL_DOWNLOAD_HOST || 'https://yt-dl.org/downloads/latest/youtube-dl'

function download (url, callback) {
Expand Down Expand Up @@ -101,15 +100,6 @@ function downloader (binDir, callback) {

download(url, function error (err, newVersion) {
if (err) return callback(err)
fs.writeFileSync(
defaultPath,
JSON.stringify({
version: newVersion,
path: binDir ? filePath : binDir,
exec: exec('youtube-dl')
}),
'utf8'
)
return callback(null, 'Downloaded youtube-dl ' + newVersion)
})
}
Expand Down
20 changes: 0 additions & 20 deletions lib/get-binary.js

This file was deleted.

7 changes: 4 additions & 3 deletions lib/youtube-dl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const universalify = require('universalify')
const streamify = require('streamify')
const request = require('request')
const path = require('path')
const hms = require('hh-mm-ss')
const http = require('http')
const url = require('url')
Expand All @@ -15,12 +16,12 @@ const {
isString
} = require('./util')

let ytdlBinary = require('./get-binary')()
let ytdlBinary = null

const execa = universalify.fromPromise(require('execa'))

function youtubeDl (args, options, cb) {
return execa(ytdlBinary, args, options, function done (err, output) {
return execa(ytdl.getYtdlBinary(), args, options, function done (err, output) {
if (err) return cb(err)
return cb(null, output.stdout ? output.stdout.trim().split(/\r?\n/) : undefined)
})
Expand Down Expand Up @@ -207,7 +208,7 @@ ytdl.setYtdlBinary = function setYtdlBinary (path) {
* @param {String} path
*/
ytdl.getYtdlBinary = function getYtdlBinary () {
return ytdlBinary
return ytdlBinary ? ytdlBinary : path.resolve(__dirname, '..', 'bin', 'youtube-dl')
}

/**
Expand Down

0 comments on commit 60afa91

Please sign in to comment.