]> git.parisson.com Git - yomguy-tools.git/commitdiff
add osc
authoryomguy <yomguy@457c0346-1240-4656-8a5a-9edca8063506>
Sat, 4 Dec 2010 00:02:32 +0000 (00:02 +0000)
committeryomguy <yomguy@457c0346-1240-4656-8a5a-9edca8063506>
Sat, 4 Dec 2010 00:02:32 +0000 (00:02 +0000)
git-svn-id: http://svn.parisson.org/svn/tools/trunk@126 457c0346-1240-4656-8a5a-9edca8063506

13 files changed:
osc/osc.py [new file with mode: 0644]
osc/osc_jingles_start.py [new file with mode: 0644]
osc/osc_jingles_stop.py [new file with mode: 0644]
osc/osc_player_fast.py [new file with mode: 0644]
osc/osc_player_next.py [new file with mode: 0644]
osc/osc_player_slow.py [new file with mode: 0644]
osc/osc_record_start.py [new file with mode: 0644]
osc/osc_record_stop.py [new file with mode: 0644]
osc/osc_relay_start.py [new file with mode: 0644]
osc/osc_relay_stop.py [new file with mode: 0644]
osc/osc_twitter_start.py [new file with mode: 0644]
osc/osc_twitter_stop.py [new file with mode: 0644]
tips/tc_clone_push.sh [new file with mode: 0755]

diff --git a/osc/osc.py b/osc/osc.py
new file mode 100644 (file)
index 0000000..cb478b0
--- /dev/null
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2006-2009 Guillaume Pellerin
+
+# <yomguy@parisson.com>
+
+# This software is a computer program whose purpose is to stream audio
+# and video data through icecast2 servers.
+
+# This software is governed by the CeCILL license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+
+# As a counterpart to the access to the source code and  rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+
+# In this respect, the user's attention is drawn to the risks associated
+# with loading, using,  modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean that it is complicated to manipulate, and that also
+# therefore means that it is reserved for developers and  experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or
+# data to be ensured and, more generally, to use and operate it in the
+# same conditions as regards security.
+
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL license and that you accept its terms.
+
+# Author: Guillaume Pellerin <yomguy@parisson.com>
+
+from threading import Thread
+
+
+class OSCController(Thread):
+
+    def __init__(self, port):
+        Thread.__init__(self)
+        import liblo
+        self.port = port
+        try:
+            self.server = liblo.Server(self.port)
+        except liblo.ServerError, err:
+            print str(err)
+        self.server.add_method(None, None, self.fallback)
+
+    def fallback(self, path, args, types, src):
+       print "got unknown message '%s' from '%s'" % (path, src.get_url())
+       for a, t in zip(args, types):
+           print "argument of type '%s': %s" % (t, a)
+
+    def run(self):
+       # register a fallback for unhandled messages
+        while True:
+            self.server.recv(100)
diff --git a/osc/osc_jingles_start.py b/osc/osc_jingles_start.py
new file mode 100644 (file)
index 0000000..3f2ebf0
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    print str(err)
+    sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/jingles", 1)
diff --git a/osc/osc_jingles_stop.py b/osc/osc_jingles_stop.py
new file mode 100644 (file)
index 0000000..d29f721
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    print str(err)
+    sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/jingles", 0)
diff --git a/osc/osc_player_fast.py b/osc/osc_player_fast.py
new file mode 100644 (file)
index 0000000..92a60fe
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    print str(err)
+    sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/player", 1)
diff --git a/osc/osc_player_next.py b/osc/osc_player_next.py
new file mode 100644 (file)
index 0000000..21a91ee
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    sys.exit(err)
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/media/next", 1)
diff --git a/osc/osc_player_slow.py b/osc/osc_player_slow.py
new file mode 100644 (file)
index 0000000..02948e0
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    print str(err)
+    sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/player", 0)
diff --git a/osc/osc_record_start.py b/osc/osc_record_start.py
new file mode 100644 (file)
index 0000000..779e90b
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    print str(err)
+    sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/record", 1)
diff --git a/osc/osc_record_stop.py b/osc/osc_record_stop.py
new file mode 100644 (file)
index 0000000..8056c69
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    print str(err)
+    sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/record", 0)
diff --git a/osc/osc_relay_start.py b/osc/osc_relay_start.py
new file mode 100644 (file)
index 0000000..14bcb69
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    print str(err)
+    sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/media/relay", 1)
diff --git a/osc/osc_relay_stop.py b/osc/osc_relay_stop.py
new file mode 100644 (file)
index 0000000..eaefe1a
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    print str(err)
+    sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/media/relay", 0)
diff --git a/osc/osc_twitter_start.py b/osc/osc_twitter_start.py
new file mode 100644 (file)
index 0000000..c298be6
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    print str(err)
+    sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/twitter", 1)
diff --git a/osc/osc_twitter_stop.py b/osc/osc_twitter_stop.py
new file mode 100644 (file)
index 0000000..3470fcc
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import liblo, sys
+
+# send all messages to port 1234 on the local machine
+try:
+    target = liblo.Address(1234)
+except liblo.AddressError, err:
+    print str(err)
+    sys.exit()
+
+# send message "/foo/message1" with int, float and string arguments
+liblo.send(target, "/twitter", 0)
diff --git a/tips/tc_clone_push.sh b/tips/tc_clone_push.sh
new file mode 100755 (executable)
index 0000000..d13d48c
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+mount /dev/sda1 /mnt/root
+mount /dev/sda2 /mnt/root/home
+mount /dev/sdc1 /mnt/ghost_root
+mount /dev/sdc2 /mnt/ghost_home
+rsync -a /mnt/ghost_root/ /mnt/root/
+rsync -a /mnt/ghost_home/ /mnt/root/home/
+sync
+umount  /mnt/ghost_root/
+umount  /mnt/ghost_home/
+mount -o bind /dev /mnt/root/dev
+mount -t proc none /mnt/root/proc
+chroot /mnt/root/
+
+grub install /dev/sda
+update-grub
+exit
+
+umount /mnt/root/proc
+umount /mnt/root/dev
+umount /mnt/root/home 
+umount /mnt/root
+