Index: ahttp.py ================================================================== --- ahttp.py +++ ahttp.py @@ -12,11 +12,11 @@ # from config import conf, __print__, dbg import requests -import copy + #-- hooks to progress meter and status bar in main window feedback = None @@ -37,22 +37,24 @@ except: pass +# prepare default query object +session = requests.Session() # default HTTP headers for requests -default_headers = { +session.headers.update({ "User-Agent": "streamtuner2/2.1 (X11; U; Linux AMD64; en; rv:1.5.0.1) like WinAmp/2.1 but not like Googlebot/2.1", #"Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6", "Accept": "*/*;q=0.5, audio/*, url/*", "Accept-Language": "en-US,en,de,es,fr,it,*;q=0.1", "Accept-Encoding": "gzip,deflate", "Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.1", "Keep-Alive": "115", "Connection": "keep-alive", "Pragma": "no-cache", "Cache-Control": "no-cache", -} +}) #-- Retrieve data via HTTP # @@ -63,21 +65,21 @@ # statusbar info progress_feedback(url, 0.1) # combine headers - headers = copy.copy(default_headers) + headers = {} if ajax: headers["X-Requested-With"] = "XMLHttpRequest" if referer: headers["Referer"] = (referer if referer else url) # read if post: - r = requests.post(url, params=params, headers=headers) + r = session.post(url, params=params, headers=headers) else: - r = requests.get(url, params=params, headers=headers) + r = session.get(url, params=params, headers=headers) # result progress_feedback(0.9) content = (r.content if binary else r.text) Index: config.py ================================================================== --- config.py +++ config.py @@ -72,10 +72,11 @@ # x-terminal-emulator -e streamripper %srv -d /home/***USERNAME***/Musik } self.plugins = { "bookmarks": 1, # built-in plugins, cannot be disabled "shoutcast": 1, + "xiph": 0, # way too slow on first start "punkcast": 0, # disable per default "basicch": 0, # ceased "tv": 0, # no longer working } self.tmp = os.environ.get("TEMP", "/tmp") Index: st2.py ================================================================== --- st2.py +++ st2.py @@ -91,10 +91,12 @@ import action # needs workaround... (action.main=main) from channels import * import favicon +__version__ = "2.1.0" + # this represents the main window # and also contains most application behaviour main = None class StreamTunerTwo(gtk.Builder): @@ -530,11 +532,11 @@ # auxiliary window: about dialog class AboutStreamtuner2: # about us def __init__(self): a = gtk.AboutDialog() - a.set_version("2.0.9.5") + a.set_version(__version__) a.set_name("streamtuner2") a.set_license("Public Domain\n\nNo Strings Attached.\nUnrestricted distribution,\nmodification, use.") a.set_authors(["Mario Salzer \n\nConcept based on streamtuner 0."+"99."+"99 from\nJean-Yves Lefort, of which some code remains\nin the Google stations plugin.\n\n\nMyOggRadio plugin based on cooperation\nwith Christian Ehm. "]) a.set_website("http://milki.include-once.org/streamtuner2/") a.connect("response", lambda a, ok: ( a.hide(), a.destroy() ) )