Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 12-06-2012, 07:37 PM   #61
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Why did you convert your repository to private? Nobody was spying on you...
eureka is offline   Reply With Quote
Old 12-06-2012, 07:38 PM   #62
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,586
Karma: 6299991
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
evidently they were...
twobob is offline   Reply With Quote
Advert
Old 12-06-2012, 07:47 PM   #63
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by twobob View Post
evidently they were...
I can't beleive! Are you sure? But why? And why to raise barriers? Maybe they are like good guardian angels?

Here is my variant of code:
Spoiler:
Code:
#!/usr/bin/env python

# -*- encoding: utf-8 -*-

from subprocess import call
import soundcloud

client = soundcloud.Client(client_id='FILL_ME,
                           client_secret='FILL_ME_TOO')

query = raw_input("What do you want to search for?  ")
tracks = client.get('/tracks', q=query, limit=10, filter="streamable")

for idx, track in enumerate(tracks, start=1):
    print(u'[{0}] Title: {1}'.format(idx, track.title))
    print(u' ID: {0}'.format(track.id))
track_idx = int(input("Which track would you like to play?")) - 1

track = client.get('/tracks/{0}'.format(tracks[track_idx].id))
print("Artist: {0}".format(track.user.get(u'username')))
print("Duration (in milliseconds): {0}".format(track.duration))

stream_url = client.get(track.stream_url, allow_redirects=False).location
call(["mplayer", "{0}".format(stream_url)])
eureka is offline   Reply With Quote
Old 12-06-2012, 09:01 PM   #64
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,586
Karma: 6299991
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
: )

Yep that would have been sensible but we were just trying to get stuff scratched together.

In retrospect a public facing version would make more sense when it is ready for release.

Thanks for your kind pointers.
twobob is offline   Reply With Quote
Old 12-06-2012, 10:02 PM   #65
qlob
Official Lurker
qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.
 
qlob's Avatar
 
Posts: 1,050
Karma: 7096675
Join Date: Apr 2012
Device: Kindle 3.4
Maybe we could have a devel release? We might need to remove the secret client id from the file though...
qlob is offline   Reply With Quote
Advert
Old 12-06-2012, 10:28 PM   #66
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by qlob View Post
Maybe we could have a devel release? We might need to remove the secret client id from the file though...
I suggest requiring a settings file from user, like soundcloud.ini:
Code:
[soundkloud]
id = USER_API_ID
secret = USER_API_SECRET
It's really easy to read ini files in Python with built-in ConfigParser.

Then you'll lose a neccessity to store private, sensitive information in repository.
eureka is offline   Reply With Quote
Old 12-06-2012, 10:31 PM   #67
qlob
Official Lurker
qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.
 
qlob's Avatar
 
Posts: 1,050
Karma: 7096675
Join Date: Apr 2012
Device: Kindle 3.4
Quote:
Originally Posted by eureka View Post
I suggest requiring a settings file from user, like soundcloud.ini:
Code:
[soundkloud]
id = USER_API_ID
secret = USER_API_SECRET
It's really easy to read ini files in Python with built-in ConfigParser.
Then you'll lose a neccessity to store private, sensitive information in repository.
.....hmmm good idea there...... twobob, what do you think about that?
qlob is offline   Reply With Quote
Old 12-06-2012, 11:04 PM   #68
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by qlob View Post
I almost fainted when I saw this thread...

This sounds like it could be pretty awesome.....

If you're willing to write it in python or ruby, I'd love to help as much as I can.
BTW, just out of curiousity, why not Go?
eureka is offline   Reply With Quote
Old 12-07-2012, 12:16 AM   #69
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,586
Karma: 6299991
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
Yeah I'm happy with that.

Toying with using Kindlets for interface.

Because Python interface was implemented and is now done. : )
twobob is offline   Reply With Quote
Old 12-07-2012, 10:55 AM   #70
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,586
Karma: 6299991
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
Hmm... So yeah. I got python to launch via a kindlet.
reused the CR3runner command structure for now.

Got some thread issues though. Kindlets don't like not being serviced (a very short fuse ) so the

call (["mplayer", "{0}".format(stream_url.location)])

makes it grumpy... is this a backgrounded call? can it be made one?

EDIT: subprocess.Popen didn't do the trick either... will keep digging


I did get the python bits to start spitting out music via a kindlet - the details are a bit messy right now, but it maybe a solution

Last edited by twobob; 12-07-2012 at 11:39 AM.
twobob is offline   Reply With Quote
Old 12-07-2012, 11:53 AM   #71
qlob
Official Lurker
qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.
 
qlob's Avatar
 
Posts: 1,050
Karma: 7096675
Join Date: Apr 2012
Device: Kindle 3.4
try os.exec instead of the subprocess.call maybe?
qlob is offline   Reply With Quote
Old 12-07-2012, 02:08 PM   #72
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,586
Karma: 6299991
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
okay . I thought one replaced the other. but I will
twobob is offline   Reply With Quote
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,586
Karma: 6299991
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
Old 12-07-2012, 04:08 PM   #74
qlob
Official Lurker
qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.
 
qlob's Avatar
 
Posts: 1,050
Karma: 7096675
Join Date: Apr 2012
Device: Kindle 3.4
ooooh looks fancy. how far along is the kindlet?
qlob is offline   Reply With Quote
Old 12-07-2012, 05:01 PM   #75
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,586
Karma: 6299991
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
yeah.. hmm... not that far really. I spend much of the time wrestling with making it not die.

I can pass a few arguments to the kindlet via a static command.txt (this could be created dynamically of course) This could be Tracks / Sets / Search / Artist / Upload / Dashboard / Last played Track... etc. etc. or something

I can also pass an argument to the shell that call the python and an argument to the python from that so the cascade for information is slowly being put in place.

It's a overhead to invoke it via this method. I suspect there is an easier wasy but meh.
at least the thing seems to not want to crash all the time now

Will feedback when I have more... (some screenies maybe)
twobob is offline   Reply With Quote
Reply


Forum Jump


All times are GMT -4. The time now is 10:28 PM.


MobileRead.com is a privately owned, operated and funded community.