Check-in [d3b1418bc6]
Comment: | rename http to ahttp to avoid conflict with Python3 modules, change .iteritems and xrange, remove same remaining plain print statements |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | py3 |
Files: | files | file ages | folders |
SHA1: |
d3b1418bc6a9ef41accbc1954941659a |
User & Date: | mario on 2014-04-08 21:16:12 |
Other Links: | branch diff | manifest | tags |
2014-04-08
| ||
21:50 | more Python3 syntax fixes, introduce compat2and3 module check-in: 7911337325 user: mario tags: py3 | |
21:16 | rename http to ahttp to avoid conflict with Python3 modules, change .iteritems and xrange, remove same remaining plain print statements check-in: d3b1418bc6 user: mario tags: py3 | |
2014-04-07
| ||
00:33 | Move __print__ into config, add unified dbg.COLOR codes check-in: 7ef1553f61 user: mario tags: trunk | |
Modified _package.epm from [d2e2c94cae] to [789f724b9f].
︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - + | f 644 root root /usr/share/pixmaps/streamtuner2.png ./logo.png f 644 root root /usr/share/streamtuner2/gtk2.xml ./gtk2.xml f 644 root root /usr/share/streamtuner2/gtk3.xml ./gtk3.xml f 644 root root /usr/share/streamtuner2/pson.py ./pson.py #f 644 root root /usr/share/streamtuner2/processing.py ./processing.py f 644 root root /usr/share/streamtuner2/action.py ./action.py f 644 root root /usr/share/streamtuner2/config.py ./config.py |
︙ |
Modified action.py from [fc0650246a] to [cd681feda2].
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + | # # # import re import os |
︙ | |||
77 78 79 80 81 82 83 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | - - + + | pass # exec wrapper @staticmethod def run(cmd): if conf.windows: |
︙ |
Modified ahttp.py from [0d4dcfee94] to [2dbe950381].
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - + + + + + + + + - - - + + + + + + | # Provides a http GET method with gtk.statusbar() callback. # And a function to add trailings slashes on http URLs. # # The latter code is pretty much unreadable. But let's put the # blame on urllib2, the most braindamaged code in the Python # standard library. # |
︙ | |||
144 145 146 147 148 149 150 | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | - - | data = r.read() progress_feedback() return data # http://techknack.net/python-urllib2-handlers/ |
︙ | |||
194 195 196 197 198 199 200 | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | - + - | if urllib2: # config 1 handlers = [None, None, None] # base handlers[0] = urllib2.HTTPHandler() |
︙ |
Modified channels/_generic.py from [f927301f5f] to [5d7f7dc2ae].
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + | # adds the required gtk Widgets manually. # import gtk from mygtk import mygtk from config import conf, __print__, dbg |
︙ | |||
145 146 147 148 149 150 151 | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | - + - + | self.gtk_cat = parent.get_widget(self.module+"_cat") # category tree self.display_categories() #mygtk.tree(self.gtk_cat, self.categories, title="Category", icon=gtk.STOCK_OPEN); # update column names |
︙ | |||
247 248 249 250 251 252 253 | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | - + | def prepare(self, streams): for i,row in enumerate(streams): # oh my, at least it's working # at start the bookmarks module isn't fully registered at instantiation in parent.channels{} - might want to do that step by step rather # then display() is called too early to take effect - load() & co should actually be postponed to when a notebook tab gets selected first # => might be fixed now, 1.9.8 # state icon: bookmark star |
︙ | |||
307 308 309 310 311 312 313 | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | - - + | if (self.shown != 55555): # if category tree is empty, initialize it if not self.categories: __print__(dbg.PROC, "first_show: reload_categories"); #self.parent.thread(self.reload_categories) |
︙ |
Modified channels/basicch.py from [2ad035d297] to [c507665eb7].
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | # realaudio archive is not available anymore. # # Needs manual initialisation of categories first. # import re |
︙ |
Modified channels/google.py from [3f0788927c] to [36a6ee6c2d].
︙ | |||
47 48 49 50 51 52 53 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. import re, os, gtk from channels import * from xml.sax.saxutils import unescape as entity_decode, escape as xmlentities |
︙ |
Modified channels/internet_radio_org_uk.py from [4dcc6f65d4] to [6c77259f65].
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - + | # from channels import * import re from config import conf, __print__, dbg |
︙ |
Modified channels/jamendo.py from [0df05c5caf] to [9d3d3ac039].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | - + | # api: streamtuner2 # title: jamendo browser # # For now this is really just a browser, doesn't utilizt the jamendo API yet. # Requires more rework of streamtuner2 list display to show album covers. # import re |
︙ |
Modified channels/live365.py from [17860a6a46] to [10562bd5f9].
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | - + | # api: st2 # title: live365 channel # # 2.0.9 fixed by Abhisek Sanyal # # streamtuner2 modules from config import conf from mygtk import mygtk |
︙ |
Modified channels/modarchive.py from [bf829e8b72] to [a906bb560c].
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | # MOD files dodn't work with all audio players. And with the default # download method, it'll receive a .zip archive with embeded .mod file. # VLC in */* seems to work fine however. # import re |
︙ |
Modified channels/musicgoal.py from [1d593a3fc6] to [faf1e3671e].
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + | # # st2 modules from config import conf from mygtk import mygtk |
︙ |
Modified channels/punkcast.py from [6f838d457b] to [57433ea58f].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - + | # api: streamtuner2 # title: punkcast listing # # # Disables itself per default. # ST1 looked prettier with random images within. # import re |
︙ |
Modified channels/shoutcast.py from [3296716516] to [0c3da6eedb].
︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - + | # there's not a lot of information to fetch left. And this plugin is now back # to defaulting to regex extraction instead of HTML parsing & DOM extraction. # # # |
︙ |
Modified channels/tv.py from [e09d4b20ac] to [2d1fa5a0ac].
︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - + | # Pasing with lxml is dead simple in this case, so we use etree directly # instead of PyQuery. Like with the Xiph plugin, downloaded streams are simply # stored in .streams["all"] pseudo-category. # # icon: http://cemagraphics.deviantart.com/art/Little-Tv-Icon-96461135 from channels import * |
︙ |
Modified channels/xiph.py from [6bbc72e8d5] to [e14b45bb99].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - + | # # streamtuner2 modules from config import conf from mygtk import mygtk |
︙ |
Modified cli.py from [a682821821] to [ea53579a96].
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | - + | # # # import sys #from channels import * |
︙ |
Modified favicon.py from [f5d4a162a1] to [997ecd51ce].
︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | - - + | delete_google_stub = 1 # don't keep placeholder images google_placeholder_filesizes = (726,896) import os, os.path import urllib import re |
︙ | |||
85 86 87 88 89 90 91 | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | - + - + | # extract first title parts title = rx_t.search(row["title"]) if title: title = title.group(0).replace(" ", "%20") # do a google search |
︙ | |||
191 192 193 194 195 196 197 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | - + - + | # try: # URL download r = urllib.urlopen(favicon) headers = r.info() # abort on if r.getcode() >= 300: |
︙ | |||
232 233 234 235 236 237 238 | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | - + | favicon = "".join(rx.findall(html)) # url or if favicon.startswith("http://"): None # just /pathname else: |
︙ | |||
262 263 264 265 266 267 268 | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | - + | # import operator import struct try: from PIL import BmpImagePlugin, PngImagePlugin, Image |
︙ |
Modified mygtk.py from [98fa2cab88] to [91f32ed114].
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | - + | # # encoding: UTF-8 # api: python # type: functions # title: mygtk helper functions # description: simplify usage of some gtk widgets |
︙ | |||
25 26 27 28 29 30 31 32 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | + + + + + + + + + + + + + + - + - - + - - + + - + - - - - | # debug from config import __print__, dbg # filesystem import os.path import copy import sys if sys.version_info[0] >= 3: unicode = str # gtk version ver = 2 # 2=gtk2, 3=gtk3 if "--gtk3" in sys.argv: ver = 3 if sys.version_info >= (3, 0): ver = 3 |
︙ | |||
103 104 105 106 107 108 109 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | - + - + | col.set_resizable(True) # width if (desc[1] > 0): col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) col.set_fixed_width(desc[1]) # loop through cells |
︙ | |||
145 146 147 148 149 150 151 | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | - + | # add data? if (entries): #- expand datamap vartypes = [] #(str, str, bool, str, int, int, gtk.gdk.Pixbuf, str, int) rowmap = [] #["title", "desc", "bookmarked", "name", "count", "max", "img", ...] if (not rowmap): for desc in datamap: |
︙ |
Modified st2.py from [0b9e0b6b81] to [1b132a9fda].
1 2 3 4 5 6 7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | - + | #!/usr/bin/env python # encoding: UTF-8 # api: python # type: application # title: streamtuner2 # description: directory browser for internet radio / audio streams # depends: gtk, pygtk, xml.dom.minidom, threading, lxml, pyquery, kronos |
︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | - + | # gtk modules from mygtk import pygtk, gtk, gobject, ui_file, mygtk # custom modules from config import conf # initializes itself, so all conf.vars are available right away from config import __print__, dbg |
︙ | |||
233 234 235 236 237 238 239 | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | - + - + | #-- Shortcut for glade.get_widget() # Allows access to widgets as direct attributes instead of using .get_widget() # Also looks in self.channels[] for the named channel plugins def __getattr__(self, name): |
︙ | |||
521 522 523 524 525 526 527 | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | + - + + + | gtk.rc_parse(f) pass # end application and gtk+ main loop def gtk_main_quit(self, widget, *x): if conf.auto_save_appstate: try: # doesn't work with gtk3 yet |
︙ | |||
1149 1150 1151 1152 1153 1154 1155 | 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 | - + - + | #-- run main --------------------------------------------- if __name__ == "__main__": #-- global configuration settings "conf = Config()" # already happened with "from config import conf" # graphical |
︙ |