mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2026-04-17 14:22:42 +00:00
完成 Midi 导入插件移植
This commit is contained in:
70
examples/exp_importdata_plugin.py
Normal file
70
examples/exp_importdata_plugin.py
Normal file
@@ -0,0 +1,70 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
示例插件:导入音符数据
|
||||
"""
|
||||
|
||||
"""
|
||||
版权所有 © 2026 金羿
|
||||
Copyright © 2026 Eilles
|
||||
"""
|
||||
|
||||
# 睿乐组织 开发交流群 861684859
|
||||
# Email TriM-Organization@hotmail.com
|
||||
|
||||
"""
|
||||
本示例模块开放授权,本文件已开放至公共领域。
|
||||
请注意:
|
||||
若是对本文件的直接转载(在形式上没有修改、增删、添加注释,或单纯修改排版、翻译、录屏、截图)
|
||||
则该使用者需要在转载所及之处,明确在转载的内容开头标注本文之原始著作权人
|
||||
在当前文件下,该原始著作权人为金羿(Eilles)
|
||||
如果是对本文进行了一定程度上的修改和补充、或者以不同方式演绎本文件(如制成视频教程等)
|
||||
则无需标注原作者,允许该使用者自行署名
|
||||
|
||||
本声明仅限于包含此声明的本文件,本声明与项目内其他文件无关。
|
||||
"""
|
||||
|
||||
from typing import BinaryIO
|
||||
from pathlib import Path
|
||||
from dataclasses import dataclass
|
||||
|
||||
from Musicreater import SingleMusic
|
||||
from Musicreater.plugins import (
|
||||
music_input_plugin,
|
||||
PluginConfig,
|
||||
PluginMetaInformation,
|
||||
PluginTypes,
|
||||
MusicInputPluginBase,
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ExampleImportConfig(PluginConfig):
|
||||
example_config_item3: bool
|
||||
example_config_item1: str = "example_config_item"
|
||||
example_config_item2: int = 0
|
||||
|
||||
|
||||
@music_input_plugin("something_convert_to_music")
|
||||
class ExampleImportPlugin(MusicInputPluginBase):
|
||||
metainfo = PluginMetaInformation(
|
||||
name="示例导入插件",
|
||||
author="金羿",
|
||||
description="这是一个示例导入插件",
|
||||
version=(0, 0, 1),
|
||||
type=PluginTypes.FUNCTION_MUSIC_IMPORT,
|
||||
license="The Unlicense",
|
||||
dependencies=("something_convertion_library")
|
||||
)
|
||||
|
||||
supported_formats = ("EXP", "example_format")
|
||||
|
||||
def loadbytes(
|
||||
self, bytes_buffer_in: BinaryIO, config: ExampleImportConfig
|
||||
) -> "SingleMusic":
|
||||
return SingleMusic()
|
||||
|
||||
def load(
|
||||
self, file_path: Path, config: ExampleImportConfig
|
||||
) -> "SingleMusic":
|
||||
return SingleMusic()
|
||||
Reference in New Issue
Block a user