mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Add Music podcast category
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Blacklight;
|
||||
use App\Models\Category;
|
||||
use App\Models\Settings;
|
||||
use App\Models\UsenetGroup;
|
||||
use Elastic\Elasticsearch\Endpoints\Cat;
|
||||
|
||||
/**
|
||||
* Categorizing of releases by name/group.
|
||||
@@ -116,6 +117,10 @@ class Categorize
|
||||
$this->tmpCat = Category::XXX_OTHER;
|
||||
$this->tmpTag[] = Category::TAG_XXX_OTHER;
|
||||
break;
|
||||
case preg_match('/alt\.binaries\.podcast$/i', $groupName):
|
||||
$this->tmpCat = Category::MUSIC_PODCAST;
|
||||
$this->tmpTag = Category::TAG_MUSIC_PODCAST;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -1178,7 +1183,7 @@ class Categorize
|
||||
public function isMusic(): bool
|
||||
{
|
||||
return match (true) {
|
||||
$this->isMusicVideo(), $this->isAudiobook(), $this->isMusicLossless(), $this->isMusicMP3(), $this->isMusicOther() => true,
|
||||
$this->isMusicVideo(), $this->isAudiobook(), $this->isMusicLossless(), $this->isMusicMP3(), $this->isMusicPodcast(),$this->isMusicOther() => true,
|
||||
default => false,
|
||||
};
|
||||
}
|
||||
@@ -1318,6 +1323,19 @@ class Categorize
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isMusicPodcast(): bool
|
||||
{
|
||||
if (preg_match('/podcast/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::MUSIC_PODCAST;
|
||||
$this->tmpTag[] = Category::TAG_MUSIC_PODCAST;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Books.
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,6 +74,7 @@ class Category extends Model
|
||||
public const MUSIC_VIDEO = 3020;
|
||||
public const MUSIC_AUDIOBOOK = 3030;
|
||||
public const MUSIC_LOSSLESS = 3040;
|
||||
public const MUSIC_PODCAST = 3050;
|
||||
public const MUSIC_OTHER = 3999;
|
||||
public const MUSIC_FOREIGN = 3060;
|
||||
public const PC_0DAY = 4010;
|
||||
@@ -200,6 +201,7 @@ class Category extends Model
|
||||
public const TAG_MUSIC_VIDEO = 'Music_Video';
|
||||
public const TAG_MUSIC_AUDIOBOOK = 'Music_Audio_Book';
|
||||
public const TAG_MUSIC_LOSSLESS = 'Music_LossLess';
|
||||
public const TAG_MUSIC_PODCAST = 'Music_Podcast';
|
||||
public const TAG_MUSIC_OTHER = 'Music_Other';
|
||||
public const TAG_MUSIC_FOREIGN = 'Music_Foreign';
|
||||
public const TAG_PC_0DAY = 'Pc_0Day';
|
||||
@@ -488,7 +490,7 @@ class Category extends Model
|
||||
*
|
||||
* @param $id
|
||||
* @param $status
|
||||
* @param $desc->update
|
||||
* @param $desc
|
||||
* @param $disablepreview
|
||||
* @param $minsize
|
||||
* @param $maxsize
|
||||
@@ -551,10 +553,10 @@ class Category extends Model
|
||||
/**
|
||||
* Return a list of categories for use in a dropdown.
|
||||
*
|
||||
* @param bool $blnIncludeNoneSelected
|
||||
* @param bool $blnIncludeNoneSelected
|
||||
* @return array
|
||||
*/
|
||||
public static function getForSelect($blnIncludeNoneSelected = true): array
|
||||
public static function getForSelect(bool $blnIncludeNoneSelected = true): array
|
||||
{
|
||||
$categories = self::getCategories();
|
||||
$temp_array = [];
|
||||
@@ -570,11 +572,11 @@ class Category extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $activeOnly
|
||||
* @param array $excludedCats
|
||||
* @return array
|
||||
* @param bool $activeOnly
|
||||
* @param array $excludedCats
|
||||
* @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public static function getCategories($activeOnly = false, array $excludedCats = [])
|
||||
public static function getCategories(bool $activeOnly = false, array $excludedCats = []): \Illuminate\Database\Eloquent\Collection|array
|
||||
{
|
||||
$sql = self::query()
|
||||
->with('parent')
|
||||
|
||||
@@ -671,4 +671,14 @@ return [
|
||||
'minsizetoformrelease' => 0,
|
||||
'maxsizetoformrelease' => 0,
|
||||
],
|
||||
75 => [
|
||||
'id' => 3050,
|
||||
'title' => 'Podcast',
|
||||
'root_categories_id' => 3000,
|
||||
'status' => 1,
|
||||
'description' => null,
|
||||
'disablepreview' => 0,
|
||||
'minsizetoformrelease' => 0,
|
||||
'maxsizetoformrelease' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -689,6 +689,16 @@ class CategoriesTableSeeder extends Seeder
|
||||
'minsizetoformrelease' => 0,
|
||||
'maxsizetoformrelease' => 0,
|
||||
],
|
||||
75 => [
|
||||
'id' => 3050,
|
||||
'title' => 'Podcast',
|
||||
'root_categories_id' => 3000,
|
||||
'status' => 1,
|
||||
'description' => null,
|
||||
'disablepreview' => 0,
|
||||
'minsizetoformrelease' => 0,
|
||||
'maxsizetoformrelease' => 0,
|
||||
],
|
||||
]);
|
||||
|
||||
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
|
||||
|
||||
Reference in New Issue
Block a user