File size: 3,902 Bytes
c63c39e 2e6074b c63c39e 2e6074b 8c64cc3 7af5aaa 8c64cc3 c63c39e 2e6074b c63c39e 7af5aaa 8c64cc3 7af5aaa 8c64cc3 7af5aaa c63c39e 2e6074b 8c64cc3 7af5aaa 2e6074b 8c64cc3 c63c39e 8c64cc3 | 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | import os
import json
# إعداد المسار ليكون دائماً داخل مجلد Clipping
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
PRESETS_DIR = os.path.join(BASE_DIR, "temp_videos", "presets")
os.makedirs(PRESETS_DIR, exist_ok=True)
defaults = {
"youtube_casual": {
"name": "youtube_casual",
"font_name": "Arial",
"font_size": 48,
"primary_color": "#FFFFFF",
"secondary_color": "#FFFF00",
"outline_color": "#000000",
"back_color": "#000000",
"outline_width": 2.0,
"shadow_depth": 1.0,
"alignment": 2,
"margin_v": 100,
"pop_up_scale": 1.2,
"highlight_mode": "karaoke",
"back_box_enabled": True,
"display_mode": "sentence",
"max_words_per_line": 3,
"uppercase": False,
"letter_spacing": 0.0,
"background_opacity": 0.7,
"glow_intensity": 0,
"rotation_angle": 0.0,
"margin_h": 20
},
"gaming": {
"name": "gaming",
"font_name": "Impact",
"font_size": 60,
"primary_color": "#00FF00",
"secondary_color": "#FF00FF",
"outline_color": "#000000",
"back_color": "#000000",
"outline_width": 3.0,
"shadow_depth": 2.0,
"alignment": 2,
"margin_v": 120,
"pop_up_scale": 1.5,
"highlight_mode": "karaoke",
"back_box_enabled": True, # تفعيل البوكس للجيمنج أيضاً
"display_mode": "sentence",
"max_words_per_line": 2,
"uppercase": True,
"letter_spacing": 1.0,
"background_opacity": 0.6,
"glow_intensity": 2,
"rotation_angle": -3.0,
"margin_h": 20,
"box_highlight_type": "word",
"box_rounding": 15
},
"professional": {
"name": "professional",
"font_name": "Helvetica",
"font_size": 40,
"primary_color": "#FFFFFF",
"secondary_color": "#CCCCCC",
"outline_color": "#000000",
"back_color": "#000000",
"outline_width": 1.0,
"shadow_depth": 0.0,
"alignment": 2,
"margin_v": 80,
"pop_up_scale": 1.0,
"highlight_mode": "instant",
"back_box_enabled": True,
"display_mode": "sentence",
"max_words_per_line": 5,
"uppercase": False,
"letter_spacing": 0.5,
"background_opacity": 0.9,
"glow_intensity": 0,
"rotation_angle": 0.0,
"margin_h": 40,
"box_highlight_type": "sentence",
"box_rounding": 5
},
"storyteller": {
"name": "storyteller",
"font_name": "Arial",
"font_size": 52,
"primary_color": "#FFFFFF",
"secondary_color": "#FFD700", # Gold
"outline_color": "#000000",
"back_color": "#000000",
"outline_width": 2.5,
"shadow_depth": 1.5,
"alignment": 2,
"margin_v": 150,
"pop_up_scale": 1.3,
"highlight_mode": "karaoke",
"back_box_enabled": True,
"display_mode": "sentence",
"max_words_per_line": 4,
"uppercase": True,
"letter_spacing": 0.0,
"background_opacity": 1.0,
"glow_intensity": 1,
"rotation_angle": 2.0,
"margin_h": 30
}
}
def init_all_defaults():
"""الدالة التي سنستدعيها عند بدء تشغيل التطبيق"""
os.makedirs(PRESETS_DIR, exist_ok=True)
for name, data in defaults.items():
file_path = os.path.join(PRESETS_DIR, f"{name}.json")
# لا نعيد الكتابة إذا كان الملف موجوداً بالفعل إلا إذا أردت تحديثه
with open(file_path, "w", encoding="utf-8") as f:
json.dump(data, f, indent=4)
print(f"✅ Initialized preset: {name}")
if __name__ == "__main__":
init_all_defaults()
|