Example #1
0
 def __init__(self, conn, table_name, value_column, index_fts):
     self.conn = conn
     self.table_name = table_name
     self.value_column = value_column
     self.fts_table_name = "{table_name}_{value_column}_fts".format(
         table_name=table_name, value_column=value_column)
     self.index_fts = index_fts
     self.cache = lru.LRUCacheDict(max_size=1000)
     self.ensure_table_exists()
Example #2
0
#def rotation_api():
#
#    for key in cache_json.keys():
#         length_time = current_time - cache_json[key]
#         if length_time > 604800:
#            try:
#                os.remove("/var/www/video/cache/" + key + ".mp4")
#            except OSError as e:
#                 print(e)
#            else:
#                 print("File is deleted successfully")
#                 cache_json.pop(key)
#

app = Flask(__name__)
cache = lru.LRUCacheDict(max_size=100, expiration=60 * 60, concurrent=True)
files = lru.LRUCacheDict(max_size=5000, expiration=60 * 60, concurrent=True)

buffer_size = 1024 * 1024  # 1MB
youtube_url = "https://www.youtube.com/watch?v="

app.config.from_object(Config())
Scheduler.init_app(app)

Scheduler.start()


class VideoInfo:
    def __init__(self, id, title, url, audio_url, extension, size):
        self.id = id
        self.title = title
Example #3
0
 def __init__(self, conn, table_name, value_column):
     self.conn = conn
     self.table_name = table_name
     self.value_column = value_column
     self.cache = lru.LRUCacheDict(max_size=1000)
     self.ensure_table_exists()