update: store null for metadata id if they do not exist

And make it difficult / encourage users to submit the ids instead of leaving them empty.
This commit is contained in:
Roardom
2025-03-17 01:27:03 +00:00
parent 5418fe8954
commit ea1bdca818
21 changed files with 1190 additions and 538 deletions
+37 -7
View File
@@ -534,22 +534,52 @@ readonly class TorrentSearchFiltersDTO
}
if ($this->tmdbId !== null) {
$filters[] = [
'tmdb_movie_id = '.$this->tmdbId,
'tmdb_tv_id = '.$this->tmdbId,
];
if ($this->tmdbId === 0) {
$filters[] = [
'tmdb_movie_id IS NULL AND tmdb_tv_id IS NOT NULL',
'tmdb_tv_id IS NULL AND tmdb_movie_id IS NOT NULL',
'tmdb_movie_id = 0 AND tmdb_tv_id != 0',
'tmdb_tv_id = 0 AND tmdb_movie_id != 0',
];
} else {
$filters[] = [
'tmdb_movie_id = '.$this->tmdbId,
'tmdb_tv_id = '.$this->tmdbId,
];
}
}
if ($this->imdbId !== null) {
$filters[] = 'imdb = '.$this->imdbId;
if ($this->imdbId === 0) {
$filters[] = [
'imdb IS NULL',
'imdb = 0',
];
} else {
$filters[] = 'imdb = '.$this->imdbId;
}
}
if ($this->tvdbId !== null) {
$filters[] = 'tvdb = '.$this->tvdbId;
if ($this->tvdbId === 0) {
$filters[] = [
'tvdb IS NULL',
'tvdb = 0',
];
} else {
$filters[] = 'tvdb = '.$this->tvdbId;
}
}
if ($this->malId !== null) {
$filters[] = 'mal = '.$this->malId;
if ($this->malId === 0) {
$filters[] = [
'mal IS NULL',
'mal = 0',
];
} else {
$filters[] = 'mal = '.$this->malId;
}
}
if ($this->playlistId !== null) {
@@ -39,6 +39,10 @@ class QuickSearchController extends Controller
[
'tmdb_movie.name EXISTS',
'tmdb_tv.name EXISTS',
],
[
'tmdb_movie_id IS NOT NULL AND tmdb_movie_id != 0',
'tmdb_tv_id IS NOT NULL AND tmdb_tv_id IS != 0',
]
];
+39 -31
View File
@@ -38,6 +38,21 @@ class StoreTorrentRequest extends FormRequest
return true;
}
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
$this->merge([
'tmdb_movie_id' => $this->has('movie_exists_on_tmdb') ? ($this->input('tmdb_movie_id') ?: null) : null,
'tmdb_tv_id' => $this->has('tv_exists_on_tmdb') ? ($this->input('tmdb_tv_id') ?: null) : null,
'imdb' => $this->has('title_exists_on_imdb') ? ($this->input('imdb') ?: null) : null,
'tvdb' => $this->has('tv_exists_on_tvdb') ? ($this->input('tvdb') ?: null) : null,
'mal' => $this->has('anime_exists_on_mal') ? ($this->input('mal') ?: null) : null,
'igdb' => $this->has('game_exists_on_igdb') ? ($this->input('igdb') ?: null) : null,
]);
}
/**
* Get the validation rules that apply to the request.
*
@@ -48,6 +63,12 @@ class StoreTorrentRequest extends FormRequest
$user = $request->user()->loadExists('internals');
$category = Category::findOrFail($request->integer('category_id'));
$mustBeNull = function (string $attribute, mixed $value, callable $fail): void {
if ($value !== null) {
$fail("The {$attribute} must be null.");
}
};
return [
'torrent' => [
'required',
@@ -141,64 +162,68 @@ class StoreTorrentRequest extends FormRequest
],
'imdb' => [
Rule::when($category->movie_meta || $category->tv_meta, [
'required',
'required_with:title_exists_on_imdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!($category->movie_meta || $category->tv_meta), [
Rule::in([0]),
$mustBeNull,
]),
],
'tvdb' => [
Rule::when($category->tv_meta, [
'required',
'required_with:tv_exists_on_tvdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->tv_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'tmdb_movie_id' => [
Rule::when($category->movie_meta, [
'required',
'required_with:movie_exists_on_tmdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->movie_meta, [
Rule::in([0]),
'exclude',
$mustBeNull,
]),
],
'tmdb_tv_id' => [
Rule::when($category->tv_meta, [
'required',
'required_with:tv_exists_on_tmdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->tv_meta, [
Rule::in([0]),
'exclude',
$mustBeNull,
]),
],
'mal' => [
Rule::when($category->movie_meta || $category->tv_meta, [
'required',
'required_with:anime_exists_on_mal',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!($category->movie_meta || $category->tv_meta), [
Rule::in([0]),
$mustBeNull,
]),
],
'igdb' => [
Rule::when($category->game_meta, [
'required',
'required_with:game_exists_on_igdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->game_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'season_number' => [
@@ -253,21 +278,4 @@ class StoreTorrentRequest extends FormRequest
],
];
}
/**
* Get the error messages for the defined validation rules.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'igdb.in' => 'The IGDB ID must be 0 if the media doesn\'t exist on IGDB or you\'re not uploading a game.',
'tmdb_movie_id.in' => 'The TMDB ID must be 0 if the media doesn\'t exist on TMDB or you\'re not uploading a tv show or movie.',
'tmdb_tv_id.in' => 'The TMDB ID must be 0 if the media doesn\'t exist on TMDB or you\'re not uploading a tv show or movie.',
'imdb.in' => 'The IMDB ID must be 0 if the media doesn\'t exist on IMDB or you\'re not uploading a tv show or movie.',
'tvdb.in' => 'The TVDB ID must be 0 if the media doesn\'t exist on TVDB or you\'re not uploading a tv show.',
'mal.in' => 'The MAL ID must be 0 if the media doesn\'t exist on MAL or you\'re not uploading a tv or movie.',
];
}
}
@@ -31,6 +31,21 @@ class StoreTorrentRequestRequest extends FormRequest
return true;
}
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
$this->merge([
'tmdb_movie_id' => $this->has('movie_exists_on_tmdb') ? ($this->input('tmdb_movie_id') ?: null) : null,
'tmdb_tv_id' => $this->has('tv_exists_on_tmdb') ? ($this->input('tmdb_tv_id') ?: null) : null,
'imdb' => $this->has('title_exists_on_imdb') ? ($this->input('imdb') ?: null) : null,
'tvdb' => $this->has('tv_exists_on_tvdb') ? ($this->input('tvdb') ?: null) : null,
'mal' => $this->has('anime_exists_on_mal') ? ($this->input('mal') ?: null) : null,
'igdb' => $this->has('game_exists_on_igdb') ? ($this->input('igdb') ?: null) : null,
]);
}
/**
* Get the validation rules that apply to the request.
*
@@ -40,6 +55,12 @@ class StoreTorrentRequestRequest extends FormRequest
{
$category = Category::findOrFail($request->integer('category_id'));
$mustBeNull = function (string $attribute, mixed $value, callable $fail): void {
if ($value !== null) {
$fail("The {$attribute} must be null.");
}
};
return [
'name' => [
'required',
@@ -47,62 +68,68 @@ class StoreTorrentRequestRequest extends FormRequest
],
'imdb' => [
Rule::when($category->movie_meta || $category->tv_meta, [
'required',
'required_with:title_exists_on_imdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!($category->movie_meta || $category->tv_meta), [
Rule::in([0]),
$mustBeNull,
]),
],
'tvdb' => [
Rule::when($category->tv_meta, [
'required',
'required_with:tv_exists_on_tvdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->tv_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'tmdb_movie_id' => [
Rule::when($category->movie_meta, [
'required',
'required_with:movie_exists_on_tmdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->movie_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'tmdb_tv_id' => [
Rule::when($category->tv_meta, [
'required',
'required_with:tv_exists_on_tmdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->tv_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'mal' => [
Rule::when($category->movie_meta || $category->tv_meta, [
'required',
'required_with:anime_exists_on_mal',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!($category->movie_meta || $category->tv_meta), [
Rule::in([0]),
$mustBeNull,
]),
],
'igdb' => [
Rule::when($category->game_meta, [
'required',
'required_with:game_exists_on_igdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->game_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'category_id' => [
@@ -142,13 +169,7 @@ class StoreTorrentRequestRequest extends FormRequest
public function messages(): array
{
return [
'igdb.in' => 'The IGDB ID must be 0 if the media doesn\'t exist on IGDB or you\'re not requesting a game.',
'tmdb_movie_id.in' => 'The TMDB ID must be 0 if the media doesn\'t exist on TMDB or you\'re not requesting a tv show or movie.',
'tmdb_tv_id.in' => 'The TMDB ID must be 0 if the media doesn\'t exist on TMDB or you\'re not requesting a tv show or movie.',
'imdb.in' => 'The IMDB ID must be 0 if the media doesn\'t exist on IMDB or you\'re not requesting a tv show or movie.',
'tvdb.in' => 'The TVDB ID must be 0 if the media doesn\'t exist on TVDB or you\'re not requesting a tv show.',
'mal.in' => 'The MAL ID must be 0 if the media doesn\'t exist on MAL or you\'re not requesting a tv or movie.',
'bounty.max' => 'You do not have enough BON to make this request.',
'bounty.max' => 'You do not have enough BON to make this request.',
];
}
}
+39 -12
View File
@@ -33,6 +33,21 @@ class UpdateTorrentRequest extends FormRequest
return true;
}
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
$this->merge([
'tmdb_movie_id' => $this->has('movie_exists_on_tmdb') ? ($this->input('tmdb_movie_id') ?: null) : null,
'tmdb_tv_id' => $this->has('tv_exists_on_tmdb') ? ($this->input('tmdb_tv_id') ?: null) : null,
'imdb' => $this->has('title_exists_on_imdb') ? ($this->input('imdb') ?: null) : null,
'tvdb' => $this->has('tv_exists_on_tvdb') ? ($this->input('tvdb') ?: null) : null,
'mal' => $this->has('anime_exists_on_mal') ? ($this->input('mal') ?: null) : null,
'igdb' => $this->has('game_exists_on_igdb') ? ($this->input('igdb') ?: null) : null,
]);
}
/**
* Get the validation rules that apply to the request.
*
@@ -48,6 +63,12 @@ class UpdateTorrentRequest extends FormRequest
$torrent = Torrent::withoutGlobalScope(ApprovedScope::class)->find($torrentId);
$user = $request->user()->load('group')->loadExists('internals');
$mustBeNull = function (string $attribute, mixed $value, callable $fail): void {
if ($value !== null) {
$fail("The {$attribute} must be null.");
}
};
return [
'name' => [
'required',
@@ -91,62 +112,68 @@ class UpdateTorrentRequest extends FormRequest
],
'imdb' => [
Rule::when($category->movie_meta || $category->tv_meta, [
'required',
'required_with:title_exists_on_imdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!($category->movie_meta || $category->tv_meta), [
Rule::in([0]),
$mustBeNull,
]),
],
'tvdb' => [
Rule::when($category->tv_meta, [
'required',
'required_with:tv_exists_on_tvdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->tv_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'tmdb_movie_id' => [
Rule::when($category->movie_meta, [
'required',
'required_with:movie_exists_on_tmdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->movie_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'tmdb_tv_id' => [
Rule::when($category->tv_meta, [
'required',
'required_with:tv_exists_on_tmdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->tv_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'mal' => [
Rule::when($category->movie_meta || $category->tv_meta, [
'required',
'required_with:anime_exists_on_mal',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!($category->movie_meta || $category->tv_meta), [
Rule::in([0]),
$mustBeNull,
]),
],
'igdb' => [
Rule::when($category->game_meta, [
'required',
'required_with:game_exists_on_igdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->game_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'season_number' => [
@@ -31,6 +31,21 @@ class UpdateTorrentRequestRequest extends FormRequest
return true;
}
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
$this->merge([
'tmdb_movie_id' => $this->has('movie_exists_on_tmdb') ? ($this->input('tmdb_movie_id') ?: null) : null,
'tmdb_tv_id' => $this->has('tv_exists_on_tmdb') ? ($this->input('tmdb_tv_id') ?: null) : null,
'imdb' => $this->has('title_exists_on_imdb') ? ($this->input('imdb') ?: null) : null,
'tvdb' => $this->has('tv_exists_on_tvdb') ? ($this->input('tvdb') ?: null) : null,
'mal' => $this->has('anime_exists_on_mal') ? ($this->input('mal') ?: null) : null,
'igdb' => $this->has('game_exists_on_igdb') ? ($this->input('igdb') ?: null) : null,
]);
}
/**
* Get the validation rules that apply to the request.
*
@@ -40,6 +55,12 @@ class UpdateTorrentRequestRequest extends FormRequest
{
$category = Category::findOrFail($request->integer('category_id'));
$mustBeNull = function (string $attribute, mixed $value, callable $fail): void {
if ($value !== null) {
$fail("The {$attribute} must be null.");
}
};
return [
'name' => [
'required',
@@ -47,62 +68,68 @@ class UpdateTorrentRequestRequest extends FormRequest
],
'imdb' => [
Rule::when($category->movie_meta || $category->tv_meta, [
'required',
'required_with:title_exists_on_imdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!($category->movie_meta || $category->tv_meta), [
Rule::in([0]),
$mustBeNull,
]),
],
'tvdb' => [
Rule::when($category->tv_meta, [
'required',
'required_with:tv_exists_on_tvdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->tv_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'tmdb_movie_id' => [
Rule::when($category->movie_meta, [
'required',
'required_with:movie_exists_on_tmdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->movie_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'tmdb_tv_id' => [
Rule::when($category->tv_meta, [
'required',
'required_with:tv_exists_on_tmdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->tv_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'mal' => [
Rule::when($category->movie_meta || $category->tv_meta, [
'required',
'required_with:anime_exists_on_mal',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!($category->movie_meta || $category->tv_meta), [
Rule::in([0]),
$mustBeNull,
]),
],
'igdb' => [
Rule::when($category->game_meta, [
'required',
'required_with:game_exists_on_igdb',
'nullable',
'decimal:0',
'min:0',
]),
Rule::when(!$category->game_meta, [
Rule::in([0]),
$mustBeNull,
]),
],
'category_id' => [
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author Roardom <roardom@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('torrents', function (Blueprint $table): void {
$table->unsignedInteger('imdb')->nullable()->change();
$table->unsignedInteger('tvdb')->nullable()->change();
$table->unsignedInteger('mal')->nullable()->change();
});
DB::table('torrents')->where('tmdb_movie_id', '=', 0)->update(['tmdb_movie_id' => null]);
DB::table('torrents')->where('tmdb_tv_id', '=', 0)->update(['tmdb_tv_id' => null]);
DB::table('torrents')->where('imdb', '=', 0)->update(['imdb' => null]);
DB::table('torrents')->where('tvdb', '=', 0)->update(['tvdb' => null]);
DB::table('torrents')->where('mal', '=', 0)->update(['mal' => null]);
DB::table('torrents')->where('igdb', '=', 0)->update(['igdb' => null]);
DB::table('requests')->where('tmdb_movie_id', '=', 0)->update(['tmdb_movie_id' => null]);
DB::table('requests')->where('tmdb_tv_id', '=', 0)->update(['tmdb_tv_id' => null]);
DB::table('requests')->where('imdb', '=', 0)->update(['imdb' => null]);
DB::table('requests')->where('tvdb', '=', 0)->update(['tvdb' => null]);
DB::table('requests')->where('mal', '=', 0)->update(['mal' => null]);
DB::table('requests')->where('igdb', '=', 0)->update(['igdb' => null]);
}
};
+4 -3
View File
@@ -2127,9 +2127,9 @@ CREATE TABLE `torrents` (
`user_id` int unsigned NOT NULL,
`tmdb_movie_id` int unsigned DEFAULT NULL,
`tmdb_tv_id` int unsigned DEFAULT NULL,
`imdb` int unsigned NOT NULL DEFAULT '0',
`tvdb` int unsigned NOT NULL DEFAULT '0',
`mal` int unsigned NOT NULL DEFAULT '0',
`imdb` int unsigned DEFAULT NULL,
`tvdb` int unsigned DEFAULT NULL,
`mal` int unsigned DEFAULT NULL,
`igdb` int unsigned DEFAULT NULL,
`season_number` int DEFAULT NULL,
`episode_number` int DEFAULT NULL,
@@ -2972,3 +2972,4 @@ INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (339,'2025_03_12_04
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (340,'2025_03_16_185628_update_torrents_table_to_int_igdb',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (341,'2025_03_17_122748_add_tmdb_prefix_to_metadata_tables',3);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (342,'2025_03_23_203227_add_automatically_unbookmark_torrents_user_setting',4);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (343,'2025_03_25_093436_update_metadata_id_default_to_null',5);
@@ -21,3 +21,10 @@
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
align-items: center;
}
.form__group--vertical {
display: flex;
flex-direction: column;
gap: 16px;
background-color: inherit;
}
@@ -39,7 +39,13 @@
<aside class="torrent-card__aside">
<a
class="torrent-card__similar-link"
href="{{ route('torrents.similar', ['category_id' => $torrent->category_id, 'tmdb' => $torrent->tmdb_movie_id ?? $torrent->tmdb_tv_id]) }}"
href="{{
match (true) {
$torrent->tmdb_movie_id !== null => route('torrents.similar', ['category_id' => $torrent->category_id, 'tmdb' => $torrent->tmdb_movie_id]),
$torrent->tmdb_tv_id !== null => route('torrents.similar', ['category_id' => $torrent->category_id, 'tmdb' => $torrent->tmdb_tv_id]),
default => '#',
}
}}"
>
<figure class="torrent-card__figure">
<img
@@ -24,7 +24,13 @@
@if (auth()->user()->settings?->show_poster)
<td class="torrent-search--list__poster">
<a
href="{{ route('torrents.similar', ['category_id' => $torrent->category_id, 'tmdb' => $torrent->tmdb_movie_id ?? $torrent->tmdb_tv_id]) }}"
href="{{
match (true) {
$torrent->tmdb_movie_id !== null => route('torrents.similar', ['category_id' => $torrent->category_id, 'tmdb' => $torrent->tmdb_movie_id]),
$torrent->tmdb_tv_id !== null => route('torrents.similar', ['category_id' => $torrent->category_id, 'tmdb' => $torrent->tmdb_tv_id]),
default => '#',
}
}}"
>
@if ($torrent->category->movie_meta || $torrent->category->tv_meta)
<img
@@ -7,7 +7,7 @@
<article class="torrent-search--poster__result">
<figure>
<a
href="{{ route('torrents.similar', ['category_id' => $categoryId, 'tmdb' => $tv?->id ?? $tmdb]) }}"
href="{{ $tv?->id ?? $tmdb ? route('torrents.similar', ['category_id' => $categoryId, 'tmdb' => $tv?->id ?? $tmdb]) : '#' }}"
class="torrent-search--poster__poster"
>
<img
+221 -110
View File
@@ -24,6 +24,12 @@
x-data="{
cat: {{ (int) $category_id }},
cats: JSON.parse(atob('{{ base64_encode(json_encode($categories)) }}')),
tmdb_movie_exists: true,
tmdb_tv_exists: true,
imdb_title_exists: true,
tvdb_tv_exists: true,
mal_anime_exists: true,
igdb_game_exists: true,
}"
>
<h2 class="panel__heading">{{ __('request.add-request') }}</h2>
@@ -108,120 +114,225 @@
class="form__group--horizontal"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv' || cats[cat].type === 'game'"
>
<p class="form__group" x-show="cats[cat].type === 'movie'">
<input type="hidden" name="tmdb_movie_id" value="0" />
<input
id="tmdb_movie_id"
class="form__text"
inputmode="numeric"
name="tmdb_movie_id"
pattern="[0-9]*"
required
type="text"
x-bind:value="cats[cat].type === 'movie' ? '{{ $movieId ?: old('tmdb_movie_id') }}' : '0'"
x-bind:required="cats[cat].type === 'movie'"
/>
<label class="form__label form__label--floating" for="tmdb_movie_id">
TMDB Movie ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
<p class="form__group" x-show="cats[cat].type === 'tv'">
<input type="hidden" name="tmdb_tv_id" value="0" />
<input
id="tmdb_tv_id"
class="form__text"
inputmode="numeric"
name="tmdb_tv_id"
pattern="[0-9]*"
required
type="text"
x-bind:value="cats[cat].type === 'tv' ? '{{ $tvId ?: old('tmdb_tv_id') }}' : '0'"
x-bind:required="cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="tmdb_tv_id">
TMDB TV ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
<p
class="form__group"
<div class="form__group--vertical" x-show="cats[cat].type === 'movie'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="movie_exists_on_tmdb"
name="movie_exists_on_tmdb"
value="1"
@checked(old('movie_exists_on_tmdb', true))
x-model="tmdb_movie_exists"
/>
<label class="form__label" for="movie_exists_on_tmdb">
This movie exists on TMDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="tmdb_movie_id" value="0" />
<input
id="tmdb_movie_id"
class="form__text"
inputmode="numeric"
name="tmdb_movie_id"
pattern="[0-9]*"
placeholder=" "
type="text"
x-bind:value="cats[cat].type === 'movie' && tmdb_movie_exists ? '{{ old('tmdb_movie_id', $movieId) }}' : ''"
x-bind:required="cats[cat].type === 'movie' && tmdb_movie_exists"
/>
<label
class="form__label form__label--floating"
for="tmdb_movie_id"
>
TMDB Movie ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'tv'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="tv_exists_on_tmdb"
name="tv_exists_on_tmdb"
value="1"
@checked(old('tv_exists_on_tmdb', true))
x-model="tmdb_tv_exists"
/>
<label class="form__label" for="tv_exists_on_tmdb">
This TV show exists on TMDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="tmdb_tv_id" value="0" />
<input
id="tmdb_tv_id"
class="form__text"
inputmode="numeric"
name="tmdb_tv_id"
pattern="[0-9]*"
placeholder=" "
type="text"
x-bind:value="cats[cat].type === 'tv' && tmdb_tv_exists ? '{{ old('tmdb_tv_id', $tvId) }}' : ''"
x-bind:required="cats[cat].type === 'tv' && tmdb_tv_exists"
/>
<label class="form__label form__label--floating" for="tmdb_tv_id">
TMDB TV ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div
class="form__group--vertical"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
>
<input type="hidden" name="imdb" value="0" />
<input
id="autoimdb"
class="form__text"
inputmode="numeric"
name="imdb"
pattern="[0-9]*"
required
type="text"
x-bind:value="cats[cat].type === 'movie' || cats[cat].type === 'tv' ? '{{ $imdb ?: old('imdb') }}' : '0'"
x-bind:required="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="autoimdb">
IMDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
<p class="form__group" x-show="cats[cat].type === 'tv'">
<input type="hidden" name="tvdb" value="0" />
<input
id="autotvdb"
class="form__text"
inputmode="numeric"
name="tvdb"
pattern="[0-9]*"
placeholder=" "
type="text"
x-bind:value="cats[cat].type === 'tv' ? '{{ $tvdb ?: old('tvdb') }}' : '0'"
x-bind:required="cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="autotvdb">
TVDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
<p
class="form__group"
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="title_exists_on_imdb"
name="title_exists_on_imdb"
value="1"
@checked(old('title_exists_on_imdb', true))
x-model="imdb_title_exists"
/>
<label class="form__label" for="title_exists_on_imdb">
This title exists on IMDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="imdb" value="0" />
<input
id="autoimdb"
class="form__text"
inputmode="numeric"
name="imdb"
pattern="[0-9]*"
placeholder=" "
type="text"
x-bind:value="
(cats[cat].type === 'movie' || cats[cat].type === 'tv') && imdb_title_exists
? '{{ old('imdb', $imdb) }}'
: ''
"
x-bind:required="(cats[cat].type === 'movie' || cats[cat].type === 'tv') && imdb_title_exists"
/>
<label class="form__label form__label--floating" for="autoimdb">
IMDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'tv'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="tv_exists_on_tvdb"
name="tv_exists_on_tvdb"
value="1"
@checked(old('tv_exists_on_tvdb', true))
x-model="tvdb_tv_exists"
/>
<label class="form__label" for="tv_exists_on_tvdb">
This TV show exists on TVDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="tvdb" value="0" />
<input
id="autotvdb"
class="form__text"
inputmode="numeric"
name="tvdb"
pattern="[0-9]*"
placeholder=" "
type="text"
x-bind:value="cats[cat].type === 'tv' && tvdb_tv_exists ? '{{ old('tvdb', $tvdb) }}' : ''"
x-bind:required="cats[cat].type === 'tv' && tvdb_tv_exists"
/>
<label class="form__label form__label--floating" for="autotvdb">
TVDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div
class="form__group--vertical"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
>
<input type="hidden" name="mal" value="0" />
<input
id="automal"
class="form__text"
inputmode="numeric"
name="mal"
pattern="[0-9]*"
placeholder=" "
type="text"
x-bind:value="cats[cat].type === 'movie' || cats[cat].type === 'tv' ? '{{ $mal ?: old('mal') }}' : '0'"
x-bind:required="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="automal">
MAL ID ({{ __('torrent.required-anime') }})
</label>
<span class="form__hint">
Numeric digits only. Required for anime. Use 0 otherwise.
</span>
</p>
<p class="form__group" x-show="cats[cat].type === 'game'">
<input
id="igdb"
class="form__text"
inputmode="numeric"
name="igdb"
pattern="[0-9]*"
placeholder
type="text"
x-bind:value="cats[cat].type === 'game' ? '{{ $igdb ?: old('igdb') }}' : '0'"
x-bind:required="cats[cat].type === 'game'"
/>
<label class="form__label form__label--floating" for="igdb">
IGDB ID ({{ __('request.required') }} For Games)
</label>
</p>
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="anime_exists_on_mal"
name="anime_exists_on_mal"
value="1"
@checked(old('anime_exists_on_mal', true))
x-model="mal_anime_exists"
/>
<label class="form__label" for="anime_exists_on_mal">
This anime exists on MAL
</label>
</p>
<p class="form__group">
<input type="hidden" name="mal" value="0" />
<input
id="automal"
class="form__text"
inputmode="numeric"
name="mal"
pattern="[0-9]*"
placeholder=" "
type="text"
x-bind:value="
(cats[cat].type === 'movie' || cats[cat].type === 'tv') && mal_anime_exists
? '{{ old('mal', $mal) }}'
: ''
"
x-bind:required="(cats[cat].type === 'movie' || cats[cat].type === 'tv') && mal_anime_exists"
/>
<label class="form__label form__label--floating" for="automal">
MAL ID ({{ __('torrent.required-anime') }})
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'game'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="game_exists_on_igdb"
name="game_exists_on_igdb"
value="1"
@checked(old('game_exists_on_igdb', true))
x-model="igdb_game_exists"
/>
<label class="form__label" for="game_exists_on_igdb">
This game exists on IGDB
</label>
</p>
<p class="form__group">
<input
id="igdb"
class="form__text"
inputmode="numeric"
name="igdb"
pattern="[0-9]*"
placeholder=" "
type="text"
x-bind:value="cats[cat].type === 'game' && igdb_game_exists ? '{{ old('igdb', $igdb) }}' : ''"
x-bind:required="cats[cat].type === 'game' && igdb_game_exists"
/>
<label class="form__label form__label--floating" for="igdb">
IGDB ID ({{ __('request.required') }} For Games)
</label>
</p>
</div>
</div>
@livewire('bbcode-input', [
'name' => 'description',
+230 -100
View File
@@ -32,6 +32,14 @@
x-data="{
cat: {{ (int) $torrentRequest->category_id }},
cats: JSON.parse(atob('{{ base64_encode(json_encode($categories)) }}')),
tmdb_movie_exists:
{{ Js::from(old('movie_exists_on_tmdb', $torrentRequest->tmdb_movie_id) !== null) }},
tmdb_tv_exists: {{ Js::from(old('tv_exists_on_tmdb', $torrentRequest->tmdb_tv_id) !== null) }},
imdb_title_exists: {{ Js::from(old('title_exists_on_imdb', $torrentRequest->imdb) !== null) }},
tvdb_tv_exists: {{ Js::from(old('tv_exists_on_tvdb', $torrentRequest->tvdb) !== null) }},
mal_anime_exists: {{ Js::from(old('anime_exists_on_mal', $torrentRequest->mal) !== null) }},
igdb_game_exists:
{{ Js::from(old('game_exists_on_igdb', $torrentRequest->igdb_game_id) !== null) }},
}"
>
<h2 class="panel__heading">{{ __('request.edit-request') }}</h2>
@@ -118,112 +126,234 @@
</label>
</p>
<div
class="form__group--short-horizontal"
class="form__group--horizontal"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv' || cats[cat].type === 'game'"
>
<p class="form__group" x-show="cats[cat].type === 'movie'">
<input type="hidden" name="tmdb_movie_id" value="0" />
<input
id="tmdb_movie_id"
class="form__text"
inputmode="numeric"
name="tmdb_movie_id"
pattern="[0-9]*"
required
type="text"
value="{{ $torrentRequest->tmdb_movie_id ?: old('tmdb_movie_id') }}"
/>
<label class="form__label form__label--floating" for="tmdb_movie_id">
TMDB Movie ID
</label>
<output name="apimatch" id="apimatch" for="torrent"></output>
</p>
<p class="form__group" x-show="cats[cat].type === 'tv'">
<input type="hidden" name="tmdb_tv_id" value="0" />
<input
id="tmdb_tv_id"
class="form__text"
inputmode="numeric"
name="tmdb_tv_id"
pattern="[0-9]*"
required
type="text"
value="{{ $torrentRequest->tmdb_tv_id ?: old('tmdb_tv_id') }}"
/>
<label class="form__label form__label--floating" for="tmdb_tv_id">
TMDB TV ID
</label>
<output name="apimatch" id="apimatch" for="torrent"></output>
</p>
<p
class="form__group"
<div class="form__group--vertical" x-show="cats[cat].type === 'movie'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="movie_exists_on_tmdb"
name="movie_exists_on_tmdb"
value="1"
x-model="tmdb_movie_exists"
/>
<label class="form__label" for="movie_exists_on_tmdb">
This movie exists on TMDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="tmdb_movie_id" value="0" />
<input
id="tmdb_movie_id"
class="form__text"
inputmode="numeric"
name="tmdb_movie_id"
pattern="[0-9]*"
placeholder=" "
type="text"
x-bind:value="
cats[cat].type === 'movie' && tmdb_movie_exists
? '{{ old('tmdb_movie_id', $torrentRequest->tmdb_movie_id) }}'
: ''
"
x-bind:required="cats[cat].type === 'movie' && tmdb_movie_exists"
/>
<label
class="form__label form__label--floating"
for="tmdb_movie_id"
>
TMDB Movie ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'tv'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="tv_exists_on_tmdb"
name="tv_exists_on_tmdb"
value="1"
x-model="tmdb_tv_exists"
/>
<label class="form__label" for="tv_exists_on_tmdb">
This TV show exists on TMDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="tmdb_tv_id" value="0" />
<input
id="tmdb_tv_id"
class="form__text"
inputmode="numeric"
name="tmdb_tv_id"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ old('tmdb_tv_id', $torrentRequest->tmdb_tv_id) }}"
x-bind:value="
cats[cat].type === 'tv' && tmdb_tv_exists
? '{{ old('tmdb_tv_id', $torrentRequest->tmdb_tv_id) }}'
: ''
"
x-bind:required="cats[cat].type === 'tv' && tmdb_tv_exists"
/>
<label class="form__label form__label--floating" for="tmdb_tv_id">
TMDB TV ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div
class="form__group--vertical"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
>
<input type="hidden" name="imdb" value="0" />
<input
id="autoimdb"
class="form__text"
inputmode="numeric"
name="imdb"
pattern="[0-9]*"
required
type="text"
value="{{ $torrentRequest->imdb ?: old('imdb') }}"
/>
<label class="form__label form__label--floating" for="autoimdb">
IMDB ID
</label>
</p>
<p class="form__group" x-show="cats[cat].type === 'tv'">
<input type="hidden" name="tvdb" value="0" />
<input
id="autotvdb"
class="form__text"
inputmode="numeric"
name="tvdb"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ $torrentRequest->tvdb ?: old('tvdb') ?? '0' }}"
/>
<label class="form__label form__label--floating" for="autotvdb">
TVDB ID
</label>
</p>
<p
class="form__group"
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="title_exists_on_imdb"
name="title_exists_on_imdb"
value="1"
x-model="imdb_title_exists"
/>
<label class="form__label" for="title_exists_on_imdb">
This title exists on IMDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="imdb" value="0" />
<input
id="autoimdb"
class="form__text"
inputmode="numeric"
name="imdb"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ old('imdb', $torrentRequest->imdb) }}"
x-bind:value="
(cats[cat].type === 'movie' || cats[cat].type === 'tv') && imdb_title_exists
? '{{ old('imdb', $torrentRequest->imdb) }}'
: ''
"
x-bind:required="(cats[cat].type === 'movie' || cats[cat].type === 'tv') && imdb_title_exists"
/>
<label class="form__label form__label--floating" for="autoimdb">
IMDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'tv'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="tv_exists_on_tvdb"
name="tv_exists_on_tvdb"
value="1"
x-model="tvdb_tv_exists"
/>
<label class="form__label" for="tv_exists_on_tvdb">
This TV show exists on TVDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="tvdb" value="0" />
<input
id="autotvdb"
class="form__text"
inputmode="numeric"
name="tvdb"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ old('tvdb', $torrentRequest->tvdb) }}"
x-bind:value="cats[cat].type === 'tv' && tvdb_tv_exists ? '{{ old('tvdb', $torrentRequest->tvdb) }}' : ''"
x-bind:required="cats[cat].type === 'tv' && tvdb_tv_exists"
/>
<label class="form__label form__label--floating" for="autotvdb">
TVDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div
class="form__group--vertical"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
>
<input type="hidden" name="mal" value="0" />
<input
id="automal"
class="form__text"
inputmode="numeric"
name="mal"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ $torrentRequest->mal ?: old('mal') ?? '0' }}"
/>
<label class="form__label form__label--floating" for="automal">
MAL ID ({{ __('torrent.required-anime') }})
</label>
</p>
<p class="form__group" x-show="cats[cat].type === 'game'">
<input
id="igdb"
class="form__text"
inputmode="numeric"
name="igdb"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ $torrentRequest->igdb ?: old('igdb') ?? '0' }}"
/>
<label class="form__label form__label--floating" for="igdb">
IGDB ID ({{ __('request.required') }} For Games)
</label>
</p>
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="anime_exists_on_mal"
name="anime_exists_on_mal"
value="1"
x-model:checked="mal_anime_exists"
/>
<label class="form__label" for="anime_exists_on_mal">
This anime exists on MAL
</label>
</p>
<p class="form__group">
<input type="hidden" name="mal" value="0" />
<input
id="automal"
class="form__text"
inputmode="numeric"
name="mal"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ old('mal', $torrentRequest->mal) }}"
x-bind:value="
(cats[cat].type === 'movie' || cats[cat].type === 'tv') && mal_anime_exists
? '{{ old('mal', $torrentRequest->mal) }}'
: ''
"
x-bind:required="(cats[cat].type === 'movie' || cats[cat].type === 'tv') && mal_anime_exists"
/>
<label class="form__label form__label--floating" for="automal">
MAL ID
</label>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'game'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="game_exists_on_igdb"
name="game_exists_on_igdb"
value="1"
x-model="igdb_game_exists"
/>
<label class="form__label" for="game_exists_on_igdb">
This game exists on IGDB
</label>
</p>
<p class="form__group">
<input
id="igdb"
class="form__text"
inputmode="numeric"
name="igdb"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ old('igdb', $torrentRequest->igdb) }}"
x-bind:value="cats[cat].type === 'game' && igdb_game_exists ? '{{ old('igdb', $torrentRequest->igdb) }}' : ''"
x-bind:required="cats[cat].type === 'game' && igdb_game_exists"
/>
<label class="form__label form__label--floating" for="igdb">
IGDB ID
</label>
</p>
</div>
</div>
@livewire('bbcode-input', [
'name' => 'description',
+227 -107
View File
@@ -44,6 +44,12 @@
x-data="{
cat: {{ (int) $category_id }},
cats: JSON.parse(atob('{{ base64_encode(json_encode($categories)) }}')),
tmdb_movie_exists: true,
tmdb_tv_exists: true,
imdb_title_exists: true,
tvdb_tv_exists: true,
mal_anime_exists: true,
igdb_game_exists: true,
}"
>
<h2 class="upload-title panel__heading">
@@ -277,115 +283,229 @@
</div>
<div
class="form__group--horizontal"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv' || cats[cat].type === 'game'"
>
<p class="form__group">
<input type="hidden" name="tmdb_movie_id" value="0" />
<input
type="text"
name="tmdb_movie_id"
id="auto_tmdb_movie"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
x-bind:value="cats[cat].type === 'movie' ? '{{ $movieId ?: old('tmdb_movie_id') }}' : '0'"
x-bind:required="cats[cat].type === 'movie'"
/>
<label class="form__label form__label--floating" for="auto_tmdb_movie">
TMDB Movie ID
</label>
<span class="form__hint">Numeric digits only.</span>
<output name="apimatch" id="apimatch" for="torrent"></output>
</p>
<p class="form__group">
<input type="hidden" name="tmdb_tv_id" value="0" />
<input
type="text"
name="tmdb_tv_id"
id="auto_tmdb_tv"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
x-bind:value="cats[cat].type === 'tv' ? '{{ $tvId ?: old('tmdb_tv_id') }}' : '0'"
x-bind:required="cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="auto_tmdb_tv">
TMDB TV ID
</label>
<span class="form__hint">Numeric digits only.</span>
<output name="apimatch" id="apimatch" for="torrent"></output>
</p>
<p class="form__group">
<input type="hidden" name="imdb" value="0" />
<input
type="text"
name="imdb"
id="autoimdb"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
x-bind:value="cats[cat].type === 'movie' || cats[cat].type === 'tv' ? '{{ $imdb ?: old('imdb') }}' : '0'"
x-bind:required="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="autoimdb">
IMDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
<p class="form__group" x-show="cats[cat].type === 'tv'">
<input type="hidden" name="tvdb" value="0" />
<input
type="text"
name="tvdb"
id="autotvdb"
inputmode="numeric"
pattern="[0-9]*"
x-bind:value="cats[cat].type === 'tv' ? '{{ $tvdb ?: old('tvdb') }}' : '0'"
class="form__text"
x-bind:required="cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="autotvdb">
TVDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
<p class="form__group">
<input type="hidden" name="mal" value="0" />
<input
type="text"
name="mal"
id="automal"
inputmode="numeric"
pattern="[0-9]*"
x-bind:value="cats[cat].type === 'movie' || cats[cat].type === 'tv' ? '{{ $mal ?: old('mal') }}' : '0'"
x-bind:required="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
class="form__text"
placeholder=" "
/>
<label class="form__label form__label--floating" for="automal">
MAL ID
</label>
<span class="form__hint">
Numeric digits only. Required for anime. Use 0 otherwise.
</span>
</p>
<div class="form__group--vertical" x-show="cats[cat].type === 'movie'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="movie_exists_on_tmdb"
name="movie_exists_on_tmdb"
value="1"
@checked(old('movie_exists_on_tmdb', true))
x-model="tmdb_movie_exists"
/>
<label class="form__label" for="movie_exists_on_tmdb">
This movie exists on TMDB
</label>
<output name="apimatch" id="apimatch" for="torrent"></output>
</p>
<p class="form__group">
<input type="hidden" name="tmdb_movie_id" value="0" />
<input
type="text"
name="tmdb_movie_id"
id="auto_tmdb_movie"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
x-bind:value="cats[cat].type === 'movie' && tmdb_movie_exists ? '{{ old('tmdb_movie_id', $movieId) }}' : ''"
x-bind:required="cats[cat].type === 'movie' && tmdb_movie_exists"
/>
<label class="form__label form__label--floating" for="auto_tmdb_movie">
TMDB Movie ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'tv'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="tv_exists_on_tmdb"
name="tv_exists_on_tmdb"
value="1"
@checked(old('tv_exists_on_tmdb', true))
x-model="tmdb_tv_exists"
/>
<label class="form__label" for="tv_exists_on_tmdb">
This TV show exists on TMDB
</label>
<output name="apimatch" id="apimatch" for="torrent"></output>
</p>
<p class="form__group">
<input type="hidden" name="tmdb_tv_id" value="0" />
<input
type="text"
name="tmdb_tv_id"
id="auto_tmdb_tv"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
x-bind:value="cats[cat].type === 'tv' && tmdb_tv_exists ? '{{ old('tmdb_tv_id', $tvId) }}' : ''"
x-bind:required="cats[cat].type === 'tv' && tmdb_tv_exists"
/>
<label class="form__label form__label--floating" for="auto_tmdb_tv">
TMDB TV ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div
class="form__group--vertical"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
>
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="title_exists_on_imdb"
name="title_exists_on_imdb"
value="1"
@checked(old('title_exists_on_imdb', true))
x-model="imdb_title_exists"
/>
<label class="form__label" for="title_exists_on_imdb">
This title exists on IMDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="imdb" value="0" />
<input
type="text"
name="imdb"
id="autoimdb"
class="form__text"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
x-bind:value="
(cats[cat].type === 'movie' || cats[cat].type === 'tv') && imdb_title_exists
? '{{ old('imdb', $imdb) }}'
: ''
"
x-bind:required="(cats[cat].type === 'movie' || cats[cat].type === 'tv') && imdb_title_exists"
/>
<label class="form__label form__label--floating" for="autoimdb">
IMDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'tv'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="tv_exists_on_tvdb"
name="tv_exists_on_tvdb"
value="1"
@checked(old('tv_exists_on_tvdb', true))
x-model="tvdb_tv_exists"
/>
<label class="form__label" for="tv_exists_on_tvdb">
This TV show exists on TVDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="tvdb" value="0" />
<input
type="text"
name="tvdb"
id="autotvdb"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
x-bind:value="cats[cat].type === 'tv' && tvdb_tv_exists ? '{{ old('tvdb', $tvdb) }}' : ''"
class="form__text"
x-bind:required="cats[cat].type === 'tv' && tvdb_tv_exists"
/>
<label class="form__label form__label--floating" for="autotvdb">
TVDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div
class="form__group--vertical"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
>
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="anime_exists_on_mal"
name="anime_exists_on_mal"
value="1"
@checked(old('anime_exists_on_mal', true))
x-model="mal_anime_exists"
/>
<label class="form__label" for="anime_exists_on_mal">
This anime exists on MAL
</label>
</p>
<p class="form__group">
<input type="hidden" name="mal" value="0" />
<input
type="text"
name="mal"
id="automal"
inputmode="numeric"
pattern="[0-9]*"
x-bind:value="
(cats[cat].type === 'movie' || cats[cat].type === 'tv') && mal_anime_exists
? '{{ old('mal', $mal) }}'
: ''
"
x-bind:required="(cats[cat].type === 'movie' || cats[cat].type === 'tv') && mal_anime_exists"
class="form__text"
placeholder=" "
/>
<label class="form__label form__label--floating" for="automal">
MAL ID
</label>
<span class="form__hint">
Numeric digits only. Required for anime. Use 0 otherwise.
</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'game'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="game_exists_on_igdb"
name="game_exists_on_igdb"
value="1"
@checked(old('game_exists_on_igdb', true))
x-model="igdb_game_exists"
/>
<label class="form__label" for="game_exists_on_igdb">
This game exists on IGDB
</label>
</p>
<p class="form__group">
<input
type="text"
name="igdb"
id="autoigdb"
inputmode="numeric"
pattern="[0-9]*"
x-bind:value="cats[cat].type === 'game' && igdb_game_exists ? '{{ old('igdb', $igdb) }}' : ''"
class="form__text"
x-bind:required="cats[cat].type === 'game' && igdb_game_exists"
/>
<label class="form__label form__label--floating" for="autoigdb">
IGDB ID
<b>({{ __('torrent.required-games') }})</b>
</label>
</p>
</div>
</div>
<p class="form__group" x-show="cats[cat].type === 'game'">
<input
type="text"
name="igdb"
id="autoigdb"
inputmode="numeric"
pattern="[0-9]*"
x-bind:value="cats[cat].type === 'game' ? '{{ $igdb ?: old('igdb') }}' : '0'"
class="form__text"
x-bind:required="cats[cat].type === 'game'"
/>
<label class="form__label form__label--floating" for="autoigdb">
IGDB ID
<b>({{ __('torrent.required-games') }})</b>
</label>
</p>
<p class="form__group">
<input
type="text"
+233 -108
View File
@@ -24,6 +24,13 @@
cats: JSON.parse(atob('{{ base64_encode(json_encode($categories)) }}')),
type: {{ (int) $torrent->type_id }},
types: JSON.parse(atob('{{ base64_encode(json_encode($types)) }}')),
tmdb_movie_exists:
{{ Js::from(old('movie_exists_on_tmdb', $torrent->tmdb_movie_id) !== null) }},
tmdb_tv_exists: {{ Js::from(old('tv_exists_on_tmdb', $torrent->tmdb_tv_id) !== null) }},
imdb_title_exists: {{ Js::from(old('title_exists_on_imdb', $torrent->imdb) !== null) }},
tvdb_tv_exists: {{ Js::from(old('tv_exists_on_tvdb', $torrent->tvdb) !== null) }},
mal_anime_exists: {{ Js::from(old('anime_exists_on_mal', $torrent->mal) !== null) }},
igdb_game_exists: {{ Js::from(old('game_exists_on_igdb', $torrent->igdb_game_id) !== null) }},
}"
>
<h2 class="panel__heading">{{ __('common.edit') }}: {{ $torrent->name }}</h2>
@@ -264,118 +271,236 @@
</div>
<div
class="form__group--horizontal"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv' || cats[cat].type === 'game'"
>
<p class="form__group" x-show="cats[cat].type === 'movie'">
<input type="hidden" name="tmdb_movie_id" value="0" />
<input
id="tmdb_movie_id"
class="form__text"
inputmode="numeric"
name="tmdb_movie_id"
pattern="[0-9]*"
type="text"
value="{{ old('tmdb_movie_id') ?? $torrent->tmdb_movie_id }}"
x-bind:value="cats[cat].type === 'movie' ? '{{ old('tmdb_movie_id') ?? $torrent->tmdb_movie_id }}' : '0'"
x-bind:required="cats[cat].type === 'movie'"
/>
<label class="form__label form__label--floating" for="tmdb_movie_id">
TMDB Movie ID
<b>({{ __('common.required') }})</b>
</label>
</p>
<p class="form__group" x-show="cats[cat].type === 'tv'">
<input type="hidden" name="tmdb_tv_id" value="0" />
<input
id="tmdb_tv_id"
class="form__text"
inputmode="numeric"
name="tmdb_tv_id"
pattern="[0-9]*"
type="text"
value="{{ old('tmdb_tv_id') ?? $torrent->tmdb_tv_id }}"
x-bind:value="cats[cat].type === 'tv' ? '{{ old('tmdb_tv_id') ?? $torrent->tmdb_tv_id }}' : '0'"
x-bind:required="cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="tmdb_tv_id">
TMDB TV ID
<b>({{ __('common.required') }})</b>
</label>
</p>
<p
class="form__group"
<div class="form__group--vertical" x-show="cats[cat].type === 'movie'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="movie_exists_on_tmdb"
name="movie_exists_on_tmdb"
value="1"
@checked(old('movie_exists_on_tmdb', true))
x-model="tmdb_movie_exists"
/>
<label class="form__label" for="movie_exists_on_tmdb">
This movie exists on TMDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="tmdb_movie_id" value="0" />
<input
id="tmdb_movie_id"
class="form__text"
inputmode="numeric"
name="tmdb_movie_id"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ old('tmdb_movie_id', $torrent->tmdb_movie_id) }}"
x-bind:value="
cats[cat].type === 'movie' && tmdb_movie_exists
? '{{ old('tmdb_movie_id', $torrent->tmdb_movie_id) }}'
: ''
"
x-bind:required="cats[cat].type === 'movie' && tmdb_movie_exists"
/>
<label class="form__label form__label--floating" for="tmdb_movie_id">
TMDB Movie ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'tv'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="tv_exists_on_tmdb"
name="tv_exists_on_tmdb"
value="1"
@checked(old('tv_exists_on_tmdb', true))
x-model="tmdb_tv_exists"
/>
<label class="form__label" for="tv_exists_on_tmdb">
This TV show exists on TMDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="tmdb_tv_id" value="0" />
<input
id="tmdb_tv_id"
class="form__text"
inputmode="numeric"
name="tmdb_tv_id"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ old('tmdb_tv_id', $torrent->tmdb_tv_id) }}"
x-bind:value="cats[cat].type === 'tv' && tmdb_tv_exists ? '{{ old('tmdb_tv_id', $torrent->tmdb_tv_id) }}' : ''"
x-bind:required="cats[cat].type === 'tv' && tmdb_tv_exists"
/>
<label class="form__label form__label--floating" for="tmdb_tv_id">
TMDB TV ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div
class="form__group--vertical"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
>
<input type="hidden" name="imdb" value="0" />
<input
id="imdb"
class="form__text"
inputmode="numeric"
name="imdb"
pattern="[0-9]*"
type="text"
value="{{ old('imdb') ?? $torrent->imdb }}"
x-bind:value="
cats[cat].type === 'movie' || cats[cat].type === 'tv'
? '{{ old('imdb') ?? $torrent->imdb }}'
: '0'
"
x-bind:required="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="imdb">IMDB ID</label>
</p>
<p class="form__group" x-show="cats[cat].type === 'tv'">
<input type="hidden" name="tvdb" value="0" />
<input
id="tvdb"
class="form__text"
inputmode="numeric"
name="tvdb"
pattern="[0-9]*"
type="text"
value="{{ old('tvdb') ?? $torrent->tvdb }}"
x-bind:value="cats[cat].type === 'tv' ? '{{ old('tvdb') ?? $torrent->tvdb }}' : '0'"
x-bind:required="cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="tvdb">TVDB ID</label>
</p>
<p class="form__group">
<input type="hidden" name="mal" value="0" />
<input
id="mal"
class="form__text"
inputmode="numeric"
name="mal"
pattern="[0-9]*"
type="text"
value="{{ old('mal') ?? $torrent->mal }}"
x-bind:value="cats[cat].type === 'movie' || cats[cat].type === 'tv' ? '{{ old('mal') ?? $torrent->mal }}' : '0'"
x-bind:required="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
/>
<label class="form__label form__label--floating" for="mal">
MAL ID
<b>({{ __('request.required') }} For Anime)</b>
</label>
</p>
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="title_exists_on_imdb"
name="title_exists_on_imdb"
value="1"
@checked(old('title_exists_on_imdb', true))
x-model="imdb_title_exists"
/>
<label class="form__label" for="title_exists_on_imdb">
This title exists on IMDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="imdb" value="0" />
<input
id="imdb"
class="form__text"
inputmode="numeric"
name="imdb"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ old('imdb', $torrent->imdb) }}"
x-bind:value="
(cats[cat].type === 'movie' || cats[cat].type === 'tv') && imdb_title_exists
? '{{ old('imdb', $torrent->imdb) }}'
: ''
"
x-bind:required="(cats[cat].type === 'movie' || cats[cat].type === 'tv') && imdb_title_exists"
/>
<label class="form__label form__label--floating" for="imdb">
IMDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'tv'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="tv_exists_on_tvdb"
name="tv_exists_on_tvdb"
value="1"
@checked(old('tv_exists_on_tvdb', true))
x-model="tvdb_tv_exists"
/>
<label class="form__label" for="tv_exists_on_tvdb">
This TV show exists on TVDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="tvdb" value="0" />
<input
id="tvdb"
class="form__text"
inputmode="numeric"
name="tvdb"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ old('tvdb', $torrent->tvdb) }}"
x-bind:value="cats[cat].type === 'tv' && tvdb_tv_exists ? '{{ old('tvdb', $torrent->tvdb) }}' : ''"
x-bind:required="cats[cat].type === 'tv' && tvdb_tv_exists"
/>
<label class="form__label form__label--floating" for="tvdb">
TVDB ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div
class="form__group--vertical"
x-show="cats[cat].type === 'movie' || cats[cat].type === 'tv'"
>
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="anime_exists_on_mal"
name="anime_exists_on_mal"
value="1"
@checked(old('anime_exists_on_mal', true))
x-model="mal_anime_exists"
/>
<label class="form__label" for="anime_exists_on_mal">
This anime exists on MAL
</label>
</p>
<p class="form__group">
<input type="hidden" name="mal" value="0" />
<input
id="mal"
class="form__text"
inputmode="numeric"
name="mal"
pattern="[0-9]*"
placeholder=" "
type="text"
value="{{ old('mal', $torrent->mal) }}"
x-bind:value="
(cats[cat].type === 'movie' || cats[cat].type === 'tv') && mal_anime_exists
? '{{ old('mal', $torrent->mal) }}'
: ''
"
x-bind:required="(cats[cat].type === 'movie' || cats[cat].type === 'tv') && mal_anime_exists"
/>
<label class="form__label form__label--floating" for="mal">
MAL ID
</label>
<span class="form__hint">Numeric digits only.</span>
</p>
</div>
<div class="form__group--vertical" x-show="cats[cat].type === 'game'">
<p class="form__group">
<input
type="checkbox"
class="form__checkbox"
id="game_exists_on_igdb"
name="game_exists_on_igdb"
value="1"
@checked(old('game_exists_on_igdb', true))
x-model="igdb_game_exists"
/>
<label class="form__label" for="game_exists_on_igdb">
This game exists on IGDB
</label>
</p>
<p class="form__group">
<input type="hidden" name="igdb" value="0" />
<input
id="igdb"
class="form__text"
name="igdb"
type="text"
value="{{ old('igdb', $torrent->igdb) }}"
inputmode="numeric"
pattern="[0-9]*"
placeholder=" "
x-bind:value="cats[cat].type === 'game' && igdb_game_exists ? '{{ old('igdb', $torrent->igdb) }}' : ''"
x-bind:required="cats[cat].type === 'game' && igdb_game_exists"
/>
<label class="form__label form__label--floating" for="igdb">
IGDB ID
</label>
</p>
</div>
</div>
<p class="form__group" x-show="cats[cat].type === 'game'">
<input type="hidden" name="igdb" value="0" />
<input
id="igdb"
class="form__text"
name="igdb"
type="text"
value="{{ old('igdb') ?? $torrent->igdb }}"
inputmode="numeric"
pattern="[0-9]*"
x-bind:value="cats[cat].type === 'game' ? '{{ old('igdb') ?? $torrent->igdb }}' : '0'"
x-bind:required="cats[cat].type === 'game'"
/>
<label class="form__label form__label--floating" for="igdb">
IGDB ID
<b>{{ __('request.required') }} For Games)</b>
</label>
</p>
<p class="form__group">
<input
id="keywords"
@@ -9,7 +9,7 @@
<a
class="meta__title-link"
href="{{ route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $igdb]) }}"
href="{{ $igdb ? route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $igdb]) : '#' }}"
>
<h1 class="meta__title">
{{ $meta->name ?? 'No Meta Found' }}
@@ -18,7 +18,7 @@
</a>
<a
class="meta__poster-link"
href="{{ route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $igdb]) }}"
href="{{ $igdb ? route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $igdb]) : '#' }}"
>
<img
src="{{ $meta?->cover_image_id ? 'https://images.igdb.com/igdb/image/upload/t_original/' . $meta->cover_image_id . '.jpg' : 'https://via.placeholder.com/400x600' }}"
@@ -5,7 +5,7 @@
<a
class="meta__title-link"
href="{{ route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $tmdb]) }}"
href="{{ $tmdb ? route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $tmdb]) : '#' }}"
>
<h1 class="meta__title">
{{ $meta->title ?? 'No Meta Found' }}
@@ -14,7 +14,7 @@
</a>
<a
class="meta__poster-link"
href="{{ route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $tmdb]) }}"
href="{{ $tmdb ? route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $tmdb]) : '#' }}"
>
<img
src="{{ $meta?->poster ? tmdb_image('poster_big', $meta->poster) : 'https://via.placeholder.com/400x600' }}"
@@ -5,7 +5,7 @@
<a
class="meta__title-link"
href="{{ route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $tmdb]) }}"
href="{{ $tmdb ? route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $tmdb]) : '#' }}"
>
<h1 class="meta__title">
{{ $meta->name ?? 'No Meta Found' }}
@@ -14,7 +14,7 @@
</a>
<a
class="meta__poster-link"
href="{{ route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $tmdb]) }}"
href="{{ $tmdb ? route('torrents.similar', ['category_id' => $category->id, 'tmdb' => $tmdb]) : '#' }}"
>
<img
src="{{ $meta?->poster ? tmdb_image('poster_big', $meta->poster) : 'https://via.placeholder.com/400x600' }}"
@@ -78,12 +78,6 @@ test('messages', function (): void {
$actual = $this->subject->messages();
expect($actual)->toEqual([
'igdb.in' => 'The IGDB ID must be 0 if the media doesn\'t exist on IGDB or you\'re not requesting a game.',
'tmdb_movie_id.in' => 'The TMDB ID must be 0 if the media doesn\'t exist on TMDB or you\'re not requesting a tv show or movie.',
'tmdb_tv_id.in' => 'The TMDB ID must be 0 if the media doesn\'t exist on TMDB or you\'re not requesting a tv show or movie.',
'imdb.in' => 'The IMDB ID must be 0 if the media doesn\'t exist on IMDB or you\'re not requesting a tv show or movie.',
'tvdb.in' => 'The TVDB ID must be 0 if the media doesn\'t exist on TVDB or you\'re not requesting a tv show.',
'mal.in' => 'The MAL ID must be 0 if the media doesn\'t exist on MAL or you\'re not requesting a tv or movie.',
'bounty.max' => 'You do not have enough BON to make this request.',
'bounty.max' => 'You do not have enough BON to make this request.',
]);
});
@@ -114,16 +114,3 @@ test('rules', function (): void {
],
], $actual);
});
test('messages', function (): void {
$actual = $this->subject->messages();
expect($actual)->toEqual([
'igdb.in' => "The IGDB ID must be 0 if the media doesn't exist on IGDB or you're not uploading a game.",
'tmdb_movie_id.in' => "The TMDB ID must be 0 if the media doesn't exist on TMDB or you're not uploading a tv show or movie.",
'tmdb_tv_id.in' => "The TMDB ID must be 0 if the media doesn't exist on TMDB or you're not uploading a tv show or movie.",
'imdb.in' => "The IMDB ID must be 0 if the media doesn't exist on IMDB or you're not uploading a tv show or movie.",
'tvdb.in' => "The TVDB ID must be 0 if the media doesn't exist on TVDB or you're not uploading a tv show.",
'mal.in' => "The MAL ID must be 0 if the media doesn't exist on MAL or you're not uploading a tv or movie.",
]);
});