Temp: Removed animation support

This commit is contained in:
Profitroll 2023-06-27 20:04:03 +02:00
parent 39b9c365fb
commit f0cad86dd6
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
4 changed files with 33 additions and 37 deletions

View File

@ -4,5 +4,5 @@ from enum import Enum
class SubmissionType(Enum):
DOCUMENT = "document"
VIDEO = "video"
ANIMATION = "animation"
# ANIMATION = "animation"
PHOTO = "photo"

View File

@ -199,15 +199,15 @@ class PyroClient(PyroClient):
),
caption="queue",
)
elif db_entry["type"] == SubmissionType.ANIMATION.value:
response = await video_upload(
self.config["posting"]["api"]["album"],
client=client,
multipart_data=BodyVideoUpload(
File(media_bytes, filepath.name, "video/*")
),
caption="queue",
)
# elif db_entry["type"] == SubmissionType.ANIMATION.value:
# response = await video_upload(
# self.config["posting"]["api"]["album"],
# client=client,
# multipart_data=BodyVideoUpload(
# File(media_bytes, filepath.name, "video/*")
# ),
# caption="queue",
# )
except UnexpectedStatus as exp:
raise SubmissionUnsupportedError(str(filepath)) from exp

View File

@ -51,7 +51,6 @@
"move_sent": false,
"use_interval": false,
"interval": "1h30m",
"page_size": 300,
"submitted_caption": {
"enabled": true,
"ignore_admins": true,
@ -59,14 +58,12 @@
},
"types": {
"photo": true,
"video": false,
"animation": false
"video": false
},
"extensions": {
"photo": [
"jpg",
"png",
"gif",
"jpeg"
],
"video": [
@ -114,7 +111,6 @@
},
"mime_types": [
"image/png",
"image/gif",
"image/jpeg",
"video/mp4",
"video/quicktime"

View File

@ -23,7 +23,7 @@ logger = logging.getLogger(__name__)
@Client.on_message(
~filters.scheduled & filters.private & filters.photo
| filters.video
| filters.animation
# | filters.animation
| filters.document
)
async def get_submission(app: PyroClient, msg: Message):
@ -103,27 +103,27 @@ async def get_submission(app: PyroClient, msg: Message):
save_tmp = False
contents = msg.video.file_id, SubmissionType.VIDEO # , msg.video.file_name
if msg.animation is not None:
logger.info(
"User %s is trying to submit an animation with name '%s' and size of %s MB",
msg.from_user.id,
msg.animation.file_name,
msg.animation.file_size / 1024 / 1024,
)
if msg.animation.file_size > app.config["submission"]["file_size"]:
await msg.reply_text(
app._("document_too_large", "message", locale=user_locale).format(
str(app.config["submission"]["file_size"] / 1024 / 1024)
),
quote=True,
)
return
if msg.animation.file_size > app.config["submission"]["tmp_size"]:
save_tmp = False
contents = (
msg.animation.file_id,
SubmissionType.ANIMATION,
) # , msg.animation.file_name
# if msg.animation is not None:
# logger.info(
# "User %s is trying to submit an animation with name '%s' and size of %s MB",
# msg.from_user.id,
# msg.animation.file_name,
# msg.animation.file_size / 1024 / 1024,
# )
# if msg.animation.file_size > app.config["submission"]["file_size"]:
# await msg.reply_text(
# app._("document_too_large", "message", locale=user_locale).format(
# str(app.config["submission"]["file_size"] / 1024 / 1024)
# ),
# quote=True,
# )
# return
# if msg.animation.file_size > app.config["submission"]["tmp_size"]:
# save_tmp = False
# contents = (
# msg.animation.file_id,
# SubmissionType.ANIMATION,
# ) # , msg.animation.file_name
if msg.photo is not None:
logger.info(