added logging, catching to dump logs

This commit is contained in:
aj 2019-05-14 22:58:15 +01:00
parent 92f4d906bd
commit ddc8c0918b

View File

@ -8,7 +8,7 @@ import os
if __name__ == '__main__': if __name__ == '__main__':
# try: try:
if os.path.exists(os.path.join(const.config_path, 'playlists.json')): if os.path.exists(os.path.join(const.config_path, 'playlists.json')):
data = json.loadJson(os.path.join(const.config_path, 'playlists.json')) data = json.loadJson(os.path.join(const.config_path, 'playlists.json'))
@ -18,6 +18,8 @@ if __name__ == '__main__':
for tomake in data['playlists']: for tomake in data['playlists']:
log.log("generatePlaylist", tomake['name'])
tracks = [] tracks = []
for part in tomake['playlists']: for part in tomake['playlists']:
@ -38,6 +40,9 @@ if __name__ == '__main__':
tracks.sort(key=lambda x: x['track']['album']['release_date'], reverse=True) tracks.sort(key=lambda x: x['track']['album']['release_date'], reverse=True)
net.replacePlaylistTracks(tomake['id'], [i['track']['uri'] for i in tracks]) net.replacePlaylistTracks(tomake['id'], [i['track']['uri'] for i in tracks])
else:
log.log("config json not found")
# except: log.dumpLog()
# log.dumpLog() except:
log.dumpLog()