Advertisement
OmgImAlexis

Untitled

Feb 27th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. def index(self):
  2. self.set_header('Content-Type', 'application/json')
  3. stats = self.show_statistics()
  4.  
  5. shows = []
  6. anime = []
  7. for show in sickbeard.showList:
  8. my_dict = {
  9. "indexerId": show.indexerid,
  10. "indexer": show.indexer,
  11. "name": show.name,
  12. "location": show.location,
  13. "network": show.network,
  14. "airs": show.airs,
  15. "status": show.status,
  16. "startyear": show.startyear,
  17. "genre": show.genre,
  18. "classification": show.classification,
  19. "runtime": show.runtime,
  20. "quality": show.quality,
  21. "scene": show.scene,
  22. "sports": show.sports,
  23. "anime": show.anime,
  24. "airsNext": stats[0][show.indexerid]['ep_airs_next'],
  25. "snatched": stats[0][show.indexerid]['ep_snatched'],
  26. "downloaded": stats[0][show.indexerid]['ep_downloaded'],
  27. "total": stats[0][show.indexerid]['ep_total']
  28. }
  29.  
  30. if show.is_anime:
  31. anime.append(my_dict)
  32. else:
  33. shows.append(my_dict)
  34.  
  35. if sickbeard.ANIME_SPLIT_HOME:
  36. return json.JSONEncoder().encode({"showLists": json.JSONEncoder().encode({"shows": shows, "anime": anime}), "show_stat": stats[0], "max_download_count": stats[1]})
  37. else:
  38. return json.JSONEncoder().encode({"showLists": json.JSONEncoder().encode({"shows": shows}), "show_stat": stats[0], "max_download_count": stats[1]})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement