Organize Files
Use moviepilot_api for every MoviePilot business operation. Retired file,
recognition, transfer, and history tools are not available.
Workflow
- Establish scope. If the user provides a path, use it. If they identify a
downloader task, use
downloader-operationand its fixedscripts/mp-downloader.pyhelper to discover the instance and calltasks.list. If they only name a configured root, callstorage.settings. Usestorage.listto inspect the selected directory. Do not process a broad shared root without an explicit, bounded scope. - Classify files into movie, TV, one music recording, one complete album, subtitle/sidecar, or unrelated content. Do not group unrelated media merely because they share a directory.
- Call
media.recognizewith the representative title or path. If uncertain, callmedia.search; if several exact candidates remain, useask_user_choice. Never invent or translate an ID. - Preserve the exact
media_source+media_id. For TV, verify season detail withmedia.detailwhen numbering is ambiguous. For music, a recording is one track, an album is one multi-track directory, and an artist is browse-only. - When duplicate risk matters, call
library.exists. If an existing transfer record affects reorganization, inspecttransfer.history. - Before a state-changing transfer, summarize the source, target identity, media type, season/music entity, storage, and mode. Continue only when the user's request already authorizes that exact action or after confirmation.
- Call
transfer.fileonce per verified unit. For an album, transfer the album directory once only after its supported audio-file count is consistent with the selected album detail. - If requested, call
media.scrapeafter a successful transfer. Report actual tag, cover, and lyrics counts; never assume all lyrics were found.
Structured Calls
- Directory listing:
storage.listwith storage/path/paging/sort inbody. - Recognition:
media.recognizewith title/path inquery. - Search:
media.searchwith title/type/source constraints inquery. - Detail:
media.detailwithpath_params.media_idand identity/type inquery. - Library check:
library.existswith the exact identity inquery. - Transfer:
transfer.filewith the manual-transfer request inbody. - Actual transfer responses include
data.itemseven when the batch reports failure. Inspect every item'sstate:acceptedandretry_waitmean that background work remains; onlycompletedconfirms execution and settlement.manual_reviewrequires resolving the task in the transfer queue first;failedandskippeddo not mean imported. Do not resubmit an entire batch that already contains accepted or completed items. Preview responses remain planning data and do not contain execution states. - Scrape:
media.scrapewithpath_params.storage, file item inbody, and exact identity/type fields inquery.
Stop and report instead of transferring when the source is missing, directory configuration is absent, identity remains ambiguous, an album appears mixed or incomplete, or the requested target would overwrite unrelated media.

