mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-12 18:31:25 +01:00
Compare commits
5 Commits
265e0f7154
...
2598790093
Author | SHA1 | Date | |
---|---|---|---|
|
2598790093 | ||
|
dca6384283 | ||
|
c6246594cf | ||
|
c3fe956e87 | ||
|
41c3dab547 |
14
README.md
14
README.md
|
@ -1379,11 +1379,12 @@ Available for the media that is a track or a part of a music album:
|
|||
- `track` (string): Title of the track
|
||||
- `track_number` (numeric): Number of the track within an album or a disc
|
||||
- `track_id` (string): Id of the track
|
||||
- `artist` (string): Artist(s) of the track
|
||||
- `genre` (string): Genre(s) of the track
|
||||
- `artists` (list): Artist(s) of the track
|
||||
- `composers` (list): Composer(s) of the piece
|
||||
- `genres` (list): Genre(s) of the track
|
||||
- `album` (string): Title of the album the track belongs to
|
||||
- `album_type` (string): Type of the album
|
||||
- `album_artist` (string): List of all artists appeared on the album
|
||||
- `album_artists` (list): List of all artists appeared on the album
|
||||
- `disc_number` (numeric): Number of the disc or other physical medium the track belongs to
|
||||
|
||||
Available only when using `--download-sections` and for `chapter:` prefix when using `--split-chapters` for videos with internal chapters:
|
||||
|
@ -1761,10 +1762,11 @@ Metadata fields | From
|
|||
`description`, `synopsis` | `description`
|
||||
`purl`, `comment` | `webpage_url`
|
||||
`track` | `track_number`
|
||||
`artist` | `artist`, `creator`, `uploader` or `uploader_id`
|
||||
`genre` | `genre`
|
||||
`artist` | `artists`, `creator`, `uploader` or `uploader_id`
|
||||
`composer` | `composers`
|
||||
`genre` | `genres`
|
||||
`album` | `album`
|
||||
`album_artist` | `album_artist`
|
||||
`album_artist` | `album_artists`
|
||||
`disc` | `disc_number`
|
||||
`show` | `series`
|
||||
`season_number` | `season_number`
|
||||
|
|
|
@ -24,7 +24,6 @@ import traceback
|
|||
import unicodedata
|
||||
|
||||
from .cache import Cache
|
||||
|
||||
from .compat import functools, urllib # isort: split
|
||||
from .compat import compat_os_name, compat_shlex_quote, urllib_req_to_req
|
||||
from .cookies import LenientSimpleCookie, load_cookies
|
||||
|
@ -3929,9 +3928,10 @@ class YoutubeDL:
|
|||
|
||||
# These imports can be slow. So import them only as needed
|
||||
from .extractor.extractors import _LAZY_LOADER
|
||||
from .extractor.extractors import _PLUGIN_CLASSES as plugin_ies
|
||||
from .extractor.extractors import \
|
||||
from .extractor.extractors import (
|
||||
_PLUGIN_CLASSES as plugin_ies,
|
||||
_PLUGIN_OVERRIDES as plugin_ie_overrides
|
||||
)
|
||||
|
||||
def get_encoding(stream):
|
||||
ret = str(getattr(stream, 'encoding', 'missing (%s)' % type(stream).__name__))
|
||||
|
|
|
@ -670,11 +670,6 @@ def get_postprocessors(opts):
|
|||
'add_metadata': opts.addmetadata,
|
||||
'add_infojson': opts.embed_infojson,
|
||||
}
|
||||
# MutagenMetadata must run after FFmpegMetadata
|
||||
if opts.addmetadata:
|
||||
yield {
|
||||
'key': 'MutagenMetadata',
|
||||
}
|
||||
# Deprecated
|
||||
# This should be above EmbedThumbnail since sponskrub removes the thumbnail attachment
|
||||
# but must be below EmbedSubtitle and FFmpegMetadata
|
||||
|
|
|
@ -423,7 +423,7 @@ class InfoExtractor:
|
|||
track_id: Id of the track (useful in case of custom indexing, e.g. 6.iii),
|
||||
as a unicode string.
|
||||
artists: List of artists of the track.
|
||||
composers: List of composers of the piece
|
||||
composers: List of composers of the piece.
|
||||
genres: List of genres of the track.
|
||||
album: Title of the album the track belongs to.
|
||||
album_type: Type of the album (e.g. "Demo", "Full-length", "Split", "Compilation", etc).
|
||||
|
|
|
@ -30,7 +30,6 @@ from .metadataparser import (
|
|||
)
|
||||
from .modify_chapters import ModifyChaptersPP
|
||||
from .movefilesafterdownload import MoveFilesAfterDownloadPP
|
||||
from .mutagenmetadata import MutagenMetadataPP
|
||||
from .sponskrub import SponSkrubPP
|
||||
from .sponsorblock import SponsorBlockPP
|
||||
from .xattrpp import XAttrMetadataPP
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
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.musepack import Musepack
|
||||
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', '.mpc']:
|
||||
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, Musepack]
|
||||
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