Skip to content

Commit e5e501e

Browse files
authored
Merge pull request #4531 from Roardom/stream-sd
(Remove) SD content and stream optimized flags
2 parents c5b3004 + 59fec6a commit e5e501e

File tree

107 files changed

+55
-553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+55
-553
lines changed

app/DTO/TorrentSearchFiltersDTO.php

-12
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ public function __construct(
7070
private bool $doubleup = false,
7171
private bool $featured = false,
7272
private bool $refundable = false,
73-
private bool $stream = false,
74-
private bool $sd = false,
7573
private bool $highspeed = false,
7674
private bool $internal = false,
7775
private bool $trumpable = false,
@@ -353,8 +351,6 @@ final public function toSqlQueryBuilder(): Closure
353351
)
354352
->when($this->featured, fn ($query) => $query->has('featured'))
355353
->when($this->refundable, fn ($query) => $query->where('refundable', '=', true))
356-
->when($this->stream, fn ($query) => $query->where('stream', '=', 1))
357-
->when($this->sd, fn ($query) => $query->where('sd', '=', 1))
358354
->when($this->highspeed, fn ($query) => $query->where('highspeed', '=', 1))
359355
->when($this->userBookmarked, fn ($query) => $query->whereRelation('bookmarks', 'user_id', '=', $this->user->id))
360356
->when($this->userWished, fn ($query) => $query->whereIn('tmdb', Wish::select('tmdb')->where('user_id', '=', $this->user->id)))
@@ -583,14 +579,6 @@ final public function toMeilisearchFilter(): array
583579
$filters[] = 'refundable = true';
584580
}
585581

586-
if ($this->stream) {
587-
$filters[] = 'stream = true';
588-
}
589-
590-
if ($this->sd) {
591-
$filters[] = 'sd = true';
592-
}
593-
594582
if ($this->highspeed) {
595583
$filters[] = 'highspeed = true';
596584
}

app/Http/Controllers/API/TorrentController.php

-10
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ public function store(Request $request): \Illuminate\Http\JsonResponse
166166
$torrent->season_number = $request->input('season_number');
167167
$torrent->episode_number = $request->input('episode_number');
168168
$torrent->anon = $request->input('anonymous');
169-
$torrent->stream = $request->input('stream');
170-
$torrent->sd = $request->input('sd');
171169
$torrent->personal_release = $request->input('personal_release') ?? false;
172170

173171
/** @phpstan-ignore property.notFound (Larastan doesn't yet support loadExists()) */
@@ -287,12 +285,6 @@ public function store(Request $request): \Illuminate\Http\JsonResponse
287285
'anon' => [
288286
'required',
289287
],
290-
'stream' => [
291-
'required',
292-
],
293-
'sd' => [
294-
'required',
295-
],
296288
'personal_release' => [
297289
'nullable',
298290
],
@@ -567,8 +559,6 @@ public function filter(Request $request): TorrentsResource|\Illuminate\Http\Json
567559
doubleup: $request->filled('doubleup'),
568560
refundable: $request->filled('refundable'),
569561
featured: $request->filled('featured'),
570-
stream: $request->filled('stream'),
571-
sd: $request->filled('sd'),
572562
highspeed: $request->filled('highspeed'),
573563
internal: $request->filled('internal'),
574564
personalRelease: $request->filled('personalRelease'),

app/Http/Controllers/RssController.php

-6
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ public function store(Request $request): \Illuminate\Http\RedirectResponse|\Illu
9898
'freeleech',
9999
'doubleupload',
100100
'featured',
101-
'stream',
102101
'highspeed',
103-
'sd',
104102
'internal',
105103
'personalrelease',
106104
'bookmark',
@@ -170,8 +168,6 @@ public function show(int $id, string $rsskey): \Illuminate\Http\Response
170168
free: $search->freeleech === null ? [] : [25, 50, 75, 100],
171169
doubleup: (bool) ($search->doubleupload ?? false),
172170
featured: (bool) ($search->featured ?? false),
173-
stream: (bool) ($search->stream ?? false),
174-
sd: (bool) ($search->sd ?? false),
175171
highspeed: (bool) ($search->highspeed ?? false),
176172
userBookmarked: (bool) ($search->bookmark ?? false),
177173
internal: (bool) ($search->internal ?? false),
@@ -271,9 +267,7 @@ public function update(Request $request, int $id): \Illuminate\Http\RedirectResp
271267
'freeleech',
272268
'doubleupload',
273269
'featured',
274-
'stream',
275270
'highspeed',
276-
'sd',
277271
'internal',
278272
'personalrelease',
279273
'bookmark',

app/Http/Livewire/PersonCredit.php

