diff --git a/streamrip/bases.py b/streamrip/bases.py index 196a594..efdf3af 100644 --- a/streamrip/bases.py +++ b/streamrip/bases.py @@ -570,7 +570,14 @@ class Track: "M4A": converter.AAC, } - self.container = codec.upper() + try: + self.container = codec.upper() + except AttributeError: + click.secho( + "Error: No audio codec chosen to convert to.", fg="red" + ) + raise click.Abort + if not hasattr(self, "final_path"): self.format_final_path() diff --git a/streamrip/tracklists.py b/streamrip/tracklists.py index 61d0332..66a6afb 100644 --- a/streamrip/tracklists.py +++ b/streamrip/tracklists.py @@ -242,12 +242,12 @@ class Album(Tracklist): """ fmt = {key: self.get(key) for key in ALBUM_KEYS} - max_bd, max_sr = get_stats_from_quality(self.quality) - if max_sr < fmt.get("sampling_rate", 0) or max_bd < fmt.get( - "bit_depth", 0 - ): - fmt["sampling_rate"] = max_sr - fmt["bit_depth"] = max_bd + stats = get_stats_from_quality(self.quality) + + # The quality chosen is not the maximum available quality + if stats != (fmt.get("sampling_rate"), fmt.get("bit_depth")): + fmt["bit_depth"] = stats[0] + fmt["sampling_rate"] = stats[1] if sr := fmt.get("sampling_rate"): if sr % 1000 == 0: