Mercurial > ~darius > hgwebdir.cgi > py-iview
comparison iviewget.py @ 5:f2e0787f52b8 default tip
Tidy up output to be clearer.
- Don't bother the user with XML errors & lack of asset tags.
- Print a header for the channel & series lists.
- Inform the user how to navigate the menus.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Fri, 21 Aug 2009 13:05:59 +0930 |
parents | c4188feb8f26 |
children |
comparison
equal
deleted
inserted
replaced
4:c4188feb8f26 | 5:f2e0787f52b8 |
---|---|
12 flvstreamerpath = '/home/darius/projects/flvstreamer/flvstreamer_x86' | 12 flvstreamerpath = '/home/darius/projects/flvstreamer/flvstreamer_x86' |
13 flvpattern = re.compile("FLVStreamer v") | 13 flvpattern = re.compile("FLVStreamer v") |
14 | 14 |
15 def listChannels(iview): | 15 def listChannels(iview): |
16 i = 1 | 16 i = 1 |
17 print "===================== Channel List =====================" | |
17 print "Id %-30s %-35s" % ('Name', 'Description') | 18 print "Id %-30s %-35s" % ('Name', 'Description') |
18 for c in iview.channels: | 19 for c in iview.channels: |
19 print "%2d %-30s %-35s" % (i, c.name, c.descr) | 20 print "%2d %-30s %-35s" % (i, c.name, c.descr) |
20 i += 1 | 21 i += 1 |
21 | 22 |
22 def listSeries(chan): | 23 def listSeries(chan): |
23 i = 1 | 24 i = 1 |
25 print "===================== Series List =====================" | |
24 for s in chan.series: | 26 for s in chan.series: |
25 if len(s.title) > 1: | 27 if len(s.title) > 1: |
26 title = s.title[1] | 28 title = s.title[1] |
27 else: | 29 else: |
28 title = s.title[0] | 30 title = s.title[0] |
81 slist = [] | 83 slist = [] |
82 while True: | 84 while True: |
83 chan = None | 85 chan = None |
84 listChannels(iview) | 86 listChannels(iview) |
85 while True: | 87 while True: |
86 print "Please select a channel number (0 to exit): ", | 88 print "Please select a channel number (0 to start downloading): ", |
87 i = getInt(sys.stdin) | 89 i = getInt(sys.stdin) |
88 if i != None and i >= 0 and i <= len(iview.channels): | 90 if i != None and i >= 0 and i <= len(iview.channels): |
89 break | 91 break |
90 print "Invalid entry, try again" | 92 print "Invalid entry, try again" |
91 | 93 |
96 chan = iview.channels[cidx] | 98 chan = iview.channels[cidx] |
97 chan.getSeries() | 99 chan.getSeries() |
98 | 100 |
99 listSeries(chan) | 101 listSeries(chan) |
100 while True: | 102 while True: |
101 print "Please select which series to download (space separated numbers):" | 103 print |
104 print "Please select which series to download (space separated numbers)" | |
105 print " or 0 to exit to channel menu: ", | |
102 res = sys.stdin.readline() | 106 res = sys.stdin.readline() |
103 for r in res.split(): | 107 for r in res.split(): |
104 try: | 108 try: |
105 i = int(r) | 109 i = int(r) |
106 except ValueError: | 110 except ValueError: |