lnbits-legend/lnbits/extensions/livestream/__init__.py

36 lines
944 B
Python
Raw Normal View History

2021-10-28 17:02:07 +01:00
import asyncio
from fastapi import APIRouter
from fastapi.staticfiles import StaticFiles
from lnbits.db import Database
from lnbits.helpers import template_renderer
from lnbits.tasks import catch_everything_and_restart
db = Database("ext_livestream")
livestream_static_files = [
{
"path": "/livestream/static",
"app": StaticFiles(packages=[("lnbits", "extensions/livestream/static")]),
2021-10-28 17:02:07 +01:00
"name": "livestream_static",
}
]
2021-11-12 04:14:55 +00:00
livestream_ext: APIRouter = APIRouter(prefix="/livestream", tags=["livestream"])
2021-10-28 17:02:07 +01:00
def livestream_renderer():
2022-07-23 20:08:59 +01:00
return template_renderer(["lnbits/extensions/livestream/templates"])
2021-10-28 17:02:07 +01:00
2021-11-12 04:14:55 +00:00
from .lnurl import * # noqa: F401,F403
2021-10-28 17:02:07 +01:00
from .tasks import wait_for_paid_invoices
from .views import * # noqa: F401,F403
from .views_api import * # noqa: F401,F403
2021-10-28 17:02:07 +01:00
2022-01-24 15:58:51 -08:00
def livestream_start():
2021-10-28 17:02:07 +01:00
loop = asyncio.get_event_loop()
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))