mirror of
https://github.com/g0ldyy/comet.git
synced 2026-01-12 01:16:12 +01:00
Merge branch 'main' into improve_tv_shows_results
This commit is contained in:
+2
-1
@@ -22,8 +22,9 @@ SCRAPE_MEDIAFUSION=False # scrape MediaFusion - has better results for Indian co
|
||||
MEDIAFUSION_URL=https://mediafusion.elfhosted.com # Allows you to scrape custom instances of MediaFusion
|
||||
PROXY_DEBRID_STREAM=False # Proxy Debrid Streams (very useful to use your debrid service on multiple IPs at same time)
|
||||
PROXY_DEBRID_STREAM_PASSWORD=CHANGE_ME # Secret password to enter on configuration page to prevent people from abusing your debrid stream proxy
|
||||
PROXY_DEBRID_STREAM_MAX_CONNECTIONS=100 # IP-Based connection limit for the Debrid Stream Proxy
|
||||
PROXY_DEBRID_STREAM_MAX_CONNECTIONS=-1 # IP-Based connection limit for the Debrid Stream Proxy (-1 = disabled)
|
||||
PROXY_DEBRID_STREAM_DEBRID_DEFAULT_SERVICE=realdebrid # if you want your users who use the Debrid Stream Proxy not to have to specify Debrid information, but to use the default one instead
|
||||
PROXY_DEBRID_STREAM_DEBRID_DEFAULT_APIKEY=CHANGE_ME # if you want your users who use the Debrid Stream Proxy not to have to specify Debrid information, but to use the default one instead
|
||||
TITLE_MATCH_CHECK=True # disable if you only use Torrentio / MediaFusion and are sure you're only scraping good titles, for example (keep it True if Zilean is enabled)
|
||||
REMOVE_ADULT_CONTENT=False # detect and remove adult content
|
||||
CUSTOM_HEADER_HTML=None # only set it if you know what it is
|
||||
|
||||
@@ -1,5 +1,42 @@
|
||||
# Changelog
|
||||
|
||||
## [1.40.0](https://github.com/g0ldyy/comet/compare/v1.39.0...v1.40.0) (2024-11-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* reverse order results ([15098f3](https://github.com/g0ldyy/comet/commit/15098f379e0e2012e229d275095afe618304567f))
|
||||
|
||||
## [1.39.0](https://github.com/g0ldyy/comet/compare/v1.38.0...v1.39.0) (2024-11-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* shit filter and adult content check ([fe3ddb6](https://github.com/g0ldyy/comet/commit/fe3ddb6702aac23de8e3ad6b51c56899f3f3ea24))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* webui config ([0487af5](https://github.com/g0ldyy/comet/commit/0487af542e3f03a2d95719b4cb7243bc21f8e119))
|
||||
|
||||
## [1.38.0](https://github.com/g0ldyy/comet/compare/v1.37.0...v1.38.0) (2024-11-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ability to disable max connection ([9ebcb71](https://github.com/g0ldyy/comet/commit/9ebcb71ef1cd48ed9ac3079838cf4b2da1575cc2))
|
||||
* ability to disable max connection [#2](https://github.com/g0ldyy/comet/issues/2) ([412699f](https://github.com/g0ldyy/comet/commit/412699fb55a77069ef17c0e5f826d87cca2d7c8d))
|
||||
* ability to disable max connection [#3](https://github.com/g0ldyy/comet/issues/3) ([05fe062](https://github.com/g0ldyy/comet/commit/05fe06294b0471a2cd8e7cfb3c3b96a9863e1f6a))
|
||||
* ability to disable max connection [#4](https://github.com/g0ldyy/comet/issues/4) ([a18dceb](https://github.com/g0ldyy/comet/commit/a18dceb01c49f4a0fee50b3afda11b5008da3085))
|
||||
* add max results per resolution configuration option ([fefc260](https://github.com/g0ldyy/comet/commit/fefc260b083e46ac062ede04abd694c9841f7c42))
|
||||
* add search term ([fdb62ab](https://github.com/g0ldyy/comet/commit/fdb62ab60adb046e92279f7f5c2578d9b54fd8bc))
|
||||
* language unknown support ([6f7c79f](https://github.com/g0ldyy/comet/commit/6f7c79f91dffabd28bcce667be6c72837711414b))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix 2160p issue ([5ca4aa5](https://github.com/g0ldyy/comet/commit/5ca4aa59a0b704f77ab45190f2e03fc83e75023e))
|
||||
|
||||
## [1.37.0](https://github.com/g0ldyy/comet/compare/v1.36.1...v1.37.0) (2024-11-15)
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -24,7 +24,8 @@ async def health():
|
||||
|
||||
indexers = settings.INDEXER_MANAGER_INDEXERS
|
||||
languages = [language for language in PTT.parse.LANGUAGES_TRANSLATION_TABLE.values()]
|
||||
languages.insert(0, "Multi")
|
||||
languages.insert(0, "Unknown")
|
||||
languages.insert(1, "Multi")
|
||||
web_config = {
|
||||
"indexers": [indexer.replace(" ", "_").lower() for indexer in indexers],
|
||||
"languages": languages,
|
||||
|
||||
+70
-80
@@ -39,15 +39,16 @@ streams = APIRouter()
|
||||
|
||||
@streams.get("/stream/{type}/{id}.json")
|
||||
async def stream_noconfig(request: Request, type: str, id: str):
|
||||
return {
|
||||
"streams": [
|
||||
{
|
||||
"name": "[⚠️] Comet",
|
||||
"description": f"{request.url.scheme}://{request.url.netloc}/configure",
|
||||
"url": "https://comet.fast",
|
||||
}
|
||||
]
|
||||
}
|
||||
return {
|
||||
"streams": [
|
||||
{
|
||||
"name": "[⚠️] Comet",
|
||||
"description": f"{request.url.scheme}://{request.url.netloc}/configure",
|
||||
"url": "https://comet.fast",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@streams.get("/{b64config}/stream/{type}/{id}.json")
|
||||
async def stream(request: Request, b64config: str, type: str, id: str):
|
||||
@@ -196,51 +197,40 @@ async def stream(request: Request, b64config: str, type: str, id: str):
|
||||
)
|
||||
balanced_hashes = get_balanced_hashes(all_sorted_ranked_files, config)
|
||||
|
||||
seen_hashes = set()
|
||||
for hash, hash_data in all_sorted_ranked_files.items():
|
||||
if hash in seen_hashes:
|
||||
continue
|
||||
for resolution in balanced_hashes:
|
||||
for hash in balanced_hashes[resolution]:
|
||||
data = all_sorted_ranked_files[hash]["data"]
|
||||
|
||||
for resolution, hash_list in balanced_hashes.items():
|
||||
if hash in hash_list:
|
||||
data = hash_data["data"]
|
||||
the_stream = {
|
||||
"name": f"[{debrid_extension}{debrid_emoji}] Comet {data['resolution']}",
|
||||
"description": format_title(data, config),
|
||||
"torrentTitle": (
|
||||
data["torrent_title"] if "torrent_title" in data else None
|
||||
),
|
||||
"torrentSize": (
|
||||
data["torrent_size"] if "torrent_size" in data else None
|
||||
),
|
||||
"behaviorHints": {
|
||||
"filename": data["raw_title"],
|
||||
"bingeGroup": "comet|" + hash,
|
||||
},
|
||||
}
|
||||
|
||||
the_stream = {
|
||||
"name": f"[{debrid_extension}{debrid_emoji}] Comet {data['resolution']}",
|
||||
"description": format_title(data, config),
|
||||
"torrentTitle": (
|
||||
data["torrent_title"]
|
||||
if "torrent_title" in data
|
||||
else None
|
||||
),
|
||||
"torrentSize": (
|
||||
data["torrent_size"] if "torrent_size" in data else None
|
||||
),
|
||||
"behaviorHints": {
|
||||
"filename": data["raw_title"],
|
||||
"bingeGroup": "comet|" + hash,
|
||||
},
|
||||
}
|
||||
if config["debridApiKey"] != "":
|
||||
the_stream["url"] = (
|
||||
f"{request.url.scheme}://{request.url.netloc}/{b64config}/playback/{hash}/{data['index']}"
|
||||
)
|
||||
else:
|
||||
the_stream["infoHash"] = hash
|
||||
|
||||
if config["debridApiKey"] != "":
|
||||
the_stream["url"] = (
|
||||
f"{request.url.scheme}://{request.url.netloc}/{b64config}/playback/{hash}/{data['index']}"
|
||||
)
|
||||
else:
|
||||
the_stream["infoHash"] = hash
|
||||
index = data["index"]
|
||||
the_stream["fileIdx"] = (
|
||||
1 if "|" in index else int(index)
|
||||
) # 1 because for Premiumize it's impossible to get the file index
|
||||
|
||||
index = data["index"]
|
||||
the_stream["fileIdx"] = (
|
||||
1 if "|" in index else int(index)
|
||||
) # 1 because for Premiumize it's impossible to get the file index
|
||||
the_stream["sources"] = trackers
|
||||
|
||||
the_stream["sources"] = trackers
|
||||
|
||||
results.append(the_stream)
|
||||
|
||||
seen_hashes.add(hash)
|
||||
|
||||
break
|
||||
results.append(the_stream)
|
||||
|
||||
results_count = len(results)
|
||||
if results_count != 0:
|
||||
@@ -410,11 +400,13 @@ async def stream(request: Request, b64config: str, type: str, id: str):
|
||||
try:
|
||||
ranked_file = rtn.rank(
|
||||
files[hash]["title"],
|
||||
hash, # , correct_title=name, remove_trash=True
|
||||
hash,
|
||||
remove_trash=True, # , correct_title=name, remove_trash=True
|
||||
)
|
||||
|
||||
ranked_files.add(ranked_file)
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.info(f"Filtered out: {e}")
|
||||
pass
|
||||
|
||||
sorted_ranked_files = sort_torrents(ranked_files)
|
||||
@@ -484,25 +476,22 @@ async def stream(request: Request, b64config: str, type: str, id: str):
|
||||
}
|
||||
)
|
||||
|
||||
for hash, hash_data in sorted_ranked_files.items():
|
||||
for resolution, hash_list in balanced_hashes.items():
|
||||
if hash in hash_list:
|
||||
data = hash_data["data"]
|
||||
results.append(
|
||||
{
|
||||
"name": f"[{debrid_extension}⚡] Comet {data['resolution']}",
|
||||
"description": format_title(data, config),
|
||||
"torrentTitle": data["torrent_title"],
|
||||
"torrentSize": data["torrent_size"],
|
||||
"url": f"{request.url.scheme}://{request.url.netloc}/{b64config}/playback/{hash}/{data['index']}",
|
||||
"behaviorHints": {
|
||||
"filename": data["raw_title"],
|
||||
"bingeGroup": "comet|" + hash,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
continue
|
||||
for resolution in balanced_hashes:
|
||||
for hash in balanced_hashes[resolution]:
|
||||
data = sorted_ranked_files[hash]["data"]
|
||||
results.append(
|
||||
{
|
||||
"name": f"[{debrid_extension}⚡] Comet {data['resolution']}",
|
||||
"description": format_title(data, config),
|
||||
"torrentTitle": data["torrent_title"],
|
||||
"torrentSize": data["torrent_size"],
|
||||
"url": f"{request.url.scheme}://{request.url.netloc}/{b64config}/playback/{hash}/{data['index']}",
|
||||
"behaviorHints": {
|
||||
"filename": data["raw_title"],
|
||||
"bingeGroup": "comet|" + hash,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
return {"streams": results}
|
||||
|
||||
@@ -602,16 +591,17 @@ async def playback(request: Request, b64config: str, hash: str, index: str):
|
||||
and settings.PROXY_DEBRID_STREAM_PASSWORD
|
||||
== config["debridStreamProxyPassword"]
|
||||
):
|
||||
active_ip_connections = await database.fetch_all(
|
||||
"SELECT ip, COUNT(*) as connections FROM active_connections GROUP BY ip"
|
||||
)
|
||||
if any(
|
||||
connection["ip"] == ip
|
||||
and connection["connections"]
|
||||
>= settings.PROXY_DEBRID_STREAM_MAX_CONNECTIONS
|
||||
for connection in active_ip_connections
|
||||
):
|
||||
return FileResponse("comet/assets/proxylimit.mp4")
|
||||
if settings.PROXY_DEBRID_STREAM_MAX_CONNECTIONS != -1:
|
||||
active_ip_connections = await database.fetch_all(
|
||||
"SELECT ip, COUNT(*) as connections FROM active_connections GROUP BY ip"
|
||||
)
|
||||
if any(
|
||||
connection["ip"] == ip
|
||||
and connection["connections"]
|
||||
>= settings.PROXY_DEBRID_STREAM_MAX_CONNECTIONS
|
||||
for connection in active_ip_connections
|
||||
):
|
||||
return FileResponse("comet/assets/proxylimit.mp4")
|
||||
|
||||
proxy = None
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ def start_log():
|
||||
f"Debrid Stream Proxy: {bool(settings.PROXY_DEBRID_STREAM)} - Password: {settings.PROXY_DEBRID_STREAM_PASSWORD} - Max Connections: {settings.PROXY_DEBRID_STREAM_MAX_CONNECTIONS} - Default Debrid Service: {settings.PROXY_DEBRID_STREAM_DEBRID_DEFAULT_SERVICE} - Default Debrid API Key: {settings.PROXY_DEBRID_STREAM_DEBRID_DEFAULT_APIKEY}",
|
||||
)
|
||||
logger.log("COMET", f"Title Match Check: {bool(settings.TITLE_MATCH_CHECK)}")
|
||||
logger.log("COMET", f"Remove Adult Content: {bool(settings.REMOVE_ADULT_CONTENT)}")
|
||||
logger.log("COMET", f"Custom Header HTML: {bool(settings.CUSTOM_HEADER_HTML)}")
|
||||
|
||||
|
||||
|
||||
+31
-10
@@ -527,6 +527,10 @@
|
||||
<sl-input id="maxResults" type="number" min=0 value=0 label="Max Results" placeholder="Enter max results"></sl-input>
|
||||
</div>
|
||||
|
||||
<div class="form-item">
|
||||
<sl-input id="maxResultsPerResolution" type="number" min=0 value=0 label="Max Results Per Resolution" placeholder="Enter max results per resolution"></sl-input>
|
||||
</div>
|
||||
|
||||
<div class="form-item">
|
||||
<sl-input id="maxSize" type="number" min=0 value=0 label="Max Size (GB)" placeholder="Enter max size in gigabytes"></sl-input>
|
||||
</div>
|
||||
@@ -555,6 +559,7 @@
|
||||
|
||||
<sl-details summary="Advanced Settings">
|
||||
<div class="form-item">
|
||||
<sl-checkbox id="reverseResultOrder" help-text="Reverse the order of the results for each resolution (useful for those who need small file sizes)">Reverse Result Order</sl-checkbox>
|
||||
<sl-select id="resultFormat" multiple label="Result Format" placeholder="Select what to show in result title" hoist max-options-visible=10>
|
||||
</sl-select>
|
||||
</div>
|
||||
@@ -594,6 +599,7 @@
|
||||
|
||||
<script type="module">
|
||||
const languagesEmojis = {
|
||||
"Unknown": "❓",
|
||||
"Multi": "🌎",
|
||||
"English": "🇬🇧",
|
||||
"Japanese": "🇯🇵",
|
||||
@@ -655,7 +661,8 @@
|
||||
customElements.whenDefined("sl-select"),
|
||||
customElements.whenDefined("sl-input"),
|
||||
customElements.whenDefined("sl-option"),
|
||||
customElements.whenDefined("sl-icon")
|
||||
customElements.whenDefined("sl-icon"),
|
||||
customElements.whenDefined("sl-checkbox")
|
||||
]);
|
||||
|
||||
const webConfig = {{webConfig|tojson}};
|
||||
@@ -710,7 +717,9 @@
|
||||
const languages = Array.from(document.getElementById("languages").selectedOptions).map(option => option.value);
|
||||
const resolutions = Array.from(document.getElementById("resolutions").selectedOptions).map(option => option.value);
|
||||
const maxResults = document.getElementById("maxResults").value;
|
||||
const maxResultsPerResolution = document.getElementById("maxResultsPerResolution").value;
|
||||
const maxSize = document.getElementById("maxSize").value;
|
||||
const reverseResultOrder = document.getElementById("reverseResultOrder").checked;
|
||||
const resultFormat = Array.from(document.getElementById("resultFormat").selectedOptions).map(option => option.value);
|
||||
const debridService = document.getElementById("debridService").value;
|
||||
const debridApiKey = document.getElementById("debridApiKey").value;
|
||||
@@ -722,7 +731,9 @@
|
||||
return {
|
||||
indexers: indexers,
|
||||
maxResults: parseInt(maxResults),
|
||||
maxResultsPerResolution: parseInt(maxResultsPerResolution),
|
||||
maxSize: parseFloat(maxSize * 1073741824),
|
||||
reverseResultOrder: reverseResultOrder,
|
||||
resultFormat: selectedResultFormat,
|
||||
resolutions: selectedResolutions,
|
||||
languages: selectedLanguages,
|
||||
@@ -773,17 +784,27 @@
|
||||
}
|
||||
|
||||
function populateFormFromSettings(settings) {
|
||||
document.getElementById("maxResults").value = settings.maxResults;
|
||||
document.getElementById("maxSize").value = settings.maxSize / 1073741824; // Convert back from bytes to GB
|
||||
document.getElementById("debridService").value = settings.debridService;
|
||||
document.getElementById("debridApiKey").value = settings.debridApiKey;
|
||||
document.getElementById("debridStreamProxyPassword").value = settings.debridStreamProxyPassword;
|
||||
document.getElementById("indexers").value = settings.indexers;
|
||||
if (settings.languages != "All")
|
||||
if (settings.maxResults !== null)
|
||||
document.getElementById("maxResults").value = settings.maxResults;
|
||||
if (settings.reverseResultOrder !== null)
|
||||
document.getElementById("reverseResultOrder").checked = settings.reverseResultOrder;
|
||||
if (settings.maxResultsPerResolution !== null)
|
||||
document.getElementById("maxResultsPerResolution").value = settings.maxResultsPerResolution;
|
||||
if (settings.maxSize !== null)
|
||||
document.getElementById("maxSize").value = settings.maxSize / 1073741824;
|
||||
if (settings.debridService !== null)
|
||||
document.getElementById("debridService").value = settings.debridService;
|
||||
if (settings.debridApiKey !== null)
|
||||
document.getElementById("debridApiKey").value = settings.debridApiKey;
|
||||
if (settings.debridStreamProxyPassword !== null)
|
||||
document.getElementById("debridStreamProxyPassword").value = settings.debridStreamProxyPassword;
|
||||
if (settings.indexers !== null)
|
||||
document.getElementById("indexers").value = settings.indexers;
|
||||
if (settings.languages !== null && settings.languages != "All")
|
||||
document.getElementById("languages").value = settings.languages;
|
||||
if (settings.resolutions != "All")
|
||||
if (settings.resolutions !== null && settings.resolutions != "All")
|
||||
document.getElementById("resolutions").value = settings.resolutions;
|
||||
if (settings.resultFormat != "All")
|
||||
if (settings.resultFormat !== null && settings.resultFormat != "All")
|
||||
document.getElementById("resultFormat").value = settings.resultFormat;
|
||||
}
|
||||
|
||||
|
||||
+15
-2
@@ -16,6 +16,7 @@ from comet.utils.logger import logger
|
||||
from comet.utils.models import settings, ConfigModel
|
||||
|
||||
languages_emojis = {
|
||||
"unknown": "❓", # Unknown
|
||||
"multi": "🌎", # Dubbed
|
||||
"en": "🇬🇧", # English
|
||||
"ja": "🇯🇵", # Japanese
|
||||
@@ -553,6 +554,7 @@ async def get_torrent_hash(session: aiohttp.ClientSession, torrent: tuple):
|
||||
|
||||
def get_balanced_hashes(hashes: dict, config: dict):
|
||||
max_results = config["maxResults"]
|
||||
max_results_per_resolution = config["maxResultsPerResolution"]
|
||||
|
||||
max_size = config["maxSize"]
|
||||
config_resolutions = [resolution.lower() for resolution in config["resolutions"]]
|
||||
@@ -578,6 +580,7 @@ def get_balanced_hashes(hashes: dict, config: dict):
|
||||
not include_all_languages
|
||||
and not any(lang in hash_info["languages"] for lang in config_languages)
|
||||
and ("multi" not in languages if hash_info["dubbed"] else True)
|
||||
and not (len(hash_info["languages"]) == 0 and "unknown" in languages)
|
||||
):
|
||||
continue
|
||||
|
||||
@@ -589,16 +592,26 @@ def get_balanced_hashes(hashes: dict, config: dict):
|
||||
hashes_by_resolution[resolution] = []
|
||||
hashes_by_resolution[resolution].append(hash)
|
||||
|
||||
if config["reverseResultOrder"]:
|
||||
for resolution in hashes_by_resolution:
|
||||
hashes_by_resolution[resolution].reverse()
|
||||
|
||||
total_resolutions = len(hashes_by_resolution)
|
||||
if max_results == 0 or total_resolutions == 0:
|
||||
if max_results == 0 and max_results_per_resolution == 0 or total_resolutions == 0:
|
||||
return hashes_by_resolution
|
||||
|
||||
hashes_per_resolution = max_results // total_resolutions
|
||||
hashes_per_resolution = (
|
||||
max_results // total_resolutions
|
||||
if max_results > 0
|
||||
else max_results_per_resolution
|
||||
)
|
||||
extra_hashes = max_results % total_resolutions
|
||||
|
||||
balanced_hashes = {}
|
||||
for resolution, hash_list in hashes_by_resolution.items():
|
||||
selected_count = hashes_per_resolution + (1 if extra_hashes > 0 else 0)
|
||||
if max_results_per_resolution > 0:
|
||||
selected_count = min(selected_count, max_results_per_resolution)
|
||||
balanced_hashes[resolution] = hash_list[:selected_count]
|
||||
if extra_hashes > 0:
|
||||
extra_hashes -= 1
|
||||
|
||||
+136
-2
@@ -37,10 +37,11 @@ class AppSettings(BaseSettings):
|
||||
CUSTOM_HEADER_HTML: Optional[str] = None
|
||||
PROXY_DEBRID_STREAM: Optional[bool] = False
|
||||
PROXY_DEBRID_STREAM_PASSWORD: Optional[str] = None
|
||||
PROXY_DEBRID_STREAM_MAX_CONNECTIONS: Optional[int] = 100
|
||||
PROXY_DEBRID_STREAM_MAX_CONNECTIONS: Optional[int] = -1
|
||||
PROXY_DEBRID_STREAM_DEBRID_DEFAULT_SERVICE: Optional[str] = "realdebrid"
|
||||
PROXY_DEBRID_STREAM_DEBRID_DEFAULT_APIKEY: Optional[str] = None
|
||||
TITLE_MATCH_CHECK: Optional[bool] = True
|
||||
REMOVE_ADULT_CONTENT: Optional[bool] = False
|
||||
|
||||
@field_validator("DASHBOARD_ADMIN_PASSWORD")
|
||||
def set_dashboard_admin_password(cls, v, values):
|
||||
@@ -68,8 +69,10 @@ class ConfigModel(BaseModel):
|
||||
indexers: List[str]
|
||||
languages: Optional[List[str]] = ["All"]
|
||||
resolutions: Optional[List[str]] = ["All"]
|
||||
reverseResultOrder: Optional[bool] = False
|
||||
resultFormat: Optional[List[str]] = ["All"]
|
||||
maxResults: Optional[int] = 0
|
||||
maxResultsPerResolution: Optional[int] = 0
|
||||
maxSize: Optional[float] = 0
|
||||
debridService: str
|
||||
debridApiKey: str
|
||||
@@ -92,12 +95,27 @@ class ConfigModel(BaseModel):
|
||||
|
||||
@field_validator("maxResults")
|
||||
def check_max_results(cls, v):
|
||||
if not isinstance(v, int):
|
||||
v = 0
|
||||
|
||||
if v < 0:
|
||||
v = 0
|
||||
return v
|
||||
|
||||
@field_validator("maxResultsPerResolution")
|
||||
def check_max_results_per_resolution(cls, v):
|
||||
if not isinstance(v, int):
|
||||
v = 0
|
||||
|
||||
if v < 0:
|
||||
v = 0
|
||||
return v
|
||||
|
||||
@field_validator("maxSize")
|
||||
def check_max_size(cls, v):
|
||||
if not isinstance(v, int):
|
||||
v = 0
|
||||
|
||||
if v < 0:
|
||||
v = 0
|
||||
return v
|
||||
@@ -109,7 +127,123 @@ class ConfigModel(BaseModel):
|
||||
return v
|
||||
|
||||
|
||||
rtn_settings = SettingsModel()
|
||||
default_settings = {
|
||||
"profile": "default",
|
||||
"require": [],
|
||||
"exclude": [],
|
||||
"preferred": [],
|
||||
"resolutions": {
|
||||
"r2160p": True,
|
||||
"r1080p": True,
|
||||
"r720p": True,
|
||||
"r480p": True,
|
||||
"r360p": True,
|
||||
"unknown": True,
|
||||
},
|
||||
"options": {
|
||||
"title_similarity": 0.85,
|
||||
"remove_all_trash": True,
|
||||
"remove_ranks_under": -1000000000000000,
|
||||
"remove_unknown_languages": False,
|
||||
"allow_english_in_languages": True,
|
||||
"enable_fetch_speed_mode": True,
|
||||
"remove_adult_content": settings.REMOVE_ADULT_CONTENT,
|
||||
},
|
||||
"languages": {
|
||||
"required": [],
|
||||
"exclude": [
|
||||
# "ar",
|
||||
# "hi",
|
||||
# "fr",
|
||||
# "es",
|
||||
# "de",
|
||||
# "ru",
|
||||
# "pt",
|
||||
# "it"
|
||||
],
|
||||
"preferred": [],
|
||||
},
|
||||
"custom_ranks": {
|
||||
"quality": {
|
||||
"av1": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"avc": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"bluray": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"dvd": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"hdtv": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"hevc": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"mpeg": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"remux": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"vhs": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"web": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"webdl": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"webmux": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"xvid": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
},
|
||||
"rips": {
|
||||
"bdrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"brrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"dvdrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"hdrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"ppvrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"satrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"tvrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"uhdrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"vhsrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"webdlrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"webrip": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
},
|
||||
"hdr": {
|
||||
"bit10": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"dolby_vision": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"hdr": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"hdr10plus": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"sdr": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
},
|
||||
"audio": {
|
||||
"aac": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"ac3": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"atmos": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"dolby_digital": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"dolby_digital_plus": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"dts_lossy": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"dts_lossless": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"eac3": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"flac": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"mono": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"mp3": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"stereo": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"surround": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"Truehd": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
},
|
||||
"extras": {
|
||||
"three_d": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"converted": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"documentary": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"dubbed": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"edition": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"hardcoded": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"network": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"proper": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"repack": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"retail": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"site": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"subbed": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"upscaled": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
"scene": {"fetch": True, "use_custom_rank": False, "rank": 0},
|
||||
},
|
||||
"trash": {
|
||||
"cam": {"fetch": False, "use_custom_rank": False, "rank": 0},
|
||||
"clean_audio": {"fetch": False, "use_custom_rank": False, "rank": 0},
|
||||
"pdtv": {"fetch": False, "use_custom_rank": False, "rank": 0},
|
||||
"r5": {"fetch": False, "use_custom_rank": False, "rank": 0},
|
||||
"screener": {"fetch": False, "use_custom_rank": False, "rank": 0},
|
||||
"size": {"fetch": False, "use_custom_rank": False, "rank": 0},
|
||||
"telecine": {"fetch": False, "use_custom_rank": False, "rank": 0},
|
||||
"telesync": {"fetch": False, "use_custom_rank": False, "rank": 0},
|
||||
},
|
||||
},
|
||||
}
|
||||
rtn_settings = SettingsModel(**default_settings)
|
||||
rtn_ranking = BestRanking()
|
||||
|
||||
# For use anywhere
|
||||
|
||||
Reference in New Issue
Block a user