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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [bfc52cab35]:

To Artifact [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
#
#  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)
    
    # 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)
    content = (r.content if binary else r.text)
    
    # finish, clean statusbar
    progress_feedback()
    __print__( dbg.INFO, "Content-Length", len(content) )
    return content




#-- Append missing trailing slash to URLs







|


















|



|







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)
    
    # 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)
    content = (r.content if binary else r.text)
    
    # finish, clean statusbar
    progress_feedback("")
    __print__( dbg.INFO, "Content-Length", len(content) )
    return content




#-- Append missing trailing slash to URLs