Last active
August 29, 2015 14:10
-
-
Save agalazis/92ae2ff2aa98038d8dd5 to your computer and use it in GitHub Desktop.
new approach for mplayer draft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo mplayer -ao alsa:device=hw -af equalizer=0:0:0:0:0:0:0:0:0:0 -volume 60 http://imagine.1stepstream.com:8000/aac| while IFS= read -r line; do echo $line |grep -Po 'KVolume.*?%|Title:.*?\\n|Album:.*?\\n|Year:.*?\\n|Track:.*?\\n' | myamqclient; done | |
amq client -emits updates: | |
#!/usr/bin/env python | |
import pika | |
import sys | |
message= sys.stdin.read().rstrip() | |
connection = pika.BlockingConnection(pika.ConnectionParameters( | |
host='localhost')) | |
channel = connection.channel() | |
channel.exchange_declare(exchange='mplayer', | |
type='fanout') | |
channel.basic_publish(exchange='logs', | |
routing_key='', | |
body=message) | |
print " [x] Sent %r" % (message,) | |
connection.close() | |
websocketd consumer receives updates: | |
#!/usr/bin/env python | |
import pika | |
connection = pika.BlockingConnection(pika.ConnectionParameters( | |
host='localhost')) | |
channel = connection.channel() | |
channel.exchange_declare(exchange='mplayer', | |
type='fanout') | |
result = channel.queue_declare(exclusive=True) | |
queue_name = result.method.queue | |
channel.queue_bind(exchange='mplayer', | |
queue=queue_name) | |
print ' [*] Waiting for logs. To exit press CTRL+C' | |
def callback(ch, method, properties, body): | |
print " [x] %r" % (body,) | |
channel.basic_consume(callback, | |
queue=queue_name, | |
no_ack=True) | |
channel.start_consuming() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment