milmilmilmil
API 參考

Library Rename

Template-driven rename plans, application, undo and history per library

PATCH
/api/v1/libraries/{id}/rename-config

Sets the Go-style template used by /rename/preview and the boolean auto flag that controls whether scans auto-apply renames. The template is compiled before saving; an invalid template returns 400.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

curl -X PATCH "https://example.com/api/v1/libraries/string/rename-config" \  -H "Content-Type: application/json" \  -d '{}'
Empty
POST
/api/v1/libraries/{id}/rename/apply

Renames each entry whose Status is ok, records a rename_history batch, and updates media_files.path rows. Skipped/error entries are counted but don't block the batch.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/libraries/string/rename/apply" \  -H "Content-Type: application/json" \  -d '{    "plans": [      {        "media_file_id": "string",        "old_path": "string",        "new_path": "string",        "status": "ok"      }    ]  }'
{  "batch_id": "string",  "applied": 0,  "skipped": 0,  "errors": [    "string"  ]}
GET
/api/v1/libraries/{id}/rename/history

Returns up to 50 recent rename batches with row counts and reverted counts.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Path Parameters

id*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/libraries/string/rename/history"
[  {    "batch_id": "string",    "applied_at": "2019-08-24T14:15:22Z",    "row_count": 0,    "reverted_count": 0  }]
GET
/api/v1/libraries/{id}/rename/preview

Renders the library's current rename template against each media file (optionally scoped to one anime via anime_id), classifying each entry as ok/skip-same/skip-collision/error. Performs no I/O beyond stat probes for collision detection.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Path Parameters

id*string

Query Parameters

anime_id?string

Restrict the plan to one anime; omit for the whole library

Response Body

application/json

curl -X GET "https://example.com/api/v1/libraries/string/rename/preview"
{  "plans": [    {      "media_file_id": "string",      "old_path": "string",      "new_path": "string",      "status": "ok",      "error": "string"    }  ]}
POST
/api/v1/libraries/{id}/rename/undo

Looks up the batch by id, ensures it belongs to this library, and renames each un-reverted entry back to its old path. Rows whose target file no longer exists on disk are skipped.

Authorization

bearerAuth
AuthorizationBearer <token>

Pass an API token obtained from POST /api/v1/auth/login or POST /api/v1/api-tokens. Tokens have the prefix mlml_.

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/api/v1/libraries/string/rename/undo" \  -H "Content-Type: application/json" \  -d '{    "batch_id": "string"  }'
{  "reverted": 0,  "skipped": 0,  "errors": [    "string"  ]}