[17] update flixpatrol with history

pull/1681/head
meisnate12 1 year ago
parent 99d98a7b0a
commit 4a446fd730

@ -1 +1 @@
1.19.1-develop16
1.19.1-develop17

@ -16,6 +16,8 @@ templates:
default:
location: world
location_<<key>>: <<location>>
in_the_last: 1
in_the_last_<<key>>: <<in_the_last>>
limit: 10
limit_<<key>>: <<limit>>
conditionals:
@ -28,6 +30,7 @@ templates:
flixpatrol_top:
platform: <<platform>>
location: <<actual_location>>
in_the_last: <<in_the_last_<<key>>>>
limit: <<limit_<<key>>>>
dynamic_collections:

@ -56,6 +56,8 @@ templates:
slug: <<key>>
location: world
location_<<key>>: <<location>>
in_the_last: 1
in_the_last_<<key>>: <<in_the_last>>
limit: 10
limit_<<key>>: <<limit>>
conditionals:
@ -68,6 +70,7 @@ templates:
flixpatrol_top:
platform: <<slug>>
location: <<actual_location>>
in_the_last: <<in_the_last_<<key>>>>
limit: <<limit_<<key>>>>
overlays:

@ -101,7 +101,6 @@ templates:
- name_format
- key_name
- translation_key
- url_poster
- file_poster
- url_background
- file_background

@ -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.<br>**Default:** `10`<br>**Values:** Any Number 1-10 |
| `limit_<<key>>`<sup>1</sup> | **Description:** Changes the Builder Limit of the specified key's collection.<br>**Default:** `limit`<br>**Values:** Any Number 1-10 |
| `in_the_last` | **Description:** Changes How many days of daily Top 10 Lists to look at.<br>**Default:** `1`<br>**Values:** Any Number 1-30 |
| `in_the_last_<<key>>`<sup>1</sup> | **Description:** Changes How many days of daily Top 10 Lists to look at.<br>**Default:** `in_the_last`<br>**Values:** Any Number 1-30 |
| `location` | **Description:** Changes the Builder Location for all collections in a Defaults file.<br>**Default:** `world`<br>**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) |
| `location_<<key>>`<sup>1</sup> | **Description:** Changes the Builder Location of the specified key's collection.<br>**Default:** `location`<br>**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.<br>**Default:** `sync`<br>**Values:**<table class="clearTable"><tr><td>`sync`</td><td>Add and Remove Items based on Builders</td></tr><tr><td>`append`</td><td>Only Add Items based on Builders</td></tr></table> |

