Skip to content

Commit

Permalink
added getCaller function and cleaned up streamer
Browse files Browse the repository at this point in the history
  • Loading branch information
carl committed Oct 29, 2011
1 parent 6e53a40 commit f75043e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
7 changes: 7 additions & 0 deletions tools/helper.py
@@ -1,5 +1,12 @@
# vim: set fileencoding=utf-8 :
from htmlentitydefs import entitydefs
import inspect

def getCaller():
ret = ""
ret += str(inspect.stack()[2][1])
ret += ": "+str(inspect.stack()[2][2])
return ret

def remove_html(txt):
txt = txt.replace('&', '&') # cause things like ä are possible ~_~
Expand Down
22 changes: 6 additions & 16 deletions tools/stream.py
Expand Up @@ -48,15 +48,7 @@ def __hash__(self):
return 'h %s' % hash(self.url)

def __getattr__(self, key):
if key == 'title':
if config.dl_title:
return config.dl_title
return self.get_title()
elif(key == 'name'):
if config.dl_name:
return config.dl_name
return self.get_name()
elif key == 'subdir':
if key == 'subdir':
return self.get_subdir()
elif(key == 'stream_url'):
return self.get_stream()
Expand Down Expand Up @@ -126,15 +118,13 @@ def get_stream(self):
if stream and stream['url']:
if stream['url'].endswith('\r\n'):
stream['url'] = stream['url'][:-2]
args = stream

self.stream_url = args['url']
if 'post' in args:
self.stream_post = args['post']
self.stream_type = defs.Stream.NONE
if not self.stream_url:
else:
self.log.error('couldn\'t find a streamlink inside this url')
return None

self.stream_url = stream['url']
if 'post' in stream:
self.stream_post = stream['post']
for i in url2defs:
if self.stream_url.find(i) > 0:
self.stream_type = url2defs[i]
Expand Down

0 comments on commit f75043e

Please sign in to comment.