diff options
author | James Meyer <james.meyer@operamail.com> | 2013-02-19 21:10:18 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2013-02-19 21:10:18 (GMT) |
commit | 2648e999d277eac5c3d331a3609bcc73fafbea71 (patch) | |
tree | 40951fb8e7fdbe28a0baa324ae615055203f1e2e /abs/core/LinHES-system/msg_client.py | |
parent | c759b5e0c4aa6fc37412b4dee2cf9ad993fd376d (diff) | |
parent | 7e6f7ca174e1af67178dc5293a312a4a733eb095 (diff) | |
download | linhes_pkgbuild-2648e999d277eac5c3d331a3609bcc73fafbea71.zip linhes_pkgbuild-2648e999d277eac5c3d331a3609bcc73fafbea71.tar.gz linhes_pkgbuild-2648e999d277eac5c3d331a3609bcc73fafbea71.tar.bz2 |
Merge branch 'testing'
# By James Meyer (1091) and others
# Via James Meyer (5) and others
* testing: (1148 commits)
LinHES-config: during install don't kill off lirc. This keeps the remote active all the way to the finish
Change version numbers to 8.0 to match the release number. LinHES-conifg LinHES-system mythdb-initial runit-scripts supplemental-web
LinHES-conifig: mv_install.py for the last partition don't go all the way to the end. Gotta leave room for gpt tables.
xf86-video-ati: xorg ati driver.
LinHES-config: timezip.py add syncing up of parental lvl passwords and starting level with MBE.
LinHES-system: correct the logic for breaking out of the wmctrl loop. As written it would break out of the inner loop..but not the 60 iteration loop.
e16_theme_settings: remove slide-in prop for new windows. For whatever reason this was preventing mplayer from being positioned correctly for appletrailers.
LinHES-config, mythinstall: change case of hd_pvr and serial to all lower refs #902
zilog-firmware: firmware for TX support of the hdpvr and pvr-150 In general I can't recommend anybody using these transmitters but including the firmware just in case someone really wants to
linhes-udev-rules: added hdprv_lirc rule. All of these lirc rules are limited to exactly one device. If more then one device is present then only the last device in init will get the symlink
runit-scripts: fix logging for igdeamon, add support to remote init script so that the blaster is always the first device in the chain. added support specificly for hd_pvr
LinHES-system: add lh_system_restore and lh_system_backup. These scripts are called from the mythmenu. refs #900
iguanair: rebuild with python 2.7
LinHES-system: msg_daemon.py fix init and nasty bug related to timeout. In a nutshell timeout wouldn't work unless a msg without a timeout was called first.
linhes-udev-rules: add rules for mce,streamzap,serial lirc devices.
mythinstall: recompile for matching libs
mythtv: latest .25-fixes and change mythbackup/restore call lh_system_$op to replace mythbackup/mythrestore. mythbackup no longer works correctly with the new windowmanager
linhes-scripts: myth2mp3, myth2x264, myth2xvid: use mythutil to get cutlist
LinHES-config, supplimental-web: Fix proxy numbering for Ceton infiniTV
linhes-system: add additional stuff to the system backup and also introduced an exclude file. The exclude/include files are locate in /home/mythtv/backup_config/
...
Diffstat (limited to 'abs/core/LinHES-system/msg_client.py')
-rwxr-xr-x | abs/core/LinHES-system/msg_client.py | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/abs/core/LinHES-system/msg_client.py b/abs/core/LinHES-system/msg_client.py new file mode 100755 index 0000000..54c2e54 --- /dev/null +++ b/abs/core/LinHES-system/msg_client.py @@ -0,0 +1,102 @@ +#!/usr/bin/python2 +#client for msg_daemon + +import socket +import sys +import argparse +import pickle +import time +# Create a UDS socket +sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + +# Connect the socket to the port where the server is listening +server_address = '/run/msg_socket' +def send_message(message): + #print >>sys.stderr, 'connecting to %s' % server_address + try: + sock.connect(server_address) + except socket.error, msg: + print >>sys.stderr, msg + sys.exit(1) +#try: + sock.sendall(message) + #amount_received = 0 + #amount_expected = len(message) + print "Waiting for response..." + data = sock.recv(1024) + print data + +#finally: + #print >>sys.stderr, 'error occured closing socket' + + sock.close() +def usage(): + line = ''' + Help screen: + msg_client.py is used to add,remove, or list items in the queue of messages that + will be displayed on screen. Optionaly messages can be given an identifier or "tag". + This identifier does not have to be unique. + + Items are processed in the order they arrive, based off their slot number. + The lowest slot number will be displayed first. + After the message is displayed it is removed from the queue. + + + ADD: + To add items to the queue: + msg_client.py --msg "My first message" --tag "tag1" + + REMOVE: + Removing items are based off the tag. + To remove all items from the queue that match the tag "tag1": + msg_client.py --clear --tag tag1 + + To remove all items from the queue: + msg_client.py --clear + + + Listing items in the queue or to get the total count: + msg_client.py --print_list + > ------------- + > msg : slot 1 + > slot : 1 + > cmd : msg + > tag : None + > timeout : None + + + To immediately stop displaying the current message, use the kill command. + msg_client.py --kill + + ''' + print line + sys.exit(0) +if __name__ == "__main__": + parser = argparse.ArgumentParser() + + parser.add_argument('--tag', action='store', dest='tag',help='message tag') + parser.add_argument('--timeout', action='store', dest='timeout',help='time to display message') + action = parser.add_mutually_exclusive_group(required=True) + action.add_argument('--msg', action='store', dest='msg', help='Add message to the queue') + action.add_argument('--clear', action='store_true', help='Remove message from queue that match tag') + action.add_argument('--kill', action='store_true', help='Kill current msg thats displayed') + action.add_argument('--print_list', action='store_true', help='Print current queue') + action.add_argument('--usage', action='store_true', help='Print help screen') + + results = parser.parse_args() + resultsdict = vars(results) + + if results.msg : + cmd = "msg" + elif results.clear: + cmd = "clear" + elif results.kill: + cmd = "kill" + elif results.print_list: + cmd = "list" + elif results.usage: + usage() + + arg_dict = {'cmd':cmd , 'msg':resultsdict['msg'] , 'tag':resultsdict['tag'] , 'timeout':resultsdict['timeout']} + send_message(pickle.dumps(arg_dict)) + #sys.exit(0) |