fabricatio 0.5.0.dev0__tar.gz → 0.5.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/.github/workflows/build-package.yaml +3 -2
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/PKG-INFO +1 -1
- fabricatio-0.5.0.dev1/examples/yue/compose.py +32 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/pyproject.toml +1 -1
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/fabricatio_yue/capabilities/genre.py +37 -6
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/fabricatio_yue/capabilities/lyricize.py +12 -1
- fabricatio-0.5.0.dev1/packages/fabricatio-yue/python/fabricatio_yue/models/segment.py +134 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/pyproject.toml +1 -1
- fabricatio-0.5.0.dev1/uv.lock +2696 -0
- fabricatio-0.5.0.dev0/packages/fabricatio-yue/python/fabricatio_yue/models/segment.py +0 -72
- fabricatio-0.5.0.dev0/uv.lock +0 -2696
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/.github/workflows/ruff.yaml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/.github/workflows/tests.yaml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/.readthedocs.yaml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/Cargo.lock +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/Cargo.toml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/LICENSE +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/Makefile +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/README.md +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/assets/band.png +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/assets/logo/16.svg +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/assets/logo/400.svg +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/assets/logo/64.svg +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/docs/Makefile +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/docs/source/conf.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/docs/source/configuration.rst +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/docs/source/contributing.rst +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/docs/source/development.rst +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/docs/source/index.rst +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/docs/source/installation.rst +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/docs/source/usage.rst +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/anki_deck/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/anki_deck/deck_gen.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/correct/correct.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/correct/correct_loop.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/extract_and_inject/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/extract_and_inject/article_rag.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/extract_and_inject/ask.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/extract_and_inject/chunk_article.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/extract_and_inject/extract_and_inject.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/extract_article/extract.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/llm_usages/llm_usage.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/make_a_rating/rating.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/make_diary/commits.json +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/make_diary/diary.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/minor/hello_fabricatio.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/minor/write_a_poem.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/propose_task/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/propose_task/propose.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/reviewer/censor.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/reviewer/review.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/rules/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/rules/draft_ruleset.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/search_bibtex/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/search_bibtex/search.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/simple_chat/chat.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/simple_rag/simple_rag.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/task_handle/handle_task.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/write_article/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/write_article/article_rag.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/write_article/post_process.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/write_article/write_article.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/write_outline/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/write_outline/write_outline.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/examples/write_outline/write_outline_corrected.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/extra/scripts/tdown +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-actions/LICENSE +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-actions/README.md +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-actions/pyproject.toml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-actions/python/fabricatio_actions/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-actions/python/fabricatio_actions/actions/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-actions/python/fabricatio_actions/actions/fs.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-actions/python/fabricatio_actions/actions/output.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-actions/python/fabricatio_actions/models/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-actions/python/fabricatio_actions/models/generic.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-actions/python/fabricatio_actions/py.typed +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/LICENSE +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/README.md +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/pyproject.toml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/python/fabricatio_digest/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/python/fabricatio_digest/actions/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/python/fabricatio_digest/capabilities/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/python/fabricatio_digest/capabilities/digest.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/python/fabricatio_digest/config.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/python/fabricatio_digest/models/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/python/fabricatio_digest/models/tasklist.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/python/fabricatio_digest/py.typed +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/python/fabricatio_digest/workflows/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-digest/python/tests/tests.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/LICENSE +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/README.md +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/pyproject.toml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/actions/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/capabilities/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/capabilities/correct.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/capabilities/review.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/config.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/models/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/models/improve.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/models/kwargs_types.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/models/problem.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/py.typed +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-improve/python/fabricatio_improve/workflows/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-judge/LICENSE +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-judge/README.md +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-judge/pyproject.toml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-judge/python/fabricatio_judge/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-judge/python/fabricatio_judge/capabilities/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-judge/python/fabricatio_judge/capabilities/advanced_judge.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-judge/python/fabricatio_judge/models/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-judge/python/fabricatio_judge/models/advanced_judge.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-judge/python/fabricatio_judge/py.typed +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/LICENSE +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/README.md +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/pyproject.toml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/python/fabricatio_question/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/python/fabricatio_question/actions/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/python/fabricatio_question/capabilities/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/python/fabricatio_question/capabilities/questioning.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/python/fabricatio_question/config.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/python/fabricatio_question/models/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/python/fabricatio_question/models/questions.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/python/fabricatio_question/py.typed +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/python/fabricatio_question/workflows/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-question/python/tests/tests.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/LICENSE +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/README.md +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/pyproject.toml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/actions/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/actions/rules.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/capabilities/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/capabilities/censor.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/capabilities/check.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/config.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/models/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/models/kwargs_types.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/models/patch.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/models/rule.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-rule/python/fabricatio_rule/py.typed +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/LICENSE +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/README.md +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/pyproject.toml +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/python/fabricatio_tagging/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/python/fabricatio_tagging/actions/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/python/fabricatio_tagging/capabilities/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/python/fabricatio_tagging/capabilities/tagging.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/python/fabricatio_tagging/config.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/python/fabricatio_tagging/models/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/python/fabricatio_tagging/py.typed +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/python/fabricatio_tagging/workflows/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-tagging/python/tests/tests.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/.gitignore +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/LICENSE +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/README.md +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/fabricatio_yue/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/fabricatio_yue/actions/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/fabricatio_yue/capabilities/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/fabricatio_yue/config.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/fabricatio_yue/models/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/fabricatio_yue/py.typed +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/fabricatio_yue/top_200_tags.json +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/fabricatio_yue/workflows/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/packages/fabricatio-yue/python/tests/tests.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/python/fabricatio/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/python/fabricatio/actions/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/python/fabricatio/capabilities/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/python/fabricatio/models/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/python/fabricatio/py.typed +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/python/fabricatio/toolboxes/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/python/fabricatio/toolboxes/arithmetic.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/python/fabricatio/toolboxes/fs.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/python/fabricatio/workflows/__init__.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/python/tests/test_minor_integration.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/src/bin/tdown.rs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/src/lib.rs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/subpackages.py +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/as_prompt.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/binary-exploitation-ctf-solver.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/chap_summary.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/check_string.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/claude-xml.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/clean-up-code.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/co_validation.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/code_string.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/create_json_obj.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/cryptography-ctf-solver.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/dependencies.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/digest.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/dispatch_task.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/document-the-code.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/draft_rating_criteria.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/draft_rating_manual.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/draft_rating_weights_klee.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/draft_tool_usage_code.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/extract.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/extract_criteria_from_reasons.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/extract_reasons_from_examples.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/find-security-vulnerabilities.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/fix-bugs.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/fix_troubled_obj.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/fix_troubled_string.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/generate_anki_card_back_side.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/generate_anki_card_front_side.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/generate_anki_card_template.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/generate_anki_card_template_generation_requirements.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/generate_anki_deck_metadata.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/generate_anki_model_generation_requirements.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/generate_anki_model_name.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/generic_string.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/improve-performance.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/liststr.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/lyricize.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/make_choice.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/make_judgment.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/mapping.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/pathstr.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/rate_fine_grind.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/refactor.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/refined_query.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/research_content_summary.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/retrieved_display.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/reverse-engineering-ctf-solver.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/review_string.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/rule_requirement.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/ruleset_requirement_breakdown.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/select_genre.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/selection.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/tagging.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/task_briefing.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/web-ctf-solver.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/write-git-commit.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/write-github-pull-request.hbs +0 -0
- {fabricatio-0.5.0.dev0 → fabricatio-0.5.0.dev1}/templates/built-in/write-github-readme.hbs +0 -0
@@ -70,7 +70,7 @@ jobs:
|
|
70
70
|
|
71
71
|
|
72
72
|
create-release:
|
73
|
-
if: needs.determine_changes.outputs.version_changed == 'true'
|
73
|
+
if: needs.determine_changes.outputs.version_changed == 'true' && github.event_name != 'pull_request'
|
74
74
|
name: Create Release
|
75
75
|
needs: determine_changes
|
76
76
|
runs-on: ubuntu-latest
|
@@ -124,7 +124,7 @@ jobs:
|
|
124
124
|
uv sync --no-install-project --only-dev --index https://pypi.org/simple -p ${{ matrix.python-version }}
|
125
125
|
|
126
126
|
- name: Upload to PyPI
|
127
|
-
if: needs.determine_changes.outputs.version_changed == 'true'
|
127
|
+
if: needs.determine_changes.outputs.version_changed == 'true' && github.event_name != 'pull_request'
|
128
128
|
run: |
|
129
129
|
make publish PY=${{ matrix.python-version }}
|
130
130
|
env:
|
@@ -134,6 +134,7 @@ jobs:
|
|
134
134
|
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
135
135
|
|
136
136
|
- name: Upload assets
|
137
|
+
if: github.event_name != 'pull_request'
|
137
138
|
uses: softprops/action-gh-release@v2
|
138
139
|
with:
|
139
140
|
tag_name: ${{ needs.determine_changes.outputs.current_version }}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"""Example of using the library."""
|
2
|
+
|
3
|
+
from pathlib import Path
|
4
|
+
|
5
|
+
from fabricatio import Action, Event, Role, Task, WorkFlow
|
6
|
+
from fabricatio.capabilities import Lyricize
|
7
|
+
from fabricatio_core.utils import ok
|
8
|
+
from fabricatio_yue.models.segment import Song
|
9
|
+
|
10
|
+
|
11
|
+
class Compose(Action, Lyricize):
|
12
|
+
"""Compose a song."""
|
13
|
+
|
14
|
+
async def _execute(self, req: str, output: Path, **cxt) -> Song:
|
15
|
+
return ok(await self.lyricize(req)).save_to(output)
|
16
|
+
|
17
|
+
|
18
|
+
(
|
19
|
+
Role()
|
20
|
+
.register_workflow(Event.quick_instantiate(ns := "generate_deck"), WorkFlow(steps=(Compose().to_task_output(),)))
|
21
|
+
.dispatch()
|
22
|
+
)
|
23
|
+
|
24
|
+
generated_song: Song = ok(
|
25
|
+
Task(name="gen deck")
|
26
|
+
.update_init_context(
|
27
|
+
req="Write a folk-rock song about finding hope in difficult times, with verses about struggle and a uplifting "
|
28
|
+
"chorus about perseverance. Include bridge section with introspective lyrics.",
|
29
|
+
output="here",
|
30
|
+
)
|
31
|
+
.delegate_blocking(ns)
|
32
|
+
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "fabricatio-yue"
|
3
|
-
version = "0.1.0-
|
3
|
+
version = "0.1.0-dev10"
|
4
4
|
description = "An extension of fabricatio, provide capability to compose lyrics that can be used in music generation with YuE."
|
5
5
|
readme = "README.md"
|
6
6
|
license = { file = "LICENSE" }
|
@@ -3,6 +3,7 @@
|
|
3
3
|
from typing import List, Unpack, overload
|
4
4
|
|
5
5
|
from fabricatio_core import TEMPLATE_MANAGER
|
6
|
+
from fabricatio_core.journal import logger
|
6
7
|
from fabricatio_core.models.kwargs_types import ValidateKwargs
|
7
8
|
from fabricatio_core.models.usages import LLMUsage
|
8
9
|
from more_itertools import flatten
|
@@ -79,16 +80,20 @@ class SelectGenre(LLMUsage):
|
|
79
80
|
For multiple requirements: List where each element is either a list of genres or None.
|
80
81
|
"""
|
81
82
|
if isinstance(requirement, str):
|
82
|
-
|
83
|
+
logger.debug("Processing single requirement")
|
84
|
+
result = await self.alist_str(
|
83
85
|
TEMPLATE_MANAGER.render_template(
|
84
86
|
yue_config.select_genre_template,
|
85
87
|
{"requirement": requirement, "genre_classifier": genre_classifier, "genres": genres},
|
86
88
|
),
|
87
89
|
**kwargs,
|
88
90
|
)
|
91
|
+
logger.debug(f"Selected genres for single requirement: {result}")
|
92
|
+
return result
|
89
93
|
if isinstance(requirement, list):
|
94
|
+
logger.debug(f"Processing {len(requirement)} requirements")
|
90
95
|
# Handle list of requirements
|
91
|
-
|
96
|
+
result = await self.alist_str(
|
92
97
|
TEMPLATE_MANAGER.render_template(
|
93
98
|
yue_config.select_genre_template,
|
94
99
|
[
|
@@ -98,7 +103,12 @@ class SelectGenre(LLMUsage):
|
|
98
103
|
),
|
99
104
|
**kwargs,
|
100
105
|
)
|
101
|
-
|
106
|
+
logger.debug(f"Selected genres for multiple requirements: {result}")
|
107
|
+
return result
|
108
|
+
|
109
|
+
error_msg = f"requirement must be str or List[str], got {type(requirement)}"
|
110
|
+
logger.error(error_msg)
|
111
|
+
raise TypeError(error_msg)
|
102
112
|
|
103
113
|
@overload
|
104
114
|
async def gather_genres(
|
@@ -154,6 +164,9 @@ class SelectGenre(LLMUsage):
|
|
154
164
|
"""
|
155
165
|
import asyncio
|
156
166
|
|
167
|
+
logger.debug(f"Gathering genres for requirements: {requirements}")
|
168
|
+
logger.debug(f"Available genre categories: {list(yue_config.genre.keys())}")
|
169
|
+
|
157
170
|
async def gather_for_single_requirement(req: str) -> List[str] | None:
|
158
171
|
"""Gather genres for a single requirement from all categories.
|
159
172
|
|
@@ -163,19 +176,37 @@ class SelectGenre(LLMUsage):
|
|
163
176
|
Returns:
|
164
177
|
List[str] | None: A list of selected genres from all categories, or None if no genres are found.
|
165
178
|
"""
|
179
|
+
logger.debug(f"Gathering genres for single requirement: {req}")
|
180
|
+
|
166
181
|
results = await asyncio.gather(
|
167
182
|
*[
|
168
183
|
self.select_genre(req, genre_classifier, genres, **kwargs)
|
169
184
|
for genre_classifier, genres in yue_config.genre.items()
|
170
185
|
]
|
171
186
|
)
|
187
|
+
|
188
|
+
logger.debug(f"Raw results from genre selection: {results}")
|
189
|
+
|
172
190
|
# Flatten the results from all genre categories, filtering out any None responses
|
173
191
|
selected_genres = list(flatten(result for result in results if result))
|
174
|
-
|
192
|
+
|
193
|
+
logger.debug(f"Flattened selected genres: {selected_genres}")
|
194
|
+
|
195
|
+
final_result = selected_genres if selected_genres else None
|
196
|
+
logger.debug(f"Final result for requirement '{req}': {final_result}")
|
197
|
+
|
198
|
+
return final_result
|
175
199
|
|
176
200
|
if isinstance(requirements, str):
|
201
|
+
logger.debug("Processing single requirement string")
|
177
202
|
return await gather_for_single_requirement(requirements)
|
178
203
|
if isinstance(requirements, list):
|
204
|
+
logger.debug(f"Processing {len(requirements)} requirement strings")
|
179
205
|
tasks = [gather_for_single_requirement(req) for req in requirements]
|
180
|
-
|
181
|
-
|
206
|
+
result = await asyncio.gather(*tasks)
|
207
|
+
logger.debug(f"Results for all requirements: {result}")
|
208
|
+
return result
|
209
|
+
|
210
|
+
error_msg = f"requirements must be str or List[str], got {type(requirements)}"
|
211
|
+
logger.error(error_msg)
|
212
|
+
raise TypeError(error_msg)
|
@@ -4,6 +4,7 @@ from typing import List, Unpack, overload
|
|
4
4
|
|
5
5
|
from fabricatio_core import TEMPLATE_MANAGER
|
6
6
|
from fabricatio_core.capabilities.propose import Propose
|
7
|
+
from fabricatio_core.journal import logger
|
7
8
|
from fabricatio_core.models.kwargs_types import ValidateKwargs
|
8
9
|
from fabricatio_core.utils import ok, override_kwargs
|
9
10
|
|
@@ -58,6 +59,7 @@ class Lyricize(Propose, SelectGenre):
|
|
58
59
|
Returns:
|
59
60
|
Song | None | List[Song | None]: Generated lyrics as Song object, list of Song objects, or None based on input type
|
60
61
|
"""
|
62
|
+
logger.debug(f"Lyricizing requirements: {requirement}")
|
61
63
|
okwargs = override_kwargs(kwargs, default=None)
|
62
64
|
|
63
65
|
async def lyricize_single(req: str) -> Song | None:
|
@@ -69,20 +71,29 @@ class Lyricize(Propose, SelectGenre):
|
|
69
71
|
Returns:
|
70
72
|
Song | None: A Song object containing generated lyrics and metadata, or None if generation fails.
|
71
73
|
"""
|
74
|
+
logger.debug(f"Processing single lyricize requirement: {req}")
|
72
75
|
genres = ok(await self.gather_genres(req, **okwargs))
|
76
|
+
logger.debug(f"Gathered genres for requirement: {genres}")
|
77
|
+
|
73
78
|
prompt = TEMPLATE_MANAGER.render_template(
|
74
79
|
yue_config.lyricize_template,
|
75
80
|
{"requirement": req, "genres": genres, "section_types": yue_config.segment_types},
|
76
81
|
)
|
82
|
+
logger.debug(f"Generated prompt for lyricize: {prompt}")
|
83
|
+
|
77
84
|
return await self.propose(Song, prompt, **kwargs)
|
78
85
|
|
79
86
|
if isinstance(requirement, str):
|
87
|
+
logger.debug("Processing single requirement string")
|
80
88
|
return await lyricize_single(requirement)
|
81
89
|
|
82
90
|
if isinstance(requirement, list):
|
91
|
+
logger.debug(f"Processing {len(requirement)} requirement strings")
|
83
92
|
import asyncio
|
84
93
|
|
85
94
|
tasks = [lyricize_single(req) for req in requirement]
|
86
95
|
return await asyncio.gather(*tasks)
|
87
96
|
|
88
|
-
|
97
|
+
error_msg = f"Invalid requirement type: {type(requirement)}. Expected str or List[str]."
|
98
|
+
logger.error(error_msg)
|
99
|
+
raise TypeError(error_msg)
|
@@ -0,0 +1,134 @@
|
|
1
|
+
"""Models for representing song segments and complete songs.
|
2
|
+
|
3
|
+
This module provides the data structures for working with songs and their
|
4
|
+
component segments in the Fabricatio YUE system. Songs are composed of
|
5
|
+
multiple segments, each with their own properties like duration, genre tags,
|
6
|
+
and lyrics.
|
7
|
+
"""
|
8
|
+
|
9
|
+
from pathlib import Path
|
10
|
+
from typing import List, Self
|
11
|
+
|
12
|
+
from fabricatio_core import logger
|
13
|
+
from fabricatio_core.models.generic import SketchedAble, WithBriefing
|
14
|
+
from pydantic import NonNegativeInt, PrivateAttr
|
15
|
+
|
16
|
+
|
17
|
+
class Segment(SketchedAble):
|
18
|
+
"""Represents a segment of a song with its attributes."""
|
19
|
+
|
20
|
+
section_type: str
|
21
|
+
"""Type of section."""
|
22
|
+
|
23
|
+
duration: NonNegativeInt
|
24
|
+
"""Duration of the segment in seconds"""
|
25
|
+
lyrics: List[str]
|
26
|
+
"""Lyrics for this segment as a list of lines"""
|
27
|
+
_extra_genres: List[str] = PrivateAttr(default_factory=list)
|
28
|
+
"""Additional genre tags for this segment"""
|
29
|
+
|
30
|
+
def override_extra_genres(self, genres: List[str]) -> Self:
|
31
|
+
"""Override the genre tags for this segment.
|
32
|
+
|
33
|
+
Args:
|
34
|
+
genres (List[str]): New list of genre tags
|
35
|
+
"""
|
36
|
+
self._extra_genres = genres
|
37
|
+
return self
|
38
|
+
|
39
|
+
@property
|
40
|
+
def extra_genres(self) -> List[str]:
|
41
|
+
"""Get the additional genre tags for this segment.
|
42
|
+
|
43
|
+
Returns:
|
44
|
+
List[str]: List of genre tags
|
45
|
+
"""
|
46
|
+
return self._extra_genres
|
47
|
+
|
48
|
+
@property
|
49
|
+
def assemble(self) -> str:
|
50
|
+
"""Assemble the segment into a formatted string representation.
|
51
|
+
|
52
|
+
Returns:
|
53
|
+
str: A formatted string with section type header and lyrics
|
54
|
+
"""
|
55
|
+
return f"[{self.section_type}]\n" + "\n".join(self.lyrics) + "\n"
|
56
|
+
|
57
|
+
|
58
|
+
class Song(SketchedAble, WithBriefing):
|
59
|
+
"""Represents a complete song with its attributes and segments."""
|
60
|
+
|
61
|
+
genres: List[str]
|
62
|
+
"""Primary genre classifications for the entire song"""
|
63
|
+
segments: List[Segment]
|
64
|
+
"""Ordered list of segments that compose the song"""
|
65
|
+
|
66
|
+
@property
|
67
|
+
def duration(self) -> NonNegativeInt:
|
68
|
+
"""Total duration of the song in seconds.
|
69
|
+
|
70
|
+
Calculated by summing the durations of all segments in the song.
|
71
|
+
|
72
|
+
Returns:
|
73
|
+
NonNegativeInt: The total duration in seconds
|
74
|
+
"""
|
75
|
+
return sum(segment.duration for segment in self.segments)
|
76
|
+
|
77
|
+
def override_genres(self, genres: List[str]) -> Self:
|
78
|
+
"""Override the primary genre tags for the entire song.
|
79
|
+
|
80
|
+
Args:
|
81
|
+
genres (List[str]): New list of genre tags
|
82
|
+
"""
|
83
|
+
self.genres.clear()
|
84
|
+
self.genres.extend(genres)
|
85
|
+
return self
|
86
|
+
|
87
|
+
@property
|
88
|
+
def briefing(self) -> str:
|
89
|
+
"""Generate a briefing of the song including its genre tags and duration."""
|
90
|
+
return f"# {self.name}\n>{self.description}\n\nDuration: {self.duration} s.\n\n{self.block(" ".join(self.genres), 'genres')} \n\n---\n"
|
91
|
+
|
92
|
+
def save_to(self, parent_dir: str | Path) -> Self:
|
93
|
+
"""Save the song to a directory.
|
94
|
+
|
95
|
+
Args:
|
96
|
+
parent_dir (str): The directory to save the song to
|
97
|
+
"""
|
98
|
+
parent_path = Path(parent_dir)
|
99
|
+
parent_path.mkdir(parents=True, exist_ok=True)
|
100
|
+
|
101
|
+
# Create filename from song name or use default
|
102
|
+
file_path = parent_path / f"{self.name}.md"
|
103
|
+
|
104
|
+
logger.info(f"Saving song to {file_path.as_posix()}")
|
105
|
+
|
106
|
+
out = f"{self.briefing}\n" + "\n".join(f'## Section {i}. {seg.section_type.capitalize()}\n\n{self._wrapp(seg)}' for i,seg in enumerate(self.segments))
|
107
|
+
|
108
|
+
file_path.write_text(out, encoding="utf-8")
|
109
|
+
|
110
|
+
return self
|
111
|
+
|
112
|
+
def _wrapp(self, segment: Segment) -> str:
|
113
|
+
return (
|
114
|
+
f"Duration: {segment.duration} s.\n\n"
|
115
|
+
|
116
|
+
+
|
117
|
+
(f"Extra Genres: {self.block(' '.join(segment.extra_genres), 'genres')}\n"
|
118
|
+
f"Assembled Genres: {self.block(' '.join(self.genres + segment.extra_genres), 'genres')}") if segment.extra_genres else ""
|
119
|
+
+
|
120
|
+
f"Lyrics:{self.block(segment.assemble, 'lyrics')}"
|
121
|
+
)
|
122
|
+
|
123
|
+
@staticmethod
|
124
|
+
def block(content: str, lang: str = "text") -> str:
|
125
|
+
"""Create a markdown code block with the specified language.
|
126
|
+
|
127
|
+
Args:
|
128
|
+
content (str): The content to wrap in the code block
|
129
|
+
lang (str, optional): The language identifier for syntax highlighting. Defaults to 'text'
|
130
|
+
|
131
|
+
Returns:
|
132
|
+
str: A formatted markdown code block
|
133
|
+
"""
|
134
|
+
return f"\n```{lang}\n{content}\n```\n"
|