|
a/rdpl2stream/StreamDecoder.py |
|
b/rdpl2stream/StreamDecoder.py |
|
... |
|
... |
19 |
##########################################################################
|
19 |
##########################################################################
|
20 |
from __future__ import print_function
|
20 |
from __future__ import print_function
|
21 |
|
21 |
|
22 |
import urllib2
|
22 |
import urllib2
|
23 |
import sys
|
23 |
import sys
|
|
|
24 |
import ssl
|
|
|
25 |
|
24 |
from lib.common import USER_AGENT
|
26 |
from lib.common import USER_AGENT
|
25 |
from lib.DummyMMSHandler import DummyMMSHandler
|
27 |
from lib.DummyMMSHandler import DummyMMSHandler
|
26 |
from PlsPlaylistDecoder import PlsPlaylistDecoder
|
28 |
from PlsPlaylistDecoder import PlsPlaylistDecoder
|
27 |
from M3uPlaylistDecoder import M3uPlaylistDecoder
|
29 |
from M3uPlaylistDecoder import M3uPlaylistDecoder
|
28 |
from AsxPlaylistDecoder import AsxPlaylistDecoder
|
30 |
from AsxPlaylistDecoder import AsxPlaylistDecoder
|
|
... |
|
... |
83 |
self.log.info('Requesting stream... %s'% url)
|
85 |
self.log.info('Requesting stream... %s'% url)
|
84 |
req = urllib2.Request(url)
|
86 |
req = urllib2.Request(url)
|
85 |
req.add_header('User-Agent', USER_AGENT)
|
87 |
req.add_header('User-Agent', USER_AGENT)
|
86 |
|
88 |
|
87 |
try:
|
89 |
try:
|
88 |
opener = urllib2.build_opener(DummyMMSHandler())
|
90 |
opener = urllib2.build_opener(
|
|
|
91 |
DummyMMSHandler(),
|
|
|
92 |
urllib2.HTTPSHandler(context =
|
|
|
93 |
ssl._create_unverified_context()))
|
89 |
f = opener.open(req, timeout=float(self.url_timeout))
|
94 |
f = opener.open(req, timeout=float(self.url_timeout))
|
90 |
|
95 |
|
91 |
except urllib2.HTTPError, e:
|
96 |
except urllib2.HTTPError, e:
|
92 |
self.log.warn('HTTP Error: No radio stream found for %s - %s' %
|
97 |
self.log.warn('HTTP Error: No radio stream found for %s - %s' %
|
93 |
(url, str(e)))
|
98 |
(url, str(e)))
|