Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inquiry: How to use a library on project? #49

Closed
terzano opened this issue Dec 24, 2016 · 4 comments
Closed

Inquiry: How to use a library on project? #49

terzano opened this issue Dec 24, 2016 · 4 comments

Comments

@terzano
Copy link

terzano commented Dec 24, 2016

HI, I am trying to use your library and was hoping you can give me in the right direction.
The commands rely on stdin for stopping, skipping, etc.
I create a process to start the player but can't seem to get the callbacks to work for ending the player. I can do p.terminate() but I am hoping for a cleaner implementation.

import time
from multiprocessing import Process
from pydora.player import PlayerApp
from pydora.mpg123 import Player

client = py.get_client()
stations = client.get_station_list()
p = Process(target=py.player.play_station, args=(stations[0],))
p.start()

time.sleep(10)

py.player.stop()  # this works
py.player.end_station() # doesn't work 

Thanks in advance,
Diego

@mcrute
Copy link
Owner

mcrute commented Dec 25, 2016

The player was not really designed to be used as a programatic interface to the library, it's more of a reference impementation that you can copy and customize. Take a look at the pandora package instead of the pydora one. The pandora.clientbuilder package provides an easy way to build an instance of pandora.client.APIClient which is the high level Pandora client. Once you start streaming from a station the Pandora API will return links to MP3 files that you can pass to any audio output backend, the pydora player uses mpg123 but you could use something like pyglet too.

@mcrute mcrute closed this as completed Dec 25, 2016
@mcrute
Copy link
Owner

mcrute commented Dec 25, 2016

Replying from a mobile phone and hit the wrong button.

@mcrute mcrute reopened this Dec 25, 2016
@terzano
Copy link
Author

terzano commented Dec 26, 2016

Hi Mike, thanks for your advise. That is actually the approach I took, I am currently using pygame as the player (in a Raspberry Pi environment) but will give pyglet a try. Thank you!

@mcrute
Copy link
Owner

mcrute commented Dec 28, 2016

Feel free to open issues or send fixes via pull requests if you find any bugs.

@mcrute mcrute closed this as completed Dec 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants