Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F217159
get_track_info.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
689 B
Referenced Files
None
Subscribers
None
get_track_info.py
View Options
#!/usr/bin/env python3
import
sys
import
tekore
as
tk
import
pyml_config
as
config
# Set up Spotify connection using client token
conf
=
(
config
.
client_id
,
config
.
client_secret
)
token
=
tk
.
request_client_token
(
*
conf
)
spotify
=
tk
.
Spotify
(
token
)
# Get track ID from first argument
trackarg
=
sys
.
argv
[
1
]
print
(
trackarg
)
try
:
#tk.from_url(trackarg)
print
(
"Looks like it's a track URL, we'll use that"
)
track
=
spotify
.
track
(
tk
.
from_url
(
trackarg
)[
1
])
except
:
print
(
"Looks like it's not a URL, maybe it's a URI?"
)
try
:
track
=
spotify
.
track
(
trackarg
)
except
:
print
(
"Still failed?!?"
)
#trackid = tk.from_url(trackarg)[1]
#track = spotify.track(trackid)
print
(
track
.
asbuiltin
())
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Sun, Apr 27, 9:17 AM (23 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
153981
Default Alt Text
get_track_info.py (689 B)
Attached To
Mode
rPYMUSICLEAGUE PyMusicLeague
Attached
Detach File
Event Timeline
Log In to Comment