Files
plezy/lib/data/iso_3166_data.dart
T
edde746 27acbaf435 feat(explore): surface the catalog data providers already return
Explore shelf cards drew a poster, a title and a year. An audit of all six
catalog sources found the rest was lost at two boundaries — the wire-to-DTO
mapping and the DTO-to-CatalogItem mapping — and then simply not drawn: the
grid card fell through every branch of buildMetadataSubtitle to the year-only
case, while the list card used by search already composed certification,
runtime and rating from fields the synthesized MediaItem already held.

Extend CatalogItem with the neutral facts every provider had been dropping:
attributed rating sources, leaderboard ranks that keep their season window,
audience counters that keep their timeframe, broadcast slots, next-episode air
times, server availability and request state, exact release dates, alternate
titles, format, source material, studios, countries, languages, credits, tags,
links, artwork variants, play state, gallery art and background prose. Replace
fetchCast and fetchRelated with one fetchDetail returning the enriched item,
its cast, its recommendations and labelled franchise relations without adding
a request: sources needing two calls keep two and run them concurrently with
isolated failures.

Map those fields in all six sources, widening only field selections that cost
no extra round trip — MAL's fields list, AniList's selection set and a bounded
row cast that lets detail skip its character call, Trakt's guest stars, Seerr's
language parameter and TMDB size ladder, and Plex's includeUserState. Plex hub
artwork widens only on TV, where the spotlight is its only consumer, because it
doubles the payload.

Render them: a rating-first caption and bounded badges on the shelf card,
labelled sections on the detail screen, provider hub styles and result counts
on shelves, and logo, banner and accent art in the TV spotlight.

Verified against live Plex, AniList, Simkl and MAL responses, and on a Pixel 7.
2026-07-29 06:47:54 +02:00

565 lines
13 KiB
Dart

