oskvr37 / tiddl

Tidal Downloader - download tracks with single Python package ✨
Apache License 2.0
25 stars 2 forks source link

add more info to logger #14

Closed bachig26 closed 3 months ago

bachig26 commented 3 months ago

i would like to see the timestamp and date in the log.

[Important] the current logger state isn't memory persistent as the older logs will be overwritten. if possible, i would like to see an persistent logger with handling the older info too.

DEBUG   Config.__init__ :: loading from file
DEBUG   Config.update :: updated
DEBUG   Config._save :: saved
DEBUG   Config.update :: updated
DEBUG   Config._save :: saved
INFO    TIDDL.main :: saved settings to .tiddl_config.json
INFO    TIDDL.main :: token expires in 4 days 3 hours
DEBUG   TidalApi._request :: tracks/216149725 {'countryCode': 'NZ'}
DEBUG   urllib3.connectionpool._new_conn :: Starting new HTTPS connection (1): api.tidal.com:443
DEBUG   urllib3.connectionpool._make_request :: https://api.tidal.com:443 "GET /v1/tracks/216149725?countryCode=NZ HTTP/1.1" 200 1030
DEBUG   TidalApi._request :: tracks/216149725/playbackinfo {'audioquality': 'HI_RES_LOSSLESS', 'playbackmode': 'STREAM', 'assetpresentation': 'FULL'}
DEBUG   urllib3.connectionpool._make_request :: https://api.tidal.com:443 "GET /v1/tracks/216149725/playbackinfo?audioquality=HI_RES_LOSSLESS&playbackmode=STREAM&assetpresentation=FULL HTTP/1.1" 200 711
INFO    TIDDL.downloadTrack :: BIBI - NABI :: High Quality - 16 bit 44.1 kHz
DEBUG   download.downloadTrackStream :: application/vnd.tidal.bts
DEBUG   download.download :: https://sp-pr-fa.audio.tidal.com/mediatracks/CAEaKwgDEic5MzAwNzE1ZTQ0NDg0ZmJjOTY3MzFmNTIwZDBmMTdjMF82MS5tcDQ/0.flac?token=1722639450~M2VjODIzOTI2MDMwZTFhODk5YWM4NTY2ZDVjNDMwNWNiMGZmOTNmZQ==
DEBUG   urllib3.connectionpool._new_conn :: Starting new HTTPS connection (1): sp-pr-fa.audio.tidal.com:443
DEBUG   urllib3.connectionpool._make_request :: https://sp-pr-fa.audio.tidal.com:443 "GET /mediatracks/CAEaKwgDEic5MzAwNzE1ZTQ0NDg0ZmJjOTY3MzFmNTIwZDBmMTdjMF82MS5tcDQ/0.flac?token=1722639450~M2VjODIzOTI2MDMwZTFhODk5YWM4NTY2ZDVjNDMwNWNiMGZmOTNmZQ== HTTP/1.1" 200 21574636
DEBUG   download.downloadTrackStream :: flac
INFO    TIDDL.downloadTrack :: track saved in E:\eNT\/BIBI - NABI.flac
oskvr37 commented 3 months ago

https://github.com/oskvr37/tiddl/commit/25b035e6869bc5693a91837c3c26ebb109924439

Let me know if the date and time format is ok

08/03/24 16:30:55 DEBUG TIDDL.main Namespace(input=None, file_template='{artist}/{album}/{title}', download_path=None, quality=None, save_options=True, no_skip=False, silent=False, verbose=False, no_color=False)
08/03/24 16:30:55 DEBUG Config.__init__ loaded {'download_path': 'tidal_download', 'track_quality': 'HIGH', 'file_template': 'XD'}
08/03/24 16:30:55 DEBUG Config._save {'download_path': 'tidal_download', 'track_quality': 'HIGH', 'file_template': 'XD'}
08/03/24 16:30:55 INFO  TIDDL.main saving new settings...
08/03/24 16:30:55 DEBUG Config.update updating
08/03/24 16:30:55 DEBUG Config._save {'download_path': 'tidal_download', 'track_quality': 'HIGH', 'file_template': '{artist}/{album}/{title}'}
08/03/24 16:30:55 DEBUG Config.update updated
08/03/24 16:30:55 INFO  TIDDL.main saved settings to .tiddl_config.json
08/03/24 16:30:55 INFO  TIDDL.main token expires in 2 days 5 hours
08/03/24 16:30:55 WARNING   TIDDL.main no ID nor URL provided

I can also make constants module where users can easily adjust code for their preferences, for example:

DEBUG_DATE_FORMAT = "%x %X"