-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_client.py
52 lines (37 loc) · 1.11 KB
/
test_client.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
44
45
46
47
48
49
50
51
52
import sys
import time
import os
from utils import (
hms_string,
)
from nbs_client import (
get_artists,
)
DEFAULT_MAX_RELEASES = 5
DEFAULT_MAX_APPEARANCES = 5
user_token = os.environ.get('NEXT_BIG_SOUND_TOKEN')
def main(argv):
if not user_token:
print 'Missing NEXT_BIG_SOUND_TOKEN environment variable'
sys.exit(2)
max_releases = DEFAULT_MAX_RELEASES
max_appearances = DEFAULT_MAX_APPEARANCES
try:
max_releases = int(argv[0])
max_appearances = int(argv[1])
except Exception:
pass
print('\nGetting {} releases with {} appearances\n'.format(max_releases, max_appearances))
start_time = time.time()
count_artist = 0
for artist in get_artists(
max_chart_releases=max_releases,
max_chart_appearances=max_appearances,
):
count_artist += 1
print('Artist {0}: {1} \n'.format(count_artist, artist))
elapsed_time = time.time() - start_time
print('Elapsed time: {}'.format(hms_string(elapsed_time)))
print('Artists Parsed: {}'.format(count_artist))
if __name__ == '__main__':
main(sys.argv[1:])