-2
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,10 @@ final public function medias(): \Illuminate\Support\Collection
169169
'season_number',
170170
'episode_number',
171171
'tmdb',
172-
'stream',
173172
'free',
174173
'doubleup',
175174
'highspeed',
176175
'sticky',
177-
'sd',
178176
'internal',
179177
'created_at',
180178
'bumped_at',

app/Http/Livewire/SimilarTorrent.php

-8
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ class SimilarTorrent extends Component
131131
#[Url(history: true)]
132132
public bool $refundable = false;
133133

134-
#[Url(history: true)]
135-
public bool $stream = false;
136-
137-
#[Url(history: true)]
138-
public bool $sd = false;
139-
140134
#[Url(history: true)]
141135
public bool $highspeed = false;
142136

@@ -310,8 +304,6 @@ final public function torrents(): \Illuminate\Support\Collection
310304
internal: $this->internal,
311305
personalRelease: $this->personalRelease,
312306
trumpable: $this->trumpable,
313-
stream: $this->stream,
314-
sd: $this->sd,
315307
highspeed: $this->highspeed,
316308
userBookmarked: $this->bookmarked,
317309
userWished: $this->wished,

app/Http/Livewire/Stats/TorrentStats.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
namespace App\Http\Livewire\Stats;
1818

1919
use App\Models\Category;
20+
use App\Models\Resolution;
2021
use App\Models\Torrent;
2122
use Livewire\Attributes\Computed;
2223
use Livewire\Attributes\Lazy;
@@ -31,10 +32,13 @@ final public function totalCount(): int
3132
return Torrent::query()->count();
3233
}
3334

35+
/**
36+
* @return \Illuminate\Database\Eloquent\Collection<int, Resolution>
37+
*/
3438
#[Computed(cache: true, seconds: 10 * 60)]
35-
final public function sdCount(): int
39+
final public function resolutions(): \Illuminate\Database\Eloquent\Collection
3640
{
37-
return Torrent::query()->where('sd', '=', 1)->count();
41+
return Resolution::query()->withCount('torrents')->orderBy('position')->get();
3842
}
3943

