Convert the rating field to a numerical data type

This commit is contained in:
C5H12O5
2023-08-31 23:56:14 +08:00
parent 4414ee9575
commit 9814863890
10 changed files with 46 additions and 16 deletions

View File

@ -54,7 +54,7 @@
"extra": {
"[plugin_id]": {
"rating": {
"[plugin_id]": "['xp_text', './/ratingValue']"
"[plugin_id]": "['xp_text', './/ratingValue', 'float']"
},
"poster": "['xp_texts', './image', 're_sub', '(.+/photo)/s_ratio_poster/(public/.+)', '\\\\1/m/\\\\2']",
"backdrop": "['xp_texts', './image', 're_sub', '(.+/photo)/s_ratio_poster/(public/.+)', '\\\\1/l/\\\\2']"

View File

@ -64,7 +64,7 @@
}
},
"rating": {
"[plugin_id]": "['xp_text', './/ratingValue']"
"[plugin_id]": "['xp_text', './/ratingValue', 'float']"
},
"poster": "['xp_texts', './image', 're_sub', '(.+/photo)/s_ratio_poster/(public/.+)', '\\\\1/m/\\\\2']"
}

View File

@ -57,14 +57,14 @@
"extra": {
"[plugin_id]": {
"rating": {
"[plugin_id]": "['xp_text', './movie/sc']"
"[plugin_id]": "['xp_text', './movie/sc', 'float']"
},
"poster": "['xp_texts', './movie/img']",
"backdrop": "['xp_texts', './movie/img']"
}
}
},
"publish_date": "['xp_text', './movie/pubDate', 'strftime', '%Y-%m-%d']",
"publish_date": "['xp_text', './movie/pubDate', 'strftime', '%Y-%m-%d', 'True']",
"available_date": "{$parent[available]}"
}
}

View File

@ -55,7 +55,7 @@
}
}
},
"publish_date": "['xp_text', './movie/pubDate', 'strftime', '%Y-%m-%d']",
"publish_date": "['xp_text', './movie/pubDate', 'strftime', '%Y-%m-%d', 'True']",
"available_date": "{$parent[available]}"
}
}

View File

@ -68,13 +68,13 @@
}
},
"rating": {
"[plugin_id]": "['xp_text', './movie/sc']"
"[plugin_id]": "['xp_text', './movie/sc', 'float']"
},
"poster": "['xp_texts', './movie/img']"
}
}
},
"publish_date": "['xp_text', './movie/pubDate', 'strftime', '%Y-%m-%d']",
"publish_date": "['xp_text', './movie/pubDate', 'strftime', '%Y-%m-%d', 'True']",
"available_date": "{$parent[available]}"
}
}

View File

@ -66,7 +66,7 @@
"extra": {
"[plugin_id]": {
"rating": {
"[plugin_id]": "['xp_text', './data/basic/overallRating']"
"[plugin_id]": "['xp_text', './data/basic/overallRating', 'float']"
},
"poster": "['xp_texts', './data/basic/img']",
"backdrop": "['xp_texts', './data/basic/bigImage']"

View File

@ -77,7 +77,7 @@
}
},
"rating": {
"[plugin_id]": "['xp_text', './data/basic/overallRating']"
"[plugin_id]": "['xp_text', './data/basic/overallRating', 'float']"
},
"poster": "['xp_texts', './data/basic/img']"
}

View File

@ -69,13 +69,27 @@
"director": "['re_matches', '\"name\":\"([^\"]*?)\"[^{{}}]*?\"department\":\"Directing\"']",
"extra": {
"[plugin_id]": {
"rating": {
"[plugin_id]": "['xp_text', './vote_average', 're_sub', '(\\d+\\.\\d)\\d*', '\\\\1']"
},
"poster": ["['xp_text', './poster_path', 'prefix', 'https://image.tmdb.org/t/p/w500']"],
"backdrop": ["['xp_text', './backdrop_path', 'prefix', 'https://image.tmdb.org/t/p/original']"]
}
}
},
"rating": "['xp_text', './vote_average', 're_sub', '(\\d+\\.\\d)\\d*', '\\\\1']"
}
}
},
{
"collect": {
"source": "rating",
"into": {
"movie": {
"extra": {
"[plugin_id]": {
"rating": {
"[plugin_id]": "['re_match', '(.*)', 'float']"
}
}
}
}
}
}

View File

@ -106,13 +106,11 @@
"director": "['re_matches', '\"department\":\"Directing\"[^{{}}]*?\"name\":\"([^\"]*?)\"']",
"extra": {
"[plugin_id]": {
"rating": {
"[plugin_id]": "['xp_text', './vote_average', 're_sub', '(\\d+\\.\\d)\\d*', '\\\\1']"
},
"poster": ["['xp_text', './still_path', 'prefix', 'https://image.tmdb.org/t/p/w500']"]
}
}
}
},
"rating": "['xp_text', './vote_average', 're_sub', '(\\d+\\.\\d)\\d*', '\\\\1']"
}
}
},
@ -126,6 +124,22 @@
}
}
},
{
"collect": {
"source": "rating",
"into": {
"episode": {
"extra": {
"[plugin_id]": {
"rating": {
"[plugin_id]": "['re_match', '(.*)', 'float']"
}
}
}
}
}
}
},
{
"retval": {
"source": "episode"

View File

@ -148,6 +148,8 @@ def _modify(result: Any, strategy: str, args: list):
args_len = len(args)
if strategy == "int":
result = int(result)
if strategy == "float":
result = float(result)
elif strategy == "split" and args_len == 1:
result = result.split(args[0])
elif strategy == "prefix" and args_len == 1: