rpms/fmtools/F-11 .cvsignore, 1.3, 1.4 fmtools.spec, 1.5, 1.6 import.log, 1.1, 1.2 sources, 1.3, 1.4 tkradio.py, 1.1, 1.2
Paulo Roma Cavalcanti
roma at fedoraproject.org
Fri Jan 29 00:47:51 UTC 2010
- Previous message: rpms/telepathy-gabble/devel .cvsignore, 1.60, 1.61 sources, 1.60, 1.61 telepathy-gabble.spec, 1.75, 1.76
- Next message: rpms/audacious/F-12 audacious-2.2-set_tuple_cb.patch, 1.2, 1.3 audacious.spec, 1.62, 1.63
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: roma
Update of /cvs/pkgs/rpms/fmtools/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16006/F-11
Modified Files:
.cvsignore fmtools.spec import.log sources tkradio.py
Log Message:
update URL
Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/fmtools/F-11/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- .cvsignore 15 Jan 2010 19:51:15 -0000 1.3
+++ .cvsignore 29 Jan 2010 00:47:51 -0000 1.4
@@ -1,2 +1,2 @@
-fmcontrol.tar.gz
fmtools-2.0.1.tar.gz
+fmcontrol.tar.gz
Index: fmtools.spec
===================================================================
RCS file: /cvs/pkgs/rpms/fmtools/F-11/fmtools.spec,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- fmtools.spec 15 Jan 2010 19:51:15 -0000 1.5
+++ fmtools.spec 29 Jan 2010 00:47:51 -0000 1.6
@@ -1,14 +1,14 @@
Summary: Simple Video for Linux radio card programs
Name: fmtools
Version: 2.0.1
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv2+
Group: Applications/Multimedia
-URL: http://www.stanford.edu/~blp/fmtools/
+URL: http://benpfaff.org/fmtools
Source0: http://benpfaff.org/fmtools/%{name}-%{version}.tar.gz
Source1: fmcontrol.tar.gz
-Source2: http://www.stanford.edu/~blp/fmtools/tkradio
-Source3: http://www.stanford.edu/~blp/fmtools/tkradio-mute
+Source2: http://benpfaff.org/fmtools/tkradio
+Source3: http://benpfaff.org/fmtools/tkradio-mute
Source4: fmtools.desktop
Source5: radio.png
Source8: radio.gif
@@ -32,6 +32,7 @@ BuildRequires: desktop-file-utils
Requires: %{name} = %{version}
Requires: python, python-lirc, notify-python
Requires: vorbis-tools, tkinter, alsa-utils
+Requires: pulseaudio-utils
BuildArch: noarch
%description tkradio
@@ -93,6 +94,11 @@ rm -rf %{buildroot}
%changelog
+* Sun Jan 24 2010 Paulo Roma <roma at lcg.ufrj.br> 2.0.1-2
+- Fixed exception handling.
+- Using pacat and parec for recording with pulseaudio.
+- Updated URL.
+
* Sat Jan 09 2010 Paulo Roma <roma at lcg.ufrj.br> 2.0.1-1
- Updated to 2.0.1
- Removed fmtools.patch
Index: import.log
===================================================================
RCS file: /cvs/pkgs/rpms/fmtools/F-11/import.log,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- import.log 15 Jan 2010 19:51:15 -0000 1.1
+++ import.log 29 Jan 2010 00:47:51 -0000 1.2
@@ -1 +1,2 @@
fmtools-2_0_1-1_fc12:F-11:fmtools-2.0.1-1.fc12.src.rpm:1263584892
+fmtools-2_0_1-2_fc12:F-11:fmtools-2.0.1-2.fc12.src.rpm:1264726051
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/fmtools/F-11/sources,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- sources 15 Jan 2010 19:51:15 -0000 1.3
+++ sources 29 Jan 2010 00:47:51 -0000 1.4
@@ -1,2 +1,2 @@
-8accad958c3f0cd0fb582aad922857aa fmcontrol.tar.gz
5b48f552180f18d46fe92124b2fcfca0 fmtools-2.0.1.tar.gz
+377d5015cc65d9c7265e8c3247217927 fmcontrol.tar.gz
Index: tkradio.py
===================================================================
RCS file: /cvs/pkgs/rpms/fmtools/F-11/tkradio.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- tkradio.py 15 Jan 2010 19:51:15 -0000 1.1
+++ tkradio.py 29 Jan 2010 00:47:51 -0000 1.2
@@ -55,6 +55,15 @@ lid = 0 # loopback pr
fmrec = None # recorder thread variable
irrec = None # lirc thread variable
+# external programs used
+
+MIXER = "/usr/bin/amixer" # alsa-utils
+PIDOF = "/sbin/pidof" # sysvinit-tools
+PS = "/bin/ps" # procps
+GREP = "/bin/grep" # grep
+FM = "/usr/bin/fm" # fmtools
+OGG = "/usr/bin/oggenc" # vorbis-tools
+
class IRRec(Thread):
"""Class for interacting with lirc."""
@@ -156,12 +165,11 @@ class FMRec(Thread):
hora = list(time.localtime(time.time()))
hora = str(hora[3])+":"+str(hora[4])+":"+str(hora[5])
rec_file = '/tmp/tkradio-'+fmstations[cur_station][0]+"-"+data+"-"+hora+'.ogg'
- arec_param = ['/usr/bin/arecord', '-D', 'default', '-d', '0', '-f', 'cd', '-']
- ogge_param = ['/usr/bin/oggenc', '-', '-Q', '-o', rec_file]
if use_notify:
n = pynotify.Notification("tkradio recording on file:", rec_file, "/usr/share/pixmaps/radio.png")
n.show()
- p1 = Popen(arec_param, stdout=PIPE)
+ ogge_param [-1] = rec_file
+ p1 = Popen(brec_param, stdout=PIPE)
p2 = Popen(ogge_param, stdin=p1.stdout)
self.__pid = p1.pid
@@ -170,10 +178,60 @@ class FMRec(Thread):
# if we get here, the thread is finished
self.stop ()
+def start_irrec ():
+ """Start the IRRec thread if lircd is running."""
+
+ global irrec
+
+ lircid = getpid ( 'lircd' )
+ if ( lircid ): # is lirc running?
+ # handle lirc events
+ path = os.environ.get("HOME")
+ fname = path+"/.fmlircrc"
+ if ( not os.path.exists (fname) ):
+ fname = "/usr/share/fmtools/fmlircrc"
+ lirc_handle = pylirc.init("tkradio", fname, blocking)
+ if (lirc_handle):
+ if ( use_notify ):
+ n = pynotify.Notification("tkradio", "Successfully opened lirc. Handle is "+str(lirc_handle),
+ "/usr/share/pixmaps/radio.png")
+ n.set_timeout(2000)
+ n.show()
+ irrec = IRRec(lirc_handle)
+ irrec.start()
+
+def set_rec_type():
+ """Set recording based on alsa or pulseaudio."""
+
+ global REC # program for recording
+ global PLAY # program for playing
+ global arec_param # recording parameters
+ global apla_param # playing parameters
+ global brec_param # recording parameters for encoding
+ global ogge_param # encoding parameters
+
+ pulseaudio = getpid ( 'pulseaudio' )
+ if ( pulseaudio ): # is pulseaudio running?
+ REC = "/usr/bin/parec" # pulseaudio-utils
+ PLAY = "/usr/bin/pacat" # pulseaudio-utils
+ arec_param = [REC]
+ brec_param = [REC]
+ apla_param = [PLAY]
+ ogge_param = [OGG, '-', '-r', '-Q', '-o', ""]
+ else:
+ REC = "/usr/bin/arecord" # alsa-utils
+ PLAY = "/usr/bin/aplay" # alsa-utils
+ arec_param = [REC, '-D', 'default', '-d', '0', '-f', 'cd']
+ brec_param = [REC, '-D', 'default', '-d', '0', '-f', 'cd', '-']
+ apla_param = [PLAY, '-f', 'cd', '-D', 'default']
+ ogge_param = [OGG, '-', '-Q', '-o', ""]
+
+ return pulseaudio
+
def radio ( cmd ):
"""Send the given command to the radio."""
- os.system("fm "+cmd)
+ os.system(FM + " " + cmd)
def setCurStation ( frequency ):
"""Update the current station."""
@@ -210,10 +268,13 @@ def changeStation ( st ):
freq.insert(0,st.split()[0])
station.set ( st )
-def quit():
+def quit(msg=""):
"""Quit the radio."""
- radio ("off")
+ if ( msg ):
+ print msg
+ else:
+ radio ("off")
# kill all threads
if ( fmrec ): fmrec.stop()
if ( irrec ): irrec.stop()
@@ -241,23 +302,23 @@ def on_move(value=0):
"""Use slider position to set the volume."""
v = scale.get()
- os.system("amixer -q -c 0 set PCM "+str(v)+"%")
+ os.system(MIXER + " -q -c 0 set PCM "+str(v)+"%")
def volup ():
- """Increases the volume."""
+ """Increase the volume."""
v = scale.get() + 5
if ( v > 100 ): v = 100
scale.set ( v )
- os.system("amixer -q -c 0 set PCM "+str(v)+"%")
+ os.system(MIXER + " -q -c 0 set PCM "+str(v)+"%")
def voldown():
- """Decreases the volume."""
+ """Decrease the volume."""
v = scale.get() - 5
if ( v < 0 ): v = 0
scale.set ( v )
- os.system("amixer -q -c 0 set PCM "+str(v)+"%")
+ os.system(MIXER + " -q -c 0 set PCM "+str(v)+"%")
def enter ():
"Enter a new frequency."""
@@ -300,7 +361,7 @@ def previous ():
changeStation ( fmstations[cur_station][1] )
def trigger ():
- """Creates a thread for recording."""
+ """Create a thread for recording."""
global tid, fmrec
@@ -316,22 +377,21 @@ def loop():
if ( loopvar.get() == "ON" ):
if ( not lid ):
- arec_param = ['/usr/bin/arecord', '-D', 'default', '-d', '0', '-f', 'cd']
- apla_param = ['/usr/bin/aplay', '-f', 'cd', '-D', 'default']
p1 = Popen(arec_param, stdout=PIPE)
p2 = Popen(apla_param, stdin=p1.stdout)
lid = p1.pid
- n = pynotify.Notification("tkradio", "Software Loop Back activated",
- "/usr/share/pixmaps/radio.png")
- n.set_timeout(2000)
- n.show()
+ if ( use_notify ):
+ n = pynotify.Notification("tkradio", "Software Loop Back activated",
+ "/usr/share/pixmaps/radio.png")
+ n.set_timeout(2000)
+ n.show()
else:
if ( lid ):
os.kill ( lid, 9 )
lid = 0
def loopon():
- """Toggles the loop variable."""
+ """Toggle the loop variable."""
if ( loopvar.get() == "ON" ):
loopvar.set ("OFF")
@@ -378,6 +438,13 @@ def str2num(datum):
except:
return datum
+def getpid(proc):
+ """Return the ID of the given process."""
+
+ aid = os.popen ( PIDOF + ' ' + proc ).readline()
+ aid = aid.replace('\n','')
+ return str2num(aid)
+
def main (argv=None):
"""Main program."""
@@ -391,7 +458,6 @@ def main (argv=None):
global ns # number of preset fm stations
global recvar # variable for setting record on/off
global loopvar # variable for setting loopback on/off
- global irrec # lirc thread variable
global lid # loopback process id
if argv is None:
@@ -401,7 +467,7 @@ def main (argv=None):
print "Python Version: ", pyversion
# check whether tkradio is already running
- stat = os.popen ("/bin/ps aux | /bin/grep -E \"python(" + pyversion[0:3] + ")? " + argv[0] + "\"").readline()
+ stat = os.popen (PS + " aux | " + GREP + " -E \"python(" + pyversion[0:3] + ")? " + argv[0] + "\"").readline()
cid = os.getpid()
if ( stat ):
pid = stat.split()[1]
@@ -429,6 +495,12 @@ def main (argv=None):
ns = len ( fmstations )
cur_station = -1
+ # sets the recording type: alsa or pulse
+ if ( set_rec_type() ):
+ Label(top, text = 'volume: pulse').pack()
+ else:
+ Label(top, text = 'volume: alsa').pack()
+
# make tuner buttons
for st in fmstations:
Radiobutton(bot,text=st[0],value=st[1],variable=station,command=setstation).pack(anchor=W)
@@ -449,9 +521,7 @@ def main (argv=None):
recvar = StringVar() # creates a checkbutton for the alarm state
loopvar = StringVar() # creates a checkbutton for the loopback
recvar.set ( "OFF" )
- aid = os.popen ( '/sbin/pidof arecord' ).readline()
- aid = aid.replace('\n','')
- aid = str2num(aid)
+ aid = getpid ( string.rsplit(REC,'/',1)[1] )
if ( aid ): # is the loop back already on?
loopvar.set ( "ON" )
lid = aid
@@ -477,27 +547,13 @@ def main (argv=None):
icon_img = PhotoImage(file="/usr/share/fmtools/radio.gif")
mw.tk.call('wm', 'iconphoto', mw._w, icon_img)
- lircid = os.popen ( '/sbin/pidof lircd' ).readline()
- if ( lircid ): # is lirc running?
- # handle lirc events
- path = os.environ.get("HOME")
- fname = path+"/.fmlircrc"
- if ( not os.path.exists (fname) ):
- fname = "/usr/share/fmtools/fmlircrc"
- lirc_handle = pylirc.init("tkradio", fname, blocking)
- if (lirc_handle):
- if ( use_notify ):
- n = pynotify.Notification("tkradio", "Successfully opened lirc. Handle is "+str(lirc_handle),
- "/usr/share/pixmaps/radio.png")
- n.set_timeout(2000)
- n.show()
- irrec = IRRec(lirc_handle)
- irrec.start()
+ # start the lirc thread
+ start_irrec()
top.mainloop()
try:
if __name__=="__main__":
sys.exit(main())
-except KeyboardInterrupt,SystemExit:
- quit()
+except (KeyboardInterrupt,SystemExit),msg:
+ quit(msg)
- Previous message: rpms/telepathy-gabble/devel .cvsignore, 1.60, 1.61 sources, 1.60, 1.61 telepathy-gabble.spec, 1.75, 1.76
- Next message: rpms/audacious/F-12 audacious-2.2-set_tuple_cb.patch, 1.2, 1.3 audacious.spec, 1.62, 1.63
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the scm-commits
mailing list