Update app.py
Browse files
app.py
CHANGED
|
@@ -50,48 +50,34 @@ def random_string(n=12):
|
|
| 50 |
return ''.join(random.choices(string.ascii_letters + string.digits, k=n))
|
| 51 |
|
| 52 |
def randomize_video_metadata(file_path):
|
| 53 |
-
"""FULL HARD:
|
| 54 |
mime, _ = mimetypes.guess_type(file_path)
|
| 55 |
if not mime or not mime.startswith("video"):
|
| 56 |
return
|
| 57 |
|
| 58 |
temp_path = file_path + ".tmp"
|
| 59 |
|
| 60 |
-
# strings randômicas
|
| 61 |
-
rand_enc = random_string(8)
|
| 62 |
-
rand_title = random_string(12)
|
| 63 |
-
rand_comment = random_string(12)
|
| 64 |
-
rand_desc = random_string(12)
|
| 65 |
-
rand_artist = random_string(10)
|
| 66 |
-
rand_album = random_string(10)
|
| 67 |
-
rand_brand = random.choice(["mp42", "iso2", "isom", "avc1"])
|
| 68 |
-
rand_compat = random.choice([
|
| 69 |
-
"mp42,isom,avc1",
|
| 70 |
-
"isom,avc1,mp41",
|
| 71 |
-
"iso2,mp42,isom"
|
| 72 |
-
])
|
| 73 |
-
|
| 74 |
cmd = [
|
| 75 |
"ffmpeg", "-y", "-i", file_path,
|
| 76 |
-
"-
|
|
|
|
| 77 |
"-c:v", "libx264", "-preset", "fast", "-crf", "23",
|
| 78 |
"-c:a", "aac", "-b:a", "128k",
|
| 79 |
"-movflags", "use_metadata_tags+faststart",
|
| 80 |
-
"-brand",
|
| 81 |
-
"-metadata", f"
|
| 82 |
-
"-metadata
|
| 83 |
-
"-metadata", f"
|
| 84 |
-
"-metadata", f"
|
| 85 |
-
"-metadata", f"
|
| 86 |
-
"-metadata", f"
|
| 87 |
-
"-metadata", f"album={rand_album}",
|
| 88 |
temp_path
|
| 89 |
]
|
| 90 |
|
| 91 |
try:
|
| 92 |
subprocess.run(cmd, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 93 |
os.replace(temp_path, file_path)
|
| 94 |
-
print(f"✅ FULL HARD
|
| 95 |
except Exception as e:
|
| 96 |
print(f"⚠ Erro ao randomizar {file_path}: {e}")
|
| 97 |
|
|
|
|
| 50 |
return ''.join(random.choices(string.ascii_letters + string.digits, k=n))
|
| 51 |
|
| 52 |
def randomize_video_metadata(file_path):
|
| 53 |
+
"""FULL HARD REAL: remove LvMetaInfo/Aigc e reinsere metadados randômicos"""
|
| 54 |
mime, _ = mimetypes.guess_type(file_path)
|
| 55 |
if not mime or not mime.startswith("video"):
|
| 56 |
return
|
| 57 |
|
| 58 |
temp_path = file_path + ".tmp"
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
cmd = [
|
| 61 |
"ffmpeg", "-y", "-i", file_path,
|
| 62 |
+
"-map", "0:v", "-map", "0:a", # ⚡ só vídeo e áudio
|
| 63 |
+
"-map_metadata", "-1", # limpa tudo
|
| 64 |
"-c:v", "libx264", "-preset", "fast", "-crf", "23",
|
| 65 |
"-c:a", "aac", "-b:a", "128k",
|
| 66 |
"-movflags", "use_metadata_tags+faststart",
|
| 67 |
+
"-brand", random.choice(["mp42", "isom", "iso2", "avc1"]),
|
| 68 |
+
"-metadata", f"encoder={random_string(10)}",
|
| 69 |
+
"-metadata", f"title={random_string(12)}",
|
| 70 |
+
"-metadata", f"comment={random_string(12)}",
|
| 71 |
+
"-metadata", f"description={random_string(12)}",
|
| 72 |
+
"-metadata", f"artist={random_string(10)}",
|
| 73 |
+
"-metadata", f"album={random_string(10)}",
|
|
|
|
| 74 |
temp_path
|
| 75 |
]
|
| 76 |
|
| 77 |
try:
|
| 78 |
subprocess.run(cmd, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 79 |
os.replace(temp_path, file_path)
|
| 80 |
+
print(f"✅ FULL HARD REAL aplicado em {file_path}")
|
| 81 |
except Exception as e:
|
| 82 |
print(f"⚠ Erro ao randomizar {file_path}: {e}")
|
| 83 |
|