Exemple #1
0
            player.getOverlay('rpifade').set(1.0, 1.0, 1.0, 1.0)


def unfadeColor():
    if is_RPi:
        player.getOverlay('rpifade').set(alpha=0.0)


def playmovie(args=None):
    player.play(args[0]) if args else player.play()


player.on(['/synctest'], syncTest)
player.on(['/fullsynctest'], fullSyncTest)
player.on(['/ipregie'], setIpRegie)

player.on(['/playmovie'], playmovie)
player.on(['/loadmovie'], lambda args: player.load(args[0]))
player.on(['/attime'], lambda args: player.seekTo(args[0]))
player.on(['/stopmovie'], player.stop)
player.on(['/unpause'], player.resume)

player.on(['/fade'], fadeColor)
player.on(['/unfade'], unfadeColor)

# RUN
hplayer.setBasePath(["/data/media", "/mnt/usb"])  # Media base path
hplayer.persistentSettings(
    "/data/hplayer2-kxkm.cfg")  # Path to persitent config
hplayer.run()
Exemple #2
0
remote_ip = "3.0.0.10"
#remote_ip = "192.168.0.29"

# PLAYER
player = hplayer.addplayer('mpv', 'ciconia')
player.loop(0)

# Interfaces
player.addInterface('osc', 4000, 4001)
player.addInterface('http', 8037)
#player.addInterface('keypad')


def syncTest(args):
    if player.status()['media'] is not None:
        display = os.path.basename(player.status()['media'])[:-4]
        if player.status()['time'] is not None:
            display += "  \"" + str(int(player.status()['time']))
    else:
        display = "-stop-"

    player.getInterface('osc').hostOut = remote_ip
    player.getInterface('osc').send(display)


player.on(['/synctest'], syncTest)

# RUN
hplayer.setBasePath("/mnt/usb")
hplayer.run()  # TODO: non blocking
Exemple #3
0
from core.engine import hplayer

# PLAYER
player = hplayer.addplayer('mpv', 'myPlayer')

# Interfaces
player.addInterface('osc', 4000, 4001)
player.addInterface('http2', 8080)
# player.addInterface('gpio', [20])

# Example event: HTTP + GPIO events
# player.on(['push1', 'gpio20'], lambda : player.play('media.mp4'))

# RUN
hplayer.setBasePath("/home/mgr/Videos")
hplayer.persistentSettings("/home/mgr/hplayer2.cfg")
hplayer.run()
Exemple #4
0
from time import sleep
from core.engine import hplayer

# PLAYER
player = hplayer.addplayer('mpv', 'looper-chrd')

# INTERFACES
player.addInterface('http2', 80)

# RUN
hplayer.setBasePath(["/data/media"])
hplayer.persistentSettings("/data/hplayer2-chrd.cfg")
hplayer.run()
Exemple #5
0
            player.getOverlay('rpifade').set(args[0]/255.0, args[1]/255.0, args[2]/255.0, 1.0)
        elif args and len(args) == 4:
            player.getOverlay('rpifade').set(args[0]/255.0, args[1]/255.0, args[2]/255.0, args[3]/255.0)
        else:
            player.getOverlay('rpifade').set(1.0, 1.0, 1.0, 1.0)

def unfadeColor():
    if is_RPi:
        player.getOverlay('rpifade').set(alpha=0.0)

def playmovie(args=None):
    player.play( args[0] ) if args else player.play()


player.on(['/synctest'],    syncTest)
player.on(['/fullsynctest'], fullSyncTest)
player.on(['/ipregie'],     setIpRegie)

player.on(['/playmovie'],   playmovie)
player.on(['/loadmovie'],   lambda args: player.load(args[0]))
player.on(['/attime'],      lambda args: player.seekTo(args[0]))
player.on(['/stopmovie'],   player.stop)
player.on(['/unpause'],     player.resume)

player.on(['/fade'],        fadeColor)
player.on(['/unfade'],      unfadeColor)

# RUN
hplayer.setBasePath(["/mnt/usb", "/data"])
hplayer.run()
Exemple #6
0
# PLAYER
player = hplayer.addplayer('mpv', network.get_hostname())
player.doLog['events'] = True
player.doLog['cmds'] = True

# Interfaces
player.addInterface('http', 8080)
player.addInterface('http2', 80)
player.addInterface('serial', "^CP2102")

# SERIAL USB
player.on(['RELOOP'], lambda: player.play("loop*.*"))

