-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjukebox_main.py
More file actions
558 lines (495 loc) · 24.3 KB
/
jukebox_main.py
File metadata and controls
558 lines (495 loc) · 24.3 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
import argparse
import fs_storage_system
import jukebox
import minio_storage_system
import s3
import storage_system
import swift
import sys
import requests
import jukebox as jb
import jukebox_options
import utils
ARG_PREFIX = "--"
ARG_DEBUG = "debug"
ARG_FILE_CACHE_COUNT = "file-cache-count"
ARG_INTEGRITY_CHECKS = "integrity-checks"
ARG_STORAGE = "storage"
ARG_ARTIST = "artist"
ARG_PLAYLIST = "playlist"
ARG_SONG = "song"
ARG_ALBUM = "album"
ARG_COMMAND = "command"
ARG_FORMAT = "format"
CMD_DELETE_ALBUM = "delete-album"
CMD_DELETE_ARTIST = "delete-artist"
CMD_DELETE_PLAYLIST = "delete-playlist"
CMD_DELETE_SONG = "delete-song"
CMD_EXPORT_ALBUM = "export-album"
CMD_EXPORT_PLAYLIST = "export-playlist"
CMD_HELP = "help"
CMD_IMPORT_ALBUM = "import-album"
CMD_IMPORT_ALBUM_ART = "import-album-art"
CMD_IMPORT_PLAYLISTS = "import-playlists"
CMD_IMPORT_SONGS = "import-songs"
CMD_INIT_STORAGE = "init-storage"
CMD_LIST_ALBUMS = "list-albums"
CMD_LIST_ARTISTS = "list-artists"
CMD_LIST_CONTAINERS = "list-containers"
CMD_LIST_GENRES = "list-genres"
CMD_LIST_PLAYLISTS = "list-playlists"
CMD_LIST_SONGS = "list-songs"
CMD_PLAY = "play"
CMD_PLAY_ALBUM = "play-album"
CMD_SHOW_ALBUM = "show-album"
CMD_PLAY_PLAYLIST = "play-playlist"
CMD_RETRIEVE_CATALOG = "retrieve-catalog"
CMD_SHOW_PLAYLIST = "show-playlist"
CMD_SHUFFLE_PLAY = "shuffle-play"
CMD_UPLOAD_METADATA_DB = "upload-metadata-db"
CMD_USAGE = "usage"
SS_FS = "fs"
SS_S3 = "s3"
SS_SWIFT = "swift"
SS_MINIO = "minio"
CREDS_FILE_SUFFIX = "_creds.txt"
CREDS_CONTAINER_PREFIX = "container_prefix"
SWIFT_AUTH_HOST = "swift_auth_host"
SWIFT_ACCOUNT = "swift_account"
SWIFT_USER = "swift_user"
SWIFT_PASSWORD = "swift_password"
UPDATE_SWIFT_USER = "update_swift_user"
UPDATE_SWIFT_PASSWORD = "update_swift_password"
AWS_ACCESS_KEY = "aws_access_key"
AWS_SECRET_KEY = "aws_secret_key"
UPDATE_AWS_ACCESS_KEY = "update_aws_access_key"
UPDATE_AWS_SECRET_KEY = "update_aws_secret_key"
ENDPOINT_URL = "endpoint_url"
ACCESS_KEY = "access_key"
SECRET_KEY = "secret_key"
UPDATE_ACCESS_KEY = "update_access_key"
UPDATE_SECRET_KEY = "update_secret_key"
FS_ROOT_DIR = "root_dir"
AUDIO_FILE_TYPE_MP3 = "mp3"
AUDIO_FILE_TYPE_M4A = "m4a"
AUDIO_FILE_TYPE_FLAC = "flac"
def connect_swift_system(credentials, in_debug_mode: bool, for_update: bool):
if not swift.is_available():
print("error: swift is not supported on this system. please install swiftclient first.")
sys.exit(1)
swift_auth_host = ""
swift_account = ""
swift_user = ""
swift_password = ""
update_swift_user = ""
update_swift_password = ""
if SWIFT_AUTH_HOST in credentials:
swift_auth_host = credentials[SWIFT_AUTH_HOST]
if SWIFT_ACCOUNT in credentials:
swift_account = credentials[SWIFT_ACCOUNT]
if SWIFT_USER in credentials:
swift_user = credentials[SWIFT_USER]
if SWIFT_PASSWORD in credentials:
swift_password = credentials[SWIFT_PASSWORD]
if UPDATE_SWIFT_USER in credentials and UPDATE_SWIFT_PASSWORD in credentials:
update_swift_user = credentials[UPDATE_SWIFT_USER]
update_swift_password = credentials[UPDATE_SWIFT_PASSWORD]
if in_debug_mode:
print("%s='%s'" % (SWIFT_AUTH_HOST, swift_auth_host))
print("%s='%s'" % (SWIFT_ACCOUNT, swift_account))
print("%s='%s'" % (SWIFT_USER, swift_user))
print("%s='%s'" % (SWIFT_PASSWORD, swift_password))
if len(update_swift_user) > 0 and len(update_swift_password) > 0:
print("%s='%s'" % (UPDATE_SWIFT_USER, update_swift_user))
print("%s='%s'" % (UPDATE_SWIFT_PASSWORD, update_swift_password))
if len(swift_account) == 0 or len(swift_user) == 0 or len(swift_password) == 0:
print("error: no swift credentials given. please specify %s, %s, and %s in credentials" % (SWIFT_ACCOUNT, SWIFT_USER, SWIFT_PASSWORD))
sys.exit(1)
if for_update:
user = update_swift_user
password = update_swift_password
else:
user = swift_user
password = swift_password
return swift.SwiftStorageSystem(swift_auth_host,
swift_account,
user,
password,
in_debug_mode)
def connect_s3_system(credentials, in_debug_mode: bool, for_update: bool):
if not s3.is_available():
print("error: s3 is not supported on this system. please install boto3 (s3 client) first.")
sys.exit(1)
aws_access_key = ""
aws_secret_key = ""
update_aws_access_key = ""
update_aws_secret_key = ""
endpoint_url = ""
if AWS_ACCESS_KEY in credentials:
aws_access_key = credentials[AWS_ACCESS_KEY]
if AWS_SECRET_KEY in credentials:
aws_secret_key = credentials[AWS_SECRET_KEY]
if UPDATE_AWS_ACCESS_KEY in credentials and UPDATE_AWS_SECRET_KEY in credentials:
update_aws_access_key = credentials[UPDATE_AWS_ACCESS_KEY]
update_aws_secret_key = credentials[UPDATE_AWS_SECRET_KEY]
if ENDPOINT_URL in credentials:
endpoint_url = credentials[ENDPOINT_URL]
else:
print("error: s3 requires %s to be configured in creds file" % ENDPOINT_URL)
return None
if in_debug_mode:
print("%s='%s'" % (AWS_ACCESS_KEY, aws_access_key))
print("%s='%s'" % (AWS_SECRET_KEY, aws_secret_key))
if len(update_aws_access_key) > 0 and len(update_aws_secret_key) > 0:
print("%s='%s'" % (UPDATE_AWS_ACCESS_KEY, update_aws_access_key))
print("%s='%s'" % (UPDATE_AWS_SECRET_KEY, update_aws_secret_key))
if len(aws_access_key) == 0 or len(aws_secret_key) == 0:
print("error: no s3 credentials given. please specify %s and %s in credentials file" % (AWS_ACCESS_KEY, AWS_SECRET_KEY))
sys.exit(1)
else:
if for_update:
access_key = update_aws_access_key
secret_key = update_aws_secret_key
else:
access_key = aws_access_key
secret_key = aws_secret_key
return s3.S3StorageSystem(access_key,
secret_key,
endpoint_url,
in_debug_mode)
def connect_minio_system(credentials, in_debug_mode: bool, for_update: bool):
if not minio_storage_system.is_available():
print("error: minio is not supported on this system. please install minio first.")
sys.exit(1)
access_key = ""
secret_key = ""
update_access_key = ""
update_secret_key = ""
endpoint_url = ""
if in_debug_mode:
print(repr(credentials))
if ACCESS_KEY in credentials:
access_key = credentials[ACCESS_KEY]
if SECRET_KEY in credentials:
secret_key = credentials[SECRET_KEY]
if UPDATE_ACCESS_KEY in credentials and UPDATE_SECRET_KEY in credentials:
update_access_key = credentials[UPDATE_ACCESS_KEY]
update_secret_key = credentials[UPDATE_SECRET_KEY]
if ENDPOINT_URL in credentials:
endpoint_url = credentials[ENDPOINT_URL]
else:
print("error: minio requires %s to be configured in creds file" % ENDPOINT_URL)
return None
if in_debug_mode:
print("%s='%s'" % (ACCESS_KEY, access_key))
print("%s='%s'" % (SECRET_KEY, secret_key))
if len(update_access_key) > 0 and len(update_secret_key) > 0:
print("%s='%s'" % (UPDATE_ACCESS_KEY, update_access_key))
print("%s='%s'" % (UPDATE_SECRET_KEY, update_secret_key))
if len(access_key) == 0 or len(secret_key) == 0:
print("error: no minio credentials given. please specify %s and %s in credentials file" % (ACCESS_KEY, SECRET_KEY))
sys.exit(1)
else:
if for_update:
if in_debug_mode:
print("update mode is true; using update access key and update secret key")
access_key = update_access_key
secret_key = update_secret_key
return minio_storage_system.MinioStorageSystem(access_key,
secret_key,
endpoint_url,
in_debug_mode)
def connect_storage_system(system_type: str, credentials, container_prefix: str,
in_debug_mode: bool, for_update: bool):
if system_type == SS_SWIFT:
return connect_swift_system(credentials, in_debug_mode, for_update)
elif system_type == SS_S3:
if container_prefix is not None and len(container_prefix) > 0:
return connect_s3_system(credentials, in_debug_mode, for_update)
else:
print("error: a container prefix MUST be specified for S3")
return None
elif system_type == SS_MINIO:
return connect_minio_system(credentials, in_debug_mode, for_update)
elif system_type == SS_FS:
if FS_ROOT_DIR in credentials:
root_dir = credentials[FS_ROOT_DIR]
if root_dir is not None and len(root_dir) > 0:
return fs_storage_system.FSStorageSystem(root_dir, in_debug_mode)
else:
return None
def show_usage():
print('Supported Commands:')
print('\t%s - delete specified artist' % CMD_DELETE_ARTIST)
print('\t%s - delete specified album' % CMD_DELETE_ALBUM)
print('\t%s - delete specified playlist' % CMD_DELETE_PLAYLIST)
print('\t%s - delete specified song' % CMD_DELETE_SONG)
print('\t%s - show this help message' % CMD_HELP)
print('\t%s - import all new songs from %s subdirectory' % (CMD_IMPORT_SONGS, jukebox.SONG_IMPORT_DIR))
print('\t%s - import all new playlists from %s subdirectory' % (CMD_IMPORT_PLAYLISTS, jukebox.PLAYLIST_IMPORT_DIR))
print('\t%s - import all album art from %s subdirectory' % (CMD_IMPORT_ALBUM_ART, jukebox.ALBUM_ART_IMPORT_DIR))
print('\t%s - show listing of all available songs' % CMD_LIST_SONGS)
print('\t%s - show listing of all available artists' % CMD_LIST_ARTISTS)
print('\t%s - show listing of all available storage containers' % CMD_LIST_CONTAINERS)
print('\t%s - show listing of all available albums' % CMD_LIST_ALBUMS)
print('\t%s - show listing of all available genres' % CMD_LIST_GENRES)
print('\t%s - show listing of all available playlists' % CMD_LIST_PLAYLISTS)
print('\t%s - show songs in specified playlist' % CMD_SHOW_PLAYLIST)
print('\t%s - start playing songs' % CMD_PLAY)
print('\t%s - play songs randomly' % CMD_SHUFFLE_PLAY)
print('\t%s - play specified playlist' % CMD_PLAY_PLAYLIST)
print('\t%s - play specified album' % CMD_PLAY_ALBUM)
print('\t%s - show specified album' % CMD_SHOW_ALBUM)
print('\t%s - retrieve copy of music catalog' % CMD_RETRIEVE_CATALOG)
print('\t%s - upload SQLite metadata' % CMD_UPLOAD_METADATA_DB)
print('\t%s - initialize storage system' % CMD_INIT_STORAGE)
print('\t%s - show this help message' % CMD_USAGE)
print('')
def init_storage_system(storage_sys: storage_system.StorageSystem, container_prefix: str) -> bool:
if jb.initialize_storage_system(storage_sys, container_prefix):
print("storage system successfully initialized")
success = True
else:
print("error: unable to initialize storage system")
success = False
return success
def main():
debug_mode = False
storage_type = SS_SWIFT
artist = ""
playlist = None
song = ""
album = ""
file_format = ""
opt_parser = argparse.ArgumentParser()
opt_parser.add_argument(ARG_PREFIX + ARG_DEBUG, action="store_true", help="run in debug mode")
opt_parser.add_argument(ARG_PREFIX + ARG_FILE_CACHE_COUNT, type=int, help="number of songs to buffer in cache")
opt_parser.add_argument(ARG_PREFIX + ARG_INTEGRITY_CHECKS, action="store_true",
help="check file integrity after download")
opt_parser.add_argument(ARG_PREFIX + ARG_STORAGE, help="storage system type (%s, %s, %s)" % (SS_S3, SS_SWIFT, SS_FS))
opt_parser.add_argument(ARG_PREFIX + ARG_ARTIST, type=str, help="limit operations to specified artist")
opt_parser.add_argument(ARG_PREFIX + ARG_PLAYLIST, type=str, help="limit operations to specified playlist")
opt_parser.add_argument(ARG_PREFIX + ARG_SONG, type=str, help="limit operations to specified song")
opt_parser.add_argument(ARG_PREFIX + ARG_ALBUM, type=str, help="limit operations to specified album")
opt_parser.add_argument(ARG_PREFIX + ARG_FORMAT, type=str, help="restrict play to specified audio file format")
opt_parser.add_argument("command", help="command for jukebox")
args = opt_parser.parse_args()
if args is None:
print("error: unable to obtain command-line arguments")
sys.exit(1)
options = jukebox_options.JukeboxOptions()
if args.debug:
debug_mode = True
options.debug_mode = True
if args.file_cache_count is not None and args.file_cache_count > 0:
if debug_mode:
print("setting file cache count=" + repr(args.file_cache_count))
options.file_cache_count = args.file_cache_count
if args.integrity_checks:
if debug_mode:
print("setting integrity checks on")
options.check_data_integrity = True
if args.storage is not None:
supported_systems = (SS_SWIFT, SS_S3, SS_MINIO, SS_FS)
if args.storage not in supported_systems:
print("error: invalid storage type '%s'" % args.storage)
print("supported systems are: %s" % str(supported_systems))
sys.exit(1)
else:
if debug_mode:
print("setting storage system to '%s'" % args.storage)
storage_type = args.storage
if args.artist is not None:
artist = args.artist
if args.playlist is not None:
playlist = args.playlist
if args.song is not None:
song = args.song
if args.album is not None:
album = args.album
if args.format is not None:
file_format = args.format
if file_format.startswith("."):
file_format = file_format[1:]
valid_file_formats = [AUDIO_FILE_TYPE_MP3, AUDIO_FILE_TYPE_M4A, AUDIO_FILE_TYPE_FLAC]
if file_format not in valid_file_formats:
print("error: invalid file format '%s'" % file_format)
print("valid file formats: %s" % ",".join(valid_file_formats))
sys.exit(1)
if args.command:
if debug_mode:
print("using storage system type '%s'" % storage_type)
container_prefix = ""
creds_file = storage_type + CREDS_FILE_SUFFIX
creds = {}
creds_file_path = utils.path_join(utils.get_current_directory(), creds_file)
if utils.file_exists(creds_file_path):
if debug_mode:
print("reading creds file '%s'" % creds_file_path)
file_contents = utils.file_read_all_text(creds_file)
if file_contents is not None:
file_lines = file_contents.split("\n")
for line in file_lines:
line = line.strip()
if len(line) > 0:
key, value = line.split("=")
key = key.strip()
value = value.strip()
creds[key] = value
if key == CREDS_CONTAINER_PREFIX:
container_prefix = value
if debug_mode:
print("using container prefix: '%s'" % container_prefix)
else:
print("error: unable to read file %s" % creds_file_path)
sys.exit(1)
else:
print("no creds file (%s)" % creds_file_path)
sys.exit(1)
command = args.command
help_cmds = [CMD_HELP, CMD_USAGE]
non_help_cmds = [CMD_IMPORT_SONGS, CMD_PLAY, CMD_SHUFFLE_PLAY, CMD_LIST_SONGS,
CMD_LIST_ARTISTS, CMD_LIST_CONTAINERS, CMD_LIST_GENRES,
CMD_LIST_ALBUMS, CMD_RETRIEVE_CATALOG, CMD_IMPORT_PLAYLISTS,
CMD_LIST_PLAYLISTS, CMD_SHOW_PLAYLIST, CMD_PLAY_PLAYLIST,
CMD_DELETE_SONG, CMD_DELETE_ALBUM, CMD_DELETE_PLAYLIST,
CMD_DELETE_ARTIST, CMD_UPLOAD_METADATA_DB, CMD_INIT_STORAGE,
CMD_IMPORT_ALBUM_ART, CMD_PLAY_ALBUM, CMD_SHOW_ALBUM]
update_cmds = [CMD_IMPORT_SONGS, CMD_IMPORT_PLAYLISTS, CMD_DELETE_SONG,
CMD_DELETE_ALBUM, CMD_DELETE_PLAYLIST, CMD_DELETE_ARTIST,
CMD_UPLOAD_METADATA_DB, CMD_IMPORT_ALBUM_ART, CMD_INIT_STORAGE]
all_cmds = help_cmds + non_help_cmds
if command not in all_cmds:
print("Unrecognized command '%s'" % command)
print('')
show_usage()
else:
if command in help_cmds:
show_usage()
else:
if not options.validate_options():
sys.exit(1)
try:
if command == CMD_UPLOAD_METADATA_DB:
options.suppress_metadata_download = True
else:
options.suppress_metadata_download = False
if command in update_cmds:
for_update = True
else:
for_update = False
with connect_storage_system(storage_type,
creds,
container_prefix,
debug_mode,
for_update) as storage_sys:
if command == CMD_INIT_STORAGE:
if init_storage_system(storage_sys, container_prefix):
sys.exit(0)
else:
sys.exit(1)
with jb.Jukebox(options, storage_sys, container_prefix) as the_jukebox:
if command == CMD_IMPORT_SONGS:
the_jukebox.import_songs()
elif command == CMD_IMPORT_PLAYLISTS:
the_jukebox.import_playlists()
elif command == CMD_PLAY:
shuffle = False
the_jukebox.play_songs(shuffle, artist, album, file_format)
elif command == CMD_SHUFFLE_PLAY:
shuffle = True
the_jukebox.play_songs(shuffle, artist, album, file_format)
elif command == CMD_LIST_SONGS:
the_jukebox.show_listings()
elif command == CMD_LIST_ARTISTS:
the_jukebox.show_artists()
elif command == CMD_LIST_CONTAINERS:
the_jukebox.show_list_containers()
elif command == CMD_LIST_GENRES:
the_jukebox.show_genres()
elif command == CMD_LIST_ALBUMS:
the_jukebox.show_albums()
elif command == CMD_LIST_PLAYLISTS:
the_jukebox.show_playlists()
elif command == CMD_SHOW_PLAYLIST:
if playlist is not None:
the_jukebox.show_playlist(playlist)
else:
print("error: playlist must be specified using %s%s option" % (ARG_PREFIX, ARG_PLAYLIST))
sys.exit(1)
elif command == CMD_PLAY_PLAYLIST:
if playlist is not None:
the_jukebox.play_playlist(playlist)
else:
print("error: playlist must be specified using %s%s option" % (ARG_PREFIX, ARG_PLAYLIST))
sys.exit(1)
elif command == CMD_PLAY_ALBUM:
if album is not None and artist is not None:
the_jukebox.play_album(artist, album)
else:
print(
"error: artist and album must be specified using %s%s and %s%s options" % (ARG_PREFIX, ARG_ARTIST, ARG_PREFIX, ARG_ALBUM))
elif command == CMD_SHOW_ALBUM:
if album is not None and artist is not None:
the_jukebox.show_album(artist, album)
else:
print(
"error: artist and album must be specified using %s%s and %s%s options" % (ARG_PREFIX, ARG_ARTIST, ARG_PREFIX, ARG_ALBUM))
elif command == CMD_RETRIEVE_CATALOG:
pass
elif command == CMD_DELETE_SONG:
if song is not None:
if the_jukebox.delete_song(song):
print("song deleted")
else:
print("error: unable to delete song")
sys.exit(1)
else:
print("error: song must be specified using %s%s option" % (ARG_PREFIX, ARG_SONG))
sys.exit(1)
elif command == CMD_DELETE_ARTIST:
if artist is not None:
if the_jukebox.delete_artist(artist):
print("artist deleted")
else:
print("error: unable to delete artist")
sys.exit(1)
else:
print("error: artist must be specified using %s%s option" % (ARG_PREFIX, ARG_ARTIST))
sys.exit(1)
elif command == CMD_DELETE_ALBUM:
if album is not None:
if the_jukebox.delete_album(album):
print("album deleted")
else:
print("error: unable to delete album")
sys.exit(1)
else:
print("error: album must be specified using %s%s option" % (ARG_PREFIX, ARG_ALBUM))
sys.exit(1)
elif command == CMD_DELETE_PLAYLIST:
if playlist is not None:
if the_jukebox.delete_playlist(playlist):
print("playlist deleted")
else:
print("error: unable to delete playlist")
sys.exit(1)
else:
print("error: playlist must be specified using %s%s option" % (ARG_PREFIX, ARG_PLAYLIST))
sys.exit(1)
elif command == CMD_UPLOAD_METADATA_DB:
if the_jukebox.upload_metadata_db():
print("metadata db uploaded")
else:
print("error: unable to upload metadata db")
sys.exit(1)
elif command == CMD_IMPORT_ALBUM_ART:
the_jukebox.import_album_art()
except requests.exceptions.ConnectionError:
print("Error: unable to connect to storage system server")
sys.exit(1)
else:
print("Error: no command given")
show_usage()
if __name__ == '__main__':
main()