diff --git a/extractors/FlacExtractor.py b/extractors/FlacExtractor.py index 53c801d89a09938779ec5efd754c62e627a73250..f738aca16c58614d0a004496091598f84166ed13 100644 --- a/extractors/FlacExtractor.py +++ b/extractors/FlacExtractor.py @@ -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, )