Internet DJ Console Homepage IDJC

website logo

With a little work this could be made to interface with your station's web page or with cloud services.

#! /usr/bin/python2.7

"""idjcmon.py demo code

This can be extended to issue e-mail alerts if IDJC freezes or perform Twitter
updates when the music changes.

Requires IDJC 0.8.11 or higher.
Takes the profile you wish to monitor as the command line parameter.
"""

import sys

import gobject
from idjcmonitor import *

def launch_handler(monitor, profile, pid):
    print "Hello to IDJC '%s' with process ID %d." % (profile, pid)

def quit_handler(monitor, profile, pid):
    print "Goodbye to IDJC '%s' with process ID %d." % (profile, pid)

def streamstate_handler(monitor, which, state, where):
    print "Stream %d is %s on connection %s." % (
                                    which, ("down", "up")[state], where)

def metadata_handler(monitor, artist, title, album, songname,
                                                        music_filename):
    print "Metadata is: artist: %s, title: %s, album: %s, filename: %s" % (
                                    artist, title, album, music_filename)

def frozen_handler(monitor, profile, pid, frozen):
    print "IDJC '%s' with process ID %d is %s" % (
                    profile, pid, ("no longer frozen", "frozen")[frozen])

def effect_started_handler(monitor, title, pathname, player):
    print "Effect player %d is playing %s" % (player, title)

def effect_stopped_handler(monitor, player):
    print "Effect player %d has stopped" % player

try:
    profile = sys.argv[1]
except IndexError:
    profile = "default"

monitor = IDJCMonitor(profile)
monitor.connect("launch", launch_handler)
monitor.connect("quit", quit_handler)
monitor.connect("streamstate-changed", streamstate_handler)
monitor.connect("metadata-changed", metadata_handler)
monitor.connect("frozen", frozen_handler)
monitor.connect("effect-started", effect_started_handler)
monitor.connect("effect-stopped", effect_stopped_handler)

gobject.MainLoop().run()