Exemplo n.º 1
0
    def __init__(self, *args):
        options = ([
            ("Yes", 1),
            ("No",  0)
        ])

        default = 1

        Radio.__init__(self, options, default, *args)
Exemplo n.º 2
0
def RADIO_ENABLE():
    global radioDisabled
    global radio
    if radio is None:
        print("========================Radio start!=======================")
        radio = Radio(0.5, 0.001)
        sounds = [('harp.wav',40.0,80.0), ('island_music_x.wav',120.0,160.0), ('sounds/radioSolveKey.wav',200.0,240.0)]
        radio.init_sounds(sounds, 'noize.wav')
        radio.start()
    radioDisabled = False
Exemplo n.º 3
0
    def __init__(self, *args):
        options = ([
            ("Undisclosed", "none"),
            ("Male",  "male"),
            ("Female", "female")
        ])

        default = "none"

        Radio.__init__(self, options, default, *args)
Exemplo n.º 4
0
def PatchWerk(config, options):

    dbUser   = config.get('database', 'user')
    dbPasswd = config.get('database', 'password')
    dbHost   = config.get('database', 'host')
    dbName   = config.get('database', 'dbname')
    dbI      = DbInterface(dbUser, dbPasswd, dbName, dbHost)

    log = Logger(dbI, options.verbose)

    #create mixing/streaming patch
    radio = Radio(config, options, dbI, log)
    radio.pause(1)
    
    #register handler for SIGTERM
    signal.signal(signal.SIGTERM, radio.terminate)

    #register handler for SIGINT
    signal.signal(signal.SIGINT, radio.terminate)
    
    #check that pure data is running fine
    if radio.check_pd():
        #register status with DB and turn DSP on
        radio.all_ok()
    else:
        sys.exit(1)
    
    #start streaming
    radio.streaming_setup()
    
    while True:
        #check to see if the control state is paused or not
        radio.control_check()

        #tell master PD to create the new patch
        radio.new_patch()
        
        if radio.loadError:
            #call function to deal with loading error
            radio.loading_error()
            
        else:
            #turn the DSP in the new patch on
            radio.activate_patch()
            
            #fade over to new patch
            radio.crossfade()
            
            #kill off old patch
            radio.kill_old_patch()
            
            #pause untill next patch needs to be loaded
            radio.play()
Exemplo n.º 5
0
# END: loop()

frontend = WebFrontend(port=config.WEB_FRONTENT_PORT)
frontend.serve()

settings_data = config.SETTINGS

radio_channels = None

with open(radio_config) as data_file:
    radio_data = json.load(data_file)

if "channels" in radio_data:
    radio_channels = radio_data['channels']

p = Radio(radio_channels=radio_channels, mplayer_path=config.MPLAYER_PATH)
if "radio" in settings_data:
    _radio_settings = settings_data['radio']
    p.change_country(_radio_settings['country'])
    if "radio_stations" in _radio_settings and len(_radio_settings['radio_stations']) > 0:
        p.radio_channels.extend(_radio_settings['radio_stations'])

web_frontend.radio = p
alarm = Alarm("res/sounds/Argon_48k.wav", settings=settings_data)
alarm.create_alarms()

web_frontend.alarm = alarm

last_state = config.load_last_state()
if last_state is not None:
    p.set_channel(last_state["last_radio_station"])