Skip to content

Instantly share code, notes, and snippets.

@agalazis
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agalazis/92ae2ff2aa98038d8dd5 to your computer and use it in GitHub Desktop.
Save agalazis/92ae2ff2aa98038d8dd5 to your computer and use it in GitHub Desktop.
new approach for mplayer draft
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