# PATH
hplayer.setBasePath(["/mnt/usb"])
hplayer.persistentSettings("/data/hplayer2-flipper.cfg")


# DISABLE automations
def disableAuto(settings):
    player.loop(False)
    player.autoplay(False)
    player.clear()


player.on(['settings-applied'], disableAuto)

# RUN
hplayer.run()
Exemple #7
0
from core.engine import hplayer

# PLAYER
player = hplayer.addplayer('mpv', 'gadagne')

# Interfaces
player.addInterface('osc', 4000, 4001)
player.addInterface('http', 8080)
# player.addInterface('gpio', [16,19,20,21,26])

# GADAGNE logic
defaultFile = 'media0.mp4'
push1File = 'media1.mp4'
push2File = 'media2.mp4'
push3File = 'media3.mp4'

# Loop default file
player.on('end', lambda: player.play(defaultFile))

# HTTP + GPIO events
player.on(['push1', 'gpio20'], lambda: player.play(push1File))
player.on(['push2', 'gpio21'], lambda: player.play(push2File))
player.on(['push3', 'gpio26'], lambda: player.play(push3File))

fails = 5

# RUN
hplayer.setBasePath("/home/pi/Videos/")
hplayer.run()
Exemple #8
0
from core.engine import hplayer
from core.engine import network

# PLAYER
player = hplayer.addplayer('mpv', 'audioscope')
player.loop(1)
player.log['events'] = True

# Interfaces
player.addInterface('osc', 1222, 3737)
player.addInterface('http', 8080)
player.addInterface('nfc', 4, 5)

# HTTP + GPIO events
player.on(['nfc-card'], lambda args: player.play(args[0]['uid'] + "-*.*"))
player.on(['nfc-nocard'], player.stop)

# RUN
hplayer.setBasePath(["/media/usb"])
hplayer.run()
Exemple #9
0
player.on(['KEY_KPPLUS-down', 'KEY_KPPLUS-hold'], 	lambda ev: vol_inc())
player.on(['KEY_KPMINUS-down', 'KEY_KPMINUS-hold'], lambda ev: vol_dec())



# PATCH Keypad LCD update
def lcd_update(self):
	lines = ["", ""]

	# Line 1 : SCENE + VOLUME
	lines[0] = available_dir[active_dir].ljust(13, ' ')[:13]
	lines[0] += str(self.player.settings()['volume']).rjust(3, ' ')[:3]

	# Line 2 : MEDIA
	if not self.player.status()['media']: lines[1] = '-stop-'
	else: lines[1] = os.path.basename(self.player.status()['media'])[:-4]
	lines[1] = lines[1].ljust(14, ' ')[:14]
	lines[1] += str(player.getInterface('zyre').activeCount()).rjust(2, ' ')[:2]

	return lines

if is_RPi:
	player.getInterface('keypad').update = types.MethodType(lcd_update, player.getInterface('keypad'))



# RUN
hplayer.setBasePath(["/mnt/usb"])        	# Media base path
hplayer.persistentSettings("/data/hplayer2-kxkm.cfg")   # Path to persitent config
hplayer.run()                               # TODO: non blocking
Exemple #10
0
player.on(['push3', 'gpio16-on'], lambda: doPlay("3_*.*"))

# GPIO on+off
player.on(['turn1', 'gpio26'], lambda state: superDebounce("1_*.*", 1000))


# GPIO RF Remote
def togglePlay():
    if player.isPlaying(): player.stop()
    else: doPlay("0_*.*")


player.on(['remote', 'gpio14-on', 'gpio15-on'], togglePlay)

# PATH
hplayer.setBasePath("/data/media")
hplayer.persistentSettings("/data/hplayer2-gadagne19.cfg")


# DISABLE automations
def disableAuto(settings):
    player.loop(False)
    player.autoplay(False)
    player.clear()


player.on(['settings-applied'], disableAuto)

# SETTINGS (pre-start)
player.imagetime(15)
Exemple #11
0
from time import sleep
from core.engine import hplayer

# PLAYER
player = hplayer.addplayer('mpv', 'dev-player')

# INTERFACES
player.addInterface('http2', 8080)

# RUN
hplayer.setBasePath(["/home/mgr/Videos/", "/home/mgr/Public/"])
hplayer.persistentSettings("/home/mgr/hplayer2-chrd.cfg")
hplayer.run()