Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • aura/engine
  • hermannschwaerzler/engine
  • sumpfralle/aura-engine
3 results
Select Git revision
Show changes
Showing
with 243 additions and 0 deletions
File added
This diff is collapsed.
File added
File added
This diff is collapsed.
This diff is collapsed.
__author__ = 'michel'
__author__ = 'michel'
import os
import sys
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import getopt
scriptdir = os.path.dirname(os.path.abspath(__file__))
# import our libraries
package_dir = os.path.join(scriptdir, '../../../')
path = list(sys.path)
sys.path.insert(0, package_dir)
from libraries.reporting.messenger import AuraMessenger
def main(argv):
m = AuraMessenger()
task = ''
channel = ''
name= ''
value = ''
time = ''
try:
opts, args = getopt.getopt(argv,"c:t:n:v:t",["channel=","task=", "name=","value=","time="])
except getopt.GetoptError:
print('message.py -c <channel> -t <task> [-n <name> -v <value> [-t <time>]]')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print('message.py -c <channel> -t <task>')
sys.exit()
elif opt in ("-c", "--channel"):
channel = arg
elif opt in ("-t", "--task"):
task = arg
elif opt in ("-n", "--name"):
name = arg
elif opt in ("-v", "--value"):
value = arg
elif opt in ("-t", "--time"):
eventtime = arg
m.setChannel(channel)
if task == 'setEvent':
#setEvent(self, name, eventtime, value)
#opts, args = getopt.getopt(argv,"c:t:",["channel=","task="])
pass
elif task == 'setState':
if name == '':
sys.exit(2)
m.setState(name, value)
else:
m.sayAlive()
if __name__ == "__main__":
main(sys.argv[1:])
sys.path[:] = path
\ No newline at end of file
#!/bin/bash
pack_int(){ printf "%08X\n" $1 | sed 's/\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)/\\\\\\x\4\\\\\\x\3\\\\\\x\2\\\\\\x\1/I' | xargs printf; }
pack_short(){ printf "%04X\n" $1 | sed 's/\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)/\\\\\\x\2\\\\\\x\1/I' | xargs printf; }
duration=1800
if [[ $# -eq 1 ]]; then
duration=$1
fi
channels=2
bps=16
sample=44100
Subchunk1Size=18
Subchunk2Size=$(echo "$duration*$sample*$channels*$bps/8" | bc)
ChunkSize=$((20 + $Subchunk1Size + $Subchunk2Size))
echo -n RIFF
pack_int $ChunkSize
echo -n "WAVEfmt "
pack_int $Subchunk1Size
pack_short 1
pack_short $channels
pack_int $sample
pack_int $((bps/8 * channels * sample))
pack_short $((bps/8 * channels))
pack_short $bps
pack_short 0
echo -n data
pack_int $Subchunk2Size
dd if=/dev/zero bs=1 count=$Subchunk2Size 2>/dev/null
set("frame.size", 1881)
#set("decoding.buffer_length", 20.)
#set("frame.channels", 2)
#set("frame.samplerate", 44100)
set("server.telnet", true)
set("server.telnet.port", 1234)
set("alsa.alsa_buffer", 2048)
#set("alsa.periods", 8)
#set("alsa.buffer_length", 4096)
# works, but every now and then buffer overruns in alsa.in on node
# more or less the same with or w/o clock_safe set. maybe a bit better with clock_safe=false
input_alsa = input.alsa(bufferize=false, clock_safe=false)
output.alsa(bufferize=false, clock_safe=false, input_alsa)
#output.alsa(bufferize = false, input.alsa(bufferize = false))
# works
#url = "http://stream.fro.at/fro64.mp3"
#i = strip_blank(input.http(id="stream", url))
#input_http = mksafe(i)
#output.alsa(bufferize=false, input_http)
# works
#input_fs = fallback(track_sensitive=false,
# [ single("/var/audio/fallback/music.flac"), playlist.safe("/var/audio/fallback/NightmaresOnWax/Smokers Delight") ] )
#ignore(input_fs)
#output.alsa(bufferize=false, input_fs)
#output.alsa(device="hw:1,0", bufferize=false, input_alsa)
#output.alsa(device="hw:1,0", bufferize=false, input_http)
#output.pulseaudio(input_http)
#output.alsa(device="hw:0,0", bufferize=false, input_alsa)
#output.pulseaudio(input_fs)
#mixer = mix(id = "mixer", [input_alsa])
#final_stream = fallback(id="station_fallback", [mixer, playlist.safe("/var/audio/fallback/NightmaresOnWax/Smokers Delight")])
#output.alsa(device="hw:1,0", bufferize=false, final_stream)
#ignore(mixer)
#ignore(input_fs)
#ignore(input_http)
#ignore(input_alsa)
#set("frame.size", 3763)
#set("decoding.buffer_length", 20.)
#set("frame.channels", 2)
#set("frame.samplerate", 44100)
set("server.telnet", true)
set("server.telnet.port", 1234)
input_alsa = input.alsa(bufferize=false)
#output.alsa(device="hw:0,0", bufferize=false, input_alsa)
#output.alsa(bufferize = false, input.alsa(bufferize = false))
url = "http://stream.fro.at/fro64.mp3"
#url = "http://mp3stream1.apasf.apa.at:8000/listen.pls"
input_http = strip_blank(id="http_strip", input.http(id="stream", url))
#input_http = mksafe(i)
ignore(input_http)
input_fs = strip_blank(id="fs_strip", single("/var/audio/fallback/music.flac"))
#fallback(track_sensitive=false,
# [ single("/var/audio/fallback/music.flac"), playlist.safe("/var/audio/fallback/NightmaresOnWax/Smokers Delight") ] )
ignore(input_fs)
#output.alsa(device="hw:0,0", bufferize=false, input_alsa)
#output.alsa(device="hw:0,0", bufferize=false, input_http)
#output.pulseaudio(input_http)
#output.alsa(device="hw:0,0", bufferize=false, input_fs)
#output.pulseaudio(input_fs)
mixer = mix(id = "mixer", [input_fs, input_http, input_alsa])
#final_stream = fallback(id="station_fallback", [mixer, playlist.safe("/var/audio/fallback/NightmaresOnWax/Smokers Delight")])
output.alsa(bufferize=false, mixer)
ignore(mixer)
#ignore(input_fs)
#ignore(input_http)
#ignore(input_alsa)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
def read_ini(file)
ret = get_process_lines("cat "^file )
ret = list.map(string.split(separator="="), ret)
# l' => the filling list
def f(l',l)=
if list.length(l) >= 2 then
line = string.extract(pattern='"(.*)"', list.nth(l,1))
print((list.hd(l),line['1']))
list.append([(list.hd(l),line['1'])],l')
else
if list.length(l) >= 1 then
list.append([(list.hd(l),"")],l')
else
l'
end
end
end
list.fold(f,[],ret)
end
This diff is collapsed.
%include "/home/gg/PycharmProjects/comba/modules/soundengine/readini.liq"
set("log.file",true)
set("log.file.path",list.assoc("logdir", ini)^"/<script>.log")
#set("log.file.path", "<script>.log")
set("log.file.perms",0o660)
set("log.level",3)
#fallback_audio_folder = list.assoc("fallback_audio_folder", ini)
#fallback_audio_folder = "/var/audio/fallback"
# track_sensitive => fallback_folder track sensitivity
# max_blank => maximum time of blank from source
# min_noise => minimum duration of noise on source to switch back over
# threshold => power in dB under which the stream is considered silent
#stream = fallback(track_sensitive=false,
# [ strip_blank(id="", max_blank=10., min_noise=10., threshold=0., once(input.alsa(id="sound_input", fallible=true, clock_safe=false))),
# playlist.safe(fallback_audio_folder) ])
stream = fallback(track_sensitive=false,
[ strip_blank(id="defaultstripper", max_blank=10., min_noise=10., threshold=0., single("/var/audio/fallback/music.flac")),
playlist.safe("/var/audio/fallback/NightmaresOnWax/Smokers Delight") ] )
#stream = single("/var/audio/fallback/music.flac")
output.alsa(id="player", device="hw:0,0", stream)
#output.alsa(fallible=true, input.alsa(id="sound_input", fallible=true, clock_safe=false))
\ No newline at end of file
This diff is collapsed.