Improved README and fixed naming

This commit is contained in:
Dniel97
2022-05-02 19:11:32 +02:00
parent 80a6ee5620
commit 3ead804744
2 changed files with 42 additions and 46 deletions

View File

@@ -17,7 +17,7 @@ from .mqa_identifier_python.mqa_identifier import MqaIdentifier
from .tidal_api import TidalTvSession, TidalApi, TidalMobileSession, SessionType, TidalError, TidalRequestError
module_information = ModuleInformation(
service_name='Tidal',
service_name='TIDAL',
module_supported_modes=ModuleModes.download | ModuleModes.credits | ModuleModes.covers | ModuleModes.lyrics,
login_behaviour=ManualEnum.manual,
global_settings={
@@ -55,6 +55,7 @@ class ModuleInterface:
# LOW = 96kbit/s AAC, HIGH = 320kbit/s AAC, LOSSLESS = 44.1/16 FLAC, HI_RES <= 48/24 FLAC with MQA
self.quality_parse = {
QualityEnum.MINIMUM: 'LOW',
QualityEnum.LOW: 'LOW',
QualityEnum.MEDIUM: 'HIGH',
QualityEnum.HIGH: 'HIGH',
@@ -92,19 +93,19 @@ class ModuleInterface:
sessions[session_type] = TidalMobileSession(self.settings['mobile_default_token'])
if session_type in saved_sessions:
logging.debug(f'Tidal: {session_type} session found, loading')
logging.debug(f'{module_information.service_name}: {session_type} session found, loading')
# load the dictionary from the temporary_settings_controller inside the TidalSession class
sessions[session_type].set_storage(saved_sessions[session_type])
else:
logging.debug(f'Tidal: No {session_type} session found, creating new one')
logging.debug(f'{module_information.service_name}: No {session_type} session found, creating new one')
if session_type == SessionType.TV.name:
self.print('Tidal: Creating a TV session')
self.print(f'{module_information.service_name}: Creating a TV session')
sessions[session_type].auth()
else:
if not username or not password:
self.print('Tidal: Creating a Mobile session')
self.print('Tidal: Enter your Tidal username and password:')
self.print(f'{module_information.service_name}: Creating a Mobile session')
self.print(f'{module_information.service_name}: Enter your Tidal username and password:')
username = input(' Username: ')
password = getpass(' Password: ')
sessions[session_type].auth(username, password)
@@ -135,11 +136,11 @@ class ModuleInterface:
# create a new session finally
if session_type == SessionType.TV.name:
self.print('Tidal: Recreating a TV session')
self.print(f'{module_information.service_name}: Recreating a TV session')
sessions[session_type].auth()
else:
self.print('Tidal: Recreating a Mobile session')
self.print('Tidal: Enter your Tidal username and password:')
self.print(f'{module_information.service_name}: Recreating a Mobile session')
self.print(f'{module_information.service_name}: Enter your Tidal username and password:')
username = input('Username: ')
password = getpass('Password: ')
sessions[session_type].auth(username, password)
@@ -159,7 +160,8 @@ class ModuleInterface:
def check_subscription(self, subscription: str) -> bool:
# returns true if "disable_subscription_checks" is enabled or subscription is HIFI Plus
if not self.disable_subscription_check and subscription not in {'HIFI', 'PREMIUM_PLUS'}:
self.print(f'Tidal: Account is not a HiFi Plus account, detected subscription: {subscription}')
self.print(f'{module_information.service_name}: Account is not a HiFi Plus account, '
f'detected subscription: {subscription}')
return False
return True
@@ -191,7 +193,7 @@ class ModuleInterface:
if 'name' in i.get('creator'):
artists = [i.get('creator').get('name')]
elif i.get('type') == 'EDITORIAL':
artists = ['TIDAL']
artists = [module_information.service_name]
else:
artists = ['Unknown']
@@ -244,7 +246,7 @@ class ModuleInterface:
if 'name' in playlist_data.get('creator'):
creator_name = playlist_data.get('creator').get('name')
elif playlist_data.get('type') == 'EDITORIAL':
creator_name = 'TIDAL'
creator_name = module_information.service_name
else:
creator_name = 'Unknown'
@@ -252,7 +254,6 @@ class ModuleInterface:
name=playlist_data.get('title'),
creator=creator_name,
tracks=tracks,
# TODO: Use playlist creation date or lastUpdated?
release_year=playlist_data.get('created')[:4],
creator_id=playlist_data['creator'].get('id'),
cover_url=self.generate_artwork_url(playlist_data['squareImage'], size=self.cover_size,
@@ -373,7 +374,7 @@ class ModuleInterface:
album_data = data[album_id] if album_id in data else self.session.get_album(album_id)
except TidalError as e:
# if an error occurs, catch it and set the album_data to an empty dict to catch it
self.print(f'Tidal: {e} Trying workaround ...', drop_level=1)
self.print(f'{module_information.service_name}: {e} Trying workaround ...', drop_level=1)
album_data = track_data.get('album')
album_data.update({
'artist': track_data.get('artist'),