[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-multimedia
Subject: Re: Python usable in plugins?
From: Richard Jones <rjones () ekit-inc ! com>
Date: 2002-04-23 3:34:50
[Download RAW message or body]
On Mon, 22 Apr 2002 13:06, Richard Jones wrote:
> ps. just to actually have some value in this post, attached is a trivial
> script that re-sorts an XML playlist ;)
Attached script takes into account the additional tag attributes :)
Richard
["sort_playlist" (text/plain)]
#! /usr/bin/env python
import sys, re, fileinput
print '<!DOCTYPE XMLPlaylist>'
print '<playlist client="noatun" version="1.0" >'
lre = re.compile('(\w+)="(.*?)"')
l = []
for line in fileinput.input():
m = lre.search(line)
entry = {}
while m:
entry[m.group(1)] = m.group(2)
m = lre.search(line, m.end())
if entry.has_key('url'):
l.append(entry)
l.sort(lambda x,y: cmp(x['url'], y['url']))
for entry in l:
print ' <item',
for item in entry.items():
print '%s="%s"'%item,
print '/>'
print '</playlist>'
_______________________________________________
kde-multimedia mailing list
kde-multimedia@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-multimedia
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic