Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:869413421 Ai moive studio BilibiliPublishService upload chapter task

From Leeroopedia
Knowledge Sources
Domains Distribution, Task_Management
Last Updated 2026-10-23 12:00 GMT

Overview

Service that orchestrates the complete Bilibili publish workflow: loading the publish task, downloading the video from MinIO, uploading via biliup CLI, and updating task status.

Description

'BilibiliPublishService.upload_chapter_task is the complete publish workflow:

1. Loads the PublishTask record and marks it as uploading 2. Loads the VideoTask and downloads the video from MinIO 3. Optionally downloads the cover image 4. Resolves the Bilibili account cookie file (account-specific or default) 5. Calls BilibiliService.upload_video with all metadata 6. On success: marks the task as published with BV/AV numbers 7. On failure: marks the task as failed with error message

Usage

Import when executing Bilibili publish tasks. Called by the Bilibili publish Celery task.

Code Reference

Source Location

  • Repository: ai-moive-studio
  • File: backend/src/services/bilibili.py:L306-409

Signature

class BilibiliPublishService(BaseService):
    async def upload_chapter_task(
        self,
        publish_task_id: str,
        user_id: str,
        celery_task_id: str
    ) -> Dict[str, Any]:
        """
        Args:
            publish_task_id: publish task UUID
            user_id: owner UUID
            celery_task_id: Celery task ID for tracking

        Returns:
            Dict with success, bvid, aid, error
        """

Import

from src.services.bilibili import BilibiliPublishService

I/O Contract

Inputs

Name Type Required Description
publish_task_id str Yes Publish task UUID
user_id str Yes Owner UUID
celery_task_id str Yes Celery task ID

Outputs

Name Type Description
return value dict {success, bvid, aid, error}
DB side effects — Updates PublishTask status (uploading→published/failed)

Usage Examples

Publishing a Video

from src.services.bilibili import BilibiliPublishService

service = BilibiliPublishService(db_session)
result = await service.upload_chapter_task(
    publish_task_id="task-uuid",
    user_id="user-uuid",
    celery_task_id="celery-uuid",
)
if result["success"]:
    print(f"Published: BV{result['bvid']}")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment