mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 09:41:26 +01:00
Compare commits
16 Commits
1f45cf74c0
...
5786cfe5da
Author | SHA1 | Date | |
---|---|---|---|
|
5786cfe5da | ||
|
4b5eec0aaa | ||
|
8b3127cf67 | ||
|
aa3498b17e | ||
|
bbc5ee2b97 | ||
|
2598790093 | ||
|
dca6384283 | ||
|
c6246594cf | ||
|
c3fe956e87 | ||
|
41c3dab547 | ||
|
265e0f7154 | ||
|
ac52bf0952 | ||
|
d60ad19944 | ||
|
a691696290 | ||
|
698199b0e8 | ||
|
071326c0cc |
|
@ -691,6 +691,11 @@ def get_postprocessors(opts):
|
||||||
'add_metadata': opts.addmetadata,
|
'add_metadata': opts.addmetadata,
|
||||||
'add_infojson': opts.embed_infojson,
|
'add_infojson': opts.embed_infojson,
|
||||||
}
|
}
|
||||||
|
# MutagenMetadata must run after FFmpegMetadata
|
||||||
|
if opts.addmetadata:
|
||||||
|
yield {
|
||||||
|
'key': 'MutagenMetadata',
|
||||||
|
}
|
||||||
# Deprecated
|
# Deprecated
|
||||||
# This should be above EmbedThumbnail since sponskrub removes the thumbnail attachment
|
# This should be above EmbedThumbnail since sponskrub removes the thumbnail attachment
|
||||||
# but must be below EmbedSubtitle and FFmpegMetadata
|
# but must be below EmbedSubtitle and FFmpegMetadata
|
||||||
|
|
|
@ -59,16 +59,15 @@ class ChaturbateIE(InfoExtractor):
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
}, fatal=False, impersonate=True) or {}
|
}, fatal=False, impersonate=True) or {}
|
||||||
|
|
||||||
status = response.get('room_status')
|
|
||||||
if status != 'public':
|
|
||||||
if error := self._ERROR_MAP.get(status):
|
|
||||||
raise ExtractorError(error, expected=True)
|
|
||||||
self.report_warning('Falling back to webpage extraction')
|
|
||||||
return None
|
|
||||||
|
|
||||||
m3u8_url = response.get('url')
|
m3u8_url = response.get('url')
|
||||||
if not m3u8_url:
|
if not m3u8_url:
|
||||||
self.raise_geo_restricted()
|
status = response.get('room_status')
|
||||||
|
if error := self._ERROR_MAP.get(status):
|
||||||
|
raise ExtractorError(error, expected=True)
|
||||||
|
if status == 'public':
|
||||||
|
self.raise_geo_restricted()
|
||||||
|
self.report_warning(f'Got status "{status}" from API; falling back to webpage extraction')
|
||||||
|
return None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|
|
@ -30,6 +30,7 @@ from .metadataparser import (
|
||||||
)
|
)
|
||||||
from .modify_chapters import ModifyChaptersPP
|
from .modify_chapters import ModifyChaptersPP
|
||||||
from .movefilesafterdownload import MoveFilesAfterDownloadPP
|
from .movefilesafterdownload import MoveFilesAfterDownloadPP
|
||||||
|
from .mutagenmetadata import MutagenMetadataPP
|
||||||
from .sponskrub import SponSkrubPP
|
from .sponskrub import SponSkrubPP
|
||||||
from .sponsorblock import SponsorBlockPP
|
from .sponsorblock import SponsorBlockPP
|
||||||
from .xattrpp import XAttrMetadataPP
|
from .xattrpp import XAttrMetadataPP
|
||||||
|
|
41
yt_dlp/postprocessor/mutagenmetadata.py
Normal file
41
yt_dlp/postprocessor/mutagenmetadata.py
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
from .common import PostProcessor
|
||||||
|
from ..dependencies import mutagen
|
||||||
|
|
||||||
|
if mutagen:
|
||||||
|
from mutagen.easymp4 import EasyMP4
|
||||||
|
from mutagen.flac import FLAC
|
||||||
|
from mutagen.mp3 import EasyMP3
|
||||||
|
from mutagen.oggopus import OggOpus
|
||||||
|
from mutagen.oggvorbis import OggVorbis
|
||||||
|
|
||||||
|
|
||||||
|
class MutagenMetadataPP(PostProcessor):
|
||||||
|
def __init__(self, downloader):
|
||||||
|
PostProcessor.__init__(self, downloader)
|
||||||
|
|
||||||
|
@PostProcessor._restrict_to(images=False)
|
||||||
|
def run(self, information):
|
||||||
|
extension = information['ext']
|
||||||
|
ret = [], information
|
||||||
|
if not mutagen:
|
||||||
|
if extension in ['mp3', 'm4a', 'ogg', 'opus', 'flac']:
|
||||||
|
self.report_warning('module mutagen was not found. Tags with multiple values (e.g. artist, album artist and genre) may be set incorrectly. Please install using `python -m pip install mutagen`')
|
||||||
|
return ret
|
||||||
|
tag_mapping = {
|
||||||
|
'artist': 'artists',
|
||||||
|
'albumartist': 'album_artists',
|
||||||
|
'genre': 'genres',
|
||||||
|
'composer': 'composers'
|
||||||
|
}
|
||||||
|
supported_formats = [EasyMP3, EasyMP4, OggVorbis, OggOpus, FLAC]
|
||||||
|
file = mutagen.File(information['filepath'], supported_formats)
|
||||||
|
if not file:
|
||||||
|
return ret
|
||||||
|
if isinstance(file, EasyMP4):
|
||||||
|
file.RegisterTextKey('composer', '\251wrt')
|
||||||
|
for tag_key, info_key in tag_mapping.items():
|
||||||
|
value = information.get(info_key)
|
||||||
|
if value:
|
||||||
|
file[tag_key] = value
|
||||||
|
file.save()
|
||||||
|
return ret
|
Loading…
Reference in New Issue
Block a user