To give you the best solution, I’ll assume a few common contexts. Please clarify which one fits: (e.g., in VLC, MPV, or a media center) Feature: Auto-select Spanish audio track and add English/Spanish subtitles.
from subliminal import download_best_subtitles, scan_video video = scan_video("El Espinazo del Diablo -DVDRIP--Spanish-.avi") subtitles = download_best_subtitles([video], {video: ['spa', 'eng']}) Feature: Identify movie as The Devil’s Backbone (2001) by Guillermo del Toro. El Espinazo del Diablo -DVDRIP--Spanish-.avi
import subprocess def play_with_spanish_audio(filepath): # Detect audio language using ffprobe (simplified) cmd = ['ffprobe', '-v', 'error', '-show_entries', 'stream=index:stream_tags=language', '-of', 'default=noprint_wrappers=1', filepath] # Then select stream with language 'spa' or 'es' subprocess.run(['mpv', '--aid=1', filepath]) (e.g., for Plex, Jellyfin) Feature: Parse filename to extract title, edition, format, and language. To give you the best solution, I’ll assume
It sounds like you want to (e.g., in a script, app, or media server) for handling the file: in a script