Thread: Native SoundKloud
View Single Post
Old 12-07-2012, 03:46 PM   #73
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,552
Karma: 6021142
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Quote:
tracks = client2.get('/tracks', q = sys.argv[1], limit=10, filter="streamable")

i = 1
temp = {} #initalize dictionary

for track in tracks:
track.id, i)

temp.update({i:track.id}) #set dictionary key
i=i + 1
queryb = i-1

trackid = temp.get(queryb) #retrieve key

track = client2.get('/tracks/{0}'.format(trackid))

stream_url = client2.get(track.stream_url, allow_redirects=False)
subprocess.Popen(['mplayer','-identify',"{0}".format(stream_url.location)])
gives fairly solid results (95% of the time) as you can see I just use q = sys.argv[1] to get the search term in at runtime
twobob is offline   Reply With Quote