This commit is contained in:
EillesWan 2023-04-29 21:32:16 +08:00
commit 5d48fcd96a
6 changed files with 260 additions and 263 deletions

View File

@ -81,7 +81,7 @@ class NotDefineTempoError(MidiFormatException):
class ChannelOverFlowError(MidiFormatException): class ChannelOverFlowError(MidiFormatException):
"""一个midi中含有过多的通道""" """一个midi中含有过多的通道"""
def __init__(self, max_channel = 16, *args): def __init__(self, max_channel=16, *args):
"""一个midi中含有过多的通道""" """一个midi中含有过多的通道"""
super().__init__("含有过多的通道(数量应≤{}".format(max_channel), *args) super().__init__("含有过多的通道(数量应≤{}".format(max_channel), *args)

View File

@ -20,17 +20,17 @@ Copyright © 2023 all the developers of Musicreater
Terms & Conditions: ../License.md Terms & Conditions: ../License.md
""" """
import mido
import brotli
import json import json
import uuid
import shutil import shutil
import uuid
from typing import TypeVar, Union
import brotli
import mido
from .utils import *
from .exceptions import * from .exceptions import *
from .instConstants import * from .instConstants import *
from .utils import *
from typing import TypeVar, Union
T = TypeVar("T") # Declare type variable T = TypeVar("T") # Declare type variable
VM = TypeVar("VM", mido.MidiFile, None) # void mido VM = TypeVar("VM", mido.MidiFile, None) # void mido
@ -1744,11 +1744,11 @@ class midiConvert:
del struct_a, pgb_struct del struct_a, pgb_struct
index_file.write( index_file.write(
f"structure load {self.mid_file_name}_reset ~{pgbSize[0]+2} ~ ~1\n" f"structure load {self.mid_file_name}_reset ~{pgbSize[0] + 2} ~ ~1\n"
) )
index_file.write( index_file.write(
f"structure load {self.mid_file_name}_main ~{pgbSize[0]+2} ~1 ~1\n" f"structure load {self.mid_file_name}_main ~{pgbSize[0] + 2} ~1 ~1\n"
) )
else: else:

View File

@ -1,6 +1,6 @@
import math import math
import os import os
from typing import Union
from TrimMCStruct import Structure, Block, TAG_Long, TAG_Byte from TrimMCStruct import Structure, Block, TAG_Long, TAG_Byte
bdx_key = { bdx_key = {
@ -280,6 +280,7 @@ def form_repeater_in_NBT_struct(
}, },
) )
def form_command_block_in_NBT_struct( def form_command_block_in_NBT_struct(
command: str, command: str,
coordinate: tuple, coordinate: tuple,
@ -372,6 +373,7 @@ def form_command_block_in_NBT_struct(
compability_version=17959425, compability_version=17959425,
) )
def commands_to_structure( def commands_to_structure(
commands: list, commands: list,
max_height: int = 64, max_height: int = 64,
@ -452,4 +454,3 @@ def commands_to_structure(
), ),
(now_x, now_y, now_z), (now_x, now_y, now_z),
) )

View File

@ -1,30 +1,22 @@
import shutil import shutil
import os import os
from rich.console import Console
from rich.progress import track
console = Console()
# find the full path of .egg-info folder def main():
egg_info = [i for i in os.listdir() if i.endswith(".egg-info")][0] with console.status("Find the full path of .egg-info folder"):
print(egg_info) egg_info: list = []
for file in os.listdir():
if os.path.isfile(file) and file.endswith(".egg-info"):
egg_info.append(file)
console.print(file)
for file in track(["build", "dist", "logs", *egg_info], description="Deleting files"):
if os.path.isdir(file) and os.access(file, os.W_OK):
shutil.rmtree(file)
# remove build, dist, logs, TrimLog.egg-info folders
try:
shutil.rmtree("build")
except FileNotFoundError:
pass
try: if __name__ == "__main__":
shutil.rmtree("dist") main()
except FileNotFoundError:
pass
try:
shutil.rmtree(egg_info)
except FileNotFoundError:
pass
try:
shutil.rmtree("logs")
except FileNotFoundError:
pass
print("Cleaned up!")

View File

@ -1,3 +1,3 @@
python setup.py sdist bdist_wheel python -m build
python -m twine upload dist/* python -m twine upload dist/*
python clean_update.py python clean_update.py

4
upload.sh Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
python -m build
python -m twine upload dist/*
python clean_update.py