Skip to content

Latest commit

 

History

History
123 lines (102 loc) · 3.29 KB

anime_api.md

File metadata and controls

123 lines (102 loc) · 3.29 KB

Api

Home

Create new task

  • URL POST /anime/create

  • Header

    Key Value Required
    Content-Type application/json Required
    Authorization PRE-SHARED-TOKEN Required
  • Body Json Params

    • src_path Required
      string
      Source video path, only mp4 are supported now
    • dst_path Optional(use this or anime_id and episode_count)
      string
      Output stream files destination(.ts, .m3u8), when front-end request https://yourhost/dst_path/playlist.m3u8 should response playlist.m3u8 in your dst_path
    • anime_id Optional
      string
      Anime id of CCNSAnime_Backend, must set env('CCNS_ANIME_BACKEND_ACTIVE'), you need another repo
    • episode_count Optional
      string
      Episode count of CCNSAnime_Backend, must set env('CCNS_ANIME_BACKEND_ACTIVE'), you need another repo
  • Respponse

    • task_id
      string
      Task id which can be used to trace this task
  • Example

    • Request

      curl --location --request POST 'http://127.0.0.1:5000/anime/create' \
      --header 'Authorization: PRE-SHARED-TOKEN' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "src_path": "/root/test/src.mp4",
          "dst_path": "/to/your/output/dir"
      }'
    • Respanse Code: 200

      Body:

      {
          "task_id": "02d636f0-bddc-4c40-a389-4c25d103453f"
      }

Get task status

  • URL GET /anime/status/<task_id>

  • Header

    Key Value Required
    Authorization PRE-SHARED-TOKEN Required
  • Url Params

    • task_id Required
      string
      Task id responsed from /anime/create
  • Respponse

    • status
      dict
      Tasks status
    • success
      bool
      Whole task are success or not
  • Example

    • Request

      curl --location --request GET 'http://127.0.0.1:5000/anime/status/02d636f0-bddc-4c40-a389-4c25d103453f' \
      --header 'Authorization: PRE-SHARED-TOKEN'
    • Respanse Code: 200

      Body:

      {
          "status": {
              "1080p": "STARTED",
              "480p": "PENDING",
              "1080p_uspp": "FAILURE",
              "2160p": "SUCCESS"
          },
          "result": {
              "1080p": {
                  "log": "LOGS HERE",
                  "paraent_task_id": "02d636f0-bddc-4c40-a389-4c25d103453f",
                  "playlist_path": "2/MQ==/playlist_h264_1080p_uspp.m3u8",
                  "resolution": "1080",
                  "status": "FAILURE"
              }
              ...
          },
          "success": false,
          "task_id": "02d636f0-bddc-4c40-a389-4c25d103453f"
      }