-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnoskip.py
51 lines (39 loc) · 1.01 KB
/
noskip.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
40
41
42
43
44
45
46
47
48
49
50
import os
import argparse
import json
from gmusicapi import Mobileclient
import codecs
from randomsongs import login, getlibrary, removesongs
G = Mobileclient()
playlist = "4e92ab67-d4a1-4ddb-a2ac-cf5f04845333"
def login():
"""logs in to gmusic"""
mc = Mobileclient()
#mc.perform_oauth()
G.oauth_login(Mobileclient.FROM_MAC_ADDRESS)
def getlibrary():
"""get all library from library"""
library = G.get_all_songs()
return library
def getplaylists():
p = G.get_all_playlists()
return p
def addsongs(songs):
"""adding songs to playlist"""
songstoadd = []
for songs in randomsong:
song = songs["id"]
try:
if not songs["rating"] == "1":
G.add_songs_to_playlist(playlist, song)
except KeyError:
G.add_songs_to_playlist(playlist, song)
return randomsong
def main():
login()
mylibrary = getlibrary()
print(mylibrary[0])
# removesongs()
# addsongs(mylibrary)
if __name__ == '__main__':
main()