diff --git a/.env-sample b/.env-sample
index 6514472..a6bf81a 100644
--- a/.env-sample
+++ b/.env-sample
@@ -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
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4646159..6b7a214 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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)
diff --git a/comet/api/core.py b/comet/api/core.py
index 1c9f7c8..1dabf54 100644
--- a/comet/api/core.py
+++ b/comet/api/core.py
@@ -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,
diff --git a/comet/api/stream.py b/comet/api/stream.py
index 92dcb5c..6dbd6f5 100644
--- a/comet/api/stream.py
+++ b/comet/api/stream.py
@@ -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
diff --git a/comet/main.py b/comet/main.py
index b5523b9..4cccd79 100644
--- a/comet/main.py
+++ b/comet/main.py
@@ -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)}")
diff --git a/comet/templates/index.html b/comet/templates/index.html
index 76f63c6..55717a2 100644
--- a/comet/templates/index.html
+++ b/comet/templates/index.html
@@ -527,6 +527,10 @@