|
2010-01-22
, 10:22
|
Posts: 7 |
Thanked: 7 times |
Joined on Jan 2010
@ Finland
|
#92
|
mkdir -p /usr/local/phone_recorder/bin
mkdir /usr/local/phone_recorder/python
#!/bin/sh exec python /usr/local/phone_recorder/python/phone_recorder.py
import gtk import hildon import time import pygst pygst.require("0.10") import gst import os class Recorder(hildon.Program): def __init__(self): self.done=0 if self.done>1: gtk.main_quit hildon.Program.__init__(self) gtk.set_application_name("Phone call record") self.program = hildon.Program.get_instance() self.window=hildon.StackableWindow() self.window.set_title("recorder") self.program.add_window(self.window) self.start=time.time() button=hildon.Button(gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL,"Recording...\nClick to stop") ts = time.strftime("%Y%m%d_%H%M%S") self.fileName = "/home/user/MyDocs/record/Rec_%s.flac" % time.strftime("%Y%m%d_%H%M%S") self.player = gst.parse_launch ("adder name=theAdder ! flacenc ! filesink location=%s. pulsesrc device=sink.hw0.monitor ! queue ! theAdder. pulsesrc device=source.hw0 ! queue ! theAdder." % self.fileName) self.player.set_state(gst.STATE_PLAYING) button.connect("clicked", self.do_stop) self.window.add(button) self.done+1 def select_event(self,tool,val): if val==0: gtk.main_quit() elif val==1: os.unlink(self.fileName) elif val==2: player = gst.parse_launch ("filesrc location=%s ! flacdec ! pulsesink" % self.fileName) player.set_state(gst.STATE_PLAYING) return 1 gtk.main_quit() def do_stop(self,widget): self.done=1 self.player.set_state(gst.STATE_NULL) now=time.time() window=hildon.StackableWindow() label=gtk.Label("Recording complete\nCreated file: %(fn)s\nrecorded total: %(sec)d sec" % {"fn": self.fileName,"sec" : (now-self.start)}) window.add(label) label.show() toolbar = gtk.Toolbar() toolitem = gtk.ToolButton(gtk.image_new_from_stock(gtk.STOCK_CLOSE,gtk.ICON_SIZE_LARGE_TOOLBAR),"Exit") toolitem.connect("clicked", self.select_event, 0) toolbar.insert(toolitem, 0) toolitem = gtk.ToolButton(gtk.image_new_from_stock(gtk.STOCK_DELETE,gtk.ICON_SIZE_LARGE_TOOLBAR),"Delete") toolitem.connect("clicked", self.select_event, 1) toolbar.insert(toolitem, 1) toolitem = gtk.ToolButton(gtk.image_new_from_stock(gtk.STOCK_MEDIA_PLAY,gtk.ICON_SIZE_LARGE_TOOLBAR),"Play") toolitem.connect("clicked", self.select_event, 2) toolbar.insert(toolitem, 2) window.add_toolbar(toolbar) window.connect("delete_event", gtk.main_quit, None) window.show_all() def run(self): self.window.show_all() gtk.main() prog=Recorder() prog.run()
[D-BUS Service] Name=com.misc.phone_recorder Exec=/usr/local/phone_recorder/bin/phone_recorder
<menuitem priority="750" name="Record"> <callback service="com.misc.phone_recorder" path="/com/misc/phone_recorder" interface="com.misc.phone_recorder" method="record" bus="session" autostart="true"> <argument type="boolean">true</argument> </callback> </menuitem>
The Following 4 Users Say Thank You to spawn For This Useful Post: | ||
|
2010-01-22
, 10:26
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#93
|
here comes, requires some manual work & root privileges
first creation of dirs
then adding wrapper file:
/usr/local/phone_recorder/bin/phone_recorder
and exec priv
chmod 755 /usr/local/phone_recorder/bin/phone_recorder
python file
/usr/local/phone_recoder/python/phone_recoder.py
adding dbus service
/usr/share/dbus-1/services/phone_recorder.service
and finally editing of systemui.xml
/etc/systemui/systemui.xml
add this inside powerkeymeny tags.
and reboot.
ps. my very first python code ever, so most likely quite bad code
The Following User Says Thank You to qwerty12 For This Useful Post: | ||
|
2010-01-22
, 10:27
|
Posts: 36 |
Thanked: 9 times |
Joined on Jan 2010
|
#94
|
The Following User Says Thank You to sxg75 For This Useful Post: | ||
|
2010-01-22
, 10:31
|
Posts: 7 |
Thanked: 7 times |
Joined on Jan 2010
@ Finland
|
#95
|
|
2010-01-22
, 13:02
|
Posts: 10 |
Thanked: 0 times |
Joined on Dec 2009
|
#96
|
|
2010-01-22
, 13:35
|
Posts: 10 |
Thanked: 0 times |
Joined on Dec 2009
|
#97
|
|
2010-01-22
, 14:24
|
Posts: 883 |
Thanked: 980 times |
Joined on Jul 2007
@ Bern, Switzerland
|
#98
|
I click add Recaller Widget shortcut, but nothing happends. I only have one panel visible. Bugg?
|
2010-01-22
, 14:32
|
Posts: 883 |
Thanked: 980 times |
Joined on Jul 2007
@ Bern, Switzerland
|
#99
|
Great! Would it be possible to share ideas with original author? The approach using Power button and lossless audio has great appeal!
The Following User Says Thank You to twaelti For This Useful Post: | ||
tech trends for every filipino | gadgetpilipinas.net
take a look at my nokia n900 unboxing photos here and unboxing videos here
my n900 review here.
Last edited by gviterbo; 2010-01-22 at 09:19.