fix: a few bugs after moving code to own directory
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
"symfony/console": "7.2.*",
|
"symfony/console": "7.2.*",
|
||||||
"symfony/doctrine-messenger": "7.2.*",
|
"symfony/doctrine-messenger": "7.2.*",
|
||||||
"symfony/dotenv": "7.2.*",
|
"symfony/dotenv": "7.2.*",
|
||||||
|
"symfony/filesystem": "7.2.*",
|
||||||
"symfony/finder": "7.2.*",
|
"symfony/finder": "7.2.*",
|
||||||
"symfony/flex": "^2",
|
"symfony/flex": "^2",
|
||||||
"symfony/form": "7.2.*",
|
"symfony/form": "7.2.*",
|
||||||
|
|||||||
2
composer.lock
generated
2
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "c9b0e6d834b028ec81a8ba1d24005d77",
|
"content-hash": "7e29123297e1ac72cd417967d2a761b4",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "1tomany/rich-bundle",
|
"name": "1tomany/rich-bundle",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Monitor\Action\Handler;
|
namespace App\Monitor\Action\Handler;
|
||||||
|
|
||||||
use App\Monitor\Action\Command\DownloadMediaCommand;
|
use App\Download\Action\Command\DownloadMediaCommand;
|
||||||
use App\Monitor\Action\Command\MonitorMovieCommand;
|
use App\Monitor\Action\Command\MonitorMovieCommand;
|
||||||
use App\Monitor\Action\Result\MonitorMovieResult;
|
use App\Monitor\Action\Result\MonitorMovieResult;
|
||||||
use App\Monitor\Framework\Repository\MonitorRepository;
|
use App\Monitor\Framework\Repository\MonitorRepository;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Monitor\Service;
|
|||||||
|
|
||||||
use Aimeos\Map;
|
use Aimeos\Map;
|
||||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||||
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
|
|
||||||
class MediaFiles
|
class MediaFiles
|
||||||
@@ -14,16 +15,21 @@ class MediaFiles
|
|||||||
|
|
||||||
private string $tvShowsPath;
|
private string $tvShowsPath;
|
||||||
|
|
||||||
|
private Filesystem $filesystem;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
#[Autowire(param: 'media.movies_path')]
|
#[Autowire(param: 'media.movies_path')]
|
||||||
string $moviesPath,
|
string $moviesPath,
|
||||||
|
|
||||||
#[Autowire(param: 'media.tvshows_path')]
|
#[Autowire(param: 'media.tvshows_path')]
|
||||||
string $tvShowsPath,
|
string $tvShowsPath,
|
||||||
|
|
||||||
|
Filesystem $filesystem,
|
||||||
) {
|
) {
|
||||||
$this->finder = new Finder();
|
$this->finder = new Finder();
|
||||||
$this->moviesPath = $moviesPath;
|
$this->moviesPath = $moviesPath;
|
||||||
$this->tvShowsPath = $tvShowsPath;
|
$this->tvShowsPath = $tvShowsPath;
|
||||||
|
$this->filesystem = $filesystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMoviesPath(): string
|
public function getMoviesPath(): string
|
||||||
@@ -61,7 +67,11 @@ class MediaFiles
|
|||||||
if (!str_starts_with($path, $this->tvShowsPath)) {
|
if (!str_starts_with($path, $this->tvShowsPath)) {
|
||||||
$path = $this->tvShowsPath . DIRECTORY_SEPARATOR . $path;
|
$path = $this->tvShowsPath . DIRECTORY_SEPARATOR . $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (false === $this->filesystem->exists($path)) {
|
||||||
|
$this->filesystem->mkdir($path);
|
||||||
|
}
|
||||||
|
|
||||||
$results = [];
|
$results = [];
|
||||||
foreach ($this->finder->in($path)->files() as $file) {
|
foreach ($this->finder->in($path)->files() as $file) {
|
||||||
if ($onlyFilenames) {
|
if ($onlyFilenames) {
|
||||||
|
|||||||
Reference in New Issue
Block a user