72 lines
2.0 KiB
Python
72 lines
2.0 KiB
Python
import os
|
|
|
|
import database
|
|
|
|
DB = None
|
|
|
|
def remove_files():
|
|
datas = DB.get_download()
|
|
|
|
top_txt = "TeamPGP Live on Twitch...\n Every Friday and Sunday @7:30 ET.\n twitch.tv/teampgp"
|
|
|
|
for data in datas:
|
|
(
|
|
id,
|
|
title,
|
|
created_at,
|
|
view_count,
|
|
duration,
|
|
url,
|
|
thumbnail_url,
|
|
game_id,
|
|
game_name,
|
|
stream_id,
|
|
creator_name,
|
|
clip_is,
|
|
downloaded,
|
|
uploaded_yt,
|
|
uploaded_yt_chats,
|
|
uploaded_yt_shorts,
|
|
) = data
|
|
|
|
if clip_is == 0:
|
|
video_path = f"download/videos/{id}/{id}.mp4"
|
|
else:
|
|
video_path = f"download/clips/{id}/{id}.mp4"
|
|
|
|
temp_chat = video_path.replace(".mp4", "_temp_chat.mp4")
|
|
temp_with_chat = video_path.replace(".mp4", "_temp_with_chat.mp4")
|
|
video_chat = video_path.replace(".mp4", "_with_chat.mp4")
|
|
video_chatSS = video_path.replace(".mp4", "_SS_with_chat.mp4")
|
|
video_chat_over = video_path.replace(".mp4", "_over_with_chat.mp4")
|
|
mask_path = video_path.replace(".mp4", "_temp_chat_mask.mp4")
|
|
|
|
shorts_gaussian_9_16 = ""#video_path.replace(".mp4", "_gaussian_9_16.mp4")
|
|
shorts_9_16 = ""#video_path.replace(".mp4", "_9_16.mp4")
|
|
|
|
srt_file = ""#video_path.replace(".mp4", ".srt")
|
|
|
|
|
|
files = [temp_chat, temp_with_chat, video_chatSS, video_chat_over, mask_path, shorts_gaussian_9_16, shorts_9_16, srt_file, video_chat]
|
|
|
|
for file in files:
|
|
if os.path.exists(file):
|
|
if file == video_path:
|
|
print("❌ Error: trying to delete import file.")
|
|
return
|
|
else:
|
|
os.remove(file)
|
|
|
|
def redownload():
|
|
DB.unmark_as_download("2840110867")
|
|
|
|
|
|
def main():
|
|
global DB
|
|
DB = database.Database()
|
|
|
|
remove_files()
|
|
redownload()
|
|
|
|
if __name__ == "__main__":
|
|
main() |