Compare commits

..

6 Commits

10 changed files with 43 additions and 15 deletions

View File

@@ -48,6 +48,7 @@ export default class extends Controller {
this.options.forEach((option) => option.querySelector('.download-btn').dataset['title'] = this.titleValue); this.options.forEach((option) => option.querySelector('.download-btn').dataset['title'] = this.titleValue);
this.options[0].querySelector('input[type="checkbox"]').checked = true; this.options[0].querySelector('input[type="checkbox"]').checked = true;
} else { } else {
this.countTarget.innerText = 0;
this.episodeSelectorTarget.disabled = true; this.episodeSelectorTarget.disabled = true;
} }
this.loadingIconOutlet.increaseCount(); this.loadingIconOutlet.increaseCount();

View File

@@ -1,4 +1,6 @@
twig: twig:
globals:
version: '%app.version%'
file_name_pattern: '*.twig' file_name_pattern: '*.twig'
date: date:
format: 'm/d/Y' format: 'm/d/Y'

View File

@@ -22,8 +22,11 @@ parameters:
app.cache.redis.host.default: 'redis://redis' app.cache.redis.host.default: 'redis://redis'
# Various configs # Various configs
app.default.version: '0.dev'
app.default.timezone: 'America/Chicago' app.default.timezone: 'America/Chicago'
app.version: '%env(default:app.default.version:APP_VERSION)%'
services: services:
# default configuration for services in *this* file # default configuration for services in *this* file
_defaults: _defaults:

View File

@@ -4,6 +4,9 @@ ENV SERVER_NAME=":80"
ENV CADDY_GLOBAL_OPTIONS="auto_https off" ENV CADDY_GLOBAL_OPTIONS="auto_https off"
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime" ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
ARG APP_VERSION="0.dev"
ENV APP_VERSION="${APP_VERSION}"
RUN install-php-extensions \ RUN install-php-extensions \
pdo_mysql \ pdo_mysql \
gd \ gd \

View File

@@ -4,6 +4,9 @@ ENV SERVER_NAME=":80"
ENV CADDY_GLOBAL_OPTIONS="auto_https off" ENV CADDY_GLOBAL_OPTIONS="auto_https off"
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime" ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
ARG APP_VERSION="0.dev"
ENV APP_VERSION="${APP_VERSION}"
RUN install-php-extensions \ RUN install-php-extensions \
pdo_mysql \ pdo_mysql \
gd \ gd \

View File

@@ -4,6 +4,9 @@ ENV SERVER_NAME=":80"
ENV CADDY_GLOBAL_OPTIONS="auto_https off" ENV CADDY_GLOBAL_OPTIONS="auto_https off"
ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime" ENV APP_RUNTIME="Runtime\\FrankenPhpSymfony\\Runtime"
ARG APP_VERSION="0.dev"
ENV APP_VERSION="${APP_VERSION}"
RUN install-php-extensions \ RUN install-php-extensions \
pdo_mysql \ pdo_mysql \
gd \ gd \

View File

@@ -61,10 +61,10 @@ readonly class MonitorTvShowHandler implements HandlerInterface
// Dispatch Episode commands for each missing Episode // Dispatch Episode commands for each missing Episode
foreach ($episodesInShow as $episode) { foreach ($episodesInShow as $episode) {
// Only monitor future episodes // Only monitor future episodes
$episodeInFuture = $this->episodeInFuture($episode); $episodeInFuture = $this->episodeReleasedAfterMonitorCreated($monitor->getCreatedAt(), $episode);
$this->logger->info('> [MonitorTvShowHandler] Episode is in future for season ' . $episode['season_number'] . ' episode ' . $episode['episode_number'] . ' for title: ' . $monitor->getTitle() . ' ? ' . (true === $episodeInFuture ? 'YES' : 'NO')); $this->logger->info('> [MonitorTvShowHandler] Episode released after monitor started for season ' . $episode['season_number'] . ' episode ' . $episode['episode_number'] . ' for title: ' . $monitor->getTitle() . ' ? ' . (true === $episodeInFuture ? 'YES' : 'NO'));
if (false === $episodeInFuture) { if (false === $episodeInFuture) {
$this->logger->info('> [MonitorTvShowHandler] Episode not in future for title: ' . 'for season ' . $episode['season_number'] . ' episode ' . $episode['episode_number'] . ', skipping'); $this->logger->info('> [MonitorTvShowHandler] Episode released after monitor started for title: ' . 'for season ' . $episode['season_number'] . ' episode ' . $episode['episode_number'] . ', skipping');
continue; continue;
} }
@@ -125,11 +125,11 @@ readonly class MonitorTvShowHandler implements HandlerInterface
); );
} }
private function episodeInFuture(array $episodeInShow): bool private function episodeReleasedAfterMonitorCreated(string|DateTimeImmutable $monitorStartDate, array $episodeInShow): bool
{ {
static $today = Carbon::today(); $monitorStartDate = Carbon::parse($monitorStartDate);
$episodeAirDate = Carbon::parse($episodeInShow['air_date']); $episodeAirDate = Carbon::parse($episodeInShow['air_date']);
return $episodeAirDate > $today; return $episodeAirDate >= $monitorStartDate;
} }
private function episodeExists(array $episodeInShow, Map $downloadedEpisodes): bool private function episodeExists(array $episodeInShow, Map $downloadedEpisodes): bool

