Added a config.json

This commit is contained in:
UrloMythus
2024-07-10 23:43:52 +02:00 Unverified
parent 7da89313d2
commit 2362c28dd0
16 changed files with 139 additions and 47 deletions
+56 -7
View File
@@ -1,62 +1,111 @@
# MammaMia # MammaMia
A Stremio Addon for high quality HTTPS Stream in Italian A Stremio Addon for high quality HTTPS Stream in Italian
While hosting, this project, remember that Filmpertutti uses Mixdrop. Mixdrop only allows seeing the videos only from the same IP where they were generated so, if you want to scrape filmpertutti, you have to host this project locally. Else, you can only scrape streamingcommunity. While hosting, this project, remember that Filmpertutti uses Mixdrop. Mixdrop only allows seeing the videos only from the same IP where they were generated so, if you want to scrape filmpertutti, you have to host this project locally. Else, you can only scrape streamingcommunity.
Hosting your own instance is suggested but you can use the public instance [linked](https://mammamia-urlo-mammamia.hf.space/) in the About Page of the repo. Hosting your own instance is suggested but you can use the public instance [linked](https://mammamia-urlo-mammamia.hf.space/) in the About Page of the repo.
# Installation # Installation
## Local ## Local
Install required packages Install required packages
`` ``
pip install -r requirements.txt pip install -r requirements.txt
`` ``
Then to start the Flask server just execute: Then to start the Flask server just execute:
`` ``
python3 run.py python3 run.py
`` ``
## Hugging Face ## Hugging Face
To host this project with Hugging Face, go to the [linked](https://huggingface.co/spaces/MammaMia-Urlo/MammaMia/) page and follow these steps To host this project with Hugging Face, go to the [linked](https://huggingface.co/spaces/MammaMia-Urlo/MammaMia/) page and follow these steps
1. Create an Hugging Face Account 1. Create an Hugging Face Account
2. Click on three dots on the top (right) part of the screen 2. Click on three dots on the top (right) part of the screen
3. Click Duplicate this Space 3. Click Duplicate this Space
4. Insert TMDB Key 4. Insert TMDB Key
5. Clone the Project 5. Clone the Project
6. You are done! 6. You are done!
7. To install it on Stremio altought, you will need the Direct URL. It can be found on three dots --> Embed This Space --> Direct URL 7. To install it on Stremio altought, you will need the Direct URL. It can be found on three dots --> Embed This Space --> Direct URL
8. Do not forget to add /manifest.json 8. Do not forget to add /manifest.json
On Hugging Face you are forced to use the 8080 port because it is the only one allowed to send/get network requests.
On Hugging Face you are forced to use the 8080 port because it is the only one allowed to send/get network requests. Moreover remember that load_env needs to be disabled (it should be by default if you clone the project from HF)
## Render ## Render
To install this project on [Render](https://render.com/) follow these steps: To install this project on [Render](https://render.com/) follow these steps:
1. Create an Account 1. Create an Account
2. Create a Web Service 2. Create a Web Service
3. Clone the repo 3. Clone the repo
4. Among the other environment variables, put PORT = 8080. This is needed because render needs the Port given as an environment variable. 4. Among the other environment variables, put PORT = 8080. This is needed because render needs the Port given as an environment variable.
5. As build command put `` pip install -r requirements `` and as run command put ``python3 run.py `` 5. As build command put `` pip install -r requirements `` and as run command put ``python3 run.py ``
6. Then just finish Render Setup and you are done :) 6. Then just finish Render Setup and you are done :)
Remember, load_env needs to be disabled in the config.json
# How to add to Stremio # How to add to Stremio
Just paste the URL/manifest.json in your search bar. Just paste the URL/manifest.json in your search bar.
# Enviroment Variables # Enviroment Variables
| Enviroment Variable | Value | | Enviroment Variable | Value |
|-------------------------|---| |-------------------------|---|
|TMDB_KEY|INSERT YOUR API KEY HERE| |TMDB_KEY|INSERT YOUR API KEY HERE|
| FT_DOMAIN | INSERT FILMPERTUTTI DOMAIN |
|SC_DOMAIN | INSERT STREAMINGCOMMUNITY DOMAIN|
|FILMPERTUTTI|Put "1" if you want Filmpertutti to be enabled, "0" if disabled Altought keep in mind that you will only be able to use it if you get the link from the same IP of your streaming server.|
|STREAMINGCOMMUNITY|Put "1" if enabled, "0" if disabled|
Here is [linked](https://developer.themoviedb.org/docs/getting-started) a tutorial about how to get a TMDB KEY Here is [linked](https://developer.themoviedb.org/docs/getting-started) a tutorial about how to get a TMDB KEY
# Config
In the repo there is a config.json that you can modify to change some aspects of the addon like the domains of the sites. Down here all explained:
| Enviroment Variable | Value |
|-------------------------|---|
| Domain | The domain of the site, must be a string |
|enabled | If the site is enabled or not. "1" means true. "0" means false. Remember there is no point in enabling filmpertutti on a remote server since it's IP-LOCKED|
|fast_search|"1" for enabled, "0" for disabled. It enables a faster search for TuttiFilm Provider but in case there are two movies/series with the exactly same name then it might take the wrong one|
|load_env|Put "1" if enabled, "0" if disabled. It needs to be enable if you need to load a .env file. On remote hosting services, like Hugging Face or Render, it needs to be disabled. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+21
View File
@@ -0,0 +1,21 @@
{
"Siti": {
"StreamingCommunity": {
"enabled": "1",
"domain": "boston"
},
"Filmpertutti": {
"enabled": "1",
"domain": "casino"
},
"Tuttifilm":{
"enabled": "1",
"domain": "bond",
"fast_search": "0"
}
},
"General":{
"load_env": "1"
}
}
+18
View File
@@ -0,0 +1,18 @@
#LOAD THE CONFIG
import json
# Open the configuration file
with open('config.json') as f:
# Load JSON data from file
config = json.load(f)
# Accessing SC_DOMAIN
SITE = config["Siti"]
FT_DOMAIN = SITE["Filmpertutti"]['domain']
SC_DOMAIN = SITE["StreamingCommunity"]['domain']
TF_DOMAIN = SITE["Filmpertutti"]['enabled']
FILMPERTUTTI = SITE["Filmpertutti"]['enabled']
STREAMINGCOMMUNITY = SITE["StreamingCommunity"]['enabled']
#General
GENERAL = config['General']
dotenv = GENERAL["load_env"]
+1 -1
View File
@@ -1,7 +1,7 @@
import requests import requests
from tmdbv3api import TMDb, Movie, TV from tmdbv3api import TMDb, Movie, TV
from loadenv import load_env from loadenv import load_env
TMDB_KEY, _, _, _,_ = load_env() TMDB_KEY= load_env()
def get_TMDb_id_from_IMDb_id(imdb_id): def get_TMDb_id_from_IMDb_id(imdb_id):
response = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}', response = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}',
params={'external_source': 'imdb_id', 'api_key': f'{TMDB_KEY}'}) params={'external_source': 'imdb_id', 'api_key': f'{TMDB_KEY}'})
-4
View File
@@ -1,7 +1,3 @@
TMDB_KEY= "INSERT YOUR API KEY HERE" TMDB_KEY= "INSERT YOUR API KEY HERE"
FT_DOMAIN = "INSERT FILMPERTUTTI DOMAIN"
SC_DOMAIN = "INSERT STREAMINGCOMMUNITY DOMAIN"
FILMPERTUTTI= "Put 1 if enabled, 0 if disabled"
STREAMINGCOMMUNITY = "Put 1 if enabled, 0 if disabled"
+3 -2
View File
@@ -7,12 +7,13 @@ import re
from datetime import datetime from datetime import datetime
import dateparser import dateparser
from convert import get_TMDb_id_from_IMDb_id from convert import get_TMDb_id_from_IMDb_id
from loadenv import load_env
from info import get_info, is_movie from info import get_info, is_movie
from convert_date import convert_US_date from convert_date import convert_US_date
import logging import logging
import config
FT_DOMAIN = config.FT_DOMAIN
_, FT_DOMAIN,_,_ ,_= load_env()
#Some basic headers #Some basic headers
headers = { headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
+1 -1
View File
@@ -1,7 +1,7 @@
from loadenv import load_env from loadenv import load_env
from tmdbv3api import TMDb, Movie, TV from tmdbv3api import TMDb, Movie, TV
from convert_date import convert_US_date, convert_IT_date from convert_date import convert_US_date, convert_IT_date
TMDB_KEY,_,_,FILMPERTUTTI,STREAMINGCOMMUNITY = load_env() TMDB_KEY= load_env()
def get_info(tmbda,ismovie,type): def get_info(tmbda,ismovie,type):
tmdb = TMDb() tmdb = TMDb()
+8 -5
View File
@@ -1,10 +1,13 @@
import os import os
import config
dotenv = config.dotenv
#You need to keep dotenv disabled on remote servers
if dotenv == "1":
from dotenv import load_dotenv from dotenv import load_dotenv
load_dotenv(".env") load_dotenv(".env")
def load_env(): def load_env():
TMDB_KEY = os.getenv('TMDB_KEY') TMDB_KEY = os.getenv('TMDB_KEY')
FT_DOMAIN = os.getenv('FT_DOMAIN') return TMDB_KEY
SC_DOMAIN= os.getenv('SC_DOMAIN')
FILMPERTUTTI = os.getenv('FILMPERTUTTI')
STREAMINGCOMMUNITY = os.getenv('STREAMINGCOMMUNITY')
return TMDB_KEY, FT_DOMAIN, SC_DOMAIN, FILMPERTUTTI, STREAMINGCOMMUNITY
+6 -2
View File
@@ -1,8 +1,12 @@
from flask import Flask, jsonify, abort from flask import Flask, jsonify, abort
from filmpertutti import filmpertutti from filmpertutti import filmpertutti
from streamingcommunity import streaming_community from streamingcommunity import streaming_community
from loadenv import load_env import json
TMDB_KEY, FT_DOMAIN, SC_DOMAIN, FILMPERTUTTI, STREAMINGCOMMUNITY = load_env() import config
FILMPERTUTTI = config.FILMPERTUTTI
STREAMINGCOMMUNITY = config.STREAMINGCOMMUNITY
app = Flask(__name__) app = Flask(__name__)
+3 -3
View File
@@ -5,10 +5,10 @@ from bs4 import BeautifulSoup,SoupStrainer
from datetime import datetime from datetime import datetime
import dateparser import dateparser
from convert import get_TMDb_id_from_IMDb_id from convert import get_TMDb_id_from_IMDb_id
from loadenv import load_env
from info import get_info, is_movie from info import get_info, is_movie
import config
#Get domain #Get domain
_, _,SC_DOMAIN,_ ,_= load_env() SC_DOMAIN= config.SC_DOMAIN
headers = { headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
@@ -83,7 +83,7 @@ def streaming_community(imdb):
tmdba = get_TMDb_id_from_IMDb_id(imdb_id) tmdba = get_TMDb_id_from_IMDb_id(imdb_id)
showname = requests.get(f'https://v3.sg.media-imdb.com/suggestion/a/{imdb_id}.json') showname = requests.get(f'https://v3.sg.media-imdb.com/suggestion/a/{imdb_id}.json')
showname = showname.json() showname = showname.json()
showname = showname['d'][0]['l'] showname = showname['d'][-1]['l']
else: else:
#else just equals them #else just equals them
tmdba = imdb_id.replace("tmdb:","") tmdba = imdb_id.replace("tmdb:","")