Compare commits

...

2 commits

View file

@ -34,7 +34,7 @@ def create_playlist_file(track_list):
def filter_tracks(tracks):
def remove_unreach_tracks(track):
try:
r = requests.head(track['listen_url'], timeout=1)
r = requests.head(track['listen_url'], timeout=2)
r.raise_for_status()
return 1
except:
@ -116,8 +116,8 @@ with concurrent.futures.ThreadPoolExecutor(max_workers=50) as executor:
except Exception as E:
print(E)
for track in tracks_stor:
artist, album, title, play_url, track_duration = track['artist']['name'], track['album']['title'], track['title'], track['listen_url'], track.get('duration')
artist, album, title, play_url, track_duration, fid = track['artist']['name'], track['album']['title'], track['title'], track['listen_url'], track.get('duration'), track['fid']
if not track_duration:
track_duration = -1
playlist_files.append(f'#EXTINF:{track_duration},{artist} - {album} - {title}\n{play_url}')
playlist_files.append(f'#EXTINF:{track_duration},{artist} - {album} - {title} url="{fid}"\n{play_url}')
create_playlist_file(playlist_files)