View File

@@ -38,11 +38,21 @@ class Torrentio
$results = $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbCode) { $results = $this->cache->get($cacheKey, function (ItemInterface $item) use ($imdbCode) {
$item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0)); $item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
$response = file_get_contents(str_replace('{imdbCode}', $imdbCode, $this->searchUrl)); try {
return json_decode( $response = $this->client->get("$this->searchUrl/$imdbCode.json");
$response, return json_decode(
true $response->getBody()->getContents(),
); true
);
} catch (\Throwable $exception) {
if ($exception->getCode() === 429) {
$this->logger->warning("> [TorrentioClient] Rate limit exceeded");
return null;
}
}
$this->logger->error("> [TorrentioClient] Request error: " . $response->getStatusCode() . " - " . $response->getBody()->getContents());
return [];
}); });
return $this->parse($results, $filter); return $this->parse($results, $filter);

View File

@@ -38,13 +38,13 @@
</ul> </ul>
</div> </div>
<div class="sticky inset-x-0 bottom-0 border-t border-orange-500"> <div class="sticky inset-x-0 bottom-0 border-t border-b border-orange-500 bg-orange-500 hover:bg-opacity-80 bg-clip-padding backdrop-filter backdrop-blur-md bg-opacity-60 flex flex-col">
<a href="#" class="nav-foot flex items-center gap-2 p-4 bg-orange-500 hover:bg-opacity-80 bg-clip-padding backdrop-filter backdrop-blur-md bg-opacity-60"> <a href="#" class="nav-foot flex items-center gap-2 pt-4 px-4">
<span class="rounded-full p-2 border-orange-500 border-2"> <span class="rounded-full p-2 border-orange-500 border-2">
<twig:ux:icon name="ri:user-line" width="30" class="text-gray-50"/> <twig:ux:icon name="ri:user-line" width="30" class="text-gray-50"/>
</span> </span>
<div> <div class="flex flex-col text-white">
<p class="text-xs"> <p class="text-xs">
{% if app.user.name %} {% if app.user.name %}
<strong class="block font-medium text-white">{{ app.user.name }}</strong> <strong class="block font-medium text-white">{{ app.user.name }}</strong>
@@ -54,5 +54,8 @@
</p> </p>
</div> </div>
</a> </a>
<p class="px-4 pt-1 inline-flex justify-center">
<small class="text-white text-xs">v0.18.14</small>
</p>
</div> </div>
</nav> </nav>

View File

@@ -33,7 +33,7 @@
<button class="py-1 px-1.5 mr-1 grow-0 font-bold text-xs bg-green-600 rounded-lg hover:cursor-pointer hover:bg-green-700 text-white" <button class="py-1 px-1.5 mr-1 grow-0 font-bold text-xs bg-green-600 rounded-lg hover:cursor-pointer hover:bg-green-700 text-white"
{{ stimulus_action('tv-results', 'toggleList', 'click') }} {{ stimulus_action('tv-results', 'toggleList', 'click') }}
> >
<span {{ stimulus_target('tv-results', 'count') }}>0</span> results <span {{ stimulus_target('tv-results', 'count') }}>-</span> results
</button> </button>
<small class="py-1 px-1.5 mr-1 grow-0 font-bold bg-gray-700 rounded-lg font-normal text-white" title="Air date {{ episode['name'] }}"> <small class="py-1 px-1.5 mr-1 grow-0 font-bold bg-gray-700 rounded-lg font-normal text-white" title="Air date {{ episode['name'] }}">