Skip to content

Commit

Permalink
add: search torrents by episode/season number via web ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Roardom committed Jun 5, 2024
1 parent 3df8a44 commit c410792
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 26 deletions.
8 changes: 8 additions & 0 deletions app/Http/Livewire/TorrentSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ class TorrentSearch extends Component
#[Url(history: true)]
public int $maxSizeMultiplier = 1;

#[Url(history: true)]
public ?int $episodeNumber = null;

#[Url(history: true)]
public ?int $seasonNumber = null;

/**
* @var string[]
*/
Expand Down Expand Up @@ -278,6 +284,8 @@ final public function filters(): Closure
->when($this->imdbId !== '', fn ($query) => $query->ofImdb((int) (preg_match('/tt0*(?=(\d{7,}))/', $this->imdbId, $matches) ? $matches[1] : $this->imdbId)))
->when($this->tvdbId !== null, fn ($query) => $query->ofTvdb($this->tvdbId))
->when($this->malId !== null, fn ($query) => $query->ofMal($this->malId))
->when($this->episodeNumber !== null, fn ($query) => $query->ofEpisode($this->episodeNumber))
->when($this->seasonNumber !== null, fn ($query) => $query->ofSeason($this->seasonNumber))
->when($this->playlistId !== null, fn ($query) => $query->ofPlaylist($this->playlistId))
->when($this->collectionId !== null, fn ($query) => $query->ofCollection($this->collectionId))
->when($this->companyId !== null, fn ($query) => $query->ofCompany($this->companyId))
Expand Down
82 changes: 56 additions & 26 deletions resources/views/livewire/torrent-search.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,62 @@ class="form__text"
</p>
</div>
<div class="form__group--short-horizontal">
<p class="form__group">
<input
id="startYear"
wire:model.live="startYear"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
/>
<label class="form__label form__label--floating" for="startYear">
{{ __('torrent.start-year') }}
</label>
</p>
<p class="form__group">
<input
id="endYear"
wire:model.live="endYear"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
/>
<label class="form__label form__label--floating" for="endYear">
{{ __('torrent.end-year') }}
</label>
</p>
<div class="form__group--short-horizontal">
<p class="form__group">
<input
id="startYear"
wire:model.live="startYear"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
/>
<label class="form__label form__label--floating" for="startYear">
{{ __('torrent.start-year') }}
</label>
</p>
<p class="form__group">
<input
id="endYear"
wire:model.live="endYear"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
/>
<label class="form__label form__label--floating" for="endYear">
{{ __('torrent.end-year') }}
</label>
</p>
</div>
<div class="form__group--short-horizontal">
<p class="form__group">
<input
id="episodeNumber"
wire:model.live="episodeNumber"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
/>
<label class="form__label form__label--floating" for="episodeNumber">
{{ __('torrent.episode-number') }}
</label>
</p>
<p class="form__group">
<input
id="seasonNumber"
wire:model.live="seasonNumber"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
/>
<label class="form__label form__label--floating" for="seasonNumber">
{{ __('torrent.season-number') }}
</label>
</p>
</div>
<div class="form__group--short-horizontal">
<p class="form__group">
<input
Expand Down

0 comments on commit c410792

Please sign in to comment.