Cleaned up more

This commit is contained in:
rmilooo 2025-01-01 22:27:37 +01:00
parent c7eb1f7c13
commit f0b20b74d0
5 changed files with 111 additions and 102 deletions

View file

@ -1,6 +1,7 @@
import os import os
import time
import subprocess import subprocess
import time
def get_folder_size(folder_path): def get_folder_size(folder_path):
total_size = 0 total_size = 0
@ -11,6 +12,7 @@ def get_folder_size(folder_path):
total_size += os.path.getsize(filepath) total_size += os.path.getsize(filepath)
return total_size return total_size
def delete_files(folder_path, extensions): def delete_files(folder_path, extensions):
os.system('sudo pkill -f revivetube.py') os.system('sudo pkill -f revivetube.py')
process = subprocess.Popen(['sudo', 'nohup', 'python3', 'revivetube.py']) process = subprocess.Popen(['sudo', 'nohup', 'python3', 'revivetube.py'])
@ -23,6 +25,7 @@ def delete_files(folder_path, extensions):
except: except:
print("ERROR") print("ERROR")
def monitor_folder(folder_path, size_limit_gb, check_interval): def monitor_folder(folder_path, size_limit_gb, check_interval):
size_limit_bytes = size_limit_gb * 1024 * 1024 * 1024 size_limit_bytes = size_limit_gb * 1024 * 1024 * 1024
while True: while True:
@ -31,6 +34,7 @@ def monitor_folder(folder_path, size_limit_gb, check_interval):
delete_files(folder_path, [".flv", ".mp4"]) delete_files(folder_path, [".flv", ".mp4"])
time.sleep(check_interval) time.sleep(check_interval)
if __name__ == "__main__": if __name__ == "__main__":
folder_to_monitor = "./sigma/videos/" folder_to_monitor = "./sigma/videos/"
size_limit = 7 size_limit = 7

View file

@ -32,6 +32,7 @@ def get_video_duration_from_file(video_path):
print(f"Can't fetch Video-Duration: {str(e)}") print(f"Can't fetch Video-Duration: {str(e)}")
return 0 return 0
def format_duration(seconds): def format_duration(seconds):
minutes = seconds // 60 minutes = seconds // 60
seconds = seconds % 60 seconds = seconds % 60
@ -53,4 +54,4 @@ def get_api_key():
with open("token.txt", "r") as f: with open("token.txt", "r") as f:
return f.read().strip() return f.read().strip()
except FileNotFoundError: except FileNotFoundError:
raise FileNotFoundError("Missing token.txt. Please go to README.md") raise FileNotFoundError("Missing token.txt. Please go to README.md")

