chore: code reorganization
This commit is contained in:
260
src/User/Database/CountryCodes.php
Normal file
260
src/User/Database/CountryCodes.php
Normal file
@@ -0,0 +1,260 @@
|
||||
<?php
|
||||
|
||||
namespace App\User\Database;
|
||||
|
||||
class CountryCodes
|
||||
{
|
||||
static $countries = [
|
||||
'AF' => 'Afghanistan',
|
||||
'AX' => 'Aland Islands',
|
||||
'AL' => 'Albania',
|
||||
'DZ' => 'Algeria',
|
||||
'AS' => 'American Samoa',
|
||||
'AD' => 'Andorra',
|
||||
'AO' => 'Angola',
|
||||
'AI' => 'Anguilla',
|
||||
'AQ' => 'Antarctica',
|
||||
'AG' => 'Antigua and Barbuda',
|
||||
'AR' => 'Argentina',
|
||||
'AM' => 'Armenia',
|
||||
'AW' => 'Aruba',
|
||||
'AU' => 'Australia',
|
||||
'AT' => 'Austria',
|
||||
'AZ' => 'Azerbaijan',
|
||||
'BS' => 'Bahamas the',
|
||||
'BH' => 'Bahrain',
|
||||
'BD' => 'Bangladesh',
|
||||
'BB' => 'Barbados',
|
||||
'BY' => 'Belarus',
|
||||
'BE' => 'Belgium',
|
||||
'BZ' => 'Belize',
|
||||
'BJ' => 'Benin',
|
||||
'BM' => 'Bermuda',
|
||||
'BT' => 'Bhutan',
|
||||
'BO' => 'Bolivia',
|
||||
'BA' => 'Bosnia and Herzegovina',
|
||||
'BW' => 'Botswana',
|
||||
'BV' => 'Bouvet Island (Bouvetoya)',
|
||||
'BR' => 'Brazil',
|
||||
'IO' => 'British Indian Ocean Territory (Chagos Archipelago)',
|
||||
'VG' => 'British Virgin Islands',
|
||||
'BN' => 'Brunei Darussalam',
|
||||
'BG' => 'Bulgaria',
|
||||
'BF' => 'Burkina Faso',
|
||||
'BI' => 'Burundi',
|
||||
'KH' => 'Cambodia',
|
||||
'CM' => 'Cameroon',
|
||||
'CA' => 'Canada',
|
||||
'CV' => 'Cape Verde',
|
||||
'KY' => 'Cayman Islands',
|
||||
'CF' => 'Central African Republic',
|
||||
'TD' => 'Chad',
|
||||
'CL' => 'Chile',
|
||||
'CN' => 'China',
|
||||
'CX' => 'Christmas Island',
|
||||
'CC' => 'Cocos (Keeling) Islands',
|
||||
'CO' => 'Colombia',
|
||||
'KM' => 'Comoros the',
|
||||
'CD' => 'Congo',
|
||||
'CG' => 'Congo the',
|
||||
'CK' => 'Cook Islands',
|
||||
'CR' => 'Costa Rica',
|
||||
'CI' => 'Cote d\'Ivoire',
|
||||
'HR' => 'Croatia',
|
||||
'CU' => 'Cuba',
|
||||
'CY' => 'Cyprus',
|
||||
'CZ' => 'Czech Republic',
|
||||
'DK' => 'Denmark',
|
||||
'DJ' => 'Djibouti',
|
||||
'DM' => 'Dominica',
|
||||
'DO' => 'Dominican Republic',
|
||||
'EC' => 'Ecuador',
|
||||
'EG' => 'Egypt',
|
||||
'SV' => 'El Salvador',
|
||||
'GQ' => 'Equatorial Guinea',
|
||||
'ER' => 'Eritrea',
|
||||
'EE' => 'Estonia',
|
||||
'ET' => 'Ethiopia',
|
||||
'FO' => 'Faroe Islands',
|
||||
'FK' => 'Falkland Islands (Malvinas)',
|
||||
'FJ' => 'Fiji the Fiji Islands',
|
||||
'FI' => 'Finland',
|
||||
'FR' => 'France, French Republic',
|
||||
'GF' => 'French Guiana',
|
||||
'PF' => 'French Polynesia',
|
||||
'TF' => 'French Southern Territories',
|
||||
'GA' => 'Gabon',
|
||||
'GM' => 'Gambia the',
|
||||
'GE' => 'Georgia',
|
||||
'DE' => 'Germany',
|
||||
'GH' => 'Ghana',
|
||||
'GI' => 'Gibraltar',
|
||||
'GR' => 'Greece',
|
||||
'GL' => 'Greenland',
|
||||
'GD' => 'Grenada',
|
||||
'GP' => 'Guadeloupe',
|
||||
'GU' => 'Guam',
|
||||
'GT' => 'Guatemala',
|
||||
'GG' => 'Guernsey',
|
||||
'GN' => 'Guinea',
|
||||
'GW' => 'Guinea-Bissau',
|
||||
'GY' => 'Guyana',
|
||||
'HT' => 'Haiti',
|
||||
'HM' => 'Heard Island and McDonald Islands',
|
||||
'VA' => 'Holy See (Vatican City State)',
|
||||
'HN' => 'Honduras',
|
||||
'HK' => 'Hong Kong',
|
||||
'HU' => 'Hungary',
|
||||
'IS' => 'Iceland',
|
||||
'IN' => 'India',
|
||||
'ID' => 'Indonesia',
|
||||
'IR' => 'Iran',
|
||||
'IQ' => 'Iraq',
|
||||
'IE' => 'Ireland',
|
||||
'IM' => 'Isle of Man',
|
||||
'IL' => 'Israel',
|
||||
'IT' => 'Italy',
|
||||
'JM' => 'Jamaica',
|
||||
'JP' => 'Japan',
|
||||
'JE' => 'Jersey',
|
||||
'JO' => 'Jordan',
|
||||
'KZ' => 'Kazakhstan',
|
||||
'KE' => 'Kenya',
|
||||
'KI' => 'Kiribati',
|
||||
'KP' => 'Korea',
|
||||
'KR' => 'Korea',
|
||||
'KW' => 'Kuwait',
|
||||
'KG' => 'Kyrgyz Republic',
|
||||
'LA' => 'Lao',
|
||||
'LV' => 'Latvia',
|
||||
'LB' => 'Lebanon',
|
||||
'LS' => 'Lesotho',
|
||||
'LR' => 'Liberia',
|
||||
'LY' => 'Libyan Arab Jamahiriya',
|
||||
'LI' => 'Liechtenstein',
|
||||
'LT' => 'Lithuania',
|
||||
'LU' => 'Luxembourg',
|
||||
'MO' => 'Macao',
|
||||
'MK' => 'Macedonia',
|
||||
'MG' => 'Madagascar',
|
||||
'MW' => 'Malawi',
|
||||
'MY' => 'Malaysia',
|
||||
'MV' => 'Maldives',
|
||||
'ML' => 'Mali',
|
||||
'MT' => 'Malta',
|
||||
'MH' => 'Marshall Islands',
|
||||
'MQ' => 'Martinique',
|
||||
'MR' => 'Mauritania',
|
||||
'MU' => 'Mauritius',
|
||||
'YT' => 'Mayotte',
|
||||
'MX' => 'Mexico',
|
||||
'FM' => 'Micronesia',
|
||||
'MD' => 'Moldova',
|
||||
'MC' => 'Monaco',
|
||||
'MN' => 'Mongolia',
|
||||
'ME' => 'Montenegro',
|
||||
'MS' => 'Montserrat',
|
||||
'MA' => 'Morocco',
|
||||
'MZ' => 'Mozambique',
|
||||
'MM' => 'Myanmar',
|
||||
'NA' => 'Namibia',
|
||||
'NR' => 'Nauru',
|
||||
'NP' => 'Nepal',
|
||||
'AN' => 'Netherlands Antilles',
|
||||
'NL' => 'Netherlands the',
|
||||
'NC' => 'New Caledonia',
|
||||
'NZ' => 'New Zealand',
|
||||
'NI' => 'Nicaragua',
|
||||
'NE' => 'Niger',
|
||||
'NG' => 'Nigeria',
|
||||
'NU' => 'Niue',
|
||||
'NF' => 'Norfolk Island',
|
||||
'MP' => 'Northern Mariana Islands',
|
||||
'NO' => 'Norway',
|
||||
'OM' => 'Oman',
|
||||
'PK' => 'Pakistan',
|
||||
'PW' => 'Palau',
|
||||
'PS' => 'Palestinian Territory',
|
||||
'PA' => 'Panama',
|
||||
'PG' => 'Papua New Guinea',
|
||||
'PY' => 'Paraguay',
|
||||
'PE' => 'Peru',
|
||||
'PH' => 'Philippines',
|
||||
'PN' => 'Pitcairn Islands',
|
||||
'PL' => 'Poland',
|
||||
'PT' => 'Portugal, Portuguese Republic',
|
||||
'PR' => 'Puerto Rico',
|
||||
'QA' => 'Qatar',
|
||||
'RE' => 'Reunion',
|
||||
'RO' => 'Romania',
|
||||
'RU' => 'Russian Federation',
|
||||
'RW' => 'Rwanda',
|
||||
'BL' => 'Saint Barthelemy',
|
||||
'SH' => 'Saint Helena',
|
||||
'KN' => 'Saint Kitts and Nevis',
|
||||
'LC' => 'Saint Lucia',
|
||||
'MF' => 'Saint Martin',
|
||||
'PM' => 'Saint Pierre and Miquelon',
|
||||
'VC' => 'Saint Vincent and the Grenadines',
|
||||
'WS' => 'Samoa',
|
||||
'SM' => 'San Marino',
|
||||
'ST' => 'Sao Tome and Principe',
|
||||
'SA' => 'Saudi Arabia',
|
||||
'SN' => 'Senegal',
|
||||
'RS' => 'Serbia',
|
||||
'SC' => 'Seychelles',
|
||||
'SL' => 'Sierra Leone',
|
||||
'SG' => 'Singapore',
|
||||
'SK' => 'Slovakia (Slovak Republic)',
|
||||
'SI' => 'Slovenia',
|
||||
'SB' => 'Solomon Islands',
|
||||
'SO' => 'Somalia, Somali Republic',
|
||||
'ZA' => 'South Africa',
|
||||
'GS' => 'South Georgia and the South Sandwich Islands',
|
||||
'ES' => 'Spain',
|
||||
'LK' => 'Sri Lanka',
|
||||
'SD' => 'Sudan',
|
||||
'SR' => 'Suriname',
|
||||
'SJ' => 'Svalbard & Jan Mayen Islands',
|
||||
'SZ' => 'Swaziland',
|
||||
'SE' => 'Sweden',
|
||||
'CH' => 'Switzerland, Swiss Confederation',
|
||||
'SY' => 'Syrian Arab Republic',
|
||||
'TW' => 'Taiwan',
|
||||
'TJ' => 'Tajikistan',
|
||||
'TZ' => 'Tanzania',
|
||||
'TH' => 'Thailand',
|
||||
'TL' => 'Timor-Leste',
|
||||
'TG' => 'Togo',
|
||||
'TK' => 'Tokelau',
|
||||
'TO' => 'Tonga',
|
||||
'TT' => 'Trinidad and Tobago',
|
||||
'TN' => 'Tunisia',
|
||||
'TR' => 'Turkey',
|
||||
'TM' => 'Turkmenistan',
|
||||
'TC' => 'Turks and Caicos Islands',
|
||||
'TV' => 'Tuvalu',
|
||||
'UG' => 'Uganda',
|
||||
'UA' => 'Ukraine',
|
||||
'AE' => 'United Arab Emirates',
|
||||
'GB' => 'United Kingdom',
|
||||
'US' => 'United States of America',
|
||||
'UM' => 'United States Minor Outlying Islands',
|
||||
'VI' => 'United States Virgin Islands',
|
||||
'UY' => 'Uruguay, Eastern Republic of',
|
||||
'UZ' => 'Uzbekistan',
|
||||
'VU' => 'Vanuatu',
|
||||
'VE' => 'Venezuela',
|
||||
'VN' => 'Vietnam',
|
||||
'WF' => 'Wallis and Futuna',
|
||||
'EH' => 'Western Sahara',
|
||||
'YE' => 'Yemen',
|
||||
'ZM' => 'Zambia',
|
||||
'ZW' => 'Zimbabwe'
|
||||
];
|
||||
|
||||
public static function convertFromAbbr(string $abbr): ?string
|
||||
{
|
||||
return self::$countries[$abbr] ?? null;
|
||||
}
|
||||
}
|
||||
140
src/User/Database/CountryLanguages.php
Normal file
140
src/User/Database/CountryLanguages.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
namespace App\User\Database;
|
||||
|
||||
class CountryLanguages
|
||||
{
|
||||
public static $languages = [
|
||||
'English (US)',
|
||||
'English',
|
||||
'French',
|
||||
'German',
|
||||
'Italian',
|
||||
'Spanish',
|
||||
'Portuguese',
|
||||
'Mandarin',
|
||||
'Japanese',
|
||||
'Korean',
|
||||
'Russian',
|
||||
'Hindi',
|
||||
'Arabic',
|
||||
'Dutch',
|
||||
'Swedish',
|
||||
'Norwegian',
|
||||
'Danish',
|
||||
'Finnish',
|
||||
'Polish',
|
||||
'Turkish',
|
||||
'Persian',
|
||||
'Thai',
|
||||
'Vietnamese',
|
||||
'Indonesian',
|
||||
'Urdu',
|
||||
'Bengali',
|
||||
'Ukrainian',
|
||||
'Greek',
|
||||
'Hebrew',
|
||||
'Malay',
|
||||
'Filipino'
|
||||
];
|
||||
|
||||
public static function fromCountryCode(string $countryCode): ?string
|
||||
{
|
||||
$countryLanguages = [
|
||||
'US' => 'English (US)',
|
||||
'GB' => 'English',
|
||||
'CA' => 'English', // Note: French is also official in parts of Canada
|
||||
'FR' => 'French',
|
||||
'DE' => 'German',
|
||||
'IT' => 'Italian',
|
||||
'ES' => 'Spanish',
|
||||
'MX' => 'Spanish',
|
||||
'BR' => 'Portuguese',
|
||||
'PT' => 'Portuguese',
|
||||
'CN' => 'Mandarin',
|
||||
'JP' => 'Japanese',
|
||||
'KR' => 'Korean',
|
||||
'RU' => 'Russian',
|
||||
'IN' => 'Hindi', // Note: India has multiple official languages
|
||||
'SA' => 'Arabic',
|
||||
'EG' => 'Arabic',
|
||||
'ZA' => 'English', // South Africa has 11 official languages
|
||||
'NG' => 'English',
|
||||
'AU' => 'English',
|
||||
'AR' => 'Spanish',
|
||||
'CH' => 'German', // Also French, Italian, Romansh
|
||||
'BE' => 'Dutch', // Also French and German
|
||||
'NL' => 'Dutch',
|
||||
'SE' => 'Swedish',
|
||||
'NO' => 'Norwegian',
|
||||
'DK' => 'Danish',
|
||||
'FI' => 'Finnish',
|
||||
'PL' => 'Polish',
|
||||
'TR' => 'Turkish',
|
||||
'IR' => 'Persian',
|
||||
'TH' => 'Thai',
|
||||
'VN' => 'Vietnamese',
|
||||
'ID' => 'Indonesian',
|
||||
'PK' => 'Urdu',
|
||||
'BD' => 'Bengali',
|
||||
'UA' => 'Ukrainian',
|
||||
'GR' => 'Greek',
|
||||
'IL' => 'Hebrew',
|
||||
'MY' => 'Malay',
|
||||
'PH' => 'Filipino',
|
||||
'KE' => 'English', // Also Swahili
|
||||
];
|
||||
|
||||
return $countryLanguages[$countryCode] ?? null;
|
||||
}
|
||||
|
||||
public static function fromCountryName(string $countryName): ?string
|
||||
{
|
||||
$countryLanguages = [
|
||||
'United States' => 'English (US)',
|
||||
'United Kingdom' => 'English',
|
||||
'Canada' => 'English', // French is also official
|
||||
'France' => 'French',
|
||||
'Germany' => 'German',
|
||||
'Italy' => 'Italian',
|
||||
'Spain' => 'Spanish',
|
||||
'Mexico' => 'Spanish',
|
||||
'Brazil' => 'Portuguese',
|
||||
'Portugal' => 'Portuguese',
|
||||
'China' => 'Mandarin',
|
||||
'Japan' => 'Japanese',
|
||||
'South Korea' => 'Korean',
|
||||
'Russia' => 'Russian',
|
||||
'India' => 'Hindi', // Also English and many regional languages
|
||||
'Saudi Arabia' => 'Arabic',
|
||||
'Egypt' => 'Arabic',
|
||||
'South Africa' => 'English', // One of 11 official languages
|
||||
'Nigeria' => 'English',
|
||||
'Australia' => 'English',
|
||||
'Argentina' => 'Spanish',
|
||||
'Switzerland' => 'German', // Also French, Italian, Romansh
|
||||
'Belgium' => 'Dutch', // Also French and German
|
||||
'Netherlands' => 'Dutch',
|
||||
'Sweden' => 'Swedish',
|
||||
'Norway' => 'Norwegian',
|
||||
'Denmark' => 'Danish',
|
||||
'Finland' => 'Finnish',
|
||||
'Poland' => 'Polish',
|
||||
'Turkey' => 'Turkish',
|
||||
'Iran' => 'Persian',
|
||||
'Thailand' => 'Thai',
|
||||
'Vietnam' => 'Vietnamese',
|
||||
'Indonesia' => 'Indonesian',
|
||||
'Pakistan' => 'Urdu',
|
||||
'Bangladesh' => 'Bengali',
|
||||
'Ukraine' => 'Ukrainian',
|
||||
'Greece' => 'Greek',
|
||||
'Israel' => 'Hebrew',
|
||||
'Malaysia' => 'Malay',
|
||||
'Philippines' => 'Filipino',
|
||||
'Kenya' => 'English', // Also Swahili
|
||||
];
|
||||
|
||||
return $countryLanguages[$countryName] ?? null;
|
||||
}
|
||||
}
|
||||
26
src/User/Database/ProviderList.php
Normal file
26
src/User/Database/ProviderList.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\User\Database;
|
||||
|
||||
class ProviderList
|
||||
{
|
||||
public static $providers = [
|
||||
'1337x',
|
||||
'Comando',
|
||||
'EZTV',
|
||||
'ilCorSaRoNeRo',
|
||||
'MagnetDL',
|
||||
'MejorTorrent',
|
||||
'RARBG',
|
||||
'Rutor',
|
||||
'Rutracker',
|
||||
'ThePirateBay',
|
||||
'Torrent9',
|
||||
'TorrentGalaxy',
|
||||
];
|
||||
|
||||
public static function getProviders()
|
||||
{
|
||||
return self::$providers;
|
||||
}
|
||||
}
|
||||
115
src/User/Database/QualityList.php
Normal file
115
src/User/Database/QualityList.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\User\Database;
|
||||
|
||||
class QualityList
|
||||
{
|
||||
public static $qualities = [
|
||||
"dvd-rip" => [
|
||||
"dvdrip",
|
||||
"dvdmux",
|
||||
"dvdr",
|
||||
"dvd-full",
|
||||
"full-rip",
|
||||
"iso rip",
|
||||
"lossless rip",
|
||||
"untouched rip",
|
||||
"dvd-5",
|
||||
"dvd-9",
|
||||
],
|
||||
"hdtv, pdtv or dsrip" => [
|
||||
"dsr",
|
||||
"dsrip",
|
||||
"satrip",
|
||||
"dthrip",
|
||||
"dvbrip",
|
||||
"hdtv",
|
||||
"pdtv",
|
||||
"dtvrip",
|
||||
"tvrip",
|
||||
"hdtvrip",
|
||||
],
|
||||
"vodrip" => [
|
||||
"vodrip",
|
||||
"vodr",
|
||||
],
|
||||
"hc hd-rip" => [
|
||||
"hc",
|
||||
"hd-rip",
|
||||
],
|
||||
"webcap" => [
|
||||
"web-cap",
|
||||
"webcap",
|
||||
"web cap",
|
||||
],
|
||||
"hdrip" => [
|
||||
"hdrip",
|
||||
"web-dlrip",
|
||||
],
|
||||
"webrip" => [
|
||||
"webrip",
|
||||
"web rip",
|
||||
"web-rip",
|
||||
"webrip (p2p)",
|
||||
"web rip (p2p)",
|
||||
"web-rip (p2p)",
|
||||
],
|
||||
"web-dl" => [
|
||||
"webdl",
|
||||
"web dl",
|
||||
"web-dl",
|
||||
"web (scene)",
|
||||
"webrip",
|
||||
],
|
||||
"blu-ray/bd/brrip" => [
|
||||
"blu-ray",
|
||||
"bluray",
|
||||
"bluray",
|
||||
"bdrip",
|
||||
"brip",
|
||||
"brrip",
|
||||
"bdr[13]",
|
||||
"bd25",
|
||||
"bd50",
|
||||
"bd66",
|
||||
"bd100",
|
||||
"bd5",
|
||||
"bd9",
|
||||
"bdmv",
|
||||
"bdiso",
|
||||
"complete.bluray",
|
||||
],
|
||||
"4k" => [
|
||||
"cbr",
|
||||
"vbr",
|
||||
],
|
||||
];
|
||||
|
||||
public static function getQualities(): array
|
||||
{
|
||||
return self::$qualities;
|
||||
}
|
||||
|
||||
public static function getBaseQualities(): array
|
||||
{
|
||||
return array_keys(self::$qualities);
|
||||
}
|
||||
|
||||
public static function getBaseQualityFromSubQuality(string $key): ?string
|
||||
{
|
||||
return array_search($key, self::$qualities) ?? null;
|
||||
}
|
||||
|
||||
public static function getAsReverseMap(): array
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach (self::$qualities as $baseQualtiy => $subQualities) {
|
||||
foreach ($subQualities as $subQuality) {
|
||||
$results[$subQuality] = $baseQualtiy;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\User\Framework\Controller\Web;
|
||||
|
||||
use App\Base\Util\Broadcaster;
|
||||
use App\Base\Util\CountryLanguages;
|
||||
use App\Base\Util\ProviderList;
|
||||
use App\Base\Util\QualityList;
|
||||
use App\Base\Service\Broadcaster;
|
||||
use App\User\Action\Handler\SaveUserDownloadPreferencesHandler;
|
||||
use App\User\Action\Handler\SaveUserMediaPreferencesHandler;
|
||||
use App\User\Action\Input\SaveUserDownloadPreferencesInput;
|
||||
use App\User\Action\Input\SaveUserMediaPreferencesInput;
|
||||
use App\User\Database\CountryLanguages;
|
||||
use App\User\Database\ProviderList;
|
||||
use App\User\Database\QualityList;
|
||||
use App\User\Framework\Repository\PreferencesRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\User\Framework\EventListener;
|
||||
|
||||
use App\Base\ConfigResolver;
|
||||
use App\Base\Util\Broadcaster;
|
||||
use App\Base\Service\Broadcaster;
|
||||
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
|
||||
|
||||
Reference in New Issue
Block a user