diff options
| author | Fbenas <philbeansburton@gmail.com> | 2020-06-20 21:07:45 +0100 | 
|---|---|---|
| committer | Fbenas <philbeansburton@gmail.com> | 2020-06-20 21:07:45 +0100 | 
| commit | 8d6e8b306d7836e4075a13ad98617bfe5afaa1a0 (patch) | |
| tree | 99c44e28da231cac0d9e513aabc1ee0768972426 /app/Youtube | |
| parent | 897b68ac107f2fb0d4dc1d31ce96ce24c862eb27 (diff) | |
Add new scripts for youtube downloading and syncing with existing matches
Diffstat (limited to 'app/Youtube')
| -rw-r--r-- | app/Youtube/Service.php | 21 | 
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          ];      } | 
