mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-02 22:53:58 +00:00
Support .ogv video files
This commit is contained in:
@@ -180,6 +180,7 @@ from picard.formats.vorbis import (
|
||||
OggSpeexFile,
|
||||
OggVorbisFile,
|
||||
OggAudioFile,
|
||||
OggVideoFile,
|
||||
OggOpusFile,
|
||||
with_opus,
|
||||
)
|
||||
@@ -190,6 +191,7 @@ register_format(OggVorbisFile)
|
||||
if with_opus:
|
||||
register_format(OggOpusFile)
|
||||
register_format(OggAudioFile)
|
||||
register_format(OggVideoFile)
|
||||
|
||||
try:
|
||||
from picard.formats.mp4 import MP4File
|
||||
|
||||
@@ -290,9 +290,8 @@ class OggOpusFile(VCommentFile):
|
||||
metadata['~format'] = self.NAME
|
||||
|
||||
|
||||
def OggAudioFile(filename):
|
||||
"""Generic Ogg audio file."""
|
||||
options = [OggFLACFile, OggSpeexFile, OggVorbisFile]
|
||||
def _select_ogg_type(filename, options):
|
||||
"""Select the best matching Ogg file type."""
|
||||
fileobj = file(filename, "rb")
|
||||
results = []
|
||||
try:
|
||||
@@ -307,5 +306,21 @@ def OggAudioFile(filename):
|
||||
raise mutagen.ogg.error("unknown Ogg audio format")
|
||||
return results[-1][2](filename)
|
||||
|
||||
|
||||
def OggAudioFile(filename):
|
||||
"""Generic Ogg audio file."""
|
||||
options = [OggFLACFile, OggSpeexFile, OggVorbisFile]
|
||||
return _select_ogg_type(filename, options)
|
||||
|
||||
|
||||
OggAudioFile.EXTENSIONS = [".oga"]
|
||||
OggAudioFile.NAME = "Ogg Audio"
|
||||
|
||||
|
||||
def OggVideoFile(filename):
|
||||
"""Generic Ogg video file."""
|
||||
options = [OggTheoraFile]
|
||||
return _select_ogg_type(filename, options)
|
||||
|
||||
OggVideoFile.EXTENSIONS = [".ogv"]
|
||||
OggVideoFile.NAME = "Ogg Video"
|
||||
|
||||
Reference in New Issue
Block a user