rpms/fmtools/F-12 tkradio.py, NONE, 1.1 fmtools.desktop, 1.1, 1.2 fmtools.spec, 1.6, 1.7 import.log, 1.1, 1.2 tkradio, 1.1, 1.2 tkradio-mute, 1.1, 1.2
Paulo Roma Cavalcanti
roma at fedoraproject.org
Thu Dec 24 10:26:37 UTC 2009
Author: roma
Update of /cvs/pkgs/rpms/fmtools/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv730/F-12
Modified Files:
fmtools.desktop fmtools.spec import.log tkradio tkradio-mute
Added Files:
tkradio.py
Log Message:
added tkradio.py
--- NEW FILE tkradio.py ---
#!/usr/bin/env python
# Paulo Roma - simple tkinter interface for fmtools
# Date: 23/12/2009
# The radio is turned off on exit.
from Tkinter import *
import Tkinter
import os, sys
# These are stations in the Rio de Janeiro area.
# Customize for your own locale.
stations = [["MPB", "90.3"],
["CBN", "92.5"],
["Band News", "94.9"],
["PARADISO", "95.7"],
["Nativa", "96.5"],
["98 FM", "98.0"],
["MEC", "98.9"],
["JB FM", "99.7"],
["O Dia", "100.5"],
["Transamerica", "101.3"],
["Joven Pan", "102.1"],
["Oi", "102.9"],
["Antena1", "103.7"]]
radbut = "95.7" # default radio frequency
volume = 100 # initial volume [0,100]
state = False
def radio ( cmd ):
"""Send the given command to the radio."""
os.system("fm "+cmd)
def setstation():
"Set the station chosen via Radio Button."""
radio ( station.get() )
freq.delete(0, END)
freq.insert(0,station.get())
def quit():
"""Quit the radio."""
radio ("off")
sys.exit ( 0 )
def mute():
"""Mute/Unmute the radio."""
global state
if ( not state ):
radio ("off")
state = True
btmute.set ( "On" )
btm.config(state=ACTIVE)
else:
radio ("on")
state = False
btmute.set ( "Off" )
btm.config(state=NORMAL)
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)+"%")
def enter ():
"Enter a new frequency."""
radio (freq.get())
def readStations ( ):
"""Read the station file."""
path = os.environ.get("HOME")
fname = path+"/.radiostations"
if ( not fname ):
fname = path+"/.fmrc"
lst = []
if ( fname ):
textf = open(fname, 'r')
for line in textf:
l=line.split(None)
st = [l[0].replace("_"," "),l[1]]
lst.append ( st )
textf.close()
return lst
def main (argv=None):
"""Main program."""
global scale, station, btmute, btm, freq
if argv is None:
argv = sys.argv
mw = Tk()
# do not resize the radio
mw.resizable(False,False)
station = StringVar()
station.set ( radbut )
btmute = StringVar()
btmute.set ( "Off" )
top = Frame(); top.pack()
bot = Frame(); bot.pack()
mw.title ("tkradio")
s = readStations ( )
if ( s ):
stations = s
# make tuner buttons
for st in stations:
Radiobutton(bot,text=st[0],value=st[1],variable=station,command=setstation).pack(anchor=W)
scale = Scale(top, from_=0, to=100, orient=HORIZONTAL, command=on_move, bd=0,
sliderlength=10, width=5, showvalue=0)
scale.pack(side='top')
scale.set(volume)
# the current radio frequency
Button(top,text="Enter", command = enter).pack(side="bottom")
freq=Entry(top,font="Arial 24",width=5,justify=CENTER)
freq.insert(0,station.get())
freq.pack(side="bottom")
# create quit and mute buttons
Button(top,text="Exit", command = quit).pack(side="right")
btm=Button(top,text="Off", command = mute, textvariable = btmute)
btm.pack(side="left")
# turn the radio on
setstation()
radio ("on")
top.mainloop()
try:
if __name__=="__main__":
sys.exit(main())
except:
radio ("off")
sys.exit(1)
Index: fmtools.desktop
===================================================================
RCS file: /cvs/pkgs/rpms/fmtools/F-12/fmtools.desktop,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- fmtools.desktop 21 Dec 2009 11:22:43 -0000 1.1
+++ fmtools.desktop 24 Dec 2009 10:26:36 -0000 1.2
@@ -1,8 +1,7 @@
-
[Desktop Entry]
Name=tkradio
Comment=Tcl/Tk wrapper for fmtools
-Exec=tkradio-mute.tcl
+Exec=tkradio.py
Icon=radio
Terminal=0
Type=Application
@@ -10,4 +9,3 @@ StartupNotify=false
StartupWMClass=tkradio
Encoding=UTF-8
Categories=Application;AudioVideo;
-X-Desktop-File-Install-Version=0.15
Index: fmtools.spec
===================================================================
RCS file: /cvs/pkgs/rpms/fmtools/F-12/fmtools.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- fmtools.spec 21 Dec 2009 11:22:43 -0000 1.6
+++ fmtools.spec 24 Dec 2009 10:26:36 -0000 1.7
@@ -1,7 +1,7 @@
Summary: Simple Video for Linux radio card programs
Name: fmtools
Version: 2.0
-Release: 3%{?dist}
+Release: 4%{?dist}
License: GPLv2+
Group: Applications/Multimedia
URL: http://www.stanford.edu/~blp/fmtools/
@@ -12,6 +12,7 @@ Source2: http://www.stanford.edu/~blp/fm
Source3: http://www.stanford.edu/~blp/fmtools/tkradio-mute
Source4: fmtools.desktop
Source5: radio.png
+Source6: tkradio.py
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
@@ -35,17 +36,17 @@ frequency and volume specified in $HOME/
or the volume given on the command line.
%package tkradio
-Summary: Tcl/Tk wrapper for fmtools
+Summary: Python/Tk wrapper for fmtools
Group: Applications/Multimedia
BuildRequires: desktop-file-utils
Requires: %{name} = %{version}
-Requires: tk, alsa-utils
+Requires: python, tk, alsa-utils
BuildArch: noarch
%description tkradio
-This package contains wrappers for providing a GUI to %{name}.
-The stations are currently hard coded, but it is easy to change
-them with a simple text editor.
+This package provides a GUI for %{name}.
+The stations are read from the same files used by fmcontrol:
+$HOME/.fmrc or $HOME/.radiostations.
%prep
%setup -q -a1
@@ -63,6 +64,7 @@ rm -rf %{buildroot}
make DESTDIR=%{buildroot} install
install -pm 0755 %{SOURCE2} %{buildroot}%{_bindir}/tkradio.tcl
install -pm 0755 %{SOURCE3} %{buildroot}%{_bindir}/tkradio-mute.tcl
+install -pm 0755 %{SOURCE6} %{buildroot}%{_bindir}/tkradio.py
install -pm 0755 fmcontrol/fmcontrol %{buildroot}%{_bindir}
install -pm 0644 fmcontrol/README README.fmcontrol
@@ -87,12 +89,16 @@ rm -rf %{buildroot}
%files tkradio
%defattr(-,root,root,-)
-%{_bindir}/tkradio*.tcl
+%{_bindir}/tkradio*
%{_datadir}/applications/fmtools.desktop
%{_datadir}/pixmaps/radio.png
%changelog
+* Sun Dec 23 2009 Paulo Roma <roma at lcg.ufrj.br> 2.0-4
+- Include tkradio.py
+- Fixed fmtools.desktop
+
* Sun Dec 20 2009 Paulo Roma <roma at lcg.ufrj.br> 2.0-3
- Packaging tkradio separately.
Index: import.log
===================================================================
RCS file: /cvs/pkgs/rpms/fmtools/F-12/import.log,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- import.log 21 Dec 2009 11:22:43 -0000 1.1
+++ import.log 24 Dec 2009 10:26:36 -0000 1.2
@@ -1 +1,2 @@
fmtools-2_0-3_fc12:F-12:fmtools-2.0-3.fc12.src.rpm:1261394532
+fmtools-2_0-4_fc12:F-12:fmtools-2.0-4.fc12.src.rpm:1261650364
Index: tkradio
===================================================================
RCS file: /cvs/pkgs/rpms/fmtools/F-12/tkradio,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- tkradio 21 Dec 2009 11:22:43 -0000 1.1
+++ tkradio 24 Dec 2009 10:26:36 -0000 1.2
@@ -54,7 +54,7 @@ proc setstation {} {
# roma 20091221
# eval exec fm [lindex $stations [expr $radbut*2+1]] $volume
eval exec fm [lindex $stations [expr $radbut*2+1]]
- eval exec amixer -c 0 set PCM $volume%
+ eval exec amixer -q -c 0 set PCM $volume%
.stn configure -state normal
.stn delete 0 end
.stn insert 0 [lindex $stations [expr $radbut*2+1]]
Index: tkradio-mute
===================================================================
RCS file: /cvs/pkgs/rpms/fmtools/F-12/tkradio-mute,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- tkradio-mute 21 Dec 2009 11:22:43 -0000 1.1
+++ tkradio-mute 24 Dec 2009 10:26:36 -0000 1.2
@@ -60,7 +60,7 @@ proc setstation {} {
# roma 20091221
# eval exec fm [lindex $stations [expr $radbut*2+1]] $volume
eval exec fm [lindex $stations [expr $radbut*2+1]]
- eval exec amixer -c 0 set PCM $volume%
+ eval exec amixer -q -c 0 set PCM $volume%
.stn configure -state normal
.stn delete 0 end
.stn insert 0 [lindex $stations [expr $radbut*2+1]]
More information about the fedora-extras-commits
mailing list