@ -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.<br>**Default:** `right`<br>**Values:** `right`, `left`, or List of Coordinates |
| `style` | **Description:** Changes the style of the Logo Image.<br>**Default:** `round`<br>**Values:** `round` or `square` |
| `pre_text` | **Description:** Changes the text before the number.<br>**Default:** `TOP`<br>**Values:** Any String |
| `limit` | **Description:** Changes the Builder Limit for all overlays in a Defaults file.<br>**Default:** `10`<br>**Values:** Any Number 1-10 |
| `limit_<<key>>`<sup>1</sup> | **Description:** Changes the Builder Limit of the specified key's overlay.<br>**Default:** `limit`<br>**Values:** Any Number 1-10 |
| `location` | **Description:** Changes the Builder Location for all overlays in a Defaults file.<br>**Default:** `world`<br>**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) |
| `location_<<key>>`<sup>1</sup> | **Description:** Changes the Builder Location of the specified key's overlay.<br>**Default:** `location`<br>**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) |
| `weight_<<key>>`<sup>1</sup> | **Description:** Controls the weight of the Overlay. Higher numbers have priority.<br>**Values:** Any Number |
| `font` | **Description:** Choose the font for the Overlay.<br>**Default:** `fonts/Inter-Medium.ttf`<br>**Values:** Path to font file |
| `font_style` | **Description:** Font style for Variable Fonts.<br>**Values:** Variable Font Style |
| `font_size` | **Description:** Choose the font size for the Overlay.<br>**Default:** `50`<br>**Values:** Any Number greater then 0 |
| `font_color` | **Description:** Choose the font color for the Overlay.<br>**Default:** `#FFFFFF`<br>**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` |
| `stroke_width` | **Description:** Font Stroke Width for the Text Overlay.<br>**Values:** Any Number greater then 0 |
| `stroke_color` | **Description:** Font Stroke Color for the Text Overlay.<br>**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` |
| `addon_offset` | **Description:** Text Addon Image Offset from the text.<br>**Default:** `30`<br>**Values:** Any Number greater then 0 |
| `addon_position` | **Description:** Text Addon Image Alignment in relation to the text.<br>**Default:** `top`<br>**Values:** `left`, `right`, `top`, `bottom` |
| Variable | Description & Values |
|:----------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `position` | **Description:** Changes the position of the Overlays.<br>**Default:** `right`<br>**Values:** `right`, `left`, or List of Coordinates |
| `style` | **Description:** Changes the style of the Logo Image.<br>**Default:** `round`<br>**Values:** `round` or `square` |
| `pre_text` | **Description:** Changes the text before the number.<br>**Default:** `TOP`<br>**Values:** Any String |
| `limit` | **Description:** Changes the Builder Limit for all overlays in a Defaults file.<br>**Default:** `10`<br>**Values:** Any Number 1-10 |
| `limit_<<key>>`<sup>1</sup> | **Description:** Changes the Builder Limit of the specified key's overlay.<br>**Default:** `limit`<br>**Values:** Any Number 1-10 |
| `in_the_last` | **Description:** Changes How many days of daily Top 10 Lists to look at.<br>**Default:** `1`<br>**Values:** Any Number 1-30 |
| `in_the_last_<<key>>`<sup>1</sup> | **Description:** Changes How many days of daily Top 10 Lists to look at.<br>**Default:** `in_the_last`<br>**Values:** Any Number 1-30 |
| `location` | **Description:** Changes the Builder Location for all overlays in a Defaults file.<br>**Default:** `world`<br>**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) |
| `location_<<key>>`<sup>1</sup> | **Description:** Changes the Builder Location of the specified key's overlay.<br>**Default:** `location`<br>**Values:** [`location` Attribute Options](../../metadata/builders/flixpatrol.md#top-platform-attributes) |
| `weight_<<key>>`<sup>1</sup> | **Description:** Controls the weight of the Overlay. Higher numbers have priority.<br>**Values:** Any Number |
| `font` | **Description:** Choose the font for the Overlay.<br>**Default:** `fonts/Inter-Medium.ttf`<br>**Values:** Path to font file |
| `font_style` | **Description:** Font style for Variable Fonts.<br>**Values:** Variable Font Style |
| `font_size` | **Description:** Choose the font size for the Overlay.<br>**Default:** `50`<br>**Values:** Any Number greater then 0 |
| `font_color` | **Description:** Choose the font color for the Overlay.<br>**Default:** `#FFFFFF`<br>**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` |
| `stroke_width` | **Description:** Font Stroke Width for the Text Overlay.<br>**Values:** Any Number greater then 0 |
| `stroke_color` | **Description:** Font Stroke Color for the Text Overlay.<br>**Values:** Color Hex Code in format `#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA` |
| `addon_offset` | **Description:** Text Addon Image Offset from the text.<br>**Default:** `30`<br>**Values:** Any Number greater then 0 |
| `addon_position` | **Description:** Text Addon Image Alignment in relation to the text.<br>**Default:** `top`<br>**Values:** `left`, `right`, `top`, `bottom` |
1. Each default overlay has a `key` that when calling to effect a specific overlay you must replace `<<key>>` with when calling.

@ -22,14 +22,16 @@ The `sync_mode: sync` and `collection_order: custom` Details are recommended sin
|:--------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `platform` | **Description:** Streaming Platform to filter on.<br>**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.<br>**Default:** `world`<br>**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.<br>**Default:** `1`<br>**Values:** Any Number 1-30 |
| `limit` | **Description:** Number of items to return.<br>**Default:** `10`<br>**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

@ -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"):

@ -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()}")

Loading…
Cancel
Save