Hi all,
First of all, thanks for pytone!
For my amusement this Sunday afternoon, I have written the attached
plugin, which starts the mp3info tag editor on the selected song if you
hit the 'e' or 'E' key.
Current limitations:
- It is runnning in an xterm, so you must be running pytone under X
- I have not been able to convince pytone to update the info after
editing the tags (item.song.rescan() crashes with an Attribute error
(see log at the end)
- mp3info is really unwieldy as tag editor, but it is nice and simple
Please tell me what you think of this (it is not that big... :-) ).
I also have a proposition for the plugin framework: Would it be possible
to define an event to subscribe to which already includes a list of
keys?
I.e.
self.channel.subscribe(events.keypressed([ord('e'),ord('E'),self.keypressed)
instead of
self.channel.subscribe(events.keypressed,self.keypressed) and the check
at the beginning of the plugin?
Best regards to all, and may the fog outside lift soon!
Kurt Gysin
#############################
Crash Log if you uncomment line 81 in the plugin
#############################
oberon@Nasqueron:~$ pytone -d ./pytonelog
Traceback (most recent call last):
File "/usr/share/pytone/pytone.py", line 278, in ?
m.run()
File "/usr/share/pytone/mainscreen.py", line 127, in run
self.channel.process()
File "/usr/share/pytone/hub.py", line 167, in process
handler(item)
File "/home/oberon/.pytone/plugins/tagedit.py", line 41, in keypressed
item.song.rescan()
File "/usr/share/pytone/dbitem.py", line 111, in __getattr__
raise AttributeError
AttributeError
Locals by frame, innermost last
Frame ? in /usr/share/pytone/pytone.py at line 285
cwd = /usr/share/pytone
sigtermhandler = <function sigtermhandler at
0x2aaaaf7658c0>
helper = <module 'helper' from
'/usr/share/pytone/helper.pyc'>
curses = <module 'curses' from
'/usr/lib/python2.3/curses/__init__.pyc'>
locale = <module 'locale' from
'/usr/lib/python2.3/locale.pyc'>
stdscr = <_curses.curses window object at
0x2aaaaab16498>
songdbname = main
plugins = [(<module 'termtitle' from
'/home/oberon/.pytone/plugins/termtitle.pyc'>, <termtitle.config
instance at 0x2aaaaab81878>), (<module 'osdtitle' from
'/home/oberon/.pytone/plugins/osdtitle.pyc'>, <osdtitle.config instance
at 0x2aaaaf6d1b00>), (<module 'tagedit' from
'/home/oberon/.pytone/plugins/tagedit.py'>, <tagedit.config instance at
0x2aaaaf6eccb0>)]
songdbids = ['main']
mainscreen = <module 'mainscreen' from
'/usr/share/pytone/mainscreen.pyc'>
playerids = ['main', None]
errors = <module 'errors' from
'/usr/share/pytone/errors.pyc'>
log = <module 'log' from
'/usr/share/pytone/log.pyc'>
cursessetup = <function cursessetup at 0x2aaaaf765230>
gettext = <module 'gettext' from
'/usr/lib/python2.3/gettext.pyc'>
imp = <module 'imp' (built-in)>
version = <module 'version' from
'/usr/share/pytone/version.pyc'>
pathname = /home/oberon/.pytone/plugins/tagedit.py
cursescleanup = <function cursescleanup at
0x2aaaaf765848>
config = <module 'config' from
'/usr/share/pytone/config.pyc'>
events = <module 'events' from
'/usr/share/pytone/events.pyc'>
fp = <open file
'/home/oberon/.pytone/plugins/tagedit.py', mode 'U' at 0x2aaaadbbd880>
description = ('.py', 'U', 1)
hub = <module 'hub' from
'/usr/share/pytone/hub.pyc'>
__builtins__ = <module '__builtin__' (built-in)>
__file__ = /usr/share/pytone/pytone.py
sys = <module 'sys' (built-in)>
pluginpath = ['/home/oberon/.pytone/plugins/',
'/usr/share/pytone/plugins']
services = <module 'services' from
'/usr/share/pytone/services/__init__.pyc'>
__name__ = __main__
network = <module 'network' from
'/usr/share/pytone/network.pyc'>
e = [Errno 17] Die Datei existiert bereits:
'/home/oberon/.pytone'
name = tagedit
pluginconfig = <tagedit.config instance at
0x2aaaaf6eccb0>
signal = <module 'signal' (built-in)>
userpluginpath = /home/oberon/.pytone/plugins/
m = <mainscreen.mainscreen instance at
0x2aaaaf776d88>
__doc__ = None
globalpluginpath = /usr/share/pytone/plugins
pluginmodule = <module 'tagedit' from
'/home/oberon/.pytone/plugins/tagedit.py'>
locallocaledir = /usr/share/pytone/../locale
os = <module 'os' from
'/usr/lib/python2.3/os.pyc'>
songdbid = main
songdbmanager = <songdbmanager(songdb manager service,
stopped)>
Frame run in /usr/share/pytone/mainscreen.py at line 138
self = <mainscreen.mainscreen instance at
0x2aaaaf776d88>
skipcount = 0
key = 69
Frame process in /usr/share/pytone/hub.py at line 169
self = <hub.channel instance at 0x2aaaaf776dd0>
item = keypressed(69)
handler = <bound method plugin.keypressed of
<tagedit.plugin instance at 0x2aaaaf7a35f0>>
timeout = None
subscribedevent = events.keypressed
block = False
Frame keypressed in /home/oberon/.pytone/plugins/tagedit.py at line 41
path = /home/oberon/Musik/Rhodanie_1/Carlos
Santana feat. Rob Thomas - Smooth.mp3
self = <tagedit.plugin instance at
0x2aaaaf7a35f0>
event = keypressed(69)
item = song(Rhodanie_1/Carlos Santana feat. Rob
Thomas - Smooth.mp3) in main database
Frame __getattr__ in /usr/share/pytone/dbitem.py at line 111
self = dbitem.song(Rhodanie_1/Carlos Santana
feat. Rob Thomas - Smooth.mp3)
name = rescan