summaryrefslogtreecommitdiff
path: root/app/Youtube/Service.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Youtube/Service.php')
-rw-r--r--app/Youtube/Service.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/app/Youtube/Service.php b/app/Youtube/Service.php
index 090020e..862a27a 100644
--- a/app/Youtube/Service.php
+++ b/app/Youtube/Service.php
@@ -15,6 +15,7 @@ class Service
protected $url;
protected $progressBar;
protected $running = false;
+ protected $video;
public function __construct(string $url, $output = null)
{
@@ -37,15 +38,13 @@ class Service
public function downloadVideo(string $path)
{
$this->path = $path;
-
- return $this->download($this->getVideoOptions());
+ $this->download($this->getVideoOptions());
}
public function downloadAudio(string $path)
{
$this->path = $path;
-
- return $this->download($thjis->getAudioOptions());
+ $this->download($thjis->getAudioOptions());
}
protected function download(array $options)
@@ -81,7 +80,7 @@ class Service
'youtube/video/' . $video->getFilename()
);
- return $video;
+ $this->video = $video;
// $video->getFile(); // \SplFileInfo instance of downloaded file
} catch (NotFoundException $e) {
@@ -99,6 +98,16 @@ class Service
}
}
+ public function getTitle(): string
+ {
+ return $this->video->getTitle();
+ }
+
+ public function getFullPath(): string
+ {
+ return $this->getStoragePath() . '/' . $this->video->getFilename();
+ }
+
protected function formatBytes(string $bytes)
{
$units = [
@@ -134,7 +143,7 @@ class Service
return [
'prefer-free-formats' => true,
'no-overwrites' => true,
- // 'skip-download' => true
+ 'skip-download' => true
];
}