Skip to content

Commit

Permalink
v1.3.0 - add option in config for catalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
LimeDrive committed Sep 16, 2024
1 parent 53f1ef4 commit d2d98e1
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 38 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "stream-fusion"
version = "1.2.0"
version = "1.3.0"
description = "StreamFusion is an advanced plugin for Stremio that significantly enhances its streaming capabilities with debrid service."
authors = ["LimeDrive <[email protected]>"]
readme = "README.md"
Expand Down
4 changes: 4 additions & 0 deletions stream_fusion/static/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ function loadData() {
document.getElementById('minCachedResults').value = decodedData.minCachedResults;
document.getElementById('torrenting').checked = decodedData.torrenting;
document.getElementById('debrid').checked = decodedData.debrid;
document.getElementById('ctg_yggtorrent').checked = decodedData.yggtorrentCtg;
document.getElementById('ctg_yggflix').checked = decodedData.yggflixCtg;
document.getElementById('tmdb').checked = decodedData.metadataProvider === 'tmdb';
document.getElementById('cinemeta').checked = decodedData.metadataProvider === 'cinemeta';

Expand Down Expand Up @@ -214,6 +216,8 @@ function getLink(method) {
zilean: document.getElementById('zilean')?.checked,
yggflix: document.getElementById('yggflix')?.checked,
sharewood: document.getElementById('sharewood')?.checked,
yggtorrentCtg: document.getElementById('ctg_yggtorrent')?.checked,
yggflixCtg: document.getElementById('ctg_yggflix')?.checked,
// yggUsername: document.getElementById('yggUsername')?.value,
// yggPassword: document.getElementById('yggPassword')?.value,
yggPasskey: document.getElementById('yggPasskey')?.value,
Expand Down
33 changes: 33 additions & 0 deletions stream_fusion/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,39 @@ <h2 class="text-white font-semibold leading-7">Torrent Providers</h2>
</div>
</div>
</div>

<div class="border-b border-gray-900/10 dark:border-white/50 pb-12">
<h2 class="text-white font-semibold leading-7">Catalogs Providers</h2>
<p class="mt-1 text-sm leading-6 text-gray-600 dark:text-gray-400">Configure your catalogs
preferences here.</p>

<div class="mt-10 space-y-10">
<div class="relative flex gap-x-3">
<div class="flex h-6 items-center">
<input id="ctg_yggflix" name="ctg_yggflix" type="checkbox"
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600">
</div>
<div class="text-sm leading-6">
<label for="ctg_yggflix" class="font-medium text-white">Enable Yggflix Catalogs</label>
<p class="text-gray-500 dark:text-gray-300">Activate yggflix catalogs for discovers
contents.</p>
</div>
</div>

<div class="relative flex gap-x-3">
<div class="flex h-6 items-center">
<input id="ctg_yggtorrent" name="ctg_yggtorrent" type="checkbox"
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600">
</div>
<div class="text-sm leading-6">
<label for="ctg_yggtorrent" class="font-medium text-white">Enable Yggtorrent Catalogs</label>
<p class="text-gray-500 dark:text-gray-300">Activate yggtorrent catalogs for discovers
contents.</p>
</div>
</div>
</div>
</div>

<div id="debrid-fields" style="display: none;">
<div class="border-b border-gray-900/10 dark:border-white/50 pb-12">
<h2 class="text-white font-semibold leading-7">Real-Debrid Configuration</h2>
Expand Down
86 changes: 49 additions & 37 deletions stream_fusion/web/root/config/views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from cachetools import TTLCache
from fastapi import APIRouter, Request
from fastapi import APIRouter, HTTPException, Request
from fastapi.responses import FileResponse, RedirectResponse
from fastapi.templating import Jinja2Templates

from stream_fusion.logging_config import logger
from stream_fusion.utils.parse_config import parse_config
from stream_fusion.utils.security.security_api_key import check_api_key
from stream_fusion.version import get_version
from stream_fusion.web.root.config.schemas import ManifestResponse, StaticFileResponse
from stream_fusion.settings import settings
Expand Down Expand Up @@ -42,12 +44,6 @@ async def get_manifest():
version=str(get_version()),
resources=[
'catalog',
## Useless for now, TMDB addon with french content and supp cinemata are OK for.
# {
# 'name': 'meta',
# 'types': ['movie', 'series'],
# 'idPrefixes': ['tt']
# },
{
'name': 'stream',
'types': ['movie', 'series'],
Expand Down Expand Up @@ -96,21 +92,58 @@ async def get_manifest():
]
)

@router.get("/{params}/manifest.json")
async def get_manifest():
@router.get("/{config}/manifest.json")
async def get_manifest(config: str):
config = parse_config(config)
logger.debug(f"Parsed configuration: {config}")

api_key = config.get("apiKey")
if api_key:
await check_api_key(api_key)
else:
logger.warning("API key not found in config.")
raise HTTPException(status_code=401, detail="API key not found in config.")

yggflix_ctg = config.get("yggflixCtg", True)
yggtorrent_ctg = config.get("yggtorrentCtg", True)

catalogs = []

if yggflix_ctg:
catalogs.extend([
{
"type": "movie",
"id": "latest_movies",
"name": "Yggflix"
},
{
"type": "series",
"id": "latest_tv_shows",
"name": "Yggflix"
}
])

if yggtorrent_ctg:
catalogs.extend([
{
"type": "movie",
"id": "recently_added_movies",
"name": "YGGtorrent - Récemment Ajoutés"
},
{
"type": "series",
"id": "recently_added_tv_shows",
"name": "YGGtorrent - Récemment Ajoutées"
}
])

logger.info("Serving manifest.json")
return ManifestResponse(
id="community.limedrive.streamfusion",
icon="https://i.imgur.com/q2VSdSp.png",
version=str(get_version()),
resources=[
'catalog',
## Useless for now, TMDB addon with french content and supp cinemata are OK for.
# {
# 'name': 'meta',
# 'types': ['movie', 'series'],
# 'idPrefixes': ['tt']
# },
{
'name': 'stream',
'types': ['movie', 'series'],
Expand All @@ -123,26 +156,5 @@ async def get_manifest():
" providing access to a vast array of cached torrent sources. This plugin seamlessly bridges"
" Stremio with popular indexers and debrid platforms, offering users an expanded content"
" library and a smooth streaming experience.",
catalogs=[
{
"type": "movie",
"id": "latest_movies",
"name": "Yggflix - Films Récents"
},
{
"type": "movie",
"id": "recently_added_movies",
"name": "YGGtorrent - Films Récemment Ajoutés"
},
{
"type": "series",
"id": "latest_tv_shows",
"name": "Yggflix - Séries Récentes"
},
{
"type": "series",
"id": "recently_added_tv_shows",
"name": "YGGtorrent - Séries Récemment Ajoutées"
}
]
catalogs=catalogs,
)

0 comments on commit d2d98e1

Please sign in to comment.