4044
/**
@@ -67,8 +71,7 @@ final public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\C
6771
return view('livewire.stats.torrent-stats', [
6872
'num_torrent' => $this->totalCount,
6973
'categories' => $this->categories,
70-
'num_hd' => $this->totalCount - $this->sdCount,
71-
'num_sd' => $this->sdCount,
74+
'resolutions' => $this->resolutions,
7275
'torrent_size' => $this->sizeSum,
7376
]);
7477
}

app/Http/Livewire/TorrentSearch.php

-10
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,6 @@ class TorrentSearch extends Component
170170
#[Url(history: true)]
171171
public bool $refundable = false;
172172

173-
#[Url(history: true)]
174-
public bool $stream = false;
175-
176-
#[Url(history: true)]
177-
public bool $sd = false;
178-
179173
#[Url(history: true)]
180174
public bool $highspeed = false;
181175

@@ -378,8 +372,6 @@ final public function filters(): TorrentSearchFiltersDTO
378372
doubleup: $this->doubleup,
379373
featured: $this->featured,
380374
refundable: $this->refundable,
381-
stream: $this->stream,
382-
sd: $this->sd,
383375
highspeed: $this->highspeed,
384376
internal: $this->internal,
385377
trumpable: $this->trumpable,
@@ -600,12 +592,10 @@ final public function groupedTorrents()
600592
'season_number',
601593
'episode_number',
602594
'tmdb',
603-
'stream',
604595
'free',
605596
'doubleup',
606597
'highspeed',
607598
'sticky',
608-
'sd',
609599
'internal',
610600
'created_at',
611601
'bumped_at',

app/Http/Requests/Staff/StoreRssRequest.php

-8
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,10 @@ public function rules(): array
123123
'sometimes',
124124
'boolean',
125125
],
126-
'stream' => [
127-
'sometimes',
128-
'boolean',
129-
],
130126
'highspeed' => [
131127
'sometimes',
132128
'boolean',
133129
],
134-
'sd' => [
135-
'sometimes',
136-
'boolean',
137-
],
138130
'internal' => [
139131
'sometimes',
140132
'boolean',

app/Http/Requests/Staff/UpdateRssRequest.php

-8
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,10 @@ public function rules(): array
123123
'sometimes',
124124
'boolean',
125125
],
126-
'stream' => [
127-
'sometimes',
128-
'boolean',
129-
],
130126
'highspeed' => [
131127
'sometimes',
132128
'boolean',
133129
],
134-
'sd' => [
135-
'sometimes',
136-
'boolean',
137-
],
138130
'internal' => [
139131
'sometimes',
140132
'boolean',

app/Http/Requests/StoreTorrentRequest.php

-8
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,6 @@ function (string $attribute, mixed $value, Closure $fail): void {
209209
'required',
210210
'boolean',
211211
],
212-
'stream' => [
213-
'required',
214-
'boolean',
215-
],
216-
'sd' => [
217-
'required',
218-
'boolean',
219-
],
220212
'personal_release' => [
221213
'required',
222214
'boolean',

app/Http/Requests/UpdateTorrentRequest.php

-8
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,6 @@ public function rules(Request $request): array
132132
Rule::requiredIf($torrent->user_id === $user->id || $user->group->is_modo),
133133
Rule::excludeIf(!($torrent->user_id === $user->id || $user->group->is_modo)),
134134
],
135-
'stream' => [
136-
'required',
137-
'boolean',
138-
],
139-
'sd' => [
140-
'required',
141-
'boolean',
142-
],
143135
'personal_release' => [
144136
'sometimes',
145137
'boolean',

app/Models/Rss.php

-2
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ public function getExpectedFieldsAttribute(): array
133133
'freeleech' => null,
134134
'doubleupload' => null,
135135
'featured' => null,
136-
'stream' => null,
137136
'highspeed' => null,
138-
'sd' => null,
139137
'internal' => null,
140138
'personalrelease' => null,
141139
'bookmark' => null,

app/Models/Torrent.php

-8
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
* @property int $igdb
5656
* @property int|null $season_number
5757
* @property int|null $episode_number
58-
* @property int $stream
5958
* @property int $free
6059
* @property bool $doubleup
6160
* @property bool $refundable
@@ -65,7 +64,6 @@
6564
* @property int|null $moderated_by
6665
* @property bool $anon
6766
* @property bool $sticky
68-
* @property int $sd
6967
* @property int $internal
7068
* @property \Illuminate\Support\Carbon|null $created_at
7169
* @property \Illuminate\Support\Carbon|null $updated_at
@@ -168,15 +166,13 @@ protected function casts(): array
168166
torrents.igdb,
169167
torrents.season_number,
170168
torrents.episode_number,
171-
torrents.stream,
172169
torrents.free,
173170
torrents.doubleup,
174171
torrents.refundable,
175172
torrents.highspeed,
176173
torrents.status,
177174
torrents.anon,
178175
torrents.sticky,
179-
torrents.sd,
180176
torrents.internal,
181177
UNIX_TIMESTAMP(torrents.deleted_at) AS deleted_at,
182178
torrents.distributor_id,
@@ -846,7 +842,6 @@ public function toSearchableArray(): array
846842
'igdb',
847843
'season_number',
848844
'episode_number',
849-
'stream',
850845
'free',
851846
'doubleup',
852847
'refundable',
@@ -855,7 +850,6 @@ public function toSearchableArray(): array
855850
'status',
856851
'anon',
857852
'sticky',
858-
'sd',
859853
'internal',
860854
'deleted_at',
861855
'distributor_id',
@@ -918,7 +912,6 @@ public function toSearchableArray(): array
918912
'igdb' => $torrent->igdb,
919913
'season_number' => $torrent->season_number,
920914
'episode_number' => $torrent->episode_number,
921-
'stream' => (bool) $torrent->stream,
922915
'free' => $torrent->free,
923916
'doubleup' => (bool) $torrent->doubleup,
924917
'refundable' => (bool) $torrent->refundable,
@@ -927,7 +920,6 @@ public function toSearchableArray(): array
927920
'status' => $torrent->status->value,
928921
'anon' => (bool) $torrent->anon,
929922
'sticky' => (int) $torrent->sticky,
930-
'sd' => (bool) $torrent->sd,
931923
'internal' => (bool) $torrent->internal,
932924
'deleted_at' => $torrent->deleted_at?->timestamp,
933925
'distributor_id' => $torrent->distributor_id,

config/scout.php

-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@
165165
'igdb',
166166
'season_number',
167167
'episode_number',
168-
'stream',
169168
'free',
170169
'doubleup',
171170
'refundable',
@@ -174,7 +173,6 @@
174173
'status',
175174
'anon',
176175
'sticky',
177-
'sd',
178176
'internal',
179177
'deleted_at',
180178
'personal_release',

database/factories/TorrentFactory.php

-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public function definition(): array
6161
'igdb' => $this->faker->randomNumber(),
6262
'type_id' => fn () => Type::factory()->create()->id,
6363
'resolution_id' => fn () => Resolution::factory()->create()->id,
64-
'stream' => $this->faker->boolean(),
6564
'free' => $freeleech[$selected],
6665
'doubleup' => $this->faker->boolean(),
6766
'highspeed' => $this->faker->boolean(),
@@ -70,7 +69,6 @@ public function definition(): array
7069
'moderated_by' => 1,
7170
'anon' => $this->faker->boolean(),
7271
'sticky' => $this->faker->boolean(),
73-
'sd' => $this->faker->boolean(),
7472
'internal' => $this->faker->boolean(),
7573
];
7674
}

0 commit comments

Comments
 (0)