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
def video_items(data): length = data['itemsLength'] total = data['totalVideos'] _items = data['items'] for i in _items: items.add_item(Videos(i).item) items.list_items()
def sub_menu(data): container = data['container'] for c in container: if c['content']: if c.get('page', None): items.add(Menu(c, 'videos').item) else: for i in c['content']: items.add(Videos(i).item) elif c['schedule']: for s in c['schedule']: items.add(Live_Videos(s).item) items.list()
def video_worker(subreddit): v = Videos() v._load_videos(subreddit)
def video(data): content = data['container'][0]['content'] for i in content: items.add(Videos(i).item) items.list()
view_func=Login.as_view('login'), methods=["GET", "POST"]) app.add_url_rule('/remote/', view_func=Remote.as_view('remote'), methods=["GET", "POST"]) app.add_url_rule('/add/', view_func=Feed.as_view('add_entry'), methods=["GET", "POST"]) app.add_url_rule('/pictures/', view_func=Pictures.as_view('pictures'), methods=["GET", "POST"]) app.add_url_rule('/display_pictures/', view_func=Display.as_view('display_pictures'), methods=["GET", "POST"]) app.add_url_rule('/videos/', view_func=Videos.as_view('videos'), methods=["GET", "POST"]) app.add_url_rule('/display_videos/', view_func=vidDisplay.as_view('display_videos'), methods=["GET", "POST"]) app.add_url_rule('/contact/', view_func=Contact.as_view('contact'), methods=["GET", "POST"]) app.add_url_rule('/donate/', view_func=Sponsors.as_view('support'), methods=["GET"]) app.add_url_rule('/members/', view_func=Members.as_view('members'), methods=["GET", "POST"]) app.add_url_rule('/events/', view_func=Event.as_view('events'),
#!/usr/bin/python3 from bottle import get, post, run, request, response, static_file, redirect, abort import json from videos import Videos, CHUNK_DIR, ENCODE_FINAL_DIR import traceback from urllib.parse import unquote vids = Videos("10.0.0.1") vids.db_connect() @get("/") def goto_index(): redirect("/app/html/dashboard.html") @get("/app/<filepath:path>") def app(filepath): return static_file(filepath, root="./app") @post("/upload/url") def upload_url(): try: data = str(request.body.read())[2:-1] print(data) data_dict = json.loads(data) url = data_dict["url"] print(url) return vids.add_video_by_url(url)