Compare commits

...

13 Commits

Author SHA1 Message Date
Brock H Caldwell
d358ef8de6 fix: adds build on push to main
All checks were successful
CI / build-test (push) Successful in 2m55s
2026-03-17 23:19:23 -05:00
Brock H Caldwell
79d9d61592 fix: includes year in media directory name 2026-03-17 23:16:11 -05:00
Brock H Caldwell
4d0a198510 fix(ci): moves build_base_image to workflow_dispatch 2026-03-15 19:58:45 -05:00
Brock H Caldwell
5da1dde24d chore: adds enum for monitor types
Some checks failed
CI / build-base-app (push) Failing after 43s
CI / build-base-worker-supervisord (push) Successful in 43s
2026-03-15 19:57:00 -05:00
Brock H Caldwell
6ed327f78e task(ci): update base image
Some checks failed
CI / build-base-worker-supervisord (push) Failing after 37s
CI / build-base-app (push) Failing after 38s
2026-03-11 08:37:33 -05:00
Brock H Caldwell
1827c1df71 task(ci): update base image
Some checks failed
CI / build-base-app (push) Failing after 30s
CI / build-base-worker (push) Successful in 34s
CI / build-base-worker-supervisord (push) Successful in 2m1s
2026-03-11 08:26:08 -05:00
Brock H Caldwell
0c5fd2544b task(ci): update base image
Some checks failed
CI / build-base-worker (push) Successful in 35s
CI / build-base-app (push) Successful in 35s
CI / build-base-worker-supervisord (push) Failing after 37s
2026-03-11 08:22:03 -05:00
Brock H Caldwell
a6d5e2b026 task(ci): update base image 2026-03-10 23:58:47 -05:00
Brock H Caldwell
688ea98922 task(ci): update base image 2026-03-10 23:57:11 -05:00
Brock H Caldwell
d55a9cfdd5 task(ci): update base image 2026-03-10 23:55:52 -05:00
Brock H Caldwell
e9021c22fa task(ci): update base image
Some checks failed
CI / build-base-worker (push) Successful in 53s
CI / build-base-worker-supervisord (push) Failing after 2m4s
CI / build-base-app (push) Successful in 2m19s
2026-03-10 23:51:32 -05:00
Brock H Caldwell
939660a715 task(ci): build base images
Some checks failed
CI / build-base-worker (push) Failing after 32s
CI / build-base-app (push) Successful in 40s
CI / build-base-worker-supervisord (push) Failing after 2m19s
2026-03-10 23:48:12 -05:00
Brock H Caldwell
fb3e7b20ff task(ci): build base images
Some checks failed
CI / build-base-worker (push) Failing after 35s
CI / build-base-worker-supervisord (push) Successful in 50s
CI / build-base-app (push) Successful in 3m1s
2026-03-10 23:09:20 -05:00
5 changed files with 97 additions and 8 deletions

View File

@@ -0,0 +1,59 @@
name: CI
on:
workflow_dispatch:
jobs:
build-base-app:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Login to registry
uses: docker/login-action@v2
with:
registry: "${{ vars.REGISTRY_URL }}"
username: "${{ vars.REGISTRY_USER }}"
password: "${{ vars.REGISTRY_PASS }}"
- name: Build and push
uses: docker/build-push-action@v5
env:
APP_FRANKENPHP_TAG: php8.4
with:
context: .
push: true
file: docker/Dockerfile.base.worker
platforms: linux/amd64
build-args: |
APP_FRANKENPHP_TAG=${{ env.APP_FRANKENPHP_TAG }}
tags: |
code.caldwell.digital/home/torsearch-base:${APP_FRANKENPHP_TAG}
code.caldwell.digital/home/torsearch-base:latest
build-base-worker-supervisord:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Login to registry
uses: docker/login-action@v2
with:
registry: "${{ vars.REGISTRY_URL }}"
username: "${{ vars.REGISTRY_USER }}"
password: "${{ vars.REGISTRY_PASS }}"
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
file: docker/Dockerfile.base.worker
platforms: linux/amd64
build-args: |
ALPINE_VERSION=3.22
tags: |
code.caldwell.digital/home/torsearch-base-worker-supervisord:latest

View File

@@ -2,6 +2,8 @@ name: CI
on: on:
push: push:
branches:
- "main"
tags: tags:
- "v*" - "v*"

View File

