diff --git a/VERSION b/VERSION index faf6ad97..746dcd89 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.19.1-develop16 +1.19.1-develop17 diff --git a/defaults/chart/flixpatrol.yml b/defaults/chart/flixpatrol.yml index 7dddbcea..8d6cb861 100644 --- a/defaults/chart/flixpatrol.yml +++ b/defaults/chart/flixpatrol.yml @@ -16,6 +16,8 @@ templates: default: location: world location_<>: <> + in_the_last: 1 + in_the_last_<>: <> limit: 10 limit_<>: <> conditionals: @@ -28,6 +30,7 @@ templates: flixpatrol_top: platform: <> location: <> + in_the_last: <>>> limit: <>>> dynamic_collections: diff --git a/defaults/overlays/flixpatrol.yml b/defaults/overlays/flixpatrol.yml index d6ce04b0..cbcd2598 100644 --- a/defaults/overlays/flixpatrol.yml +++ b/defaults/overlays/flixpatrol.yml @@ -56,6 +56,8 @@ templates: slug: <> location: world location_<>: <> + in_the_last: 1 + in_the_last_<>: <> limit: 10 limit_<>: <> conditionals: @@ -68,6 +70,7 @@ templates: flixpatrol_top: platform: <> location: <> + in_the_last: <>>> limit: <>>> overlays: diff --git a/defaults/templates.yml b/defaults/templates.yml index a51b62d8..c73b9be4 100644 --- a/defaults/templates.yml +++ b/defaults/templates.yml @@ -101,7 +101,6 @@ templates: - name_format - key_name - translation_key - - url_poster - file_poster - url_background - file_background diff --git a/docs/defaults/chart/flixpatrol.md b/docs/defaults/chart/flixpatrol.md index a6629862..d23c416e 100644 --- a/docs/defaults/chart/flixpatrol.md +++ b/docs/defaults/chart/flixpatrol.md @@ -46,6 +46,8 @@ All [Shared Collection Variables](../collection_variables) are available as well |:---------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `limit` | **Description:** Changes the Builder Limit for all collections in a Defaults file.
**Default:** `10`
**Values:** Any Number 1-10 | | `limit_<>`1 | **Description:** Changes the Builder Limit of the specified key's collection.
**Default:** `limit`
**Values:** Any Number 1-10 | +| `in_the_last` | **Description:** Changes How many days of daily Top 10 Lists to look at.
**Default:** `1`
**Values:** Any Number 1-30 | +| `in_the_last_<>`1 | **Description:** Changes How many days of daily Top 10 Lists to look at.
**Default:** `in_the_last`
**Values:** Any Number 1-30 | | `location` | **Description:** Changes the Builder Location for all collections in a Defaults file.
**Default:** `world`
**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) | | `location_<>`1 | **Description:** Changes the Builder Location of the specified key's collection.
**Default:** `location`
**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) | | `sync_mode` | **Description:** Changes the Sync Mode for all collections in a Defaults file.
**Default:** `sync`
**Values:**
`sync`Add and Remove Items based on Builders
`append`Only Add Items based on Builders
| diff --git a/docs/defaults/overlays/flixpatrol.md b/docs/defaults/overlays/flixpatrol.md index f91ab5e5..14a91b1a 100644 --- a/docs/defaults/overlays/flixpatrol.md +++ b/docs/defaults/overlays/flixpatrol.md @@ -54,24 +54,26 @@ All [Shared Overlay Variables](../overlay_variables) except `horizontal_offset`, | `back_height` | `160` | | `back_padding` | `15` | -| Variable | Description & Values | -|:----------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `position` | **Description:** Changes the position of the Overlays.
**Default:** `right`
**Values:** `right`, `left`, or List of Coordinates | -| `style` | **Description:** Changes the style of the Logo Image.
**Default:** `round`
**Values:** `round` or `square` | -| `pre_text` | **Description:** Changes the text before the number.
**Default:** `TOP`
**Values:** Any String | -| `limit` | **Description:** Changes the Builder Limit for all overlays in a Defaults file.
**Default:** `10`
**Values:** Any Number 1-10 | -| `limit_<>`1 | **Description:** Changes the Builder Limit of the specified key's overlay.
**Default:** `limit`
**Values:** Any Number 1-10 | -| `location` | **Description:** Changes the Builder Location for all overlays in a Defaults file.
**Default:** `world`
**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) | -| `location_<>`1 | **Description:** Changes the Builder Location of the specified key's overlay.
**Default:** `location`
**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) | -| `weight_<>`1 | **Description:** Controls the weight of the Overlay. Higher numbers have priority.
**Values:** Any Number | -| `font` | **Description:** Choose the font for the Overlay.
**Default:** `fonts/Inter-Medium.ttf`
**Values:** Path to font file | -| `font_style` | **Description:** Font style for Variable Fonts.
**Values:** Variable Font Style | -| `font_size` | **Description:** Choose the font size for the Overlay.
**Default:** `50`
**Values:** Any Number greater then 0 | -| `font_color` | **Description:** Choose the font color for the Overlay.
**Default:** `#FFFFFF`
**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` | -| `stroke_width` | **Description:** Font Stroke Width for the Text Overlay.
**Values:** Any Number greater then 0 | -| `stroke_color` | **Description:** Font Stroke Color for the Text Overlay.
**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` | -| `addon_offset` | **Description:** Text Addon Image Offset from the text.
**Default:** `30`
**Values:** Any Number greater then 0 | -| `addon_position` | **Description:** Text Addon Image Alignment in relation to the text.
**Default:** `top`
**Values:** `left`, `right`, `top`, `bottom` | +| Variable | Description & Values | +|:----------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `position` | **Description:** Changes the position of the Overlays.
**Default:** `right`
**Values:** `right`, `left`, or List of Coordinates | +| `style` | **Description:** Changes the style of the Logo Image.
**Default:** `round`
**Values:** `round` or `square` | +| `pre_text` | **Description:** Changes the text before the number.
**Default:** `TOP`
**Values:** Any String | +| `limit` | **Description:** Changes the Builder Limit for all overlays in a Defaults file.
**Default:** `10`
**Values:** Any Number 1-10 | +| `limit_<>`1 | **Description:** Changes the Builder Limit of the specified key's overlay.
**Default:** `limit`
**Values:** Any Number 1-10 | +| `in_the_last` | **Description:** Changes How many days of daily Top 10 Lists to look at.
**Default:** `1`
**Values:** Any Number 1-30 | +| `in_the_last_<>`1 | **Description:** Changes How many days of daily Top 10 Lists to look at.
**Default:** `in_the_last`
**Values:** Any Number 1-30 | +| `location` | **Description:** Changes the Builder Location for all overlays in a Defaults file.
**Default:** `world`
**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) | +| `location_<>`1 | **Description:** Changes the Builder Location of the specified key's overlay.
**Default:** `location`
**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) | +| `weight_<>`1 | **Description:** Controls the weight of the Overlay. Higher numbers have priority.
**Values:** Any Number | +| `font` | **Description:** Choose the font for the Overlay.
**Default:** `fonts/Inter-Medium.ttf`
**Values:** Path to font file | +| `font_style` | **Description:** Font style for Variable Fonts.
**Values:** Variable Font Style | +| `font_size` | **Description:** Choose the font size for the Overlay.
**Default:** `50`
**Values:** Any Number greater then 0 | +| `font_color` | **Description:** Choose the font color for the Overlay.
**Default:** `#FFFFFF`
**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` | +| `stroke_width` | **Description:** Font Stroke Width for the Text Overlay.
**Values:** Any Number greater then 0 | +| `stroke_color` | **Description:** Font Stroke Color for the Text Overlay.
**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` | +| `addon_offset` | **Description:** Text Addon Image Offset from the text.
**Default:** `30`
**Values:** Any Number greater then 0 | +| `addon_position` | **Description:** Text Addon Image Alignment in relation to the text.
**Default:** `top`
**Values:** `left`, `right`, `top`, `bottom` | 1. Each default overlay has a `key` that when calling to effect a specific overlay you must replace `<>` with when calling. diff --git a/docs/metadata/builders/flixpatrol.md b/docs/metadata/builders/flixpatrol.md index a6763983..023c4576 100644 --- a/docs/metadata/builders/flixpatrol.md +++ b/docs/metadata/builders/flixpatrol.md @@ -22,14 +22,16 @@ The `sync_mode: sync` and `collection_order: custom` Details are recommended sin |:--------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `platform` | **Description:** Streaming Platform to filter on.
**Values:** `amazon_prime`, `apple_tv`, `chili`, `disney`, `freevee`, `globoplay`, `google`, `hbo`, `hulu`, `itunes`, `netflix`, `osn`, `paramount_plus`, `rakuten_tv`, `shahid`, `star_plus`, `starz`, `viaplay`, `vudu` | | `location` | **Description:** Location to filter on.
**Default:** `world`
**Values:** `world`, `albania`, `algeria`, `angola`, `argentina`, `armenia`, `australia`, `austria`, `azerbaijan`, `bahamas`, `bahrain`, `bangladesh`, `belarus`, `belgium`, `belize`, `benin`, `bolivia`, `bosnia_and_herzegovina`, `botswana`, `brazil`, `bulgaria`, `burkina_faso`, `cambodia`, `cameroon`, `canada`, `chad`, `chile`, `colombia`, `costa_rica`, `croatia`, `cyprus`, `czech_republic`, `democratic_republic_of_the_congo`, `denmark`, `dominican_republic`, `ecuador`, `egypt`, `estonia`, `finland`, `france`, `gabon`, `georgia`, `germany`, `ghana`, `greece`, `guadeloupe`, `guatemala`, `guyana`, `haiti`, `honduras`, `hong_kong`, `hungary`, `iceland`, `india`, `indonesia`, `iraq`, `ireland`, `israel`, `italy`, `ivory_coast`, `jamaica`, `japan`, `jordan`, `kazakhstan`, `kenya`, `kuwait`, `kyrgyzstan`, `laos`, `latvia`, `lebanon`, `libya`, `lithuania`, `luxembourg`, `madagascar`, `malawi`, `malaysia`, `maldives`, `mali`, `malta`, `martinique`, `mauritania`, `mauritius`, `mexico`, `moldova`, `mongolia`, `montenegro`, `morocco`, `mozambique`, `myanmar`, `namibia`, `netherlands`, `new_caledonia`, `new_zealand`, `nicaragua`, `niger`, `nigeria`, `north_macedonia`, `norway`, `oman`, `pakistan`, `panama`, `papua_new_guinea`, `paraguay`, `peru`, `philippines`, `poland`, `portugal`, `qatar`, `republic_of_the_congo`, `reunion`, `romania`, `russia`, `rwanda`, `salvador`, `saudi_arabia`, `senegal`, `serbia`, `singapore`, `slovakia`, `slovenia`, `somalia`, `south_africa`, `south_korea`, `south_sudan`, `spain`, `sri_lanka`, `sweden`, `switzerland`, `taiwan`, `tajikistan`, `tanzania`, `thailand`, `togo`, `trinidad_and_tobago`, `tunisia`, `turkey`, `turkmenistan`, `uganda`, `ukraine`, `united_arab_emirates`, `united_kingdom`, `united_states`, `uruguay`, `uzbekistan`, `venezuela`, `vietnam`, `yemen`, `zambia`, `zimbabwe` | +| `in_the_last` | **Description:** Retrieve items that were in the daily Top 10 anytime in the last X days.
**Default:** `1`
**Values:** Any Number 1-30 | | `limit` | **Description:** Number of items to return.
**Default:** `10`
**Values:** Integer greater than 0 | ```yaml collections: - US Netflix Monthly Top 20: + US Netflix Top of the Last 30 Days: flixpatrol_top: platform: netflix location: united_states + in_the_last: 30 limit: 20 collection_order: custom sync_mode: sync diff --git a/modules/builder.py b/modules/builder.py index 8256de9a..8b40b273 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1449,11 +1449,12 @@ class CollectionBuilder: def _flixpatrol(self, method_name, method_data): for dict_data in util.parse(self.Type, method_name, method_data, datatype="listdict"): dict_methods = {dm.lower(): dm for dm in dict_data} - self.builders.append((method_name, self.config.FlixPatrol.validate_builder(method_name, { + self.builders.append((method_name, { "platform": util.parse(self.Type, "platform", dict_data, methods=dict_methods, parent=method_name, options=self.config.FlixPatrol.platforms), "location": util.parse(self.Type, "location", dict_data, methods=dict_methods, parent=method_name, default="world", options=self.config.FlixPatrol.locations), + "in_the_last": util.parse(self.Type, "in_the_last", dict_data, datatype="int", methods=dict_methods, parent=method_name, default=1, maximum=30), "limit": util.parse(self.Type, "limit", dict_data, datatype="int", methods=dict_methods, parent=method_name, default=10, maximum=10) - }, self.library.is_movie))) + }, self.library.is_movie)) def _icheckmovies(self, method_name, method_data): if method_name.startswith("icheckmovies_list"): diff --git a/modules/flixpatrol.py b/modules/flixpatrol.py index 1bf5c6c0..6098e6c6 100644 --- a/modules/flixpatrol.py +++ b/modules/flixpatrol.py @@ -3,57 +3,57 @@ from modules.util import Failed logger = util.logger -ids_url = "https://raw.githubusercontent.com/meisnate12/PMM-TOP10/master/top10.yml" +base_url = "https://raw.githubusercontent.com/meisnate12/PMM-TOP10/master/" builders = ["flixpatrol_top"] class FlixPatrol: def __init__(self, config): self.config = config - self._data = None self._platforms = None self._locations = None + self.country_data = {} - @property - def data(self): - if self._data is None: - self._data = self.config.load_yaml(ids_url) - return self._data + def load_info(self): + info = self.config.load_yaml(f"{base_url}info.yml") + self._platforms = info["platforms"] + self._locations = info["locations"] + + def get_country(self, country): + if country not in self.country_data: + self.country_data[country] = self.config.load_yaml(f"{base_url}lists/{country}.yml") + return self.country_data[country] @property def platforms(self): if self._platforms is None: - self._platforms = [platform for platform in self.data] - self._platforms.sort() + self.load_info() return self._platforms @property def locations(self): if self._locations is None: - self._locations = [] - for platform in self.data: - self._locations.extend([loc for loc in self.data[platform] if loc not in self._locations and loc != "world"]) - self._locations.sort() - self._locations = ["world"] + self._locations + self.load_info() return self._locations - def validate_builder(self, method, data, is_movie): - builder_type = "movies" if is_movie else "shows" - if method == "flixpatrol_top" and data["location"] in self.data[data["platform"]] and builder_type in self.data[data["platform"]][data["location"]]: - return data - raise Failed(f"FlixPatrol Error: No {builder_type[:-1].capitalize()} Data Found for {data['platform']} in {data['location']}") - def get_tmdb_ids(self, method, data, is_movie): flix_items = [] + media_type = "movies" if is_movie else "shows" if method == "flixpatrol_top": - logger.info("Processing FlixPatrol Top:") + logger.info(f"Processing FlixPatrol Top {media_type.capitalize()}:") logger.info(f"\tPlatform: {data['platform'].replace('_', ' ').title()}") logger.info(f"\tLocation: {data['location'].replace('_', ' ').title()}") + logger.info(f"\tIn The Last: {data['in_the_last']}") logger.info(f"\tLimit: {data['limit']}") - flix_items = self.data[data["platform"]][data["location"]]["movies" if is_movie else "shows"][:data["limit"]] + country_info = self.get_country(data["location"]) + for key in [k for k in country_info][:data["in_the_last"]]: + if data["platform"] in country_info[key] and media_type in country_info[key][data["platform"]]: + for item in country_info[key][data["platform"]][media_type]: + if item not in flix_items and len(flix_items) < data["limit"]: + flix_items.append(item) items = [(i, "tmdb" if is_movie else "tmdb_show") for i in flix_items] if len(items) > 0: logger.info(f"Processed {len(items)} TMDb IDs") return items else: - raise Failed(f"FlixPatrol Error: No List Items found in {data}") + raise Failed(f"FlixPatrol Error: No {media_type.capitalize()} Found for {data['platform'].replace('_', ' ').title()} in {data['location'].replace('_', ' ').title()}")