Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP. Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
991 B
Python
37 lines
991 B
Python
# -*- coding: utf-8 -*-
|
|
"""Force remirror all YouTube channel avatars to S3 (dy.nomadro.live)."""
|
|
import asyncio
|
|
import os
|
|
import sys
|
|
|
|
# Load DY_S3_* from systemd unit environment
|
|
import subprocess
|
|
|
|
out = subprocess.check_output(
|
|
["systemctl", "show", "douyinweb-api", "-p", "Environment", "--value"],
|
|
text=True,
|
|
)
|
|
for part in out.split():
|
|
if part.startswith("DY_") and "=" in part:
|
|
k, _, v = part.partition("=")
|
|
os.environ[k] = v
|
|
|
|
sys.path.insert(0, "/opt/douyinWEB/backend")
|
|
from app import youtube_manage
|
|
from app import s3_storage
|
|
from app.config import settings
|
|
|
|
print("s3", settings.s3_enabled, s3_storage.s3_enabled(), settings.s3_public_base)
|
|
|
|
|
|
async def main():
|
|
r = await youtube_manage.refresh_stale_yt_profiles(max_age_sec=0, limit=50)
|
|
print(r)
|
|
# verify thumbs
|
|
caches = youtube_manage.list_yt_profile_caches()
|
|
for pk, sn in caches.items():
|
|
print(pk[:8], sn.get("title"), sn.get("thumb_url", "")[:100])
|
|
|
|
|
|
asyncio.run(main())
|