Skip to content

Commit

Permalink
Fixed no debrid cache error
Browse files Browse the repository at this point in the history
  • Loading branch information
aymene69 committed Feb 21, 2024
1 parent c63f251 commit 15c1f0f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
4 changes: 2 additions & 2 deletions debrid/alldebrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def get_stream_link_ad(query, config):
data = response.json()
tries = 0
while True:
if tries > 5:
break
if tries > 1:
return config['addonHost'] + "/nocache/"
url = ("https://api.alldebrid.com/v4/magnet/status?agent=jackett&apikey=" + config['debridKey'] + "&id=" +
str(data["data"]['magnets'][0]['id']))
response = requests.get(url)
Expand Down
8 changes: 4 additions & 4 deletions debrid/realdebrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def get_stream_link_rd(query, config):
print("Selected file")
tries = 0
while True:
if tries > 5:
break
if tries > 1:
return config['addonHost'] + "/nocache/"
print("Getting link")
url = "https://api.real-debrid.com/rest/1.0/torrents/info/" + torrent_id
response = requests.get(url, headers=headers)
Expand Down Expand Up @@ -72,8 +72,8 @@ def get_stream_link_rd(query, config):
print("Selected file")
tries = 0
while True:
if tries > 5:
break
if tries > 1:
return config['addonHost'] + "/nocache/"
print("Getting link")
url = "https://api.real-debrid.com/rest/1.0/torrents/info/" + torrent_id
response = requests.get(url, headers=headers)
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<form style="background-color: rgba(255,255,255,0.68);padding: 2rem;border-radius: 1rem">
<img src="https://user-images.githubusercontent.com/27040483/28728094-99f3e3f6-73c7-11e7-8f8d-28912dc6ac0d.png" alt="logo" style="width: 100px;height: 100px;">
<div class="space-y-12">
<p style="text-align: center">Stremio-Jackett v3.0.0</p>
<p style="text-align: center">Stremio-Jackett v3.0.4</p>
<h1 class="text-base font-semibold leading-7 text-gray-900" style="text-align: center;font-size: 2rem;">Addon configuration</h1>


Expand Down
9 changes: 9 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json

from fastapi import FastAPI, Request, HTTPException
from fastapi.responses import FileResponse
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import RedirectResponse
from fastapi.responses import HTMLResponse
Expand Down Expand Up @@ -211,3 +212,11 @@ async def get_playback(config: str, query: str, title: str):
except Exception as e:
print(f"An error occurred: {e}")
raise HTTPException(status_code=500, detail="An error occurred while processing the request.")

@app.get("/{config}/nocache")
async def get_nocache():
return FileResponse("nocache.mp4", media_type="video/mp4")

@app.get("/nocache")
async def get_nocache():
return FileResponse("nocache.mp4", media_type="video/mp4")
24 changes: 7 additions & 17 deletions migrate.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

echo "Please enter your email: "
read userMail

echo "Please enter your domain name: "
read domainName
cd jackett
Expand All @@ -15,18 +12,11 @@ cd ../traefik
sudo docker compose down
cd ..

sudo mkdir /etc/traefik
sudo mkdir /etc/traefik/certs

sudo curl -fsSL https://raw.githubusercontent.com/aymene69/stremio-jackett/main/traefik/traefik.yml -o /etc/traefik/traefik.yml

sudo sed -i "s/[email protected]/$userMail/g" /etc/traefik/traefik.yml

sudo mkdir traefik jackett addon
sudo curl -fsSL https://raw.githubusercontent.com/aymene69/stremio-jackett/main/traefik/docker-compose.yml -o ./traefik/docker-compose.yml

sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 9117 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 8191 -j ACCEPT

sudo netfilter-persistent save
cd traefik
sudo docker compose up -d
Expand All @@ -39,12 +29,12 @@ sudo docker compose up -d
cd ../addon
sudo curl -fsSL https://raw.githubusercontent.com/aymene69/stremio-jackett/main/docker-compose-traefik.yml -o ./docker-compose.yml
sudo sed -i "s/YOURADDON.COM/$domainName/g" ./docker-compose.yml
sudo docker compose pull
sudo docker compose up -d
cd ../traefik
sudo docker compose down
sudo docker compose up -d
clear

IP=$(curl -4 -s ifconfig.me)
echo "Your addon is accessible at https://$domainName/"
echo "Jackett is accessible at http://$(curl -4 -s ifconfig.me):9117"
echo "FlareSolverr is accessible at http://$(curl -4 -s ifconfig.me):8191"
echo "Jackett is accessible at http://${IP}:9117"
echo "FlareSolverr is accessible at http://${IP}:8191"
Binary file added nocache.mp4
Binary file not shown.
2 changes: 1 addition & 1 deletion utils/parse_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ def parse_xml(xml_content, query, config):
sorted_items = sorted(items_list, key=lambda x: int(x['seeders']), reverse=True)
data = json.dumps(sorted_items, indent=4)
threading.Thread(target=cache_torrents, args=(sorted_items, query['type'], config)).start()
return data
return data

0 comments on commit 15c1f0f

Please sign in to comment.