A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
fix: irrelevant di in index and scan scheduled jobs and console commands
aminnausin82dc9f383ac2
diff --git a/app/Console/Commands/IndexFilesCommand.php b/app/Console/Commands/IndexFilesCommand.phpindex cb3ce960..668a4d37 100644--- a/app/Console/Commands/IndexFilesCommand.php+++ b/app/Console/Commands/IndexFilesCommand.php@@ -2,8 +2,6 @@namespace App\Console\Commands;-use App\Jobs\IndexFiles;-use App\Jobs\SyncFiles;use App\Services\FileJobService;use Illuminate\Console\Command;@@ -22,29 +20,9 @@ class IndexFilesCommand extends Command {*/protected $description = 'Index Media Files';- public function __construct(- protected FileJobService $fileJobService- ) {- parent::__construct();- }-- public function handle() {- $name = 'Console Index Files';- $description = 'Looks for folder and video changes in in all libraries.';+ public function handle(FileJobService $fileJobService) {$this->info('Starting Index Files...');-- $this->fileJobService->executeBatchOperation(- userId: null,- name: $name,- description: $description,- chain: function ($task) {- return [- new SyncFiles($task->id),- new IndexFiles($task->id),- ];- },- );-+ $fileJobService->indexFiles(['userId' => null, 'namePrefix' => 'Console ']);$this->info('Index Files Queued!');}}diff --git a/app/Console/Commands/ScanFilesCommand.php b/app/Console/Commands/ScanFilesCommand.phpindex 8e9d0eb5..7f9d4ffb 100644--- a/app/Console/Commands/ScanFilesCommand.php+++ b/app/Console/Commands/ScanFilesCommand.php@@ -2,8 +2,6 @@namespace App\Console\Commands;-use App\Jobs\IndexFiles;-use App\Jobs\SyncFiles;use App\Models\Category;use App\Services\FileJobService;use Illuminate\Console\Command;@@ -23,38 +21,15 @@ class ScanFilesCommand extends Command {*/protected $description = 'Scan Media Files';- public function __construct(- protected FileJobService $fileJobService- ) {+ public function __construct() {parent::__construct();}- public function handle() {- $fileJobService = $this->fileJobService; // isolate it from $this-- $name = 'Console Scan Files';- $description = 'Scans for file changes and loads metadata from all libraries.';-- $library_id = $this->argument('library_id');-+ public function handle(FileJobService $fileJobService) {$this->info('Starting Scan Files');- $this->fileJobService->executeBatchOperation(- userId: null,- name: $name,- description: $description,- chain: function ($task) {- return [- new SyncFiles($task->id),- new IndexFiles($task->id),- ];- },- callback: function ($task) use ($fileJobService, $library_id) {- $library = Category::find($library_id);-- $fileJobService->verifyFiles([], $library, $task->id);- }- );+ $library = $this->argument('library_id') ? Category::find($this->argument('library_id')) : null;+ $fileJobService->scanFiles(['userId' => null, 'namePrefix' => 'Console '], $library);$this->info('Scan Files Queued!');}diff --git a/app/Jobs/ScheduledIndexFiles.php b/app/Jobs/ScheduledIndexFiles.phpindex 8ea7d6bb..398d342f 100644--- a/app/Jobs/ScheduledIndexFiles.php+++ b/app/Jobs/ScheduledIndexFiles.php@@ -3,7 +3,6 @@namespace App\Jobs;use App\Services\FileJobService;-use App\Services\TaskService;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;use Illuminate\Foundation\Queue\Queueable;@@ -13,34 +12,10 @@ use Illuminate\Queue\SerializesModels;class ScheduledIndexFiles implements ShouldQueue {use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;- protected $controller;-- public function __construct() {- $taskService = new TaskService;- $this->controller = new FileJobService($taskService);- }-/*** Execute the job.*/- public function handle(): void {- $this->handleTask();- }-- public function handleTask() {- $name = 'Scheduled Index Files';- $description = 'Looks for folder and video changes in in all Libraries.';-- return $this->controller->executeBatchOperation(- userId: null,- name: $name,- description: $description,- chain: function ($task) {- return [- new SyncFiles($task->id),- new IndexFiles($task->id),- ];- },- );+ public function handle(FileJobService $fileJobService): void {+ $fileJobService->indexFiles(['userId' => null, 'namePrefix' => 'Scheduled ']);}}