File size: 2,622 Bytes
1a33f31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import os

import json

def read_json_file(input_file_path):
    with open(input_file_path, 'r') as file:
        data = json.load(file)  # Load the JSON data from the file
    return data

# root folder path
file_path = os.path.abspath(__file__)
current_Folder_Path = os.path.dirname(file_path)
root_folder = os.path.dirname(current_Folder_Path)

# imp folder path
content_folder = current_Folder_Path + "/content/"
unique_code_file_Path=current_Folder_Path +"/Unique_code/unique_code.json"

# drive imp folders id
youtube_videos_for_upload_folder_id = "150E6lc1owcHdPnz5DKOFXgmSxjFm0i3f"
content_folder_id = "1tcNOWyaTxPrnEfDkTlejSySNQE3Ib9BT"
unicode_folder_id="1iOt0tn1xcbfOZGvUwkRsLSFQFusbJZL8"

download_drive_folder_list = [youtube_videos_for_upload_folder_id, content_folder_id]

# vedio editing paths
PATHS = {
    # files path
    "logo": content_folder + "logo.png",
    "background": content_folder + "background_image.jpg",
    "banner": content_folder + "yt_banner.png",
    "subscribe": content_folder + "subscribe.png",
    "animation": content_folder + "like_share_subscribe_animation.mp4",

    # imp folder path
    "input_folder_path": current_Folder_Path + "/youtube_videos/",
    "output_folder_path": current_Folder_Path + "/output_videos/"

    # "input_videos": current_Folder_Path + "input_vedio/",
    # "audio": content_folder + "audio.mp3",
    # "output_video": current_Folder_Path + "/output_videos/output_video_with_audio.mp4",
    # "input_video_path": current_Folder_Path + "/downloaded_videos/vedio_0.webm",

}


# imp functions
def create_output_videos_folder():
    output_videos_folder = PATHS["output_folder_path"]
    if not os.path.exists(output_videos_folder):
        os.makedirs(output_videos_folder)
    return output_videos_folder





def check_paths_exist(paths):
    ignore_keys = {"input_videos", "audio", "output_video", "input_video_path"}  # Keys to ignore
    missing_paths = {}
    for key, path in paths.items():
        if key not in ignore_keys and not os.path.exists(path):
            missing_paths[key] = path

    if missing_paths:
        print("\033[91mThe following paths do not exist:\033[0m")  # Red color
        for key, path in missing_paths.items():
            print(f"\033[91m{key}: {path}\033[0m")
        raise Exception("Some required paths are missing.")
    else:
        print("All paths exist.")

    return missing_paths

def validate_name(name):
    json_data = read_json_file(unique_code_file_Path)
    unique_code = json_data["unique_code"]
    print(name)
    if name == unique_code:
        return True
    else:
        return False