2019-02-28 07:49:52 +00:00
|
|
|
import spotframework.net.user as userclass
|
2019-04-30 16:10:41 +01:00
|
|
|
import spotframework.net.network as networkclass
|
2019-02-28 07:49:52 +00:00
|
|
|
import spotframework.io.csv as csvwrite
|
|
|
|
|
2019-03-04 22:45:58 +00:00
|
|
|
import sys, datetime, os
|
2019-03-04 21:31:32 +00:00
|
|
|
|
2019-02-28 07:49:52 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
|
2019-04-30 16:10:41 +01:00
|
|
|
network = networkclass.network(userclass.User())
|
|
|
|
playlists = network.getUserPlaylists()
|
2019-05-08 22:41:47 +01:00
|
|
|
|
|
|
|
for playlist in playlists:
|
|
|
|
playlist.tracks = network.getPlaylistTracks(playlist.playlistid)
|
2019-03-04 22:45:58 +00:00
|
|
|
|
|
|
|
path = sys.argv[1]
|
|
|
|
|
|
|
|
datepath = str(datetime.datetime.now()).split(' ')[0].replace('-', '/')
|
|
|
|
|
|
|
|
totalpath = os.path.join(path, datepath)
|
|
|
|
pathdir = os.path.dirname(totalpath)
|
|
|
|
if not os.path.exists(totalpath):
|
|
|
|
os.makedirs(totalpath)
|
2019-02-28 07:49:52 +00:00
|
|
|
|
|
|
|
for play in playlists:
|
2019-04-30 16:10:41 +01:00
|
|
|
csvwrite.exportPlaylist(play, totalpath)
|
|
|
|
print(play.name + ' exported')
|