37 lines
1.5 KiB
Python
37 lines
1.5 KiB
Python
import requests
|
|
from ffmpegHLS import convertMP4toHLSFFmpeg
|
|
|
|
LC_URL = "https://onedrive-vercel-index-nnyg.vercel.app/api/?path=/"
|
|
LC_FILEURL = "https://onedrive-vercel-index-nnyg.vercel.app/api/raw/?path=/"
|
|
session = requests.Session() # Avvio la Sessione
|
|
ROOT_FOLDER = input("Inserisci la cartella di Root : ")
|
|
|
|
def checkHLS(folder=""): # sourcery skip: move-assign
|
|
# print("CARTELLA :",folder)
|
|
apiURL = f"{LC_URL}{ROOT_FOLDER}/{folder}"
|
|
rawURL = f"{LC_FILEURL}{ROOT_FOLDER}/{folder}"
|
|
r = session.get(apiURL)
|
|
if r.status_code == 200:
|
|
r = r.json()
|
|
data = r["folder"]["value"]
|
|
if "next" in r:
|
|
while "next" in r:
|
|
nextLink = r["next"]
|
|
r = session.get(f"{apiURL}&next={nextLink}").json()
|
|
data.extend(r["folder"]["value"])
|
|
for elements in data:
|
|
fileorFolderName = requests.utils.quote(elements["name"])
|
|
if "stagione" in fileorFolderName.lower():
|
|
checkHLS(f"{folder}/{fileorFolderName}")
|
|
if(fileorFolderName.endswith(".mp4")):
|
|
# print("MP4 FILES : ",fileorFolderName)
|
|
# print(f"FULL URL : {rawURL}/{fileorFolderName}")
|
|
cartella_principale,sottocartella = folder.split("/")
|
|
# TODO: FFMPEG HLS CONVERTER
|
|
convertMP4toHLSFFmpeg(f"{rawURL}/{fileorFolderName}",cartella_principale,sottocartella)
|
|
checkHLS(fileorFolderName)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
checkHLS() |