-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplayDiscogsCollection.py
More file actions
29 lines (21 loc) · 942 Bytes
/
playDiscogsCollection.py
File metadata and controls
29 lines (21 loc) · 942 Bytes
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
__version_info__ = (0,0,1)
__version__ = '0.0.1'
import argparse
from discogs import DiscogsClient
from spotify import SpotifyClient
if __name__ == "__main__":
# Parse arguments
parser = argparse.ArgumentParser(description='Fetch a collection on discogs and play it on Spotify')
parser.add_argument('-u','--user', type=str, required=True, help='User collection to play on Spotify')
parser.add_argument('-f','--force', required=False, action='store_true', help='Force to update the collection')
args = parser.parse_args()
# Import discogs and spotify classes
discogsClient = DiscogsClient()
spotifyOp = SpotifyClient()
# Get catalogs
catalogs,exists = discogsClient.getCatalog(args.user,args.force)
# Get all songs from the request catalog
allSongs = spotifyOp.getSongsFromCatalog(catalogs,args.force,exists,args.user)
uri = spotifyOp.getURIforSongs(allSongs)
# Send link to spotify
spotifyOp.playSpotifyURI(uri)