Загрузка...

Script allowing you to find all the videos on your PC

Thread in Python created by PowerDevil Apr 2, 2025. 190 views

  1. PowerDevil
    PowerDevil Topic starter Apr 2, 2025 12,836 Aug 27, 2022
    Скрипт позволяющий найти все видео на вашем пк
    Допусти как вы фапали 2014 году
    А он мне нужен был для... ( смотри в конец скрипта )
    Python
    import os
    import shutil
    import platform
    import time
    from datetime import datetime
    import concurrent.futures
    import re
    import threading
    import random

    def الأقراص():
    drives = []

    if platform.system() == "Windows":
    for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
    if os.path.exists(f"{letter}:\\"):
    drives.append(f"{letter}:\\")
    else:
    drives = [os.path.expanduser("~")]

    return drives

    def الفيديو(filename):
    video_extensions = ('.mp4', '.mov', '.avi', '.mkv', '.webm', '.3gp', '.flv', '.wmv', '.m4v', '.mpg', '.mpeg')
    return filename.lower().endswith(video_extensions)

    def المجلدات():
    if platform.system() == "Windows":
    return [
    "Windows", "$Recycle.Bin", "Program Files", "Program Files (x86)",
    "ProgramData", "System Volume Information", "Recovery", "AppData"
    ]
    elif platform.system() == "Darwin":
    return [
    "System", "Library", "private", "bin", "sbin", "usr", "var", "Applications"
    ]
    else:
    return [
    "bin", "boot", "dev", "etc", "lib", "lib64", "lost+found", "mnt",
    "proc", "root", "run", "sbin", "srv", "sys", "tmp", "usr", "var"
    ]

    def تخطي(path):
    excluded = المجلدات()
    path_parts = path.split(os.sep)

    if any(part.startswith('.') for part in path_parts if part):
    return True

    for excluded_dir in excluded:
    if any(part.lower() == excluded_dir.lower() for part in path_parts):
    return True

    return False

    def جمع_الفيديوهات(path, target_folder, counter_dict, seen_files):
    videos_found = 0
    errors = 0

    arabic_texts = [
    "جاري تحميل الملفات من القرص",
    "نقل البيانات إلى المجلد الهدف",
    "البحث عن ملفات الفيديو",
    "تحميل الملف، يرجى الانتظار",
    "جاري معالجة الملفات",
    "نقل البيانات مستمر",
    "العملية مستمرة، يرجى الانتظار",
    "تجميع ملفات الفيديو من المجلدات",
    "تحميل الملف التالي",
    "العملية تستغرق بعض الوقت"
    ]

    try:
    for root, dirs, files in os.walk(path, topdown=True):
    if تخطي(root):
    dirs[:] = []
    continue

    for file in files:
    if الفيديو(file):
    src_path = os.path.join(root, file)

    try:
    file_size = os.path.getsize(src_path)
    file_id = f"{file}_{file_size}"

    with counter_dict['seen_lock']:
    if file_id in seen_files:
    continue
    seen_files.add(file_id)

    timestamp = datetime.fromtimestamp(os.path.getmtime(src_path)).strftime('%Y%m%d_%H%M%S')

    file_size_mb = file_size / (1024 * 1024)

    if file_size_mb < 1:
    continue

    size_str = f"{file_size_mb:.1f}MB"

    file_name, file_ext = os.path.splitext(file)
    clean_name = re.sub(r'[^\w\-\.]', '_', file_name)
    if len(clean_name) > 30:
    clean_name = clean_name[:30]

    new_filename = f"video_{timestamp}_{clean_name}_{size_str}{file_ext}"
    dest_path = os.path.join(target_folder, new_filename)

    shutil.copy2(src_path, dest_path)
    videos_found += 1

    with counter_dict['lock']:
    counter_dict['videos'] += 1
    if counter_dict['videos'] % 5 == 0:
    arabic_text = random.choice(arabic_texts)
    print(f"{arabic_text} - {counter_dict['videos']} - {os.path.basename(src_path)}")

    except Exception as e:
    with counter_dict['lock']:
    counter_dict['errors'] += 1
    errors += 1
    except Exception as e:
    print(f"خطأ في المسار {path}: {e}")

    return videos_found, errors

    def سرقة_الفيديوهات(target_folder):
    if not os.path.exists(target_folder):
    os.makedirs(target_folder)
    print(f"إنشاء مجلد الفيديو: {target_folder}")

    drives = الأقراص()
    print(f"العثور على الأقراص: {drives}")

    seen_files = set()

    counter_dict = {
    'videos': 0,
    'errors': 0,
    'lock': threading.Lock(),
    'seen_lock': threading.Lock()
    }

    max_workers = min(len(drives), os.cpu_count() or 4)
    print(f"بدء البحث باستخدام {max_workers} من المعالجات")

    with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
    futures = {executor.submit(جمع_الفيديوهات, drive, target_folder, counter_dict, seen_files): drive for drive in drives}

    done_count = 0
    total_count = len(futures)
    for future in concurrent.futures.as_completed(futures):
    drive = futures[future]
    done_count += 1
    try:
    videos, errors = future.result()
    print(f"تم البحث في القرص {drive}: تم العثور على {videos} ملف فيديو")
    except Exception as e:
    print(f"خطأ في القرص {drive}: {e}")

    return counter_dict['videos'], counter_dict['errors']

    if __name__ == "__main__":
    print("=" * 60)
    print("برنامج تجميع ملفات الفيديو")
    print("=" * 60)
    print("يقوم هذا البرنامج بجمع جميع ملفات الفيديو من جهاز الكمبيوتر")
    print("=" * 60)

    script_dir = os.path.dirname(os.path.abspath(__file__)) or "."

    target_folder = os.path.join(script_dir, "video")

    print(f"مجلد الوجهة: {target_folder}")
    print("جاري بدء البحث...")

    start_time = time.time()
    video_count, error_count = سرقة_الفيديوهات(target_folder)
    end_time = time.time()

    print("\n" + "=" * 60)
    print("اكتملت العملية!")
    print("-" * 60)
    print(f"تم العثور على: {video_count} ملف فيديو")
    print(f"موقع الملفات: {os.path.abspath(target_folder)}")

    if error_count > 0:
    print(f"عدد الأخطاء: {error_count}")

    time_taken = end_time - start_time
    minutes = int(time_taken // 60)
    seconds = int(time_taken % 60)
    print(f"الوقت المستغرق: {minutes} دقيقة و {seconds} ثانية")

    total_size = 0
    for dirpath, dirnames, filenames in os.walk(target_folder):
    for f in filenames:
    fp = os.path.join(dirpath, f)
    total_size += os.path.getsize(fp)

    if total_size > 1024 * 1024 * 1024:
    size_str = f"{total_size / (1024 * 1024 * 1024):.2f} ГБ"
    else:
    size_str = f"{total_size / (1024 * 1024):.2f} МБ"

    print(f"الحجم الإجمالي للملفات: {size_str}")
    print("=" * 60)

    input("\nاضغط Enter للخروج...")
    Чтобы найти как я стреляю с ак
    Все оптимизировано быстро найдет
     
    1. Y4sperMaglot
      PowerDevil, это че за нейминг функций аааай красавчик красоту делаеш
  2. Loss
    Loss Apr 2, 2025 даун 7647 Apr 18, 2018
    أحب إطلاق النار أيضا.
     
    1. Тиджой
      Loss, иншаллах
  3. panacea
    panacea Apr 2, 2025 DeadInDesignerClothes 1272 Sep 18, 2018
    так есть же everything
     
  4. мерзость
    يقوم هذا البرنامج بجمع جميع ملفات الفيديو من جهاز الكمبيوتر
     
  5. derkown
    обфусификация кода по арабски
     
  6. Киана
    Киана Apr 10, 2025 Реклама от Кианы - lolz.live/threads/7756293/
    ХАХАХАХАХААХХАХААХ Названия функций меня убили.
     
    1. Whitley
Top
Loading...