View file

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>ReviveTube by ReviveMii</title> <title>ReviveTube by ReviveMii</title>
<style> <style>
body { body {
@ -76,39 +76,41 @@
</style> </style>
</head> </head>
<body class="dark-mode" id="page-body"> <body class="dark-mode" id="page-body">
<h1>ReviveTube by ReviveMii</h1> <h1>ReviveTube by ReviveMii</h1>
<p>A YouTube App for the Wii</p> <p>A YouTube App for the Wii</p>
<form action="/" method="get"> <form action="/" method="get">
<input class="search-bar" type="text" name="query" placeholder="Search YouTube"> <input class="search-bar" name="query" placeholder="Search YouTube" type="text">
<button type="submit">Go</button> <button type="submit">Go</button>
</form> </form>
{% if results %} {% if results %}
<h2>Search Results</h2> <h2>Search Results</h2>
<div> <div>
{% for video in results %} {% for video in results %}
<div class="video-item"> <div class="video-item">
<a href="/watch?video_id={{ video['id'] }}"> <a href="/watch?video_id={{ video['id'] }}">
<img src="{{ video['thumbnail'] }}" alt="{{ video['title'] }}"> <img alt="{{ video['title'] }}" src="{{ video['thumbnail'] }}">
<div class="video-item-title">{{ video['title'] }}</div> <div class="video-item-title">{{ video['title'] }}</div>
<div class="video-item-uploader">By: {{ video['uploader'] }}</div> <div class="video-item-uploader">By: {{ video['uploader'] }}</div>
<div class="video-item-duration">Duration: {{ video['duration'] }}</div> <div class="video-item-duration">Duration: {{ video['duration'] }}</div>
</a> </a>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
<p><a href="http://revivemii.errexe.xyz" target="_blank">Visit ReviveMii</a></p> <p><a href="http://revivemii.errexe.xyz" target="_blank">Visit ReviveMii</a></p>
<p style="color: red;">\/ Scroll down \/</p> <p style="color: red;">\/ Scroll down \/</p>
<p style="font-size: 12px;">We are NOT affiliated with Nintendo or YouTube. This app uses code from Wiinet.xyz. For more information, scroll down to Open Source Software.</p> <p style="font-size: 12px;">We are NOT affiliated with Nintendo or YouTube. This app uses code from Wiinet.xyz. For more
<p style="color: blue">It's recommended to bookmark this page. Some sites may take longer to load.</p> information, scroll down to Open Source Software.</p>
<a href="http://revivetube.errexe.xyz/revivetube/t-and-p.html">Terms of Service and Privacy Policy (Last Updated: 7. Dec 2024 12:41 CET)</a><br><br> <p style="color: blue">It's recommended to bookmark this page. Some sites may take longer to load.</p>
<a href="https://github.com/ReviveMii/revivetube/" target="_blank">Source Code</a><br><br> <a href="http://revivetube.errexe.xyz/revivetube/t-and-p.html">Terms of Service and Privacy Policy (Last Updated: 7. Dec
<a href="http://revivetube.errexe.xyz/discord-redirect.html">Discord Server [Use a Compatible Device]</a> 2024 12:41 CET)</a><br><br>
<p>Version: v2 Beta (Sometimes I forget to update the Version Number)</p> <a href="https://github.com/ReviveMii/revivetube/" target="_blank">Source Code</a><br><br>
<a href="/licenses.html">Open Source Software Used in This App</a> <a href="http://revivetube.errexe.xyz/discord-redirect.html">Discord Server [Use a Compatible Device]</a>
<br> <p>Version: v2 Beta (Sometimes I forget to update the Version Number)</p>
<a href="mailto:theerrorexe@gmail.com">Contact</a> <a href="/licenses.html">Open Source Software Used in This App</a>
<br> <br>
<a href="https://revivemii.errexe.xyz/feedback.html">Report Bugs & Feedback</a> <a href="mailto:theerrorexe@gmail.com">Contact</a>
<br>
<a href="https://revivemii.errexe.xyz/feedback.html">Report Bugs & Feedback</a>
</body> </body>
</html> </html>

View file

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Loading...</title> <title>Loading...</title>
<style> <style>
body { body {
@ -31,13 +31,14 @@
</style> </style>
</head> </head>
<body> <body>
<h1>Loading</h1> <h1>Loading</h1>
<img id="loadingGif" src="loading.gif" alt="Loading..." /> <img alt="Loading..." id="loadingGif" src="loading.gif"/>
<p id="progressText">Fetching Info...</p> <p id="progressText">Fetching Info...</p>
<button id="goButton" onclick="startVideo()">Go</button> <button id="goButton" onclick="startVideo()">Go</button>
<br> <br>
<small style="color: grey">Loading Screen will NOT work in Dolphin Emulator.<br><br>Long Video = Longer Download and Converting.<br><br>For videos longer than 7 minutes, there is a chance that they wont play.</small> <small style="color: grey">Loading Screen will NOT work in Dolphin Emulator.<br><br>Long Video = Longer Download and
<script type="text/javascript"> Converting.<br><br>For videos longer than 7 minutes, there is a chance that they wont play.</small>
<script type="text/javascript">
var goButton = document.getElementById('goButton'); var goButton = document.getElementById('goButton');
var loadingGif = document.getElementById('loadingGif'); var loadingGif = document.getElementById('loadingGif');
var progressText = document.getElementById('progressText'); var progressText = document.getElementById('progressText');

View file

@ -2,66 +2,67 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>{{ title }}</title> <title>{{ title }}</title>
<style> <style>
body { body {
font-family: 'Arial', sans-serif; font-family: 'Arial', sans-serif;
text-align: center; /* Zentriert den Text */ text-align: center; /* Zentriert den Text */
color: #fff; color: #fff;
background-color: #181818; background-color: #181818;
} }
.dark-mode { .dark-mode {
background-color: #181818; background-color: #181818;
color: #fff; color: #fff;
} }
.dark-mode a { .dark-mode a {
color: #1e90ff; color: #1e90ff;
} }
.comments { .comments {
margin: 0 auto; margin: 0 auto;
width: 80%; width: 80%;
} }
h1 { h1 {
color: red; color: red;
text-align: center; text-align: center;
} }
h3 { h3 {
color: white; color: white;
text-align: center; text-align: center;
} }
</style> </style>
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script> <script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
</head> </head>
<body class="dark-mode" id="page-body"> <body class="dark-mode" id="page-body">
<div style="width: 100%; background-color: #000; text-align: center;"> <div style="width: 100%; background-color: #000; text-align: center;">
<object type="application/x-shockwave-flash" data="/player.swf" width="384" height="256"> <object data="/player.swf" height="256" type="application/x-shockwave-flash" width="384">
<param name="wmode" value="transparent"> <param name="wmode" value="transparent">
<param name="allowFullScreen" value="false"> <param name="allowFullScreen" value="false">
<param name="flashvars" value="filename={{ video_flv }}"> <param name="flashvars" value="filename={{ video_flv }}">
</object> </object>
</div> </div>
<h1 style="color: red">{{ title }}</h1> <h1 style="color: red">{{ title }}</h1>
<h3>Uploaded by: <a href="/channel?channel_id={{ channelId }}">{{ uploader }}</a></h3> <h3>Uploaded by: <a href="/channel?channel_id={{ channelId }}">{{ uploader }}</a></h3>
<p><strong>Views:</strong> {{ viewCount }}</p> <p><strong>Views:</strong> {{ viewCount }}</p>
<p><strong>Likes:</strong> {{ likeCount }}</p> <p><strong>Likes:</strong> {{ likeCount }}</p>
<p><strong>Upload Date:</strong> {{ publishedAt }}</p> <p><strong>Upload Date:</strong> {{ publishedAt }}</p>
<a href="#comments">Skip Description</a> <a href="#comments">Skip Description</a>
<h3 style="color: red">Description:</h3> <h3 style="color: red">Description:</h3>
<p>{{ description | safe }}</p> <p>{{ description | safe }}</p>
<h3 id="comments" class="comments" style="color: red">Comments:</h3> <h3 class="comments" id="comments" style="color: red">Comments:</h3>
<div class="comments"> <div class="comments">
{% if comments %} {% if comments %}
{% for comment in comments %} {% for comment in comments %}
<div class="comment"> <div class="comment">
<p><strong>{{ comment.author }}</strong> posted:</p> <p><strong>{{ comment.author }}</strong> posted:</p>
<p>{{ comment.text|safe }}</p> <p>{{ comment.text|safe }}</p>
<p style="color: gray; font-size: 12px;">Likes: {{ comment.likeCount }} | Post date: {{ comment.publishedAt }}</p> <p style="color: gray; font-size: 12px;">Likes: {{ comment.likeCount }} | Post date: {{ comment.publishedAt
</div> }}</p>
{% endfor %}
{% else %}
<p>No Comments.</p>
{% endif %}
</div> </div>
{% endfor %}
{% else %}
<p>No Comments.</p>
{% endif %}
</div>
</body> </body>
</html> </html>