Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


Check-in [c5251618b3]

Overview
Comment:Fix ProgressBar for Py2, don't use default steps in HTTP retrieval.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c5251618b3fc0e61f93af35bfc8e3ff56f28961f
User & Date: mario on 2014-05-26 14:05:34
Other Links: manifest | tags
Context
2014-05-26
14:06
New Freebase topic IDs, fix progressbar for multi-page collecting. check-in: 95166f7d96 user: mario tags: trunk
14:05
Fix ProgressBar for Py2, don't use default steps in HTTP retrieval. check-in: c5251618b3 user: mario tags: trunk
03:00
Youtube video browsing channel replaces DMOZ listings. check-in: 404f0b4329 user: mario tags: trunk
Changes

Modified ahttp.py from [bfc52cab35] to [154714b751].

60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

87
88
89
90

91
92
93
94
95
96
97
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

86
87
88
89

90
91
92
93
94
95
96
97







-
+


















-
+



-
+







#
#  Well, it says "get", but it actually does POST and AJAXish GET requests too.
#
def get(url, params={}, referer="", post=0, ajax=0, binary=0, feedback=None):
    __print__( dbg.HTTP, "GET", url, params )

    # statusbar info
    progress_feedback(url, 0.1)
    progress_feedback(url)
    
    # combine headers
    headers = {}
    if ajax:
        headers["X-Requested-With"] = "XMLHttpRequest"
    if referer:
        headers["Referer"] = (referer if referer else url)
    
    # read
    if post:
        r = session.post(url, params=params, headers=headers)
    else:    
        r = session.get(url, params=params, headers=headers)

    #__print__( dbg.HTTP, r.request.headers );
    #__print__( dbg.HTTP, r.headers );
            
    # result
    progress_feedback(0.9)
    #progress_feedback(0.9)
    content = (r.content if binary else r.text)
    
    # finish, clean statusbar
    progress_feedback()
    progress_feedback("")
    __print__( dbg.INFO, "Content-Length", len(content) )
    return content




#-- Append missing trailing slash to URLs

Modified st2.py from [647f8af5c1] to [9efbd2b2e3].

418
419
420
421
422
423
424

425

426
427

428
429

430
431
432
433
434
435
436
418
419
420
421
422
423
424
425

426
427
428
429
430
431
432
433
434
435
436
437
438
439







+
-
+


+


+







            sbar_cid = self.get_widget("statusbar").get_context_id("messages")
            # remove text
            while ((not text) and (type(text)==str) and len(sbar_msg)):
                sbar_msg.pop()
                mygtk.do(lambda:self.statusbar.pop(sbar_cid))
            # progressbar
            if (type(text)==float):
                __print__(dbg.PROC, "status.progressbar", float, text)
                if (text >= 999/1000):  # completed
                if (text >= 999.0/1000):  # completed
                    mygtk.do(lambda:self.progress.hide())
                else:  # show percentage
                    __print__(dbg.PROC, "status.progressbar", dbg.ERR, "fraction")
                    mygtk.do(lambda:self.progress.show() or self.progress.set_fraction(text))
                    if (text <= 0):  # unknown state
                        __print__(dbg.PROC, "status.progressbar", dbg.STAT, "PULSE")
                        mygtk.do(lambda:self.progress.pulse())
            # add text
            elif (type(text)==str):
                sbar_msg.append(1)
                mygtk.do(lambda:self.statusbar.push(sbar_cid, text))
            pass