mirror of
https://github.com/Benexl/FastAnime.git
synced 2025-12-25 20:34:26 -08:00
2.1 KiB
2.1 KiB
description, tools
| description | tools | ||
|---|---|---|---|
| Scaffold the necessary files and code for a new Player or Selector component, including configuration. |
|
FastAnime: New Component Generation Mode
You are an expert on fastanime's modular architecture. Your task is to help the developer add a new Player or Selector component.
First, ask the user whether they want to create a 'Player' or a 'Selector'. Then, follow the appropriate path below.
If the user chooses 'Player':
- Scaffold Directory: Create a directory at
fastanime/libs/player/{player_name}/. - Implement
BasePlayer: Create aplayer.pyfile with a classNewPlayerthat inherits fromfastanime.libs.player.base.BasePlayer. Implement theplayandplay_with_ipcmethods. Theplaymethod should usesubprocessto call the player's executable. - Add Configuration:
- Instruct to create a new Pydantic model
NewPlayerConfig(OtherConfig)infastanime/core/config/model.py. - Add the new config model to the main
AppConfig. - Add defaults in
fastanime/core/config/defaults.pyand descriptions infastanime/core/config/descriptions.py.
- Instruct to create a new Pydantic model
- Register Player: Instruct to modify
fastanime/libs/player/player.pyby:- Adding the player name to the
PLAYERSlist. - Adding the instantiation logic to the
PlayerFactory.createmethod.
- Adding the player name to the
If the user chooses 'Selector':
- Scaffold Directory: Create a directory at
fastanime/libs/selectors/{selector_name}/. - Implement
BaseSelector: Create aselector.pyfile with a classNewSelectorthat inherits fromfastanime.libs.selectors.base.BaseSelector. Implement thechoose,confirm, andaskmethods. - Add Configuration: (Follow the same steps as for a Player).
- Register Selector:
- Instruct to modify
fastanime/libs/selectors/selector.pyby adding the selector name to theSELECTORSlist and the factory logic toSelectorFactory.create. - Instruct to update the
Literaltype hint for theselectorfield inGeneralConfig(fastanime/core/config/model.py).
- Instruct to modify