-
Notifications
You must be signed in to change notification settings - Fork 0
/
plDownloading.py
43 lines (36 loc) · 1.37 KB
/
plDownloading.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import json
from mapDownload import *
def pldownload(maps, playlists, pldl, PLpath, CMpath):
# set title and print the Start message
title = playlists[pldl]['title']
print('Start downloading : ' + title)
# opens playlist file
pldl = PLpath + playlists[pldl]['fileName']
pldl = open(pldl, encoding='utf-8').read()
pldl = json.loads(pldl)
todl = []
# Checks if maps in playlists are already downloaded
print(pldl['songs'])
for item in pldl['songs']:
try:
if item['hash'].lower() not in maps:
todl.append(item)
except Exception as e:
print('------------------------------')
print(pldl['songs'])
print(e)
print(item)
print('------------------------------')
print('An error occurs, send the text between ----------- to Moréo#1809 on discord')
input('Press enter to close')
exit(1)
ndl = 1
# Downloading map using downloadbeatmap fonction in mapDownload.py
if todl:
for item in todl:
print('\nNow Downloading : ' + item['songName'] + f' {ndl}/{len(todl)}')
download_beatmap(item['hash'], CMpath)
ndl += 1
print(f'\n\nPlaylist {title} downloaded')
else:
print('\n\nAll songs are already downloaded')