[6] add MDbList Sort Rank

pull/858/head
meisnate12 3 years ago
parent 74083a68d3
commit 1d06d5c4df

@ -1 +1 @@
1.16.5-develop5 1.16.5-develop6

@ -34,12 +34,13 @@ collections:
``` ```
You can also sort the items by using the `sort_by` and `url` attributes under `mdblist_list`. You can also sort the items by using the `sort_by` and `url` attributes under `mdblist_list`.
The default `sort_by` when it's not specified is `score.desc`. The default `sort_by` when it's not specified is `rank.asc`.
### Sort Options ### Sort Options
| Option | Description | | Option | Description |
|:----------------------------------------|:------------------------------| |:----------------------------------------|:------------------------------|
| `rank.asc`<br>`rank.desc` | Sort by MdbList Rank |
| `score.asc`<br>`score.desc` | Sort by MdbList Score | | `score.asc`<br>`score.desc` | Sort by MdbList Score |
| `released.asc`<br>`released.desc` | Sort by Release Date | | `released.asc`<br>`released.desc` | Sort by Release Date |
| `imdbrating.asc`<br>`imdbrating.desc` | Sort by IMDb Rating | | `imdbrating.asc`<br>`imdbrating.desc` | Sort by IMDb Rating |

@ -7,7 +7,7 @@ from urllib.parse import urlparse
logger = util.logger logger = util.logger
builders = ["mdblist_list"] builders = ["mdblist_list"]
sort_names = ["score", "released", "imdbrating", "imdbvotes", "imdbpopular", "tmdbpopular", "rogerebert", "rtomatoes", "metacritic", "myanimelist", "budget", "revenue", "added"] sort_names = ["rank", "score", "released", "imdbrating", "imdbvotes", "imdbpopular", "tmdbpopular", "rogerebert", "rtomatoes", "metacritic", "myanimelist", "budget", "revenue", "added"]
list_sorts = [f"{s}.asc" for s in sort_names] + [f"{s}.desc" for s in sort_names] list_sorts = [f"{s}.asc" for s in sort_names] + [f"{s}.desc" for s in sort_names]
base_url = "https://mdblist.com/lists" base_url = "https://mdblist.com/lists"
api_url = "https://mdblist.com/api/" api_url = "https://mdblist.com/api/"
@ -145,7 +145,7 @@ class Mdblist:
logger.warning(f"{error_type} Warning: mdb_list limit attribute must be an integer 0 or greater using 0 as default") logger.warning(f"{error_type} Warning: mdb_list limit attribute must be an integer 0 or greater using 0 as default")
if list_count is None: if list_count is None:
list_count = 0 list_count = 0
sort_by = "score.desc" sort_by = "rank.asc"
if "sort_by" in dict_methods: if "sort_by" in dict_methods:
if mdb_dict[dict_methods["sort_by"]] is None: if mdb_dict[dict_methods["sort_by"]] is None:
logger.warning(f"{error_type} Warning: mdb_list sort_by attribute is blank using score as default") logger.warning(f"{error_type} Warning: mdb_list sort_by attribute is blank using score as default")

Loading…
Cancel
Save