xyz / lhotseWorkspace /checkFileBullshit.py
benderrodriguez's picture
Upload folder using huggingface_hub (part 37)
9e060c3 verified
Raw
History Blame Contribute Delete
1.55 kB
import subprocess
TARGET_FILE = "/mnt/jonathanDisk/ivritData/讬讚 讬爪讞拽 讘谉-爪讘讬/2011.06.14 诪讚专砖讬 讗讙讚讛 讘讗专抓 讬砖专讗诇 讜转驻讜爪转诐 - 讗讘讬讙讚讜专 砖谞讗谉.m4a"
def main():
print(f"Interrogating:\n{TARGET_FILE}\n")
# --- 1. THE METADATA (The Header) ---
print("1. Reading Metadata (The Header)...")
try:
meta_cmd = [
"ffprobe", "-v", "error",
"-show_entries", "format=duration",
"-of", "default=noprint_wrappers=1:nokey=1",
TARGET_FILE
]
meta_seconds = float(subprocess.check_output(meta_cmd).decode().strip())
meta_mins = meta_seconds / 60
print(f" Result: {meta_seconds:.2f} seconds ({meta_mins:.2f} minutes)")
except Exception as e:
print(f" Failed to read metadata: {e}")
# --- 2. THE PHYSICAL REALITY (The Stream) ---
print("\n2. Decoding physical packets (The Truth)...")
print(" (Reading all bytes to find the physical cliff. Takes a few seconds...)")
try:
# We use tr '\r' '\n' to catch ffmpeg's updating progress bar
phys_cmd = f"ffmpeg -v info -i '{TARGET_FILE}' -f null - 2>&1 | tr '\\r' '\\n' | grep 'time=' | tail -n 1"
phys_out = subprocess.check_output(phys_cmd, shell=True).decode().strip()
# phys_out looks like: "size=N/A time=00:32:51.05 bitrate=N/A speed= 341x"
print(f" Result: {phys_out}")
except Exception as e:
print(f" Failed to decode stream: {e}")
if __name__ == "__main__":
main()