56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
import os
|
|
import sys
|
|
|
|
# Finds the absolute path to 'project_directory' and adds it to Python's search path
|
|
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))
|
|
sys.path.append(PROJECT_ROOT)
|
|
|
|
# Your original import will now work
|
|
from package.config import DB as DB
|
|
|
|
|
|
def remove_files():
|
|
datas = DB.get_downloaded()
|
|
|
|
for data in datas:
|
|
|
|
if data.clip_is is False:
|
|
continue
|
|
video_path = f"download/videos/{data.id}/{data.id}.mp4"
|
|
else:
|
|
video_path = f"download/clips/{data.id}/{data.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():
|
|
remove_files()
|
|
print("done")
|
|
#redownload()
|
|
|
|
if __name__ == "__main__":
|
|
main() |