Exemple #1
0
def _extract(data):
    results = PlayItemList()
    rtree = data['results']
    for r in rtree:
        title = replace_entity(r['title'])
        img = r['thumbnailUrl']
        if 'url' in r:
            url = r['url']
        else:
            url = r['URL']
        results.add(PlayItem(title, img, url))
    return results
Exemple #2
0
def _extract(data):
  results = PlayItemList()
  rtree = data['results']
  for r in rtree:
    title = replace_entity(r['title'])
    img = r['thumbnailUrl']
    if 'url' in r:
      url = r['url']
    else:
      url = r['URL']
    results.add(PlayItem(title, img, url))
  return results
Exemple #3
0
def _extract(data, moviesubs):
  results = playitem.PlayItemList()
  if not 'data' in data or len(data['data']['children']) == 0:
    return results
  rtree = data['data']['children']
  for r in rtree:
    r = r['data']
    # Internal reddit question/discussion
    if r['is_self']:
      continue
    thumb = None
    if r['thumbnail'] and r['thumbnail'].find('/') > -1:
      thumb = r['thumbnail']
    subtitle = "Score: " + str(r['score'])
    comments = "<a target='_blank' href='http://reddit.com" + r['permalink'] + "'>Comments:" + str(r['num_comments']) + "</a>" 
    subtitle = subtitle + ", " + comments
    title = chanutils.replace_entity(r['title'])
    url = chanutils.replace_entity(r['url'])
    subs = None
    if moviesubs:
      subs = chanutils.movie_title_year(title)
    item = playitem.PlayItem(title, thumb, url, subtitle, subs=subs)
    results.add(item)
  return results