-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
executable file
·40 lines (32 loc) · 947 Bytes
/
run.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
#/usr/bin/env python
# coding: utf-8
import random
import os
import sys
import autotracks
from autotracks import track, playlist, library, tools
from autotracks.errors import NotEnoughTracksError
if __name__ == '__main__':
if len(sys.argv) < 3:
print('Usage: {autotracks} {playlist} {tracks}'
.format(
autotracks=sys.argv[0],
playlist='<playlist name>',
tracks='<track list>'
)
)
sys.exit(1)
# initialize library
autotracks = tools.Autotracks(sys.argv[1])
try:
autotracks.load(sys.argv[2:])
except NotEnoughTracksError as error:
print(error.message)
sys.exit(2)
# generate playlists and save the longest
autotracks.generate()
longest = autotracks.save_longest_playlist()
# show unused tracks
autotracks.show_unused_tracks(longest)
# show errors
autotracks.show_errors()