示例#1
0
 async def check_status(self) -> Tuple[Optional[str], Optional[str]]:
     """Возвращает статус скачивания файла и имя файла, если уже скачан"""
     url: Optional[str]
     filename = await self.check_file()
     if filename:
         url = f'{settings.DOWNLOAD_URL}{filename}'
         status = '100'
     else:
         if models.DB().sget(self.y_id, self.format, 'error'):
             raise YouTubeDownloadError('Ошибка при скачивании видео')
         url = None
         status = models.DB().sget(self.y_id, self.format, 'status')
     return status, url
示例#2
0
    def init(self, params):
        self.params = dict(params)

        self.db = models.DB()

        self.session = self.httpsession.get("session")
        if not self.session:
            self.httpsession["session"] = self.session = NebulaSession()
        self.session.config = self.config
        self.session_id = self.params.pop('session_id', None)

        self.context = self.params.pop('context', None)
        self.debug = self.params.pop('debug', False) != False
示例#3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import json
import re
import web
from libs.qrcode import QRCode, ErrorCorrectLevel
import settings
import models

debug = web.config.debug = settings.DEBUG
render = web.template.render(settings.TEMPLATE_DIR,
                             base=settings.BASE_TEMPLATE)
app = web.application(settings.URLS, globals())
db = models.DB(settings.DATABASES)


class Index(object):
    """首页"""
    def GET(self):
        return render.index()


class Shorten(object):
    """网址缩短结果页"""
    def __init__(self):
        self.db = db

    def add_scheme(self, url):
        """给 URL 添加 scheme(qq.com -> http://qq.com)"""
        # 支持的 URL scheme
示例#4
0
import json
import re
import web
import qrcode
import settings
import models
import sys
import datetime
import os

debug = web.config.debug = settings.DEBUG
render = web.template.render(settings.TEMPLATE_DIR,
                             base=settings.BASE_TEMPLATE)
app = web.application(settings.URLS, globals())
db = models.DB()


def notfound():
    return Exception(render.notfound())


class Wosign(object):
    def GET(self):
        return open('fvck.it.html', 'r').read()


class GetCode(object):
    def GET(self):
        #return render.getcode("124343243")
        return render.getcode(db.generate_code())
示例#5
0
 def __init__(self, y_id, video_format=None):
     self.y_id = y_id
     self.format = video_format
     self.video = models.DB().jget(self.y_id, 'info', {})
示例#6
0
import models

__version__ = '0.0.0'
__author__ = 'Daniele Affinita'

user = "******"
mydb = models.DB("../api.json")

#------------------------------------------------------------------------------------------------------
#Creazione di un Database e di alcune Tabelle
#mydb.createDB("andicappatoDB", user)
#mydb.createTable("boomer")
#mydb.createFields([("bamba", "bool"), ("dim", "float")], "bamba", True)
#for c in range(3):
#mydb.insertRow([False,float(c)])

#------------------------------------------------------------------------------------------------------
#Selezione di un Database
mydb.selectDB("tester")
mydb.selectTable("Foglio1")

#------------------------------------------------------------------------------------------------------
#Eliminazione di un Database/di Tabelle
#mydb.dropTable(2)
#mydb.dropDB("andicappatoDB")
#print(mydb.testUnique())

#------------------------------------------------------------------------------------------------------
#Test vari
mydb.insertRow(["", ""])