removed pyrogram stuff
Browse files- App/Transcription/Utils/fastapi_tasks.py +5 -5
- App/__init__.py +7 -7
- App/app.py +3 -3
App/Transcription/Utils/fastapi_tasks.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
| 1 |
-
from App import
|
| 2 |
from fastapi import UploadFile
|
| 3 |
from App.Transcription.Model import Transcriptions
|
| 4 |
|
| 5 |
|
| 6 |
async def perform_background_task(file: UploadFile, task_id: str):
|
| 7 |
-
data = await
|
| 8 |
-
|
| 9 |
-
|
| 10 |
caption=file.filename,
|
|
|
|
| 11 |
)
|
| 12 |
-
|
| 13 |
# get entry and update
|
| 14 |
entry: Transcriptions = await Transcriptions.objects.filter(task_id=task_id).first()
|
| 15 |
await entry.update(tl_file_id=str(data.id))
|
|
|
|
| 1 |
+
from App import bot
|
| 2 |
from fastapi import UploadFile
|
| 3 |
from App.Transcription.Model import Transcriptions
|
| 4 |
|
| 5 |
|
| 6 |
async def perform_background_task(file: UploadFile, task_id: str):
|
| 7 |
+
data = await bot.send_file(
|
| 8 |
+
-1001925049183,
|
| 9 |
+
file_size=file.size,
|
| 10 |
caption=file.filename,
|
| 11 |
+
file=f"./{file.filename}",
|
| 12 |
)
|
|
|
|
| 13 |
# get entry and update
|
| 14 |
entry: Transcriptions = await Transcriptions.objects.filter(task_id=task_id).first()
|
| 15 |
await entry.update(tl_file_id=str(data.id))
|
App/__init__.py
CHANGED
|
@@ -9,10 +9,10 @@ bot = TelegramClient(
|
|
| 9 |
)
|
| 10 |
|
| 11 |
|
| 12 |
-
upload_bot = Client(
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
)
|
|
|
|
| 9 |
)
|
| 10 |
|
| 11 |
|
| 12 |
+
# upload_bot = Client(
|
| 13 |
+
# str("the book"),
|
| 14 |
+
# api_id=870972,
|
| 15 |
+
# api_hash="ce2efaca02dfcd110941be6025e9ac0d",
|
| 16 |
+
# bot_token="6183919505:AAEhHFt4mI18bQeAf2Lj7AePXFRPVLrOFM8",
|
| 17 |
+
# workers=9,
|
| 18 |
+
# )
|
App/app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
-
from App import bot
|
| 3 |
from .Users.UserRoutes import user_router
|
| 4 |
from .modelInit import models, database
|
| 5 |
from .Transcription.TranscriptionRoutes import transcription_router
|
|
@@ -31,7 +31,7 @@ app.add_middleware(
|
|
| 31 |
@app.on_event("startup")
|
| 32 |
async def startup_event():
|
| 33 |
await bot.start()
|
| 34 |
-
await upload_bot.start()
|
| 35 |
await models.create_all()
|
| 36 |
if not database.is_connected:
|
| 37 |
await database.connect()
|
|
@@ -41,7 +41,7 @@ async def startup_event():
|
|
| 41 |
@app.on_event("shutdown")
|
| 42 |
async def shutdown_event():
|
| 43 |
await bot.stop()
|
| 44 |
-
await upload_bot.stop()
|
| 45 |
if not database.is_connected:
|
| 46 |
await database.disconnect()
|
| 47 |
print("shutting down!")
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from App import bot
|
| 3 |
from .Users.UserRoutes import user_router
|
| 4 |
from .modelInit import models, database
|
| 5 |
from .Transcription.TranscriptionRoutes import transcription_router
|
|
|
|
| 31 |
@app.on_event("startup")
|
| 32 |
async def startup_event():
|
| 33 |
await bot.start()
|
| 34 |
+
# await upload_bot.start()
|
| 35 |
await models.create_all()
|
| 36 |
if not database.is_connected:
|
| 37 |
await database.connect()
|
|
|
|
| 41 |
@app.on_event("shutdown")
|
| 42 |
async def shutdown_event():
|
| 43 |
await bot.stop()
|
| 44 |
+
# await upload_bot.stop()
|
| 45 |
if not database.is_connected:
|
| 46 |
await database.disconnect()
|
| 47 |
print("shutting down!")
|