def generate_bg_worker(r): v = Videos(subreddit=r) print v for cat in Videos.CATEGORIES: videos = v.get_videos(cat, 1, 100).get('videos', []) for video in videos: v._generate_bg(video['vid'])
def getVidsWithBg(db): subreddits = db.subreddits.find() print subreddits vids = [] for r in subreddits: print r["name"] v = Videos(subreddit=r["name"]) for cat in Videos.CATEGORIES: vids += [video["vid"] for video in v.get_videos(cat, 1, 100).get("videos", [])] print len(vids) return vids