// ISO 3166-1 alpha-2 country names, from
// https://raw.githubusercontent.com/lukes/ISO-3166-Countries-with-Regional-Codes/master/all/all.json
// with widely-used short forms substituted for unwieldy official long names
// (for example "United Kingdom" rather than "United Kingdom of Great Britain
// and Northern Ireland"), because these render in metadata chips.
//
// Static data, like lib/data/iso_639_data.dart. There is no in-repository
// regeneration path; refresh by re-fetching the source above and re-applying
// the short forms and aliases.
//
// English only. The app ships no localized country catalog, and Dart's intl
// does not provide one offline; callers fall back to the raw code, which is
// itself recognizable.
const countryNames = <String, String>{
'AD': "Andorra",
'AE': "United Arab Emirates",
'AF': "Afghanistan",
'AG': "Antigua and Barbuda",
'AI': "Anguilla",
'AL': "Albania",
'AM': "Armenia",
'AO': "Angola",
'AQ': "Antarctica",
'AR': "Argentina",
'AS': "American Samoa",
'AT': "Austria",
'AU': "Australia",
'AW': "Aruba",
'AX': "Åland Islands",
'AZ': "Azerbaijan",
'BA': "Bosnia and Herzegovina",
'BB': "Barbados",
'BD': "Bangladesh",
'BE': "Belgium",
'BF': "Burkina Faso",
'BG': "Bulgaria",
'BH': "Bahrain",
'BI': "Burundi",
'BJ': "Benin",
'BL': "Saint Barthélemy",
'BM': "Bermuda",
'BN': "Brunei",
'BO': "Bolivia",
'BQ': "Bonaire, Sint Eustatius and Saba",
'BR': "Brazil",
'BS': "Bahamas",
'BT': "Bhutan",
'BV': "Bouvet Island",
'BW': "Botswana",
'BY': "Belarus",
'BZ': "Belize",
'CA': "Canada",
'CC': "Cocos (Keeling) Islands",
'CD': "DR Congo",
'CF': "Central African Republic",
'CG': "Congo",
'CH': "Switzerland",
'CI': "Côte d'Ivoire",
'CK': "Cook Islands",
'CL': "Chile",
'CM': "Cameroon",
'CN': "China",
'CO': "Colombia",
'CR': "Costa Rica",
'CU': "Cuba",
'CV': "Cabo Verde",
'CW': "Curaçao",
'CX': "Christmas Island",
'CY': "Cyprus",
'CZ': "Czechia",
'DE': "Germany",
'DJ': "Djibouti",
'DK': "Denmark",
'DM': "Dominica",
'DO': "Dominican Republic",
'DZ': "Algeria",
'EC': "Ecuador",
'EE': "Estonia",
'EG': "Egypt",
'EH': "Western Sahara",
'ER': "Eritrea",
'ES': "Spain",
'ET': "Ethiopia",
'FI': "Finland",
'FJ': "Fiji",
'FK': "Falkland Islands",
'FM': "Micronesia",
'FO': "Faroe Islands",
'FR': "France",
'GA': "Gabon",
'GB': "United Kingdom",
'GD': "Grenada",
'GE': "Georgia",
'GF': "French Guiana",
'GG': "Guernsey",
'GH': "Ghana",
'GI': "Gibraltar",
'GL': "Greenland",
'GM': "Gambia",
'GN': "Guinea",
'GP': "Guadeloupe",
'GQ': "Equatorial Guinea",
'GR': "Greece",
'GS': "South Georgia and the South Sandwich Islands",
'GT': "Guatemala",
'GU': "Guam",
'GW': "Guinea-Bissau",
'GY': "Guyana",
'HK': "Hong Kong",
'HM': "Heard Island and McDonald Islands",
'HN': "Honduras",
'HR': "Croatia",
'HT': "Haiti",
'HU': "Hungary",
'ID': "Indonesia",
'IE': "Ireland",
'IL': "Israel",
'IM': "Isle of Man",
'IN': "India",
'IO': "British Indian Ocean Territory",
'IQ': "Iraq",
'IR': "Iran",
'IS': "Iceland",
'IT': "Italy",
'JE': "Jersey",
'JM': "Jamaica",
'JO': "Jordan",
'JP': "Japan",
'KE': "Kenya",
'KG': "Kyrgyzstan",
'KH': "Cambodia",
'KI': "Kiribati",
'KM': "Comoros",
'KN': "Saint Kitts and Nevis",
'KP': "North Korea",
'KR': "South Korea",
'KW': "Kuwait",
'KY': "Cayman Islands",
'KZ': "Kazakhstan",
'LA': "Laos",
'LB': "Lebanon",
'LC': "Saint Lucia",
'LI': "Liechtenstein",
'LK': "Sri Lanka",
'LR': "Liberia",
'LS': "Lesotho",
'LT': "Lithuania",
'LU': "Luxembourg",
'LV': "Latvia",
'LY': "Libya",
'MA': "Morocco",
'MC': "Monaco",
'MD': "Moldova",
'ME': "Montenegro",
'MF': "Saint Martin (French part)",
'MG': "Madagascar",
'MH': "Marshall Islands",
'MK': "North Macedonia",
'ML': "Mali",
'MM': "Myanmar",
'MN': "Mongolia",
'MO': "Macao",
'MP': "Northern Mariana Islands",
'MQ': "Martinique",
'MR': "Mauritania",
'MS': "Montserrat",
'MT': "Malta",
'MU': "Mauritius",
'MV': "Maldives",
'MW': "Malawi",
'MX': "Mexico",
'MY': "Malaysia",
'MZ': "Mozambique",
'NA': "Namibia",
'NC': "New Caledonia",
'NE': "Niger",
'NF': "Norfolk Island",
'NG': "Nigeria",
'NI': "Nicaragua",
'NL': "Netherlands, Kingdom of the",
'NO': "Norway",
'NP': "Nepal",
'NR': "Nauru",
'NU': "Niue",
'NZ': "New Zealand",
'OM': "Oman",
'PA': "Panama",
'PE': "Peru",
'PF': "French Polynesia",
'PG': "Papua New Guinea",
'PH': "Philippines",
'PK': "Pakistan",
'PL': "Poland",
'PM': "Saint Pierre and Miquelon",
'PN': "Pitcairn",
'PR': "Puerto Rico",
'PS': "Palestine",
'PT': "Portugal",
'PW': "Palau",
'PY': "Paraguay",
'QA': "Qatar",
'RE': "Réunion",
'RO': "Romania",
'RS': "Serbia",
'RU': "Russia",
'RW': "Rwanda",
'SA': "Saudi Arabia",
'SB': "Solomon Islands",
'SC': "Seychelles",
'SD': "Sudan",
'SE': "Sweden",
'SG': "Singapore",
'SH': "Saint Helena, Ascension and Tristan da Cunha",
'SI': "Slovenia",
'SJ': "Svalbard and Jan Mayen",
'SK': "Slovakia",
'SL': "Sierra Leone",
'SM': "San Marino",
'SN': "Senegal",
'SO': "Somalia",
'SR': "Suriname",
'SS': "South Sudan",
'ST': "Sao Tome and Principe",
'SV': "El Salvador",
'SX': "Sint Maarten (Dutch part)",
'SY': "Syria",
'SZ': "Eswatini",
'TC': "Turks and Caicos Islands",
'TD': "Chad",
'TF': "French Southern Territories",
'TG': "Togo",
'TH': "Thailand",
'TJ': "Tajikistan",
'TK': "Tokelau",
'TL': "Timor-Leste",
'TM': "Turkmenistan",
'TN': "Tunisia",
'TO': "Tonga",
'TR': "Türkiye",
'TT': "Trinidad and Tobago",
'TV': "Tuvalu",
'TW': "Taiwan",
'TZ': "Tanzania",
'UA': "Ukraine",
'UG': "Uganda",
'UM': "United States Minor Outlying Islands",
'US': "United States",
'UY': "Uruguay",
'UZ': "Uzbekistan",
'VA': "Vatican City",
'VC': "Saint Vincent and the Grenadines",
'VE': "Venezuela",
'VG': "British Virgin Islands",
'VI': "U.S. Virgin Islands",
'VN': "Vietnam",
'VU': "Vanuatu",
'WF': "Wallis and Futuna",
'WS': "Samoa",
'YE': "Yemen",
'YT': "Mayotte",
'ZA': "South Africa",
'ZM': "Zambia",
'ZW': "Zimbabwe",
};
/// Reverse index for providers that send a country *name* instead of a code.
/// Plex Discover returns `Country` child tags such as `United States of
/// America`, so a mapper has to normalize before storing alpha-2.
///
/// Keyed by lowercased name, covering the official ISO form, the short form
/// used above, and colloquial names providers actually emit.
const countryCodesByName = <String, String>{
"afghanistan": 'AF',
"albania": 'AL',
"algeria": 'DZ',
"america": 'US',
"american samoa": 'AS',
"andorra": 'AD',
"angola": 'AO',
"anguilla": 'AI',
"antarctica": 'AQ',
"antigua and barbuda": 'AG',
"argentina": 'AR',
"armenia": 'AM',
"aruba": 'AW',
"australia": 'AU',
"austria": 'AT',
"azerbaijan": 'AZ',
"bahamas": 'BS',
"bahrain": 'BH',
"bangladesh": 'BD',
"barbados": 'BB',
"belarus": 'BY',
"belgium": 'BE',
"belize": 'BZ',
"benin": 'BJ',
"bermuda": 'BM',
"bhutan": 'BT',
"bolivia": 'BO',
"bolivia, plurinational state of": 'BO',
"bonaire, sint eustatius and saba": 'BQ',
"bosnia and herzegovina": 'BA',
"botswana": 'BW',
"bouvet island": 'BV',
"brazil": 'BR',
"britain": 'GB',
"british indian ocean territory": 'IO',
"british virgin islands": 'VG',
"brunei": 'BN',
"brunei darussalam": 'BN',
"bulgaria": 'BG',
"burkina faso": 'BF',
"burma": 'MM',
"burundi": 'BI',
"cabo verde": 'CV',
"cambodia": 'KH',
"cameroon": 'CM',
"canada": 'CA',
"cape verde": 'CV',
"cayman islands": 'KY',
"central african republic": 'CF',
"chad": 'TD',
"chile": 'CL',
"china": 'CN',
"christmas island": 'CX',
"cocos (keeling) islands": 'CC',
"colombia": 'CO',
"comoros": 'KM',
"congo": 'CG',
"congo, democratic republic of the": 'CD',
"cook islands": 'CK',
"costa rica": 'CR',
"croatia": 'HR',
"cuba": 'CU',
"curaçao": 'CW',
"cyprus": 'CY',
"czech republic": 'CZ',
"czechia": 'CZ',
"côte d'ivoire": 'CI',
"denmark": 'DK',
"djibouti": 'DJ',
"dominica": 'DM',
"dominican republic": 'DO',
"dr congo": 'CD',
"east timor": 'TL',
"ecuador": 'EC',
"egypt": 'EG',
"el salvador": 'SV',
"england": 'GB',
"equatorial guinea": 'GQ',
"eritrea": 'ER',
"estonia": 'EE',
"eswatini": 'SZ',
"ethiopia": 'ET',
"falkland islands": 'FK',
"falkland islands (malvinas)": 'FK',
"faroe islands": 'FO',
"fiji": 'FJ',
"finland": 'FI',
"france": 'FR',
"french guiana": 'GF',
"french polynesia": 'PF',
"french southern territories": 'TF',
"gabon": 'GA',
"gambia": 'GM',
"georgia": 'GE',
"germany": 'DE',
"ghana": 'GH',
"gibraltar": 'GI',
"great britain": 'GB',
"greece": 'GR',
"greenland": 'GL',
"grenada": 'GD',
"guadeloupe": 'GP',
"guam": 'GU',
"guatemala": 'GT',
"guernsey": 'GG',
"guinea": 'GN',
"guinea-bissau": 'GW',
"guyana": 'GY',
"haiti": 'HT',
"heard island and mcdonald islands": 'HM',
"holy see": 'VA',
"honduras": 'HN',
"hong kong": 'HK',
"hong kong sar china": 'HK',
"hungary": 'HU',
"iceland": 'IS',
"india": 'IN',
"indonesia": 'ID',
"iran": 'IR',
"iran, islamic republic of": 'IR',
"iraq": 'IQ',
"ireland": 'IE',
"isle of man": 'IM',
"israel": 'IL',
"italy": 'IT',
"ivory coast": 'CI',
"jamaica": 'JM',
"japan": 'JP',
"jersey": 'JE',
"jordan": 'JO',
"kazakhstan": 'KZ',
"kenya": 'KE',
"kiribati": 'KI',
"korea, democratic people's republic of": 'KP',
"korea, republic of": 'KR',
"kuwait": 'KW',
"kyrgyzstan": 'KG',
"lao people's democratic republic": 'LA',
"laos": 'LA',
"latvia": 'LV',
"lebanon": 'LB',
"lesotho": 'LS',
"liberia": 'LR',
"libya": 'LY',
"liechtenstein": 'LI',
"lithuania": 'LT',
"luxembourg": 'LU',
"macao": 'MO',
"macao sar china": 'MO',
"macedonia": 'MK',
"madagascar": 'MG',
"malawi": 'MW',
"malaysia": 'MY',
"maldives": 'MV',
"mali": 'ML',
"malta": 'MT',
"marshall islands": 'MH',
"martinique": 'MQ',
"mauritania": 'MR',
"mauritius": 'MU',
"mayotte": 'YT',
"mexico": 'MX',
"micronesia": 'FM',
"micronesia, federated states of": 'FM',
"moldova": 'MD',
"moldova, republic of": 'MD',
"monaco": 'MC',
"mongolia": 'MN',
"montenegro": 'ME',
"montserrat": 'MS',
"morocco": 'MA',
"mozambique": 'MZ',
"myanmar": 'MM',
"namibia": 'NA',
"nauru": 'NR',
"nepal": 'NP',
"netherlands, kingdom of the": 'NL',
"new caledonia": 'NC',
"new zealand": 'NZ',
"nicaragua": 'NI',
"niger": 'NE',
"nigeria": 'NG',
"niue": 'NU',
"norfolk island": 'NF',
"north korea": 'KP',
"north macedonia": 'MK',
"northern mariana islands": 'MP',
"norway": 'NO',
"oman": 'OM',
"pakistan": 'PK',
"palau": 'PW',
"palestine": 'PS',
"palestine, state of": 'PS',
"panama": 'PA',
"papua new guinea": 'PG',
"paraguay": 'PY',
"peru": 'PE',
"philippines": 'PH',
"pitcairn": 'PN',
"poland": 'PL',
"portugal": 'PT',
"puerto rico": 'PR',
"qatar": 'QA',
"romania": 'RO',
"russia": 'RU',
"russian federation": 'RU',
"rwanda": 'RW',
"réunion": 'RE',
"saint barthélemy": 'BL',
"saint helena, ascension and tristan da cunha": 'SH',
"saint kitts and nevis": 'KN',
"saint lucia": 'LC',
"saint martin (french part)": 'MF',
"saint pierre and miquelon": 'PM',
"saint vincent and the grenadines": 'VC',
"samoa": 'WS',
"san marino": 'SM',
"sao tome and principe": 'ST',
"saudi arabia": 'SA',
"senegal": 'SN',
"serbia": 'RS',
"seychelles": 'SC',
"sierra leone": 'SL',
"singapore": 'SG',
"sint maarten (dutch part)": 'SX',
"slovakia": 'SK',
"slovenia": 'SI',
"solomon islands": 'SB',
"somalia": 'SO',
"south africa": 'ZA',
"south georgia and the south sandwich islands": 'GS',
"south korea": 'KR',
"south sudan": 'SS',
"spain": 'ES',
"sri lanka": 'LK',
"sudan": 'SD',
"suriname": 'SR',
"svalbard and jan mayen": 'SJ',
"swaziland": 'SZ',
"sweden": 'SE',
"switzerland": 'CH',
"syria": 'SY',
"syrian arab republic": 'SY',
"taiwan": 'TW',
"taiwan, province of china": 'TW',
"tajikistan": 'TJ',
"tanzania": 'TZ',
"tanzania, united republic of": 'TZ',
"thailand": 'TH',
"the netherlands": 'NL',
"timor-leste": 'TL',
"togo": 'TG',
"tokelau": 'TK',
"tonga": 'TO',
"trinidad and tobago": 'TT',
"tunisia": 'TN',
"turkmenistan": 'TM',
"turks and caicos islands": 'TC',
"tuvalu": 'TV',
"türkiye": 'TR',
"u.k.": 'GB',
"u.s. virgin islands": 'VI',
"u.s.a.": 'US',
"uganda": 'UG',
"uk": 'GB',
"ukraine": 'UA',
"united arab emirates": 'AE',
"united kingdom": 'GB',
"united kingdom of great britain and northern ireland": 'GB',
"united states": 'US',
"united states minor outlying islands": 'UM',
"united states of america": 'US',
"uruguay": 'UY',
"us": 'US',
"usa": 'US',
"uzbekistan": 'UZ',
"vanuatu": 'VU',
"vatican city": 'VA',
"venezuela": 'VE',
"venezuela, bolivarian republic of": 'VE',
"viet nam": 'VN',
"vietnam": 'VN',
"virgin islands (british)": 'VG',
"virgin islands (u.s.)": 'VI',
"wallis and futuna": 'WF',
"western sahara": 'EH',
"yemen": 'YE',
"zambia": 'ZM',
"zimbabwe": 'ZW',
"åland islands": 'AX',
};