2 # vi:si:et:sw=4:sts=4:ts=4
4 # Copyright (C) 2009-2010 Fluendo, S.L. (www.fluendo.com).
5 # Copyright (C) 2009-2010 Marc-Andre Lureau <marcandre.lureau@gmail.com>
7 # This file may be distributed and/or modified under the terms of
8 # the GNU General Public License version 2 as published by
9 # the Free Software Foundation.
10 # This file is distributed without any warranty; without even the implied
11 # warranty of merchantability or fitness for a particular purpose.
12 # See "LICENSE" in the source distribution for more information.
17 __version_info__ = (0,2,0)
18 __version__ = '.'.join(map(str,__version_info__))
21 def make_url(base_url, url):
22 if urlparse.urlsplit(url).scheme == '':
23 url = urlparse.urljoin(base_url, url)
24 if 'HLS_PLAYER_SHIFT_PORT' in os.environ.keys():
25 shift = int(os.environ['HLS_PLAYER_SHIFT_PORT'])
26 p = urlparse.urlparse(url)
28 if loc.find(":") != -1:
29 loc, port = loc.split(':')
30 port = int(port) + shift
31 loc = loc + ":" + str(port)
32 elif p.scheme == "http":
34 loc = loc + ":" + str(shift)
35 p = urlparse.ParseResult(scheme=p.scheme,
41 url = urlparse.urlunparse(p)