@@ -113,9 +113,14 @@ class MediaFiles
return Map::from($results); return Map::from($results);
} }
public function createMovieDirectory(string $path): string public function createMovieDirectory(string $title, string|int $year): string
{ {
$path = $this->moviesPath . DIRECTORY_SEPARATOR . $path; $path = sprintf(
'%s' . DIRECTORY_SEPARATOR . '%s (%s)',
$this->moviesPath,
$title,
$year
);
if (false === $this->filesystem->exists($path)) { if (false === $this->filesystem->exists($path)) {
$this->filesystem->mkdir($path); $this->filesystem->mkdir($path);
@@ -124,9 +129,14 @@ class MediaFiles
return $path; return $path;
} }
public function createTvShowDirectory(string $path): string public function createTvShowDirectory(string $title, string|int $year): string
{ {
$path = $this->tvShowsPath . DIRECTORY_SEPARATOR . $path; $path = sprintf(
'%s' . DIRECTORY_SEPARATOR . '%s (%s)',
$this->tvShowsPath,
$title,
$year
);
if (false === $this->filesystem->exists($path)) { if (false === $this->filesystem->exists($path)) {
$this->filesystem->mkdir($path); $this->filesystem->mkdir($path);

View File

@@ -7,6 +7,8 @@ use App\Base\Service\MediaFiles;
use App\Download\DownloadEvents; use App\Download\DownloadEvents;
use App\Download\Framework\Entity\Download; use App\Download\Framework\Entity\Download;
use App\EventLog\Action\Command\AddEventLogCommand; use App\EventLog\Action\Command\AddEventLogCommand;
use App\Search\Action\Command\GetMediaInfoCommand;
use App\Search\Action\Handler\GetMediaInfoHandler;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Cache\Adapter\RedisAdapter; use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Messenger\MessageBusInterface;
@@ -25,6 +27,7 @@ class ProcessDownloader implements DownloaderInterface
private MediaFiles $mediaFiles, private MediaFiles $mediaFiles,
private CacheInterface $cache, private CacheInterface $cache,
private readonly Broadcaster $broadcaster, private readonly Broadcaster $broadcaster,
private readonly GetMediaInfoHandler $getMediaInfoHandler,
) {} ) {}
/** /**
@@ -37,7 +40,7 @@ class ProcessDownloader implements DownloaderInterface
$this->entityManager->flush(); $this->entityManager->flush();
$downloadPreferences = $downloadEntity->getUser()->getDownloadPreferences(); $downloadPreferences = $downloadEntity->getUser()->getDownloadPreferences();
$path = $this->getDownloadPath($mediaType, $title, $downloadPreferences); $path = $this->getDownloadPath($mediaType, $title, $downloadEntity->getImdbId(), $downloadPreferences);
$processArgs = ['wget', '-O', $downloadEntity->getFilename(), $url]; $processArgs = ['wget', '-O', $downloadEntity->getFilename(), $url];
@@ -103,17 +106,22 @@ class ProcessDownloader implements DownloaderInterface
$this->entityManager->flush(); $this->entityManager->flush();
} }
public function getDownloadPath(string $mediaType, string $title, array $downloadPreferences): string public function getDownloadPath(string $mediaType, string $title, string $imdbId, array $downloadPreferences): string
{ {
$mediaInfo = $this->getMediaInfoHandler->handle(new GetMediaInfoCommand(
$imdbId,
$mediaType,
));
if ($mediaType === 'movies') { if ($mediaType === 'movies') {
if ((bool) $downloadPreferences['movie_folder']->getPreferenceValue() === true) { if ((bool) $downloadPreferences['movie_folder']->getPreferenceValue() === true) {
return $this->mediaFiles->createMovieDirectory($title); return $this->mediaFiles->createMovieDirectory($title, $mediaInfo->media->year);
} }
return $this->mediaFiles->getMoviesPath(); return $this->mediaFiles->getMoviesPath();
} }
if ($mediaType === 'tvshows') { if ($mediaType === 'tvshows') {
return $this->mediaFiles->createTvShowDirectory($title); return $this->mediaFiles->createTvShowDirectory($title, $mediaInfo->media->year);
} }
throw new \Exception("There is no download path for media type: $mediaType"); throw new \Exception("There is no download path for media type: $mediaType");

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Monitor;
enum MonitorTypes: string
{
case TV_EPISODE = "tvepisode";
case TV_SEASON = "tvseason";
case TV_SERIES = "tvseries";
}