v4.3 ui: 3D wooden bookshelf redesign, fix player cover aspect ratio, and smooth subtitle scroll

This commit is contained in:
Ashim Kumar
2026-07-03 18:43:07 +06:00
parent cf93085e22
commit 14d18fbad4
14 changed files with 1174 additions and 193 deletions

View File

@@ -140,6 +140,57 @@ def get_storage_usage_bytes():
return total
# ============================================
# Pending thumbnails (v4.4) — আপলোডের সময় জেনারেট, সেভের সময় commit
# ============================================
import uuid as _uuid
def _pending_thumbs_dir():
return os.path.join(MEDIA_STORAGE_DIR, '_pending_thumbs')
def save_pending_thumbnail(image_bytes, image_format='jpeg'):
"""
অস্থায়ী থাম্বনেইল সেভ করে একটা token রিটার্ন করে।
প্রজেক্ট এখনো তৈরি হয়নি বলে project_id ছাড়াই রাখা হয়।
"""
if not image_bytes:
return None
d = _pending_thumbs_dir()
_ensure_dir(d)
fmt = (image_format or 'jpeg').lower()
token = _uuid.uuid4().hex
filename = f'{token}.{fmt}'
with open(os.path.join(d, filename), 'wb') as f:
f.write(image_bytes)
return filename # token = filename
def read_pending_thumbnail(token):
"""Pending thumbnail-এর (bytes, format) ফেরত দেয়। না থাকলে (None, None)।"""
if not token or '/' in token or '\\' in token or '..' in token:
return None, None
path = os.path.join(_pending_thumbs_dir(), token)
if not os.path.exists(path):
return None, None
fmt = token.rsplit('.', 1)[-1] if '.' in token else 'jpeg'
with open(path, 'rb') as f:
return f.read(), fmt
def delete_pending_thumbnail(token):
"""Pending thumbnail মুছে দেয় (commit বা বাতিলের পর)।"""
if not token or '/' in token or '\\' in token or '..' in token:
return
path = os.path.join(_pending_thumbs_dir(), token)
if os.path.exists(path):
try:
os.remove(path)
except OSError:
pass
# ============================================
# Delete operations
# ============================================