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): class SubmissionType(Enum):
DOCUMENT = "document" DOCUMENT = "document"
VIDEO = "video" VIDEO = "video"
ANIMATION = "animation" # ANIMATION = "animation"
PHOTO = "photo" PHOTO = "photo"

View File

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

View File

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

View File

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