So everytime I tried to use a script to get my TV_CHANNELs to parse out so
I could add them to my local_config.py but it would not sort the channels
in the right order. I asked my lug (AKLUG) friends to see if they could
get it to parse correctly and they came up with two solutions. Both of the
solutions work perfectly so I dont have to sort them out myself. Here they
both are in case anyone would like to try them.

The first one is a sed:

sed "s/[',()]//g" <filename> | sort -n -k 3 | sed "s/\([^ ]*\)/'\1',/g" |
sed 's/^\(.*\),$/(\1),/'

The second one is a python script(which I think the Freevo guys would like
a little more :)):

#!/usr/bin/env python

datafile = file('<filename>')
data = datafile.read()
datafile.close()

map = {}
lines = [eval(line)[0] for line in data.split('\n') if line]
for host, foo, index in lines:
    map[int(index)] = host, foo

map = [(k, v, d) for k, (v, d) in map.items()]
map.sort()

for index, host, foo in map:
    print "('%s', '%s', '%s')" % (host, foo, index, )

Just replace <filename> with the file you have your TV_CHANNELS listings
in and it will sort them out from (in my case) 1-953.

Hope that helps someone else,

Jon

p.s. I am still having problems with sorting my XMLTV data, tv_sort is not
adding the stop times if they are missing. Please,please help me with this
one, I am so close to getting this to work smoothly. I am revisiting
Freevo to shut my Mac friend up about his beloved ReplayTV and TiVo. :)


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Freevo-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to