Active Topics

 


Closed Thread
Thread Tools
gviterbo's Avatar
Posts: 56 | Thanked: 9 times | Joined on Sep 2009 @ Philippines
#91
Originally Posted by spawn View Post
i changed my version of recorder to encode files to flac format and added possibility to listen / delete recording after it's done.

if anyone is interested recording using power button menu i could share
this mod.
+1 I want one too! Big thanks!
__________________
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.
 
Posts: 7 | Thanked: 7 times | Joined on Jan 2010 @ Finland
#92
here comes, requires some manual work & root privileges

first creation of dirs
mkdir -p /usr/local/phone_recorder/bin
mkdir /usr/local/phone_recorder/python
then adding wrapper file:

/usr/local/phone_recorder/bin/phone_recorder
Code:
#!/bin/sh
exec python /usr/local/phone_recorder/python/phone_recorder.py
and exec priv
chmod 755 /usr/local/phone_recorder/bin/phone_recorder

python file
/usr/local/phone_recoder/python/phone_recoder.py
Code:
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()
adding dbus service
/usr/share/dbus-1/services/phone_recorder.service
Code:
[D-BUS Service]
Name=com.misc.phone_recorder
Exec=/usr/local/phone_recorder/bin/phone_recorder
and finally editing of systemui.xml
/etc/systemui/systemui.xml

add this inside powerkeymeny tags.
Code:
 <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>
and reboot.

ps. my very first python code ever, so most likely quite bad code

pss. also create dir /home/user/MyDocs/record/
with write privs to user or modify that file location.

Last edited by spawn; 2010-01-22 at 10:39.
 

The Following 4 Users Say Thank You to spawn For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#93
Originally Posted by spawn View Post
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
FWIW, if you create an osso.Context within the app, add the customary "#! /usr/bin/env python2.5" to the top and mark it as executable, then you don't need the script to start it.
 

The Following User Says Thank You to qwerty12 For This Useful Post:
Posts: 36 | Thanked: 9 times | Joined on Jan 2010
#94
Originally Posted by spawn View Post
i changed my version of recorder to encode files to flac format and added possibility to listen / delete recording after it's done.
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 sxg75 For This Useful Post:
Posts: 7 | Thanked: 7 times | Joined on Jan 2010 @ Finland
#95
Originally Posted by qwerty12 View Post
FWIW, if you create an osso.Context within the app, add the customary "#! /usr/bin/env python2.5" to the top and mark it as executable, then you don't need the script to start it.
thanks, i'll make a not of that, so it works like a perl
 
Posts: 10 | Thanked: 0 times | Joined on Dec 2009
#96
I dont get it. I just saw and installed it from Application manager. But after installation there was no shortcut to it in menu.

So unisntalled Python 2.5 that i installed yesterday, uninstalled Recaller. Now i can not find it in Application manager, even with a search?!?!?
 
Posts: 10 | Thanked: 0 times | Joined on Dec 2009
#97
I click add Recaller Widget shortcut, but nothing happends. I only have one panel visible. Bugg?

Tried making all panels visible but no change. It refuses to create the Widget/shortcut on the panel.

Last edited by addee; 2010-01-22 at 13:42.
 
Posts: 883 | Thanked: 980 times | Joined on Jul 2007 @ Bern, Switzerland
#98
Originally Posted by addee View Post
I click add Recaller Widget shortcut, but nothing happends. I only have one panel visible. Bugg?
Reboot, then try again.
__________________
-Tom (N900, N810, N800)

"the idea of truly having a computer in your pocket just moved a big step closer."
 
Posts: 883 | Thanked: 980 times | Joined on Jul 2007 @ Bern, Switzerland
#99
Originally Posted by sxg75 View Post
Great! Would it be possible to share ideas with original author? The approach using Power button and lossless audio has great appeal!
Of course, I'm reading It looks to me like the FLAC encoder is new since PR1.1, at least I didn't see it before.
__________________
-Tom (N900, N810, N800)

"the idea of truly having a computer in your pocket just moved a big step closer."
 

The Following User Says Thank You to twaelti For This Useful Post:
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#100
Then when we're done, we can throw some lipstick on that pig.

Name:  Screenshot-20100122-070756.jpg
Views: 691
Size:  23.5 KB
__________________
N9: Go white or go home
 

The Following User Says Thank You to daperl For This Useful Post:
Closed Thread


 
Forum Jump


All times are GMT. The time now is 15:47.