Skip to content

Commit

Permalink
chore: Add missing library files and modules
Browse files Browse the repository at this point in the history
First build
  • Loading branch information
corando98 committed Aug 4, 2024
1 parent a597046 commit 16d4cbb
Show file tree
Hide file tree
Showing 2,121 changed files with 160,334 additions and 32 deletions.
128 changes: 98 additions & 30 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import requests
import urllib3
import webbrowser
import shutil
from flask import Flask, render_template_string, request, jsonify, send_from_directory
from moviepy.editor import VideoFileClip
from werkzeug.serving import make_server
Expand All @@ -25,14 +26,14 @@
# Disable SSL warnings
urllib3.disable_warnings()

# Embed the HTML template
# Embed the HTML template (empty for now)
html_template = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Preview and Convert</title>
<title>ACSE Animation Changer</title>
<style>
body {
font-family: Arial, sans-serif;
Expand Down Expand Up @@ -149,10 +150,22 @@
.quit-button:hover {
background-color: #d11a1a;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 5px;
}
.form-group input {
width: 100%;
padding: 8px;
box-sizing: border-box;
}
</style>
</head>
<body class="dark-mode">
<h1>Video Preview and Convert</h1>
<h1>ACSE Animation Changer</h1>
<button class="quit-button" onclick="quitProgram()">Quit</button>
<div class="tab">
<button class="tablinks" onclick="openTab(event, 'Download')">Download Videos</button>
Expand All @@ -168,8 +181,8 @@
<div class="sort-options">
<label for="sort">Sort by:</label>
<select id="sort" onchange="changeSort()">
<option value="trending">Trending</option>
<option value="downloads-desc">Most Downloaded</option>
<option value="trending">Trending</option>
<option value="likes-desc">Most Liked</option>
<option value="created_at-desc">Uploaded (Newest)</option>
<option value="created_at-asc">Uploaded (Oldest)</option>
Expand All @@ -185,15 +198,19 @@
<div id="Manage" class="tabcontent">
<h2>Downloaded Videos</h2>
<div class="form-group">
<label for="replacePath">Replace Path:</label>
<input type="text" id="replacePath" placeholder="Specify the path to replace or leave empty to auto-detect">
</div>
<div id="video-list" class="video-grid">
{% for video in videos %}
<div class="video-item" id="{{ video }}-item">
<h2>{{ video }}</h2>
<h2>{{ video.replace('.webm', '') }}</h2>
<video controls>
<source src="{{ url_for('preview', filename=video) }}" type="video/webm">
Your browser does not support the video tag.
</video>
<button onclick="convertVideo('{{ video }}')">Convert to MP4 and Replace</button>
<button onclick="replaceVideo('{{ video }}')">Replace</button>
<button onclick="deleteVideo('{{ video }}')">Delete</button>
</div>
{% endfor %}
Expand Down Expand Up @@ -277,14 +294,15 @@
location.reload();
}
async function convertVideo(filename) {
console.log(`Converting video: ${filename}`);
const response = await fetch('/convert', {
async function replaceVideo(filename) {
console.log(`Replacing video: ${filename}`);
const replacePath = document.getElementById('replacePath').value;
const response = await fetch('/convert_replace', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ filename })
body: JSON.stringify({ filename, replacePath })
});
const data = await response.json();
alert(data.message);
Expand Down Expand Up @@ -325,23 +343,40 @@
document.addEventListener('DOMContentLoaded', () => {
fetchExternalVideos();
document.querySelector('.tablinks').click();
document.getElementById('sort').value = 'downloads-desc'; // Default to Most Downloaded
changeSort();
});
</script>
</body>
</html>
"""

# Function to render the embedded HTML template
@app.route('/')
def index():
videos = [f for f in os.listdir(app.config['UPLOAD_FOLDER']) if f.endswith('.webm')]
print(f"Listing downloaded videos: {videos}")
return render_template_string(html_template, videos=videos)
def sanitize_filename(filename):
return "".join(c for c in filename if c.isalnum() or c in (' ', '.', '_', '-')).rstrip()

def download_video(url, path):
print(f"Downloading video from {url} to {path}")
response = requests.get(url, stream=True, verify=False)
with open(path, 'wb') as file:
for chunk in response.iter_content(chunk_size=1024):
if chunk:
file.write(chunk)
print(f"Finished downloading video from {url}")

def find_dynamic_path():
user_profile = os.environ['USERPROFILE']
base_path = os.path.join(user_profile, 'AppData', 'Local', 'Packages')
target_filename = 'Starfield_backup.mp4'
for root, dirs, files in os.walk(base_path):
if target_filename in files:
return os.path.join(root, target_filename)
return None

@app.route('/fetch_videos')
def fetch_videos_route():
page = request.args.get('page', 1, type=int)
sort = request.args.get('sort', 'trending')
sort = request.args.get('sort', 'downloads-desc')
search = request.args.get('search', '')
search_query = f"&search={search}" if search else ""
url = f'https://steamdeckrepo.com/api/posts?page={page}&sort={sort}{search_query}'
Expand All @@ -355,19 +390,40 @@ def fetch_videos_route():
def preview(filename):
return send_from_directory(app.config['UPLOAD_FOLDER'], filename)

@app.route('/convert', methods=['POST'])
def convert():
@app.route('/convert_replace', methods=['POST'])
def convert_replace():
data = request.json
webm_path = os.path.join(app.config['UPLOAD_FOLDER'], data['filename'])
filename = data['filename']
target_path = data.get('replacePath') or find_dynamic_path()

if not target_path:
return jsonify({'status': 'error', 'message': 'Target path not found'})

webm_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
mp4_path = webm_path.replace('.webm', '.mp4')

if not os.path.exists(mp4_path):
print(f"Converting {webm_path} to {mp4_path}")
clip = VideoFileClip(webm_path)
clip.write_videofile(mp4_path, codec='libx264')
print(f"Finished converting {webm_path} to {mp4_path}")
else:
print(f"File {mp4_path} already exists. Skipping conversion.")
return jsonify({'status': 'success', 'message': 'Video converted successfully'})
try:
print(f"Converting {webm_path} to {mp4_path}")
clip = VideoFileClip(webm_path)
clip.write_videofile(mp4_path, codec='libx264')
print(f"Finished converting {webm_path} to {mp4_path}")
except Exception as e:
print(f"Error during conversion: {e}")
return jsonify({'status': 'error', 'message': str(e)})

print(f"Replacing {target_path} with {mp4_path}")

try:
if os.path.exists(target_path):
os.remove(target_path)
print(f"Removed existing file at {target_path}")
shutil.copy(mp4_path, target_path)
print(f"Replaced {target_path} successfully")
return jsonify({'status': 'success', 'message': 'Boot animation replaced!'})
except Exception as e:
print(f"Error replacing file: {e}")
return jsonify({'status': 'error', 'message': str(e)})

@app.route('/shutdown', methods=['POST'])
def shutdown():
Expand All @@ -384,10 +440,15 @@ def download_video_route():
data = request.json
video_url = data['url']
title = data['title']
filename = f"{title.replace(' ', '_').replace('/', '_')}.webm"
sanitized_title = sanitize_filename(title)
filename = f"{sanitized_title}.webm"
download_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
download_video(video_url, download_path)
return jsonify({'status': 'success', 'message': 'Video downloaded successfully'})
try:
download_video(video_url, download_path)
return jsonify({'status': 'success', 'message': 'Video downloaded successfully'})
except Exception as e:
print(f"Error downloading video: {e}")
return jsonify({'status': 'error', 'message': str(e)})

@app.route('/delete_video', methods=['POST'])
def delete_video_route():
Expand All @@ -405,6 +466,13 @@ def delete_video_route():
else:
return jsonify({'status': 'error', 'message': 'File not found'})

# Function to render the embedded HTML template
@app.route('/')
def index():
videos = [f for f in os.listdir(app.config['UPLOAD_FOLDER']) if f.endswith('.webm')]
print(f"Listing downloaded videos: {videos}")
return render_template_string(html_template, videos=videos)

# Thread class for Flask server
class FlaskThread(threading.Thread):
def __init__(self):
Expand Down
Binary file added build/exe.win-amd64-3.12/app.exe
Binary file not shown.
63 changes: 63 additions & 0 deletions build/exe.win-amd64-3.12/frozen_application_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## Why this file is included

This program has been frozen with cx_Freeze. The freezing process
resulted in certain components from the cx_Freeze software being included
in the frozen application, in particular bootstrap code for launching
the frozen python script. The cx_Freeze software is subject to the
license set out below.

# Licensing

- Copyright © 2020-2024, Marcelo Duarte.
- Copyright © 2007-2019, Anthony Tuininga.
- Copyright © 2001-2006, Computronix (Canada) Ltd., Edmonton, Alberta,
Canada.
- All rights reserved.

NOTE: This license is derived from the Python Software Foundation
License which can be found at
<https://docs.python.org/3/license.html#psf-license-agreement-for-python-release>

## License for cx_Freeze

1. This LICENSE AGREEMENT is between the copyright holders and the
Individual or Organization ("Licensee") accessing and otherwise
using cx_Freeze software in source or binary form and its associated
documentation.
2. Subject to the terms and conditions of this License Agreement, the
copyright holders hereby grant Licensee a nonexclusive,
royalty-free, world-wide license to reproduce, analyze, test,
perform and/or display publicly, prepare derivative works,
distribute, and otherwise use cx_Freeze alone or in any derivative
version, provided, however, that this License Agreement and this
notice of copyright are retained in cx_Freeze alone or in any
derivative version prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on or
incorporates cx_Freeze or any part thereof, and wants to make the
derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary
of the changes made to cx_Freeze.
4. The copyright holders are making cx_Freeze available to Licensee on
an "AS IS" basis. THE COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR
WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT
LIMITATION, THE COPYRIGHT HOLDERS MAKE NO AND DISCLAIM ANY
REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY
PARTICULAR PURPOSE OR THAT THE USE OF CX_FREEZE WILL NOT INFRINGE
ANY THIRD PARTY RIGHTS.
5. THE COPYRIGHT HOLDERS SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER
USERS OF CX_FREEZE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL
DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE
USING CX_FREEZE, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE
POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between the
copyright holders and Licensee. This License Agreement does not
grant permission to use copyright holder's trademarks or trade name
in a trademark sense to endorse or promote products or services of
Licensee, or any third party.
8. By copying, installing or otherwise using cx_Freeze, Licensee agrees
to be bound by the terms and conditions of this License Agreement.

Computronix® is a registered trademark of Computronix (Canada) Ltd.
Binary file added build/exe.win-amd64-3.12/lib/PIL/BdfFontFile.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ContainerIO.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ExifTags.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/FontFile.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/GdImageFile.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/Image.pyc
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageCms.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageColor.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageDraw.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageDraw2.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageEnhance.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageFile.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageFilter.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageFont.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageGrab.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageMath.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageMode.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageMorph.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageOps.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImagePalette.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImagePath.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageQt.pyc
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageShow.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageStat.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageTk.pyc
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/ImageWin.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/JpegPresets.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/PSDraw.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/PaletteFile.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/PcfFontFile.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/PdfParser.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/PyAccess.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/TarIO.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/TiffTags.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/WalImageFile.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/__init__.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/__main__.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/_binary.pyc
Binary file not shown.
Binary file added build/exe.win-amd64-3.12/lib/PIL/_deprecate.pyc
Binary file not shown.
Binary file not shown.
30 changes: 30 additions & 0 deletions build/exe.win-amd64-3.12/lib/PIL/_imaging.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from typing import Any

class ImagingCore:
def __getattr__(self, name: str) -> Any: ...

class ImagingFont:
def __getattr__(self, name: str) -> Any: ...

class ImagingDraw:
def __getattr__(self, name: str) -> Any: ...

class PixelAccess:
def __getitem__(self, xy: tuple[int, int]) -> float | tuple[int, ...]: ...
def __setitem__(
self, xy: tuple[int, int], color: float | tuple[int, ...]
) -> None: ...

class ImagingDecoder:
def __getattr__(self, name: str) -> Any: ...

class ImagingEncoder:
def __getattr__(self, name: str) -> Any: ...

class _Outline:
def close(self) -> None: ...
def __getattr__(self, name: str) -> Any: ...

def font(image: ImagingCore, glyphdata: bytes) -> ImagingFont: ...
def outline() -> _Outline: ...
def __getattr__(name: str) -> Any: ...
Binary file not shown.
Loading

0 comments on commit 16d4cbb

Please sign in to comment.