Skip to content

Commit

Permalink
fix compress
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsmh committed Jan 4, 2025
1 parent 23437cb commit b653001
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions biliparser/strategy/video.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
from math import log
import os
import re
from functools import cached_property
from urllib.parse import parse_qs, urlparse

import orjson
from bilibili_api import video
from telegram.constants import FileSizeLimit

from ..cache import CACHES_TIMER, RedisCache
from ..utils import (
BILI_API,
LOCAL_MODE,
ParserException,
credential,
escape_markdown,
get_filename,
headers,
logger,
credential,
)
from .feed import Feed
from bilibili_api import video
from urllib.parse import urlparse, parse_qs

QN = [64, 32, 16]

Expand Down Expand Up @@ -144,7 +143,8 @@ async def __get_dash_video(self):
self.dashurls = [streams[0].url, streams[1].url]
self.dashtype = "dash"
self.mediaraws = True
return True
return True
return False

async def handle(self):
logger.info(f"处理视频信息: 链接: {self.rawurl}")
Expand Down
1 change: 1 addition & 0 deletions biliparser/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def compress(inpil, size=1280, fix_ratio=False) -> BytesIO:
new_w = math.ceil(h / 20)
padded = Image.new("RGBA", (new_w, h))
padded.paste(pil, (int((new_w - h) / 2), 0))
pil = padded
if size > 0:
pil.thumbnail((size, size), Image.Resampling.LANCZOS)
outpil = BytesIO()
Expand Down

0 comments on commit b653001

Please sign in to comment.