03/11/04 01:18 AopNZRIO
>>400
とりあえず以下のコードで。
class PlaylistWindow にて
self.keymap.bind('C', self.command_add_or_refresh_cd_entries, ())
def command_add_or_refresh_cd_entries(self):
current_entry = self.current()
cdda_entries = []
for e in self.buffer:
if re.match("cdda://", e.pathname):
cdda_entries.append(e)
map(self.remove, cdda_entries)
proc = os.popen3(["cdparanoia", "-Q"])[2]
lines = proc.readlines()
while lines:
line = lines.pop(0)
m = re.match("\s+(\d+)\.\s+(\d+)", line)
if m:
e = PlaylistEntry("cdda://%02d" % int(m.group(1)))
self.append(e) # カーソル位置に追加すべき?
try: self.bufptr = self.buffer.index(current_entry)
except ValueError: pass
self.update()