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

[Question] How to refresh Client Data #25

Open
Chrasonier opened this issue Feb 4, 2021 · 1 comment
Open

[Question] How to refresh Client Data #25

Chrasonier opened this issue Feb 4, 2021 · 1 comment

Comments

@Chrasonier
Copy link

Hello,

I am rebuilding for me the program to work without GUI and as API/Input for e.g. a light show at home.
Unfortunately I haven't quite figured out how to get the updated client data. Via the media_change_callback I get the data once. But how do I update them?

Kind regards

@flesniak
Copy link
Owner

flesniak commented Feb 6, 2021

Hi,

you should be able to use set_client_change_callback, which is also used by the default monitor-qt gui: https://github.com/flesniak/python-prodj-link/blob/master/monitor-qt.py#L65

You can use the client_changed_slot implementation as reference:

def client_change_slot(self, player_number):
player = self.create_player(player_number)
if player is None:
return
c = self.prodj.cl.getClient(player_number)
if c is None:
self.remove_player(player_number)
return
if c.type != "cdj":
return
player.setSpeed(c.bpm, c.pitch)
player.setMaster("master" in c.state)
player.setSync("sync" in c.state)
player.beat_bar.setBeat(c.beat)
player.waveform.setPosition(c.position, c.actual_pitch, c.play_state)
player.setPlayState(c.play_state)
player.setOnAir(c.on_air)

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