diff -Nru aceproxy-0.9.1-531~da40d80/debian/changelog aceproxy-0.9.1-534~a937b0c/debian/changelog --- aceproxy-0.9.1-531~da40d80/debian/changelog 2015-04-10 21:33:15.000000000 +0000 +++ aceproxy-0.9.1-534~a937b0c/debian/changelog 2015-08-18 17:55:10.000000000 +0000 @@ -1,25 +1,15 @@ -aceproxy (0.9.1-531~da40d80-precise) precise; urgency=medium +aceproxy (0.9.1-534~a937b0c-precise) precise; urgency=medium - * [da40d80ba465951081f9f2098bf61327c334658c] - Print traceback if plugin exception was caught + * [a937b0c17228748c9befd16245655d4055d68a1a] + Correct allfon usage description text - * [ce22926a2c4b62f567382c83cced2e6671e79b65] - Fix VLC spawn logic - Spawn VLC if vlcspawn = True. If vlcspawn = False we will try to connect to VLC and only then find process. + * [eaab692d4b3bb95ed8efa3a70706f245217c22cf] + New allfon.tv plugin - * [7845b893d97e0889189fbd9caad0741204ab7ab9] - P2pProxy plugin rewrite and refactoring - Moved all API communication stuff from plugin code to torrenttv_api.py and covered it with proper documentation. - Rewrote API logic. Now errors are handled by exceptions. - Deleted session caching feature because it caused more problems than advantages. Now every request will open new session. - Refactored code. - - - * [ee250ca910c7c6804b325120e4fe10f8c7afaef2] - Make torrent-telik mobile playlist accessible again - Renamed command for getting mobile torrent-tv playlist because it was shadowed by another command after changing '==' to 'startswith' + * [946274248dff019f5bfa3ae62e29fe16ba5c015c] + Handle socket timeout and don't print traceback - -- Andrey Pavlenko Sat, 11 Apr 2015 00:33:15 +0300 + -- Andrey Pavlenko Tue, 18 Aug 2015 20:55:10 +0300 diff -Nru aceproxy-0.9.1-531~da40d80/plugins/allfon_plugin.py aceproxy-0.9.1-534~a937b0c/plugins/allfon_plugin.py --- aceproxy-0.9.1-531~da40d80/plugins/allfon_plugin.py 1970-01-01 00:00:00.000000000 +0000 +++ aceproxy-0.9.1-534~a937b0c/plugins/allfon_plugin.py 2015-08-18 17:55:10.000000000 +0000 @@ -0,0 +1,70 @@ +''' +Allfon.tv Playlist Downloader Plugin +http://ip:port/allfon +''' +import re +import logging +import urllib2 +import time +from modules.PluginInterface import AceProxyPlugin +from modules.PlaylistGenerator import PlaylistGenerator +import config.allfon as config + + +class Allfon(AceProxyPlugin): + + # ttvplaylist handler is obsolete + handlers = ('allfon',) + + logger = logging.getLogger('plugin_allfon') + playlist = None + playlisttime = None + + def __init__(self, AceConfig, AceStuff): + pass + + def downloadPlaylist(self): + try: + Allfon.logger.debug('Trying to download playlist') + print(config.url) + req = urllib2.Request(config.url, headers={'User-Agent' : "Magic Browser"}) + Allfon.playlist = urllib2.urlopen( + req, timeout=10).read() + Allfon.playlisttime = int(time.time()) + except: + Allfon.logger.error("Can't download playlist!") + return False + + return True + + def handle(self, connection): + # 30 minutes cache + if not Allfon.playlist or (int(time.time()) - Allfon.playlisttime > 30 * 60): + if not self.downloadPlaylist(): + connection.dieWithError() + return + + hostport = connection.headers['Host'] + + connection.send_response(200) + connection.send_header('Content-Type', 'application/x-mpegurl') + connection.end_headers() + + # Match playlist with regexp + + matches = re.finditer(r'\#EXTINF\:0\,ALLFON\.TV (?P\S.+)\n.+\n.+\n(?P^acestream.+$)', + Allfon.playlist, re.MULTILINE) + + add_ts = False + try: + if connection.splittedpath[2].lower() == 'ts': + add_ts = True + except: + pass + + + playlistgen = PlaylistGenerator() + for match in matches: + playlistgen.addItem(match.groupdict()) + + connection.wfile.write(playlistgen.exportm3u(hostport, add_ts=add_ts)) diff -Nru aceproxy-0.9.1-531~da40d80/plugins/config/allfon.py aceproxy-0.9.1-534~a937b0c/plugins/config/allfon.py --- aceproxy-0.9.1-531~da40d80/plugins/config/allfon.py 1970-01-01 00:00:00.000000000 +0000 +++ aceproxy-0.9.1-534~a937b0c/plugins/config/allfon.py 2015-08-18 17:55:10.000000000 +0000 @@ -0,0 +1,6 @@ +''' +Allfon.tv Playlist Downloader Plugin configuration file +''' + +# Insert your allfon.tv playlist URL here +url = 'http://allfon.tv/autogenplaylist/allfontv.m3u' diff -Nru aceproxy-0.9.1-531~da40d80/plugins/torrenttv_api.py aceproxy-0.9.1-534~a937b0c/plugins/torrenttv_api.py --- aceproxy-0.9.1-531~da40d80/plugins/torrenttv_api.py 2015-04-10 21:33:15.000000000 +0000 +++ aceproxy-0.9.1-534~a937b0c/plugins/torrenttv_api.py 2015-08-18 17:55:10.000000000 +0000 @@ -6,6 +6,7 @@ __author__ = 'miltador' import urllib2 +import socket import xml.dom.minidom as dom @@ -168,5 +169,5 @@ try: result = urllib2.urlopen('http://api.torrent-tv.ru/' + request + '&typeresult=xml', timeout=10).read() return result - except urllib2.URLError as e: + except (urllib2.URLError, socket.timeout) as e: raise TorrentTvApiException('Error happened while trying to access API: ' + repr(e)) \ No newline at end of file