Metadata pusher to IDJC
A feature packed DJ console and internet radio client for Linux users
Status: Beta
Brought to you by:
s-fairchild
Hello, I requested support to send metadata to the IDJC stream from an external source, in this case a text file, Thanks to the team that helped me with an example code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #!/usr/bin/env python import sys import re import dbus from dbus.exceptions import DBusException def main(profile): session = dbus.SessionBus() for metadata in sys.stdin: try: output = session.get_object('net.sf.idjc.' + profile, '/net/sf/idjc/output') output.set_metadata_control_string(0, metadata.strip(), dbus_interface='net.sf.idjc') output.metadata_update(0, dbus_interface='net.sf.idjc') except DBusException as e: print(e) # Optional: Handle scenario where idjc is not running here. # e.g. return 5 return 0 if name == "main": try: PROFILE = sys.argv[1] except IndexError: PROFILE = "default" sys.exit(main(PROFILE)) |
After some syntaxis adjustments with my limited python skills I ended up only with the error:
NameError: name 'name' is not defined
So for testing purposes i define it manually, and test it without errors but also didn't worked with the metadata change on the stream.
If someone could give me a tip to continue my search I would appreciate it.
Greetings
Here it is again this time in code tags.
This will only work if you are logged in on the same user account on the same machine. If you want it to work on a different profile than default you have to supply it on the command line.
Example one off usage:
I tested on the user session in the same machine with the default profile, It didn't change the metadata, but also I didn't got any errors, I tested python with -v but got no error or warning messages. I'll try it in the console, thank you for the support.
It dawned on me that the version of IDJC you are using could be too old for this to work. Reckon your version number is among the 0.8 series.
I've compiled V 0.9.1 because Debian hasn't include it in Bullseye, everything is working great, maybe there's something else I can check.
It worked! after checking I've found that the script works properly, my problem was that I had two outputs and the change only works in the first output stream.
Thank you very much Stephen!
See the line of code that goes: output.set_metadata_control_string(0, ...
Replace the 0 with a 1 to affect metadata on the second stream and so on.
The same applies for metadata_update.
Last edit: Stephen Fairchild 2022-04-21