Skip to content

Commit 8773e16

Browse files
committed
feat: runs strm on boot
1 parent 65c7524 commit 8773e16

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

functions/filesystemFunctions.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ def generateFolderPath(data: dict):
6060
def generateStremFile(file_path: str, url: str, type: str, file_name: str):
6161
if file_path is None:
6262
return
63+
if type == "movie":
64+
type = "movies"
65+
elif type == "series":
66+
type = "series"
67+
elif type == "anime":
68+
type = "series"
69+
6370
full_path = os.path.join(MOUNT_PATH, type, file_path)
6471

6572
os.makedirs(full_path, exist_ok=True)
@@ -300,3 +307,13 @@ def unmountFuse():
300307
sys.exit(1)
301308
logging.info("Unmounted successfully.")
302309

310+
def runStrm():
311+
all_downloads = getAllUserDownloads()
312+
for download in all_downloads:
313+
file_path = generateFolderPath(download)
314+
if file_path is None:
315+
continue
316+
generateStremFile(file_path, download.get("download_link"), download.get("metadata_mediatype"), download.get("metadata_filename"))
317+
318+
319+

main.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from apscheduler.schedulers.blocking import BlockingScheduler
22
from apscheduler.schedulers.background import BackgroundScheduler
33
from functions.appFunctions import bootUp, getMountMethod, getAllUserDownloadsFresh
4-
from functions.filesystemFunctions import runFuse, unmountFuse
4+
from functions.filesystemFunctions import runFuse, unmountFuse, runStrm
55
import logging
66

77

@@ -36,6 +36,13 @@
3636
try:
3737
logging.info("Starting scheduler and mounting...")
3838
if mount_method == "strm":
39+
runStrm()
40+
scheduler.add_job(
41+
runStrm,
42+
"interval",
43+
minutes=5,
44+
id="run_strm",
45+
)
3946
scheduler.start()
4047
elif mount_method == "fuse":
4148
scheduler.start()

0 commit comments

Comments
 (0)