radusuciu / traktor_nowplaying

A cross-platform library and command-line tool that extracts the currently playing track in Traktor and optionally outputs to a file with configurable formatting.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stop listening or execute code while listening

Scatti94 opened this issue · comments

Is there a way to stop listening or execute code while listening? I'm fairly new to python and i can't seem to figure it out.

Can you tell me a little bit more about what you're trying to do?

My approach here: https://github.com/radusuciu/traktor_ice/blob/master/traktor_ice/core.py is to start the Listener in a separate process (see the stream method). You could also do the same thing with threads but I like working with the multiprocessing module.

from traktor_nowplaying import Listener

listener = Listener(port=8000)
listener.start()
print("test")

when i execute this code it doesn't reach the print statement.

What i want to do is to start recording inside traktor and list all songs that are playing. When i end the recording i want my programm to rename the recorded file to all songtitles, so that i know what songs are in the mix.

Edit: i figured it out by complely ignoring the issue and do everything else in a seperate thread but i dont think thats the best solution. i use pynput to get keypress even when out of focus and do everything in the "on_press" funtion

Seems like this is solved, ping me again if not. Thanks!