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.
18 def make_url(base_url, url):
19 if urlparse.urlsplit(url).scheme == '':
20 url = urlparse.urljoin(base_url, url)
21 if 'HLS_PLAYER_SHIFT_PORT' in os.environ.keys():
22 shift = int(os.environ['HLS_PLAYER_SHIFT_PORT'])
23 p = urlparse.urlparse(url)
25 if loc.find(":") != -1:
26 loc, port = loc.split(':')
27 port = int(port) + shift
28 loc = loc + ":" + str(port)
29 elif p.scheme == "http":
31 loc = loc + ":" + str(shift)
32 p = urlparse.ParseResult(scheme=p.scheme,
38 url = urlparse.urlunparse(p)