From f0b20b74d004cfab2c742260944dcd3c46d3c2ed Mon Sep 17 00:00:00 2001 From: rmilooo <73422068+rmilooo@users.noreply.github.com> Date: Wed, 1 Jan 2025 22:27:37 +0100 Subject: [PATCH] Cleaned up more --- check-folder-revivetube.py | 6 +- helper.py | 3 +- site_storage/index_template.html | 72 +++++++++-------- site_storage/loading_template.html | 17 ++-- site_storage/watch_wii_template.html | 115 ++++++++++++++------------- 5 files changed, 111 insertions(+), 102 deletions(-) diff --git a/check-folder-revivetube.py b/check-folder-revivetube.py index ed407ba..57ea802 100644 --- a/check-folder-revivetube.py +++ b/check-folder-revivetube.py @@ -1,6 +1,7 @@ import os -import time import subprocess +import time + def get_folder_size(folder_path): total_size = 0 @@ -11,6 +12,7 @@ def get_folder_size(folder_path): total_size += os.path.getsize(filepath) return total_size + def delete_files(folder_path, extensions): os.system('sudo pkill -f revivetube.py') process = subprocess.Popen(['sudo', 'nohup', 'python3', 'revivetube.py']) @@ -23,6 +25,7 @@ def delete_files(folder_path, extensions): except: print("ERROR") + def monitor_folder(folder_path, size_limit_gb, check_interval): size_limit_bytes = size_limit_gb * 1024 * 1024 * 1024 while True: @@ -31,6 +34,7 @@ def monitor_folder(folder_path, size_limit_gb, check_interval): delete_files(folder_path, [".flv", ".mp4"]) time.sleep(check_interval) + if __name__ == "__main__": folder_to_monitor = "./sigma/videos/" size_limit = 7 diff --git a/helper.py b/helper.py index 47ab0b8..a4a5d25 100644 --- a/helper.py +++ b/helper.py @@ -32,6 +32,7 @@ def get_video_duration_from_file(video_path): print(f"Can't fetch Video-Duration: {str(e)}") return 0 + def format_duration(seconds): minutes = seconds // 60 seconds = seconds % 60 @@ -53,4 +54,4 @@ def get_api_key(): with open("token.txt", "r") as f: return f.read().strip() except FileNotFoundError: - raise FileNotFoundError("Missing token.txt. Please go to README.md") \ No newline at end of file + raise FileNotFoundError("Missing token.txt. Please go to README.md") diff --git a/site_storage/index_template.html b/site_storage/index_template.html index 37e948e..4b1bddd 100644 --- a/site_storage/index_template.html +++ b/site_storage/index_template.html @@ -2,7 +2,7 @@
- +A YouTube App for the Wii
- - {% if results %} -\/ 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)Version: v2 Beta (Sometimes I forget to update the Version Number)
- Open Source Software Used in This App -A YouTube App for the Wii
+ +{% if results %} +\/ 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)Version: v2 Beta (Sometimes I forget to update the Version Number)
+Open Source Software Used in This App +Fetching Info...
- -Views: {{ viewCount }}
-Likes: {{ likeCount }}
-Upload Date: {{ publishedAt }}
- Skip Description -{{ description | safe }}
-
{{ comment.author }} posted:
-{{ comment.text|safe }}
-Likes: {{ comment.likeCount }} | Post date: {{ comment.publishedAt }}
-No Comments.
- {% endif %} +{{ title }}
+Uploaded by: {{ uploader }}
+Views: {{ viewCount }}
+Likes: {{ likeCount }}
+Upload Date: {{ publishedAt }}
+Skip Description +Description:
+{{ description | safe }}
+Comments:
+{{ comment.author }} posted:
+{{ comment.text|safe }}
+Likes: {{ comment.likeCount }} | Post date: {{ comment.publishedAt + }}
No Comments.
+ {% endif %} +