Skip to content
Snippets Groups Projects
Unverified Commit 48651695 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

fix: correctly handle flac with split total numbers

parent e4a7a427
Branches master
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ from mutagen.flac import FLAC
from extractors.MediaExtractor import MediaExtractor
from models.TrackMeta import TrackMeta
from util.extract_numbers import extract_numbers
from util.optional_map import optional_map
......@@ -21,6 +22,8 @@ class FlacExtractor(MediaExtractor):
return None
def extract_tags(self) -> TrackMeta:
discnumber, disctotal = optional_map(self.extract_tag('discnumber'), extract_numbers)
tracknumber, tracktotal = optional_map(self.extract_tag('tracknumber'), extract_numbers)
return TrackMeta(
album=self.extract_tag('album'),
albumsort=self.extract_tag('albumsort'),
......@@ -29,14 +32,14 @@ class FlacExtractor(MediaExtractor):
artist=self.extract_tag('artist'),
artistsort=self.extract_tag('artistsort'),
catalognumber=self.extract_tag('catalognumber'),
discnumber=optional_map(self.extract_tag('discnumber'), int),
disctotal=optional_map(self.extract_tag('disctotal'), int),
discnumber=discnumber,
disctotal=optional_map(self.extract_tag('disctotal'), int) or disctotal,
label=self.extract_tag('label'),
media=self.extract_tag('media'),
originaldate=self.extract_tag('originaldate'),
originalyear=self.extract_tag('originalyear'),
title=self.extract_tag('title'),
titlesort=self.extract_tag('titlesort'),
tracknumber=optional_map(self.extract_tag('tracknumber'), int),
tracktotal=optional_map(self.extract_tag('tracktotal'), int),
tracknumber=tracknumber,
tracktotal=optional_map(self.extract_tag('tracktotal'), int) or tracktotal,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment