コード例 #1
0
ファイル: airplay_class.py プロジェクト: towmeod/piradio
from config_class import Configuration
from translate_class import Translate

# Airplay (shairport-sync) pipe and files
AirplayDir = "/tmp/shairport"
AirplayInfo = AirplayDir + "/info"
AirplayMetadata = AirplayDir + "/metadata"
AirplayPipe = "/tmp/shairport-sync-metadata"
ShairportReader = "/usr/local/bin/shairport-sync-metadata-reader"

# Stored mixer volume
RadioLibDir = "/var/lib/radiod"
MixerVolumeFile = RadioLibDir + "/mixer_volume"

log = Log()
translate = Translate()
config = Configuration()


class AirplayReceiver:

    mixerVolume = 100  # Mixer volume
    saveMixerVolume = 0  # Saved Mixer volume for mute functions
    mixerPreset = 100  # Mixer preset volume
    mixerMuted = False  # Mixer muted yes no
    AirplayRunning = False
    hostname = None
    title = 'Uknown title'
    interrupt = False

    # Initialisation routine
コード例 #2
0
ファイル: test_lcd.py プロジェクト: bobrathbone/piradio
# Disclaimer: Software is provided as is and absolutly no warranties are implied or given.
#             The authors shall not be liable for any loss or damage however caused.
#

import sys
import os
import atexit
import traceback
import RPi.GPIO as GPIO
from lcd_class import Lcd
from translate_class import Translate

stderr = sys.stderr.write;

lcd = Lcd()
translate = Translate()

# Try to trap any exit errors and cleanup GPIO
def exit_fn():
	if not traceback.format_exc().startswith('None'):
		s=traceback.format_exc()

# Register
atexit.register(exit_fn)

def interrupt():
        return False

boardrevision = 2
stderr("Are you using an old revision 1 board y/n: ")
answer = raw_input("")
コード例 #3
0
ファイル: test_lcd.py プロジェクト: towmeod/piradio
# Disclaimer: Software is provided as is and absolutly no warranties are implied or given.
#             The authors shall not be liable for any loss or damage however caused.
#

import sys
import os
import atexit
import traceback
import RPi.GPIO as GPIO
from lcd_class import Lcd
from translate_class import Translate

stderr = sys.stderr.write

lcd = Lcd()
translate = Translate()


# Try to trap any exit errors and cleanup GPIO
def exit_fn():
    if not traceback.format_exc().startswith('None'):
        s = traceback.format_exc()


# Register
atexit.register(exit_fn)


def interrupt():
    return False
コード例 #4
0
ファイル: lcd_class.py プロジェクト: bobrathbone/piradio6
    # Does this screen support color
    def hasColor(self):
        return False

# End of Lcd class

# No interrupt routine used as default
def no_interrupt():
    return False

# Class test routine
if __name__ == "__main__":
    test_Russian = False
    from translate_class import Translate
    translate = Translate() # Test routine in __main__

    try:
        print("Test lcd_class.py")

        # Code page. 0=Use primary font code page
        # 1 to 3 override primary font codepage. gives 0x0 to 0x2 
        page = 3    # MC0100 Russian

        lcd = Lcd()
        if test_Russian:
            lcd.init(code_page=page)
        else:
            lcd.init()

        lcd.clear()