From 458edd258204f86871f9f073170cfcef50c69b0c Mon Sep 17 00:00:00 2001 From: uh wot Date: Fri, 24 Nov 2023 15:33:56 +0100 Subject: [PATCH 1/5] fix session selection for atmos + hires tracks --- interface.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/interface.py b/interface.py index e72c697..b7302c8 100644 --- a/interface.py +++ b/interface.py @@ -471,19 +471,19 @@ class ModuleInterface: format = 'ac3' session = { - 'flac_hires': SessionType.MOBILE_ATMOS, - '360ra': SessionType.MOBILE_ATMOS, + 'flac_hires': SessionType.MOBILE_DEFAULT, + '360ra': SessionType.MOBILE_DEFAULT, 'ac4': SessionType.MOBILE_ATMOS, 'ac3': SessionType.TV, - # MOBILE_DEFAULT is used whenever possible to avoid MPEG-DASH, which slows downloading - None: SessionType.MOBILE_DEFAULT, + # TV is used whenever possible to avoid MPEG-DASH, which slows downloading + None: SessionType.TV, }[format] - if not format and 'SONY_360RA' in media_tags: - # if 360RA is available, we don't use the mobile session here because that will get 360RA + if not format and 'DOLBY_ATMOS' in media_tags: + # if atmos is available, we don't use the TV session here because that will get atmos everytime # there are no tracks with both 360RA and atmos afaik, # so this shouldn't be an issue for now - session = SessionType.TV + session = SessionType.MOBILE_DEFAULT if session.name in self.available_sessions: self.session.default = session From bd660e0102486d12de1ce69306c0a9682ddf8e42 Mon Sep 17 00:00:00 2001 From: uh wot Date: Fri, 24 Nov 2023 15:37:31 +0100 Subject: [PATCH 2/5] change mobile default client id to DefaultHiResClientId --- interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface.py b/interface.py index b7302c8..52f9dfa 100644 --- a/interface.py +++ b/interface.py @@ -24,7 +24,7 @@ module_information = ModuleInformation( 'tv_atmos_token': '4N3n6Q1x95LL5K7p', 'tv_atmos_secret': 'oKOXfJW371cX6xaZ0PyhgGNBdNLlBZd4AKKYougMjik=', 'mobile_atmos_hires_token': 'km8T1xS355y7dd3H', - 'mobile_default_token': 'WAU9gXp3tHhK4Nns', + 'mobile_hires_token': '6BDSRdpK9hqEBTgU', 'enable_mobile': True, 'force_non_spatial': False, 'prefer_ac4': False, @@ -166,7 +166,7 @@ class ModuleInterface: elif session_type == SessionType.MOBILE_ATMOS.name: session = TidalMobileSession(self.settings['mobile_atmos_hires_token']) else: - session = TidalMobileSession(self.settings['mobile_default_token']) + session = TidalMobileSession(self.settings['mobile_hires_token']) return session def auth_session(self, session, session_type, login_session): From 3e6b2d1d3ce914b73c654a9dc282d5cd31fb964a Mon Sep 17 00:00:00 2001 From: uh wot Date: Thu, 4 Jan 2024 13:34:38 +0100 Subject: [PATCH 3/5] rework spatial codec handling --- interface.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/interface.py b/interface.py index 52f9dfa..f8e4103 100644 --- a/interface.py +++ b/interface.py @@ -26,7 +26,6 @@ module_information = ModuleInformation( 'mobile_atmos_hires_token': 'km8T1xS355y7dd3H', 'mobile_hires_token': '6BDSRdpK9hqEBTgU', 'enable_mobile': True, - 'force_non_spatial': False, 'prefer_ac4': False, 'fix_mqa': True }, @@ -460,15 +459,16 @@ class ModuleInterface: media_tags = track_data['mediaMetadata']['tags'] format = None - if 'HIRES_LOSSLESS' in media_tags and quality_tier is QualityEnum.HIFI: + if codec_options.spatial_codecs: + if 'SONY_360RA' in media_tags: + format = '360ra' + elif 'DOLBY_ATMOS' in media_tags: + if self.settings['prefer_ac4']: + format = 'ac4' + else: + format = 'ac3' + if 'HIRES_LOSSLESS' in media_tags and not format and quality_tier is QualityEnum.HIFI: format = 'flac_hires' - if 'SONY_360RA' in media_tags and not format and not self.settings['force_non_spatial']: - format = '360ra' - if 'DOLBY_ATMOS' in media_tags and not format and not self.settings['force_non_spatial']: - if self.settings['prefer_ac4']: - format = 'ac4' - else: - format = 'ac3' session = { 'flac_hires': SessionType.MOBILE_DEFAULT, @@ -607,10 +607,6 @@ class ModuleInterface: credits_extra_kwargs={'data': {track_id: track_data['credits']} if 'credits' in track_data else {}} ) - if not codec_options.spatial_codecs and codec_data[track_codec].spatial: - track_info.error = 'Info: Spatial codecs are disabled, if you want to download it, set "spatial_codecs": ' \ - 'true ' - if error is not None: track_info.error = f'Error: {error}' From ffff53f4276c1e701edbeb6b3fd8a290175c3d02 Mon Sep 17 00:00:00 2001 From: uh wot Date: Thu, 4 Jan 2024 13:52:26 +0100 Subject: [PATCH 4/5] remove 'force_non_spatial' setting from README --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index dc8ece8..14d844e 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,6 @@ loaded module. You'll find the configuration file here: `config/settings.json` "mobile_atmos_token": "dN2N95wCyEBTllu4", "mobile_default_token": "WAU9gXp3tHhK4Nns", "enable_mobile": true, - "force_non_spatial": false, "prefer_ac4": false, "fix_mqa": true } @@ -154,7 +153,6 @@ loaded module. You'll find the configuration file here: `config/settings.json` | tv_secret | Enter a valid TV client secret for the `tv_token` | | mobile_* | Enter a valid MOBILE client token for the desired session | | enable_mobile | Enables a second MOBILE session which needs a `username` and `password` (can be the same "TV" account) to archive Sony 360RA and Dolby AC-4 if available or allows `force_non_spatial` to work properly | -| force_non_spatial | Forces a default Mobile session (`mobile_default_token` without support for Dolby Atmos at all, Sony 360RA will still be available) to get FLAC/AAC tracks | | prefer_ac4 | If enabled and a mobile session is available (`enable_mobile` is set to `true`) this will ensure to get Dolby AC-4 on Dolby Atmos tracks | | fix_mqa | If enabled it will download the MQA file before the actual track and analyze the FLAC file to extract the bitDepth and originalSampleRate. The tags `MQAENCODER`, `ENCODER` and `ORIGINALSAMPLERATE` are than added to the FLAC file in order to get properly detected by MQA enabled software such as Roon, UAPP or Audirvana. | From 15a232f4d4303e97e53b31151041cc4a0c79caa4 Mon Sep 17 00:00:00 2001 From: Dniel97 <6324072+Dniel97@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:41:45 +0100 Subject: [PATCH 5/5] Updated readme for HiRes --- README.md | 55 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 7060456..911abde 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ loaded module. You'll find the configuration file here: `config/settings.json` "global": { "general": { // ... - "download_quality": "lossless" + "download_quality": "hifi" }, "formatting": { "album_format": "{artist}/{name}{quality}{explicit}" @@ -105,15 +105,22 @@ loaded module. You'll find the configuration file here: `config/settings.json` } ``` -`download_quality`: Choose one of the following settings: -* "hifi": FLAC with MQA up to 48/24 -* "lossless": FLAC with 44.1/16 (is MQA if the album is available in MQA) -* "high": same as "medium" -* "medium": AAC 320 kbit/s -* "low": same as "minimum" -* "minimum": AAC 96 kbit/s +#### `download_quality` -`album_format`: +Choose one of the following settings: + +| Quality | Info | +|------------|--------------------------------------------------------------------------------------| +| `hifi` | FLAC up to 192/24 **or** MQA (FLAC) up to 48/24 when `proprietary_codecs` is enabled | +| `lossless` | FLAC with 44.1/16 (is MQA if the album is available in MQA) | +| `high` | same as `medium` | +| `medium` | AAC 320 kbit/s | +| `low` | same as `minimum` | +| `minimum` | AAC 96 kbit/s | + +**Note: HiRes will ALWAYS be preferred instead of MQA!** + +#### `album_format` * `{quality}` will add ``` [Dolby Atmos] @@ -130,38 +137,38 @@ loaded module. You'll find the configuration file here: `config/settings.json` | Option | Info | |--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| proprietary_codecs | Enables/Disables MQA (Tidal Masters) downloading regardless the "hifi" setting from `download_quality` | -| spatial_codecs | Enables/Disables downloading of Dolby Atmos (EAC-3, AC-4) and Sony 360RA | +| proprietary_codecs | Enables/Disables MQA (Tidal Masters) downloading when no HiRes track is available | +| spatial_codecs | Enables/Disables downloading of Dolby Atmos (EAC-3, AC-4) and Sony 360RA (MHA1) | | main_resolution | Tidal only supports 80x80, 160x160, 320x320, 480x480, 640x640, 1080x1080 and 1280x1280px (1280px won't work for playlists).
If you choose 1400 or anything above 1280, it will get the highest quality even if the highest is 4000x4000px. That's because Tidal doesn't provide the "origin artwork" size, so the module will just get the largest. | ### TIDAL ```json { - "tv_token": "7m7Ap0JC9j1cOM3n", - "tv_secret": "vRAdA108tlvkJpTsGZS8rGZ7xTlbJ0qaZ2K9saEzsgY=", - "mobile_atmos_token": "dN2N95wCyEBTllu4", - "mobile_default_token": "WAU9gXp3tHhK4Nns", + "tv_atmos_token": "4N3n6Q1x95LL5K7p", + "tv_atmos_secret": "oKOXfJW371cX6xaZ0PyhgGNBdNLlBZd4AKKYougMjik=", + "mobile_atmos_hires_token": "km8T1xS355y7dd3H", + "mobile_hires_token": "6BDSRdpK9hqEBTgU", "enable_mobile": true, "prefer_ac4": false, "fix_mqa": true } ``` -| Option | Info | -|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| tv_token | Enter a valid TV client token | -| tv_secret | Enter a valid TV client secret for the `tv_token` | -| mobile_* | Enter a valid MOBILE client token for the desired session | -| enable_mobile | Enables a second MOBILE session to archive Sony 360RA and Dolby AC-4 if available or allows `force_non_spatial` to work properly | -| prefer_ac4 | If enabled and a mobile session is available (`enable_mobile` is set to `true`) this will ensure to get Dolby AC-4 on Dolby Atmos tracks | -| fix_mqa | If enabled it will download the MQA file before the actual track and analyze the FLAC file to extract the bitDepth and originalSampleRate. The tags `MQAENCODER`, `ENCODER` and `ORIGINALSAMPLERATE` are than added to the FLAC file in order to get properly detected by MQA enabled software such as Roon, UAPP or Audirvana. | +| Option | Info | +|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| tv_token | Enter a valid TV client token | +| tv_secret | Enter a valid TV client secret for the `tv_token` | +| mobile_* | Enter a valid MOBILE client token for the desired session | +| enable_mobile | Enables a MOBILE session to archive Sony 360RA and Dolby AC-4 if available | +| prefer_ac4 | If enabled and a mobile session is available (`enable_mobile` is set to `true`) this will ensure to get Dolby AC-4 on Dolby Atmos tracks | +| fix_mqa | If enabled it will download the MQA file before the actual track and analyze the FLAC file to extract the bitDepth and originalSampleRate. The tags `MQAENCODER`, `ENCODER` and `ORIGINALSAMPLERATE` are than added to the FLAC file in order to get properly detected by MQA enabled software such as Roon, UAPP or Audirvana. | **Credits: [MQA_identifier](https://github.com/purpl3F0x/MQA_identifier) by [@purpl3F0x](https://github.com/purpl3F0x) and [mqaid](https://github.com/redsudo/mqaid) by [@redsudo](https://github.com/redsudo).** -**NOTE: `fix_mqa` is experimental! May be slower as a download with `fix_mqa` disabled and could be incorrect** +**NOTE: `fix_mqa` may be slower as a download without `fix_mqa` and could be incorrect.** ## Contact