Skip to content

Commit

Permalink
Do not locate downloaded file if we are in "skip-download" mode
Browse files Browse the repository at this point in the history
  • Loading branch information
norkunas committed Jan 11, 2018
1 parent 72f9ee7 commit 17c0bad
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/YoutubeDl.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,18 @@ private function processDownload(Process $process): Video

@unlink($metadataFile);

if (isset($this->options['extract-audio']) && true === $this->options['extract-audio']) {
$file = $this->findFile($videoData['_filename'], implode('|', $this->allowedAudioFormats));
$videoData['_filename'] = pathinfo($file, PATHINFO_BASENAME);
} elseif (preg_match('/merged into mkv/', $process->getErrorOutput())) {
$videoData['_filename'] = pathinfo($this->findFile($videoData['_filename'], 'mkv'), PATHINFO_BASENAME);
}
if (!$this->options['skip-download']) {
if (isset($this->options['extract-audio']) && true === $this->options['extract-audio']) {
$file = $this->findFile($videoData['_filename'], implode('|', $this->allowedAudioFormats));
$videoData['_filename'] = pathinfo($file, PATHINFO_BASENAME);
} elseif (preg_match('/merged into mkv/', $process->getErrorOutput())) {
$videoData['_filename'] = pathinfo($this->findFile($videoData['_filename'], 'mkv'), PATHINFO_BASENAME);
}

$videoData['file'] = new \SplFileInfo($this->downloadPath.'/'.$videoData['_filename']);
$videoData['file'] = new \SplFileInfo($this->downloadPath.'/'.$videoData['_filename']);
} else {
$videoData['file'] = null;
}

return new Video($videoData);
}
Expand Down

2 comments on commit 17c0bad

@kminek
Copy link

@kminek kminek commented on 17c0bad Jan 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this gives me Undefined index: skip-download, i guess you should check if key exists first...

@norkunas
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, fixed.

Please sign in to comment.