Fix #157: Can now import and play flac files
If you ever need an empty flac file with metadata again: 1. Get a flac file (like https://archive.org/download/NineInchNailsTheSlip24bit96khz/01999999.flac) 2. Tag it with Musicbrainz Picard 3. Truncate it, keeping only tags with `ffmpeg -i in.flac -ss 0 -to 0.001 out.flac` Thanks @HgO for the trick!
This commit is contained in:
parent
2f44dd0eb7
commit
ce92747d89
6 changed files with 60 additions and 2 deletions
|
|
@ -28,6 +28,13 @@ def get_id3_tag(f, k):
|
|||
raise TagNotFound(k)
|
||||
|
||||
|
||||
def get_flac_tag(f, k):
|
||||
try:
|
||||
return f.get(k)[0]
|
||||
except (KeyError, IndexError):
|
||||
raise TagNotFound(k)
|
||||
|
||||
|
||||
def get_mp3_recording_id(f, k):
|
||||
try:
|
||||
return [
|
||||
|
|
@ -121,7 +128,38 @@ CONF = {
|
|||
'getter': get_mp3_recording_id,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
'FLAC': {
|
||||
'getter': get_flac_tag,
|
||||
'fields': {
|
||||
'track_number': {
|
||||
'field': 'tracknumber',
|
||||
'to_application': convert_track_number
|
||||
},
|
||||
'title': {
|
||||
'field': 'title'
|
||||
},
|
||||
'artist': {
|
||||
'field': 'artist'
|
||||
},
|
||||
'album': {
|
||||
'field': 'album'
|
||||
},
|
||||
'date': {
|
||||
'field': 'date',
|
||||
'to_application': lambda v: arrow.get(str(v)).date()
|
||||
},
|
||||
'musicbrainz_albumid': {
|
||||
'field': 'musicbrainz_albumid'
|
||||
},
|
||||
'musicbrainz_artistid': {
|
||||
'field': 'musicbrainz_artistid'
|
||||
},
|
||||
'musicbrainz_recordingid': {
|
||||
'field': 'musicbrainz_trackid'
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ def compute_status(jobs):
|
|||
AUDIO_EXTENSIONS_AND_MIMETYPE = [
|
||||
('ogg', 'audio/ogg'),
|
||||
('mp3', 'audio/mpeg'),
|
||||
('flac', 'audio/flac'),
|
||||
]
|
||||
|
||||
EXTENSION_TO_MIMETYPE = {ext: mt for ext, mt in AUDIO_EXTENSIONS_AND_MIMETYPE}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue