diff --git a/assets/bootstrap.js b/assets/bootstrap.js index d4e50c9..2a0c6a0 100644 --- a/assets/bootstrap.js +++ b/assets/bootstrap.js @@ -1,5 +1,6 @@ import { startStimulusApp } from '@symfony/stimulus-bundle'; +import Popover from '@stimulus-components/popover' const app = startStimulusApp(); // register any custom, 3rd party controllers here -// app.register('some_controller_name', SomeImportedController); +app.register('popover', Popover); diff --git a/composer.json b/composer.json index 60e2153..d2f900b 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "ext-iconv": "*", "1tomany/rich-bundle": "^1.8", "aimeos/map": "^3.12", + "chrisullyott/php-filesize": "^4.2", "doctrine/dbal": "^3", "doctrine/doctrine-bundle": "^2.14", "doctrine/doctrine-fixtures-bundle": "^4.1", diff --git a/composer.lock b/composer.lock index daf85df..8b559ec 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "63610a631352051ae8327669536efcef", + "content-hash": "c519733202d45f8fb3a4f5b8e7dfb95b", "packages": [ { "name": "1tomany/rich-bundle", @@ -186,6 +186,55 @@ ], "time": "2023-12-11T17:09:12+00:00" }, + { + "name": "chrisullyott/php-filesize", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/chrisullyott/php-filesize.git", + "reference": "967ea3365c00974b50b608ffc045a267ab92ef43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chrisullyott/php-filesize/zipball/967ea3365c00974b50b608ffc045a267ab92ef43", + "reference": "967ea3365c00974b50b608ffc045a267ab92ef43", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7" + }, + "type": "library", + "autoload": { + "psr-4": { + "ChrisUllyott\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Ullyott", + "email": "contact@chrisullyott.com", + "homepage": "http://www.chrisullyott.com" + } + ], + "description": "Easily calculate file sizes and convert between units.", + "homepage": "https://github.com/chrisullyott/php-filesize", + "keywords": [ + "php", + "size-calculation" + ], + "support": { + "issues": "https://github.com/chrisullyott/php-filesize/issues", + "source": "https://github.com/chrisullyott/php-filesize" + }, + "time": "2021-10-17T22:52:23+00:00" + }, { "name": "composer/semver", "version": "3.4.3", diff --git a/config/services.yaml b/config/services.yaml index 82dd3df..6426eb4 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -5,6 +5,7 @@ # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: # Media + media.base_path: '/var/download' media.default_movies_dir: movies media.default_tvshows_dir: tvshows media.movies_path: '%env(default:media.default_movies_dir:MOVIES_PATH)%' diff --git a/importmap.php b/importmap.php index 73f4fcf..7f6c5f6 100644 --- a/importmap.php +++ b/importmap.php @@ -28,4 +28,7 @@ return [ '@hotwired/turbo' => [ 'version' => '7.3.0', ], + '@stimulus-components/popover' => [ + 'version' => '7.0.0', + ], ]; diff --git a/src/Monitor/Service/MediaFiles.php b/src/Monitor/Service/MediaFiles.php index 5f23a2a..51236b3 100644 --- a/src/Monitor/Service/MediaFiles.php +++ b/src/Monitor/Service/MediaFiles.php @@ -13,6 +13,8 @@ class MediaFiles { private Finder $finder; + private string $basePath; + private string $moviesPath; private string $tvShowsPath; @@ -20,6 +22,9 @@ class MediaFiles private Filesystem $filesystem; public function __construct( + #[Autowire(param: 'media.base_path')] + string $basePath, + #[Autowire(param: 'media.movies_path')] string $moviesPath, @@ -29,6 +34,7 @@ class MediaFiles Filesystem $filesystem, ) { $this->finder = new Finder(); + $this->basePath = $basePath; $this->moviesPath = $moviesPath; $this->tvShowsPath = $tvShowsPath; $this->filesystem = $filesystem; @@ -45,6 +51,11 @@ class MediaFiles throw new \Exception(sprintf('A path for media type %s does not exist.', $mediaType)); } + public function getBasePath(): string + { + return $this->basePath; + } + public function getMoviesPath(): string { return $this->moviesPath; diff --git a/src/Twig/Extensions/UtilExtension.php b/src/Twig/Extensions/UtilExtension.php new file mode 100644 index 0000000..f707b3e --- /dev/null +++ b/src/Twig/Extensions/UtilExtension.php @@ -0,0 +1,32 @@ +asAuto(); + } + + #[AsTwigFilter('strip_media_path')] + public function stripMediaPath(string $path) + { + return str_replace( + $this->mediaFiles->getBasePath() . DIRECTORY_SEPARATOR, + '', + $path + ); + } +} diff --git a/tailwind.config.js b/tailwind.config.js index b040ed8..6d5aa5c 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -12,10 +12,25 @@ module.exports = { "bg-purple-400", "bg-orange-400", "bg-blue-600", - "bg-rose-600" + "bg-rose-600", + "transition-opacity", + "ease-in", + "duration-700", + "opacity-100" ], theme: { - extend: {}, + extend: { + animation: { + fade: 'fadeIn .3s ease-in-out', + }, + + keyframes: { + fadeIn: { + from: { opacity: 0 }, + to: { opacity: 1 }, + }, + }, + }, }, plugins: [], } diff --git a/templates/torrentio/tvshows.html.twig b/templates/torrentio/tvshows.html.twig index 47e120b..6369644 100644 --- a/templates/torrentio/tvshows.html.twig +++ b/templates/torrentio/tvshows.html.twig @@ -20,9 +20,22 @@ {% if results.file != false %} - - exists - + + + + Existing file(s) for this episode: + + {{ results.file.realPath|strip_media_path }} — {{ results.file.size|filesize }} + + + + + exists + + {% endif %} {% if results.file == false %}
Existing file(s) for this episode: