diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6b578d4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+
+token.txt
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..da5d2d0
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..a078ea6
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/revivetube.iml b/.idea/revivetube.iml
new file mode 100644
index 0000000..10df758
--- /dev/null
+++ b/.idea/revivetube.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/__pycache__/helper.cpython-312.pyc b/__pycache__/helper.cpython-312.pyc
new file mode 100644
index 0000000..2626013
Binary files /dev/null and b/__pycache__/helper.cpython-312.pyc differ
diff --git a/helper.py b/helper.py
new file mode 100644
index 0000000..a514fcc
--- /dev/null
+++ b/helper.py
@@ -0,0 +1,11 @@
+def read_file(path):
+ assert isinstance(path, str), "Path must be a string"
+
+ try:
+ with open(path, 'r', encoding='utf-8') as file:
+ content = file.read()
+ return content
+ except FileNotFoundError:
+ return "Error: File not found."
+ except Exception as e:
+ return f"Error: {str(e)}"
diff --git a/revivetube.py b/revivetube.py
index c49a344..09b58a3 100644
--- a/revivetube.py
+++ b/revivetube.py
@@ -15,28 +15,32 @@ ReviveMii Project: https://revivemii.fr.to/
"""
import json
-import isodate
-from flask import Flask, request, render_template_string, send_file, Response, abort, jsonify
-import tempfile
-import shutil
-import yt_dlp
-import requests
-import subprocess
import os
+import shutil
+import subprocess
+import tempfile
import threading
-from threading import Thread
import time
+from threading import Thread
+
+import requests
+import yt_dlp
+from flask import Flask, request, render_template_string, send_file, Response, abort, jsonify
+
+from helper import read_file
app = Flask(__name__)
+
def check_and_create_folder():
while True:
folder_path = './sigma/videos'
if not os.path.exists(folder_path):
os.makedirs(folder_path)
- print(f"Ordner {folder_path} wurde erstellt.")
+ print(f"Folder {folder_path} got created.")
time.sleep(10)
+
def start_folder_check():
thread = Thread(target=check_and_create_folder)
thread.daemon = True
@@ -48,118 +52,34 @@ API_BASE_URL = "https://y.com.sb/api/v1/"
YOUTUBE_API_URL = "https://www.googleapis.com/youtube/v3/videos"
video_status = {}
-LOADING_TEMPLATE = """
-
-
-
-
-
- Loading...
-
-
-
- Loading
-
- Fetching Info...
-
-
- Loading Screen will NOT work in Dolphin Emulator.
Long Video = Longer Download and Converting.
For videos longer than 7 minutes, there is a chance that they won’t play.
-
-
-"""
def get_file_size(file_path):
return os.path.getsize(file_path)
+
def get_range(file_path, byte_range):
with open(file_path, 'rb') as f:
f.seek(byte_range[0])
return f.read(byte_range[1] - byte_range[0] + 1)
+
def get_api_key():
try:
with open("token.txt", "r") as f:
- return f.read().strip()
+ return f.read().strip()
except FileNotFoundError:
raise FileNotFoundError("Missing token.txt. Please go to README.md")
+
os.makedirs(VIDEO_FOLDER, exist_ok=True)
-MAX_VIDEO_SIZE = 1 * 1024 * 1024 * 1024
-MAX_FOLDER_SIZE = 5 * 1024 * 1024 * 1024
+MAX_VIDEO_SIZE = 1 * 1024 * 1024 * 1024
+MAX_FOLDER_SIZE = 5 * 1024 * 1024 * 1024
+
def get_folder_size(path):
total_size = 0
@@ -169,7 +89,10 @@ def get_folder_size(path):
total_size += os.path.getsize(file_path)
return total_size
+
"""
+[UNUSED IN THE CURRENT VERSION]
+
def delete_videos_periodically():
while True:
time.sleep(86400)
@@ -182,244 +105,13 @@ def delete_videos_periodically():
threading.Thread(target=delete_videos_periodically, daemon=True).start()
"""
-INDEX_TEMPLATE = """
-
-
-
-
-
- ReviveTube by ReviveMii
-
-
-
- ReviveTube by ReviveMii
- A YouTube App for the Wii
-
- {% if results %}
- Search Results
-
- {% for video in results %}
-
- {% endfor %}
-
- {% endif %}
- Visit ReviveMii
- \/ Scroll down \/
- We are NOT affiliated with Nintendo or YouTube. This app uses code from Wiinet.xyz. For more information, scroll down to Open Source Software.
- It's recommended to bookmark this page. Some sites may take longer to load.
- Terms of Service and Privacy Policy (Last Updated: 7. Dec 2024 12:41 CET)
- Source Code
- Discord Server [Use a Compatible Device]
- Version: v2 Beta (Sometimes I forget to update the Version Number)
- Open Source Software Used in This App
-
- Contact
-
- Report Bugs & Feedback
-
-
-"""
+INDEX_TEMPLATE = read_file(f"site_storage{FILE_SEPARATOR}index_template.html")
+
+WATCH_STANDARD_TEMPLATE = read_file(f"site_storage{FILE_SEPARATOR}watch_standard_template.html")
+
+WATCH_WII_TEMPLATE = read_file(f"site_storage{FILE_SEPARATOR}watch_wii_template.html")
-WATCH_STANDARD_TEMPLATE = """
-
-
-
-
-
- {{ title }}
-
-
-
-Please access this Site on a Wii
-
-