Add MDbList Average as Mass * Rating Option

This commit is contained in:
YozoraXCII 2022-11-10 23:24:06 +00:00
parent f2d6020c64
commit d2df74eb13
6 changed files with 27 additions and 19 deletions

View file

@ -175,6 +175,7 @@ Updates every item's audience/critic/user rating in the library to the chosen si
| `trakt_user` | Use Trakt User's Personal Rating |
| `omdb` | Use IMDbRating through OMDb |
| `mdb` | Use MdbList Score |
| `mdb_average` | Use MdbList Average Score |
| `mdb_imdb` | Use IMDb Rating through MDbList |
| `mdb_metacritic` | Use Metacritic Rating through MDbList |
| `mdb_metacriticuser` | Use Metacritic User Rating through MDbList |

View file

@ -38,22 +38,23 @@ The default `sort_by` when it's not specified is `rank.asc`.
### Sort Options
| Option | Description |
|:----------------------------------------|:------------------------------|
| `rank.asc`<br>`rank.desc` | Sort by MdbList Rank |
| `score.asc`<br>`score.desc` | Sort by MdbList Score |
| `released.asc`<br>`released.desc` | Sort by Release Date |
| `imdbrating.asc`<br>`imdbrating.desc` | Sort by IMDb Rating |
| `imdbvotes.asc`<br>`imdbvotes.desc` | Sort by IMDb Votes |
| `imdbpopular.asc`<br>`imdbpopular.desc` | Sort by IMDb Popular |
| `tmdbpopular.asc`<br>`tmdbpopular.desc` | Sort by TMDb Popular |
| `rogerebert.asc`<br>`rogerebert.desc` | Sort by RogerEvert Score |
| `rtomatoes.asc`<br>`rtomatoes.desc` | Sort by Rotten Tomatoes Score |
| `metacritic.asc`<br>`metacritic.desc` | Sort by Metacritic Score |
| `myanimelist.asc`<br>`myanimelist.desc` | Sort by MyAnimeList Score |
| `budget.asc`<br>`budget.desc` | Sort by Budget |
| `revenue.asc`<br>`revenue.desc` | Sort by Revenue |
| `added.asc`<br>`added.desc` | Sort by Date Added |
| Option | Description |
|:----------------------------------------------|:------------------------------|
| `rank.asc`<br>`rank.desc` | Sort by MdbList Rank |
| `score.asc`<br>`score.desc` | Sort by MdbList Score |
| `score_average.asc`<br>`score_average.desc` | Sort by MdbList Score |
| `released.asc`<br>`released.desc` | Sort by Release Date |
| `imdbrating.asc`<br>`imdbrating.desc` | Sort by IMDb Rating |
| `imdbvotes.asc`<br>`imdbvotes.desc` | Sort by IMDb Votes |
| `imdbpopular.asc`<br>`imdbpopular.desc` | Sort by IMDb Popular |
| `tmdbpopular.asc`<br>`tmdbpopular.desc` | Sort by TMDb Popular |
| `rogerebert.asc`<br>`rogerebert.desc` | Sort by RogerEvert Score |
| `rtomatoes.asc`<br>`rtomatoes.desc` | Sort by Rotten Tomatoes Score |
| `metacritic.asc`<br>`metacritic.desc` | Sort by Metacritic Score |
| `myanimelist.asc`<br>`myanimelist.desc` | Sort by MyAnimeList Score |
| `budget.asc`<br>`budget.desc` | Sort by Budget |
| `revenue.asc`<br>`revenue.desc` | Sort by Revenue |
| `added.asc`<br>`added.desc` | Sort by Date Added |
For these sorts to be reflected in your collection you must use `collection_order: custom`.

View file

@ -70,7 +70,8 @@ mass_rating_options = {
"imdb": "Use IMDb Rating",
"trakt_user": "Use Trakt User Rating",
"omdb": "Use IMDb Rating through OMDb",
"mdb": "Use MdbList Average Score",
"mdb": "Use MdbList Score",
"mdb_average": "Use MdbList Average Score",
"mdb_imdb": "Use IMDb Rating through MDbList",
"mdb_metacritic": "Use Metacritic Rating through MDbList",
"mdb_metacriticuser": "Use Metacritic User Rating through MDbList",

View file

@ -7,7 +7,7 @@ from urllib.parse import urlparse
logger = util.logger
builders = ["mdblist_list"]
sort_names = ["rank", "score", "released", "imdbrating", "imdbvotes", "imdbpopular", "tmdbpopular", "rogerebert", "rtomatoes", "metacritic", "myanimelist", "budget", "revenue", "added"]
sort_names = ["rank", "score", "score_average", "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]
base_url = "https://mdblist.com/lists"
api_url = "https://mdblist.com/api/"
@ -37,6 +37,7 @@ class MDbObj:
self.tmdb_rating = None
self.letterboxd_rating = None
self.myanimelist_rating = None
self.score_average_rating = None
for rating in data["ratings"]:
if rating["source"] == "imdb":
self.imdb_rating = util.check_num(rating["value"], is_int=False)
@ -56,6 +57,8 @@ class MDbObj:
self.letterboxd_rating = util.check_num(rating["value"], is_int=False)
elif rating["source"] == "myanimelist":
self.myanimelist_rating = util.check_num(rating["value"], is_int=False)
elif rating["source"] == "average":
self.score_average_rating = util.check_num(rating["value"], is_int=False)
self.content_rating = data["certification"]
self.commonsense = data["commonsense"]

View file

@ -256,6 +256,8 @@ class Operations:
found_rating = omdb_item.imdb_rating
elif mdb_item and attribute == "mdb":
found_rating = mdb_item.score / 10 if mdb_item.score else None
elif mdb_item and attribute == "mdb_average":
found_rating = mdb_item.average_score_rating / 10 if mdb_item.average_rating else None
elif mdb_item and attribute == "mdb_imdb":
found_rating = mdb_item.imdb_rating if mdb_item.imdb_rating else None
elif mdb_item and attribute == "mdb_metacritic":

View file

@ -87,7 +87,7 @@ tags_to_edit = {
"Show": ["genre", "label", "collection"],
"Artist": ["genre", "label", "style", "mood", "country", "collection", "similar_artist"]
}
mdb_types = ["mdb", "mdb_imdb", "mdb_metacritic", "mdb_metacriticuser", "mdb_trakt", "mdb_tomatoes", "mdb_tomatoesaudience", "mdb_tmdb", "mdb_letterboxd"]
mdb_types = ["mdb", "mdv_average", "mdb_imdb", "mdb_metacritic", "mdb_metacriticuser", "mdb_trakt", "mdb_tomatoes", "mdb_tomatoesaudience", "mdb_tmdb", "mdb_letterboxd"]
collection_mode_options = {
"default": "default", "hide": "hide",
"hide_items": "hideItems", "hideitems": "hideItems",