-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
21 lines (17 loc) · 807 Bytes
/
cli.py
File metadata and controls
21 lines (17 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import underthehood
def openLibrary(loc):
return underthehood.openLibrary(loc)
def listPlaylists(library):
for plist in library['Playlists']:
try:
print ("Name: {0} | ID: {1} | {2} items".format(plist['Name'],plist['Playlist ID'], len(plist['Playlist Items'])))
except KeyError as e:
print ('Name: {0} | ID: {1}'.format(plist['Name'],plist['Playlist ID']))
pass
def getPlaylistID(library, name='Library'):
return [plist['Playlist ID'] for plist in library['Playlists'] if plist['Name'] == name][0]
def convertPlaylist(library, form, playlistID):
if type(playlistID) is str:
underthehood.convertPlaylist(library,form,getPlaylistID(library,playlistID))
else:
underthehood.convertPlaylist(library,form,playlistID)