diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c02afb2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,66 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# OSX useful to ignore +*.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# IntelliJ Idea family of suites +.idea +*.iml +## File-based project format: +*.ipr +*.iws +## mpeltonen/sbt-idea plugin +.idea_modules/ + +# Briefcase build directories +iOS/ +macOS/ +windows/ +android/ +linux/ +django/ diff --git a/Cmd_Msct.py b/Cmd_Msct.py deleted file mode 100644 index b17746e..0000000 --- a/Cmd_Msct.py +++ /dev/null @@ -1,341 +0,0 @@ -# -*- coding: utf-8 -*- - - -# W-YI 金羿 -# QQ 2647547478 -# 音·创 开发交流群 861684859 -# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com -# 版权所有 Team-Ryoun 金羿 -# 若需转载或借鉴 请附作者 - - -# 代码写的并非十分的漂亮,还请大佬多多包涵;本软件源代码依照Apache软件协议公开 - - -import json -import os -import shutil -import threading -import sys - -from msctspt.threadOpera import NewThread -from msctspt.bugReporter import version -from nmcsup.log import log - -__version__ = version.version[1]+version.version[0] -__author__ = 'W-YI (金羿)' - - -log("系统工作————————加载变量及函数") - - -print("更新执行位置...") - -if sys.platform == 'win32': - os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('\\')]) - log("更新执行位置,当前文件位置"+__file__) -else: - try: - os.chdir(__file__[:len(__file__) - - __file__[len(__file__)::-1].index('/')]) - except: - pass - log("其他平台:"+sys.platform+"更新执行位置,当前文件位置"+__file__) -print('完成!') - - -def __main__(): - - print('建立变量,存入内存,载入字典常量函数') - - # 主体部分 - - # 支持多文件同时操作 - - # dataset[{ 'mainset':{ 'x':'y' }, 'musics': [ { 'set' :{ 'A':'B' } , 'note' : [ [ 'a' , b ], ] }, ] }, ] - - # 编辑: - # 修改主设置: dataset[第几个项目]['mainset']['什么设置'] = '设置啥' - # 修改音乐: dataset[第几个项目]['musics'][第几个音轨]['notes'][第几个音符][音符还是时间(0,1)] = 改成啥 - # 修改音轨设置: dataset[第几个项目]['musics'][第几个音轨]['set']['什么设置'] = '设置啥' - # - # 新增音轨: dataset[第几个项目]['musics'].append(datasetmodelpart) - # - ''' - dataset=[ - { - 'mainset':{ - 'PackName':"Ryoun", - 'MusicTitle':'Noname', - 'IsRepeat':False, - 'PlayerSelect':'' - }, - 'musics':[ - { - 'set':{ - 'EntityName':'music_support', - 'ScoreboardName':'music_support', - 'Instrument':'harp', - 'FileName':"Music" - }, - 'notes':[ - [0.0,1.0], - ] - }, - ], - }, - ] - ''' - - global dataset - - dataset = [ - { - 'mainset': { - 'PackName': "Ryoun", - 'MusicTitle': 'Noname', - 'IsRepeat': False, - 'PlayerSelect': '' - }, - 'musics': [ - { - 'set': { - 'EntityName': 'MusicSupport', - 'ScoreboardName': 'MusicSupport', - 'Instrument': 'note.harp', - 'FileName': "Music" - }, - 'notes': [ - [0.0, 1.0], - ] - }, - ], - }, - ] - - global is_new_file - global is_save - global ProjectName - global NowMusic - - is_new_file = True - is_save = True - ProjectName = '' - NowMusic = 0 - - def DMM(): # 反回字典用于编辑 - datasetmodelpart = { - 'set': { - 'EntityName': 'MusicSupport', - 'ScoreboardName': 'MusicSupport', - 'Instrument': 'note.harp', - 'FileName': "Music" - }, - 'notes': [] - } - return datasetmodelpart - - print("完成") - - # 菜单命令 - print('加载菜单命令...') - - def exitapp(cmd): - - log("程序正常退出", False) - global is_save - if is_save == False: - if '/s' in cmd: - saveProject() - else: - print("您尚未保存,请使用 /s 开关保存并退出") - return - - try: - global dataset - del dataset - except: - pass - - if '/c' in cmd: - print("清除log(此句不载入日志)") - try: - if os.path.exists("./log/"): - shutil.rmtree("./log/") - if os.path.exists("./logs/"): - shutil.rmtree("./logs/") - if os.path.exists("./cache/"): - shutil.rmtree("./cache/") - except: - print("无法清除日志及临时文件") - - exit() - - print('退出函数加载完成!') - - print("载入文件读取函数") - - def ReadFile(fn: str) -> list: - from nmcsup.nmcreader import ReadFile as fileRead - k = fileRead(fn) - if k == False: - log("找不到"+fn) - return - else: - return k - - def ReadMidi(midfile: str) -> str: - from nmcsup.nmcreader import ReadMidi as midiRead - k = midiRead(midfile) - if k == False: - log("找不到"+midfile) - return - else: - return k - - print('完成!') - - print("载入命令函数") - - def saveProject(cmd: list): - global is_new_file - if '/a' in cmd: - log("另存项目") - ProjectName = cmd[cmd.index('/a')+1] - else: - if is_new_file: - print("初次存储请使用 /a 开关规定存储文件名") - log("文件为未保存") - return - - log("存储文件:"+ProjectName) - with open(ProjectName, 'w', encoding='utf-8') as f: - json.dump(dataset[0], f) - global is_save - is_save = True - - print('保存项目函数加载完成!') - - def loadMusic(cmd: list): - if '/mid' in cmd: - th = NewThread(ReadMidi, (cmd[cmd.index('/mid')+1],)) - th.start() - - def midiSPT(th): - for i in th.getResult(): - datas = DMM() - datas['notes'] = i - dataset[0]['musics'].append(datas) - del th - global is_save - is_save = False - threading.Thread(target=midiSPT, args=(th,)).start() - del th - elif '/txt' in cmd: - th = NewThread(ReadFile, (cmd[cmd.index('/txt')+1],)) - th.start() - - def midiSPT(th): - for i in th.getResult(): - datas = DMM() - datas['notes'] = i - dataset[0]['musics'].append(datas) - del th - global is_save - is_save = False - threading.Thread(target=midiSPT, args=(th,)).start() - elif '/input' in cmd: - datas = [] - for i in cmd[cmd.index('/input')+1:]: - datas.append([str(i), 1.0]) - from nmcsup.trans import note2list - datat = DMM() - datat['notes'] = note2list(datas) - dataset[0]['musics'].append(datat) - del datas, datat - global is_save - is_save = False - - print('音轨载入函数加载完成!') - - def funBuild(cmd: list): - if '/file' in cmd: - from msctspt.funcOpera import makeFuncFiles - makepath = cmd[cmd.index('/file')+1] - if makepath[-1] != '/': - makepath += '/' - makeFuncFiles(dataset[0], makepath) - elif '/directory' in cmd: - from msctspt.funcOpera import makeFunDir - makepath = cmd[cmd.index('/directory')+1] - if makepath[-1] != '/': - makepath += '/' - makeFunDir(dataset[0], makepath) - elif '/mcpack' in cmd: - import zipfile - from msctspt.funcOpera import makeFunDir - makepath = cmd[cmd.index('/mcpack')+1] - if makepath[-1] != '/': - makepath += '/' - - if not os.path.exists('./temp/'): - os.makedirs('./temp/') - makeFunDir(dataset[0], './temp/') - shutil.move('./temp/'+dataset[0]['mainset']['PackName'] + - "Pack/behavior_packs/"+dataset[0]['mainset']['PackName']+"/functions", './') - shutil.move('./temp/'+dataset[0]['mainset']['PackName'] + "Pack/behavior_packs/" + - dataset[0]['mainset']['PackName']+"/manifest.json", './') - with zipfile.ZipFile(makepath+dataset[0]['mainset']['PackName']+'.mcpack', "w") as zipobj: - for i in os.listdir('./functions/'): - zipobj.write('./functions/'+i) - zipobj.write('./manifest.json') - shutil.move('./functions', './temp/') - shutil.move('./manifest.json', './temp/') - shutil.rmtree("./temp/") - - print("函数建立函数加载完成") - - if sys.platform == 'win32': - os.system("cls") - else: - os.system("clear") - - if sys.platform in ('win32', 'linux'): - print("您当前的运行环境为标准桌面,您可以打开 Musicreater.py 运行窗口模式的 音·创") - print("您也可以输入 win 指令在不退出命令行模式的同时打开窗口模式\n") - - print(__author__+" 音·创 —— 当前核心版本 "+__version__+'\n') - - nowWorkPath = os.path.split(os.path.realpath(__file__))[0] - - while True: - - strcmd = input("MSCT "+nowWorkPath+">") - cmd = strcmd.lower().split(' ') - - if cmd[0] == 'exit': - exitapp(cmd[1:]) - elif cmd[0] == 'save': - saveProject(cmd[1:]) - elif cmd[0] == 'load': - loadMusic(cmd[1:]) - elif cmd[0] == 'win': - def run(cmd): - os.system(cmd) - if sys.platform == 'win32': - NewThread(run, ("python "+os.path.split(os.path.realpath(__file__)) - [0]+"/Musicreater.py",)).start() - else: - NewThread(run, ("python3 "+os.path.split(os.path.realpath(__file__)) - [0]+"/Musicreater.py",)).start() - elif cmd[0] == 'chdir': - nowWorkPath = os.path.realpath(cmd[1]) - os.chdir(nowWorkPath) - elif cmd[0] == 'build': - funBuild(cmd[1:]) - else: - os.system(strcmd) - - -if __name__ == '__main__': - __main__() diff --git a/README.md b/README.md index f3c99b8..0dc5c54 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Musicreater +# 音·创 Musicreater ### 介绍 音·创(Musicreater)是由金羿(W-YI)开发的一款《我的世界》基岩版音乐生成辅助软件 @@ -7,59 +7,39 @@ ### 软件架构 -软件采用Python作为第一语言,目前还没有使用其他语言辅助。现在的图形库是tkinter,后期将使用BeeWare兼容安卓 +软件采用Python作为第一语言,目前还没有使用其他语言辅助。使用BeeWare作为图形库兼容安卓。 -现阶段支持Windows7+,Linux(版本嘛,支持Python3.8就好) +尽量全平台支持 ### 安装教程 -#### Windows7+ +#### Windows -0. [Gitee下载(需要登陆)](https://gitee.com/EillesWan/Musicreater/repository/archive/master.zip) - [Github下载(慢)](https://github.com/EillesWan/Musicreater/archive/refs/heads/master.zip)本程序 -1. 安装Python 3.8.10 - [下载64位安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe) - [下载32位安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe) -2. 以管理员身份运行 补全库.py : - - 按下 Ctrl+Shift+Esc 打开任务管理器 - - 点击 "文件" 菜单中的 运行新任务 命令 - - 输入 `cmd` 并框选 "以管理员身份运行" 按下 "确定" - - 将 "补全库.py" 拖拽入开启的窗口,按下回车 -3. 等待安装完成后,双击运行 Musicreater.py +即将到来。 -#### Linux (测试版本:Kali 2021.4) +#### Linux -0. 若你没有足够优秀的环境,推荐先在终端敲: -```bash -sudo apt-get update -sudo apt-get upgrade -sudo apt-get install python3 -sudo apt-get install python3-pip -sudo apt-get install git -``` -1. 若你足够自信,该整的都整了,就在你想下载此程序的地方打开终端,敲: -```bash -sudo git clone https://gitee.com/EillesWan/Musicreater.git -cd Musicreater -python3 补全库.py -python3 Musicreater.py -``` +即将到来。 +#### Android + +即将到来。 ### 使用说明 1. 直接运行就好 -2. 看得懂简体中文字的不一定全会用 -3. 最好要懂一点点英文 +2. 有不懂的问题来群里问 +3. 请理解英文表述 ### 致谢 1. 感谢由 [Fuckcraft](https://github.com/fuckcraft) “鸣凤鸽子”等 带来的我的世界websocket服务器功能 2. 感谢 昀梦<QQ1515399885> 找出指令生成错误bug并指正 3. 感谢由 Charlie_Ping “查理平” 带来的bdx转换功能 -4. 感谢广大群友为此程序提供的测试等支持 -5. 若您为我找出了错误但您的名字没有显示在此列表中,请联系我! +4. 感谢由 CMA_2401PT 提供的 BDXWorkShop作为.bdx结构的操作指导 +5. 感谢广大群友为此程序提供的测试等支持 +6. 若您为我找出了错误但您的名字没有显示在此列表中,请联系我! ### 作者<金羿>联系方式 diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..e372caa --- /dev/null +++ b/README.rst @@ -0,0 +1,12 @@ +Musicreater +=========== + +**This cross-platform app was generated by** `Briefcase`_ **- part of** +`The BeeWare Project`_. **If you want to see more tools like Briefcase, please +consider** `becoming a financial member of BeeWare`_. + +音·创(Musicreater)是由金羿(W-YI)开发的一款《我的世界》基岩版音乐生成辅助软件 + +.. _`Briefcase`: https://github.com/beeware/briefcase +.. _`The BeeWare Project`: https://beeware.org/ +.. _`becoming a financial member of BeeWare`: https://beeware.org/contributing/membership diff --git a/README_en.md b/README_en.md new file mode 100644 index 0000000..d48a854 --- /dev/null +++ b/README_en.md @@ -0,0 +1,52 @@ +# Musicreater + +### Introduction +Musicreater(音·创) is an Eilles(*W-YI*)'s app that is used for creating musics in **Minecraft: Bedrock Edition**. + +Welcome to join our QQ group: 861684859 + +### Framework + +Use *Python* to develop, use *BeeWare* as a Windows Library. + +We are trying to support every platform. + + +### Tutorials + +#### Windows + +Please wait for a while... +Comming soon + +#### Linux + +Please wait for a while... +Comming soon + +#### Android + +Please wait for a while... +Comming soon + +### Instructions + +1. Just make u understand the Chinese +2. If u dont understand, u can come to the QQ group or email me to ask questions +3. The English Edition is comming soon. + +### Thanks + +1. Thank [Fuckcraft](https://github.com/fuckcraft) “鸣凤鸽子”and so on for the function of Creating the Websocket Server for Minecraft: Bedrock Edition. +2. Thank 昀梦<QQ1515399885> for finding and correcting the bugs in the commands that *Musicreater* Created. +3. Thank Charlie_Ping “查理平” for bdx convert funtion. +4. Thank CMA_2401PT for BDXWorkShop as the .bdx structure's operation guide. +5. Thanks for a lot of groupmates who support me and help me to test the program. +6. If u have give me some help but u haven't been in the list, please contact me. + + +### Contact *Eilles(W-YI)*(金羿) + +1. QQ 2647547478 +2. E-mail EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com +3. WeChat WYI_DoctorYI \ No newline at end of file diff --git a/Run in devmode.bat b/Run in devmode.bat new file mode 100644 index 0000000..a9aaa3e --- /dev/null +++ b/Run in devmode.bat @@ -0,0 +1 @@ +briefcase dev \ No newline at end of file diff --git a/Run the Ver Build under Tkinter.py b/Run the Ver Build under Tkinter.py new file mode 100644 index 0000000..7f03dea --- /dev/null +++ b/Run the Ver Build under Tkinter.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +import os,shutil +from sys import platform + + + + + +print("更新执行位置...") +if platform == 'win32': + try: + os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('\\')]+'src\\') + print("更新执行位置,当前文件位置"+__file__) + except: + pass +else: + try: + os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('/')]+'src/') + except: + pass + print("其他平台:"+platform+"更新执行位置,当前文件位置"+__file__) +print('完成!') + + + + + + + +try: + import toga,amulet +except: + print("You'd better install the libraries of this app\nNow, we're helping you with this.") + from src.musicreater.msctspt.bugReporter import version + version.installLibraries(version) + + + + + + +if platform == 'win32': + os.system("python ./Musicreater.py") +elif platform == 'linux': + os.system("python3 ./Musicreater.py") + + + + + + +try: + if os.path.exists("./log/"): + shutil.rmtree("./log/") + if os.path.exists("./logs/"): + shutil.rmtree("./logs/") + if os.path.exists("./cache/"): + shutil.rmtree("./cache/") +except: + print("无法清除日志及临时文件") \ No newline at end of file diff --git a/fcwslib/__pycache__/__init__.cpython-310.pyc b/fcwslib/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 95b93a6..0000000 Binary files a/fcwslib/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/fcwslib/__pycache__/__init__.cpython-38.pyc b/fcwslib/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index b6354a3..0000000 Binary files a/fcwslib/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/msctspt/__init__.pyc b/msctspt/__init__.pyc deleted file mode 100644 index d6538b0..0000000 Binary files a/msctspt/__init__.pyc and /dev/null differ diff --git a/msctspt/__pycache__/__init__.cpython-38.pyc b/msctspt/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 1a54853..0000000 Binary files a/msctspt/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/msctspt/__pycache__/__init__.cpython-39.pyc b/msctspt/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 7a15a93..0000000 Binary files a/msctspt/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/msctspt/__pycache__/bdxOpera_CP.cpython-38.pyc b/msctspt/__pycache__/bdxOpera_CP.cpython-38.pyc deleted file mode 100644 index 1b65f77..0000000 Binary files a/msctspt/__pycache__/bdxOpera_CP.cpython-38.pyc and /dev/null differ diff --git a/msctspt/__pycache__/bdxOpera_CP.cpython-39.pyc b/msctspt/__pycache__/bdxOpera_CP.cpython-39.pyc deleted file mode 100644 index a5eb9a5..0000000 Binary files a/msctspt/__pycache__/bdxOpera_CP.cpython-39.pyc and /dev/null differ diff --git a/msctspt/__pycache__/bugReporter.cpython-38.pyc b/msctspt/__pycache__/bugReporter.cpython-38.pyc deleted file mode 100644 index 3873e81..0000000 Binary files a/msctspt/__pycache__/bugReporter.cpython-38.pyc and /dev/null differ diff --git a/msctspt/__pycache__/bugReporter.cpython-39.pyc b/msctspt/__pycache__/bugReporter.cpython-39.pyc deleted file mode 100644 index 035dcbe..0000000 Binary files a/msctspt/__pycache__/bugReporter.cpython-39.pyc and /dev/null differ diff --git a/msctspt/__pycache__/funcOpera.cpython-38.pyc b/msctspt/__pycache__/funcOpera.cpython-38.pyc deleted file mode 100644 index 4e3e7ff..0000000 Binary files a/msctspt/__pycache__/funcOpera.cpython-38.pyc and /dev/null differ diff --git a/msctspt/__pycache__/funcOpera.cpython-39.pyc b/msctspt/__pycache__/funcOpera.cpython-39.pyc deleted file mode 100644 index 80172f1..0000000 Binary files a/msctspt/__pycache__/funcOpera.cpython-39.pyc and /dev/null differ diff --git a/msctspt/__pycache__/threadOpera.cpython-38.pyc b/msctspt/__pycache__/threadOpera.cpython-38.pyc deleted file mode 100644 index aa300e4..0000000 Binary files a/msctspt/__pycache__/threadOpera.cpython-38.pyc and /dev/null differ diff --git a/msctspt/__pycache__/threadOpera.cpython-39.pyc b/msctspt/__pycache__/threadOpera.cpython-39.pyc deleted file mode 100644 index d42baa1..0000000 Binary files a/msctspt/__pycache__/threadOpera.cpython-39.pyc and /dev/null differ diff --git a/msctspt/__pycache__/transfer.cpython-38.pyc b/msctspt/__pycache__/transfer.cpython-38.pyc deleted file mode 100644 index b86a005..0000000 Binary files a/msctspt/__pycache__/transfer.cpython-38.pyc and /dev/null differ diff --git a/msctspt/__pycache__/transfer.cpython-39.pyc b/msctspt/__pycache__/transfer.cpython-39.pyc deleted file mode 100644 index 3fd8945..0000000 Binary files a/msctspt/__pycache__/transfer.cpython-39.pyc and /dev/null differ diff --git a/msctspt/__pycache__/values.cpython-38.pyc b/msctspt/__pycache__/values.cpython-38.pyc deleted file mode 100644 index 5c9dc42..0000000 Binary files a/msctspt/__pycache__/values.cpython-38.pyc and /dev/null differ diff --git a/msctspt/__pycache__/values.cpython-39.pyc b/msctspt/__pycache__/values.cpython-39.pyc deleted file mode 100644 index b791c05..0000000 Binary files a/msctspt/__pycache__/values.cpython-39.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/__init__.cpython-310.pyc b/nmcsup/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 3b77c78..0000000 Binary files a/nmcsup/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/__init__.cpython-38.pyc b/nmcsup/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index a633faa..0000000 Binary files a/nmcsup/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/__init__.cpython-39.pyc b/nmcsup/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index ab1ed7f..0000000 Binary files a/nmcsup/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/const.cpython-310.pyc b/nmcsup/__pycache__/const.cpython-310.pyc deleted file mode 100644 index 85f395c..0000000 Binary files a/nmcsup/__pycache__/const.cpython-310.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/const.cpython-38.pyc b/nmcsup/__pycache__/const.cpython-38.pyc deleted file mode 100644 index 1a84c63..0000000 Binary files a/nmcsup/__pycache__/const.cpython-38.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/const.cpython-39.pyc b/nmcsup/__pycache__/const.cpython-39.pyc deleted file mode 100644 index bf7c4fa..0000000 Binary files a/nmcsup/__pycache__/const.cpython-39.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/log.cpython-310.pyc b/nmcsup/__pycache__/log.cpython-310.pyc deleted file mode 100644 index b720ea3..0000000 Binary files a/nmcsup/__pycache__/log.cpython-310.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/log.cpython-38.pyc b/nmcsup/__pycache__/log.cpython-38.pyc deleted file mode 100644 index 470cd4f..0000000 Binary files a/nmcsup/__pycache__/log.cpython-38.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/log.cpython-39.pyc b/nmcsup/__pycache__/log.cpython-39.pyc deleted file mode 100644 index 9d4bdfd..0000000 Binary files a/nmcsup/__pycache__/log.cpython-39.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/nmcreader.cpython-38.pyc b/nmcsup/__pycache__/nmcreader.cpython-38.pyc deleted file mode 100644 index 4665732..0000000 Binary files a/nmcsup/__pycache__/nmcreader.cpython-38.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/nmcreader.cpython-39.pyc b/nmcsup/__pycache__/nmcreader.cpython-39.pyc deleted file mode 100644 index 99038e2..0000000 Binary files a/nmcsup/__pycache__/nmcreader.cpython-39.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/trans.cpython-310.pyc b/nmcsup/__pycache__/trans.cpython-310.pyc deleted file mode 100644 index 2e9ef90..0000000 Binary files a/nmcsup/__pycache__/trans.cpython-310.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/trans.cpython-38.pyc b/nmcsup/__pycache__/trans.cpython-38.pyc deleted file mode 100644 index 1cbec8b..0000000 Binary files a/nmcsup/__pycache__/trans.cpython-38.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/trans.cpython-39.pyc b/nmcsup/__pycache__/trans.cpython-39.pyc deleted file mode 100644 index 762587c..0000000 Binary files a/nmcsup/__pycache__/trans.cpython-39.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/vers.cpython-310.pyc b/nmcsup/__pycache__/vers.cpython-310.pyc deleted file mode 100644 index 8b2d2e7..0000000 Binary files a/nmcsup/__pycache__/vers.cpython-310.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/vers.cpython-38.pyc b/nmcsup/__pycache__/vers.cpython-38.pyc deleted file mode 100644 index d21a940..0000000 Binary files a/nmcsup/__pycache__/vers.cpython-38.pyc and /dev/null differ diff --git a/nmcsup/__pycache__/vers.cpython-39.pyc b/nmcsup/__pycache__/vers.cpython-39.pyc deleted file mode 100644 index 2ada10a..0000000 Binary files a/nmcsup/__pycache__/vers.cpython-39.pyc and /dev/null differ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9a8769f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,49 @@ +[tool.briefcase] +project_name = "Musicreater" +bundle = "com.ryoun.musicreater" +version = "0.0.1" +url = "https://musicreater.ryoun.com/musicreater" +license = "Apache Software License" +author = 'Eilles Wan' +author_email = "W-YI_DoctorYI@outlook.com" + +[tool.briefcase.app.musicreater] +formal_name = "Musicreater" +description = "Musicreater is an Eilles's app that is used for creating musics in Minecraft: Bedrock Edition" +icon = "src/musicreater/resources/musicreater" +sources = ['src/musicreater'] +requires = [] + + +[tool.briefcase.app.musicreater.macOS] +requires = [ + 'toga-cocoa>=0.3.0.dev20', +] + +[tool.briefcase.app.musicreater.linux] +requires = [ + 'toga-gtk>=0.3.0.dev20', +] +system_requires = [ + 'libgirepository1.0-dev', + 'libcairo2-dev', + 'libpango1.0-dev', + 'libwebkitgtk-3.0-0', + 'gir1.2-webkit-3.0', +] + +[tool.briefcase.app.musicreater.windows] +requires = [ + 'toga-winforms>=0.3.0.dev20', +] + +# Mobile deployments +[tool.briefcase.app.musicreater.iOS] +requires = [ + 'toga-iOS>=0.3.0.dev20', +] + +[tool.briefcase.app.musicreater.android] +requires = [ + 'toga-android>=0.3.0.dev20', +] diff --git a/Musicreater.py b/src/Musicreater.py similarity index 96% rename from Musicreater.py rename to src/Musicreater.py index 9106993..31c095e 100644 --- a/Musicreater.py +++ b/src/Musicreater.py @@ -21,8 +21,8 @@ import tkinter.filedialog import tkinter.messagebox import tkinter.simpledialog -from msctspt.threadOpera import NewThread -from nmcsup.vers import VER +from musicreater.msctspt.threadOpera import NewThread +from musicreater.nmcsup.vers import VER @@ -154,7 +154,7 @@ print("完成") def __main__(): - '''音·创 本体\n + '''音·创 Tkinter窗口构建 本体\n W-YI 金羿\n QQ 2647547478\n 音·创 开发交流群 861684859\n @@ -168,7 +168,7 @@ def __main__(): print('载入日志功能...') - from nmcsup.log import log + from musicreater.nmcsup.log import log print('完成!') @@ -197,7 +197,7 @@ def __main__(): print("载入文件读取函数") def ReadFile(fn:str) -> list: - from nmcsup.nmcreader import ReadFile as fileRead + from musicreater.nmcsup.nmcreader import ReadFile as fileRead k = fileRead(fn) if k == False : tk.messagebox.showerror(title='错误', message="找不到文件😢:"+fn) @@ -207,7 +207,7 @@ def __main__(): def ReadMidi(midfile:str) -> str: - from nmcsup.nmcreader import ReadMidi as midiRead + from musicreater.nmcsup.nmcreader import ReadMidi as midiRead k = midiRead(midfile) if k == False : tk.messagebox.showerror(title='错误', message="找不到文件或无法读取文件😢:"+midfile) @@ -317,7 +317,7 @@ def __main__(): else: fn = fn[0] log("读取文件:"+fn) - from nmcsup.nmcreader import ReadOldProject + from musicreater.nmcsup.nmcreader import ReadOldProject dataset[0] = ReadOldProject(fn) @@ -406,8 +406,8 @@ def __main__(): else: mp3file = mp3file[0] log("转换mp3文件"+mp3file) - from nmcsup.nmcreader import ReadMidi - from nmcsup.trans import Mp32Mid + from musicreater.nmcsup.nmcreader import ReadMidi + from musicreater.nmcsup.trans import Mp32Mid if not os.path.exists('./Temp/'): os.makedirs('./Temp/') Mp32Mid(mp3file,'./Temp/Trans.mid') @@ -499,7 +499,7 @@ def __main__(): for i in dat.split(" "): datas.append([str(i), 1.0]) log('音符数据写入'+str(datas)) - from nmcsup.trans import note2list + from musicreater.nmcsup.trans import note2list datat = DMM() datat['notes'] = note2list(datas) dataset[0]['musics'].append(datat) @@ -518,13 +518,13 @@ def __main__(): def ShowCMD(): log("展示指令") global NowMusic - from nmcsup.trans import Note2Cmd + from musicreater.nmcsup.trans import Note2Cmd RefreshCMDList(Note2Cmd(dataset[0]['musics'][NowMusic]['notes'],dataset[0]['musics'][NowMusic]['set']['ScoreboardName'],dataset[0]['musics'][NowMusic]['set']['Instrument'],dataset[0]['mainset']['PlayerSelect'])) def MakeCMD(): log("生成文件") - from msctspt.funcOpera import makeFuncFiles + from musicreater.msctspt.funcOpera import makeFuncFiles file = tkinter.filedialog.askdirectory(title='请选择文件生成的位置', initialdir=r'./') if file == None or file =='': log("取消") @@ -535,7 +535,7 @@ def __main__(): def MakeCMDdir(): log("生成函数包") - from msctspt.funcOpera import makeFunDir + from musicreater.msctspt.funcOpera import makeFunDir file = tkinter.filedialog.askdirectory(title='请选择文件夹生成的位置', initialdir=r'./') if file == None or file =='': log("取消") @@ -551,7 +551,7 @@ def __main__(): return; import zipfile - from msctspt.funcOpera import makeFunDir + from musicreater.msctspt.funcOpera import makeFunDir log("生成附加包文件") if not os.path.exists('./temp/'): os.makedirs('./temp/') @@ -575,7 +575,7 @@ def __main__(): def ToBlockWorldEpt(): import zipfile - from nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player + from musicreater.nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player while True: try: dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16') @@ -608,7 +608,7 @@ def __main__(): #转为已存在的方块世界 def ToBlockWorld(): - from nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player + from musicreater.nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player while True: try: dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16') @@ -654,7 +654,7 @@ def __main__(): return; else: Outdire+='/'+dataset[0]['mainset']['PackName']+'/'; - from nmcsup.trans import Notes2Player + from musicreater.nmcsup.trans import Notes2Player for i in range(len(dataset[0]['musics'])): open(Outdire+dataset[0]['musics'][i]['set']['FileName']+'_'+str(i)+'.mcfunction','w',encoding='utf-8').writelines(Notes2Player(dataset[0]['musics'][i]['notes'],[dire[0],dire[1],dire[2]+i],{'Ent':dataset[0]['musics'][i]['set']['EntityName'],'Pls':dataset[0]['mainset']['PlayerSelect'],'Ins':dataset[0]['musics'][i]['set']['Instrument']})) @@ -666,7 +666,7 @@ def __main__(): def ToCmdWorldEpt(): import zipfile - from nmcsup.trans import Cmd2World, Note2Cmd + from musicreater.nmcsup.trans import Cmd2World, Note2Cmd while True: try: dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16'); @@ -692,7 +692,7 @@ def __main__(): #转为已存在的指令世界 def ToCmdWorld(): - from nmcsup.trans import Cmd2World, Note2Cmd + from musicreater.nmcsup.trans import Cmd2World, Note2Cmd while True: try: dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16') @@ -718,7 +718,7 @@ def __main__(): #函数输入指令块 def func2World(): - from nmcsup.trans import Cmd2World + from musicreater.nmcsup.trans import Cmd2World while True: try: dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16') @@ -744,9 +744,9 @@ def __main__(): log("分割大函数") import uuid - from msctspt.funcOpera import funSplit - from msctspt.transfer import hans2pinyin - from nmcsup.trans import Cmd2World + from musicreater.msctspt.funcOpera import funSplit + from musicreater.msctspt.transfer import hans2pinyin + from musicreater.nmcsup.trans import Cmd2World while True: try: dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入执行链生成坐标:',initialvalue = '16 4 16'); @@ -808,7 +808,7 @@ def __main__(): def toScbBDXfile(): - from msctspt.transfer import note2bdx + from musicreater.msctspt.transfer import note2bdx while True: try: dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入执行链生成相对坐标:',initialvalue = '0 0 0'); @@ -835,7 +835,7 @@ def __main__(): def wsPlay(): - from msctspt.transfer import note2webs + from musicreater.msctspt.transfer import note2webs spd = tkinter.simpledialog.askfloat("输入播放速度",prompt='一秒,音乐走几拍?',initialvalue = '5.0') tkinter.messagebox.showinfo(title="创建中", message="请在游戏中使用connect指令连接localhost:8080,即可播放"); note2webs(dataset[0]['musics'][NowMusic]['notes'],dataset[0]['musics'][NowMusic]['set']['Instrument'],spd,dataset[0]['mainset']['PlayerSelect']) @@ -847,7 +847,7 @@ def __main__(): def toRSworldEPT(): import zipfile - from msctspt.transfer import note2RSworld + from musicreater.msctspt.transfer import note2RSworld while True: try: dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16'); @@ -873,7 +873,7 @@ def __main__(): def toRSworld(): - from msctspt.transfer import note2RSworld + from musicreater.msctspt.transfer import note2RSworld while True: try: dire = tkinter.simpledialog.askstring(title = '坐标信息输入',prompt='请输入坐标:',initialvalue = '16 4 16') @@ -927,7 +927,7 @@ def __main__(): if fileName == None or fileName == '': log("取消") return; - from msctspt.transfer import ryStruct + from musicreater.msctspt.transfer import ryStruct rys = ryStruct(outdir) rys.world2Rys(begp,endp,isAir) try: @@ -958,7 +958,7 @@ def __main__(): #使用邮件反馈bug def sendBugReport(): - from msctspt.bugReporter import report + from musicreater.msctspt.bugReporter import report name = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您的称呼') contact = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您的联系方式') describetion = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您对问题的描述') @@ -1106,7 +1106,7 @@ def __main__(): def changeInstrument(event): - from nmcsup.const import Instuments as inst + from musicreater.nmcsup.const import Instuments as inst global NowMusic while(True): instemp = tkinter.simpledialog.askstring(title='修改节设置', prompt='修改本音轨所用乐器:', initialvalue='note.harp') @@ -1242,7 +1242,7 @@ def __main__(): - from nmcsup.vers import resetver + from musicreater.nmcsup.vers import resetver # 创建帮助菜单 helpmenu = tk.Menu(main_menu_bar, tearoff=0) diff --git a/src/musicreater.dist-info/INSTALLER b/src/musicreater.dist-info/INSTALLER new file mode 100644 index 0000000..0d8da94 --- /dev/null +++ b/src/musicreater.dist-info/INSTALLER @@ -0,0 +1 @@ +briefcase diff --git a/src/musicreater.dist-info/METADATA b/src/musicreater.dist-info/METADATA new file mode 100644 index 0000000..8ae1aef --- /dev/null +++ b/src/musicreater.dist-info/METADATA @@ -0,0 +1,10 @@ +Metadata-Version: 2.1 +Briefcase-Version: 0.3.5 +Name: musicreater +Formal-Name: Musicreater +App-ID: com.ryoun.musicreater.musicreater +Version: 0.0.1 +Home-page: https://musicreater.ryoun.com/musicreater +Author: Eilles Wan +Author-email: W-YI_DoctorYI@outlook.com +Summary: Musicreater is an Eilles's app that is used for creating musics in Minecraft: Bedrock Edition diff --git a/src/musicreater/Cmd_Msct.py b/src/musicreater/Cmd_Msct.py new file mode 100644 index 0000000..bc14a77 --- /dev/null +++ b/src/musicreater/Cmd_Msct.py @@ -0,0 +1,364 @@ +# -*- coding: utf-8 -*- + + +# W-YI 金羿 +# QQ 2647547478 +# 音·创 开发交流群 861684859 +# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com +# 版权所有 Team-Ryoun 金羿 +# 若需转载或借鉴 请附作者 + + +# 代码写的并非十分的漂亮,还请大佬多多包涵;本软件源代码依照Apache软件协议公开 + + +import json +import os +import shutil +import threading +import sys + +from musicreater.msctspt.threadOpera import NewThread +from musicreater.msctspt.bugReporter import version +from musicreater.nmcsup.log import log + +__version__ = version.version[1]+version.version[0] +__author__ = 'W-YI (金羿)' + + +log("系统工作————————加载变量及函数") + + +print("更新执行位置...") + +if sys.platform == 'win32': + os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('\\')]) + log("更新执行位置,当前文件位置"+__file__) +else: + try: + os.chdir(__file__[:len(__file__) - + __file__[len(__file__)::-1].index('/')]) + except: + pass + log("其他平台:"+sys.platform+"更新执行位置,当前文件位置"+__file__) +print('完成!') + + + +print('建立变量,存入内存,载入字典常量函数') + +# 主体部分 + +# 支持多文件同时操作 + +# dataset[{ 'mainset':{ 'x':'y' }, 'musics': [ { 'set' :{ 'A':'B' } , 'note' : [ [ 'a' , b ], ] }, ] }, ] + +# 编辑: +# 修改主设置: dataset[第几个项目]['mainset']['什么设置'] = '设置啥' +# 修改音乐: dataset[第几个项目]['musics'][第几个音轨]['notes'][第几个音符][音符还是时间(0,1)] = 改成啥 +# 修改音轨设置: dataset[第几个项目]['musics'][第几个音轨]['set']['什么设置'] = '设置啥' +# +# 新增音轨: dataset[第几个项目]['musics'].append(datasetmodelpart) +# +''' +dataset=[ + { + 'mainset':{ + 'PackName':"Ryoun", + 'MusicTitle':'Noname', + 'IsRepeat':False, + 'PlayerSelect':'' + }, + 'musics':[ + { + 'set':{ + 'EntityName':'music_support', + 'ScoreboardName':'music_support', + 'Instrument':'harp', + 'FileName':"Music" + }, + 'notes':[ + [0.0,1.0], + ] + }, + ], + }, + ] +''' + +global dataset + +dataset = [ + { + 'mainset': { + 'PackName': "Ryoun", + 'MusicTitle': 'Noname', + 'IsRepeat': False, + 'PlayerSelect': '' + }, + 'musics': [ + { + 'set': { + 'EntityName': 'MusicSupport', + 'ScoreboardName': 'MusicSupport', + 'Instrument': 'note.harp', + 'FileName': "Music" + }, + 'notes': [ + [0.0, 1.0], + ] + }, + ], + }, +] + +global is_new_file +global is_save +global ProjectName +global NowMusic + +is_new_file = True +is_save = True +ProjectName = '' +NowMusic = 0 + +def DMM(): # 反回字典用于编辑 + datasetmodelpart = { + 'set': { + 'EntityName': 'MusicSupport', + 'ScoreboardName': 'MusicSupport', + 'Instrument': 'note.harp', + 'FileName': "Music" + }, + 'notes': [] + } + return datasetmodelpart + +print("完成") + +# 菜单命令 +print('加载菜单命令...') + +def exitapp(cmd): + + log("程序正常退出", False) + global is_save + if is_save == False: + if '/s' in cmd: + saveProject() + else: + print("您尚未保存,请使用 /s 开关保存并退出") + return False + + try: + global dataset + del dataset + except: + pass + + if '/c' in cmd: + print("清除log(此句不载入日志)") + try: + if os.path.exists("./log/"): + shutil.rmtree("./log/") + if os.path.exists("./logs/"): + shutil.rmtree("./logs/") + if os.path.exists("./cache/"): + shutil.rmtree("./cache/") + except: + print("无法清除日志及临时文件") + + exit() + +print('退出函数加载完成!') + +print("载入文件读取函数") + +def ReadFile(fn: str): + from nmcsup.nmcreader import ReadFile as fileRead + k = fileRead(fn) + if k == False: + log("找不到"+fn) + return False + else: + return k + +def ReadMidi(midfile: str): + from nmcsup.nmcreader import ReadMidi as midiRead + k = midiRead(midfile) + if k == False: + log("找不到"+midfile) + return False + else: + return k + +print('完成!') + +print("载入命令函数") + +def saveProject(cmd: list): + global is_new_file + if '/a' in cmd: + log("另存项目") + ProjectName = cmd[cmd.index('/a')+1] + else: + if is_new_file: + print("初次存储请使用 /a 开关规定存储文件名") + log("文件未保存") + return False + + log("存储文件:"+ProjectName) + with open(ProjectName, 'w', encoding='utf-8') as f: + json.dump(dataset[0], f) + global is_save + is_save = True + +print('保存项目函数加载完成!') + +def loadMusic(cmd: list): + if '/mid' in cmd: + th = NewThread(ReadMidi, (cmd[cmd.index('/mid')+1],)) + th.start() + + def midiSPT(th): + for i in th.getResult(): + datas = DMM() + datas['notes'] = i + dataset[0]['musics'].append(datas) + del th + global is_save + is_save = False + threading.Thread(target=midiSPT, args=(th,)).start() + del th + elif '/txt' in cmd: + th = NewThread(ReadFile, (cmd[cmd.index('/txt')+1],)) + th.start() + + def midiSPT(th): + for i in th.getResult(): + datas = DMM() + datas['notes'] = i + dataset[0]['musics'].append(datas) + del th + global is_save + is_save = False + threading.Thread(target=midiSPT, args=(th,)).start() + elif '/input' in cmd: + datas = [] + for i in cmd[cmd.index('/input')+1:]: + datas.append([str(i), 1.0]) + from nmcsup.trans import note2list + datat = DMM() + datat['notes'] = note2list(datas) + dataset[0]['musics'].append(datat) + del datas, datat + global is_save + is_save = False + else: + log("无参数,无法读入。") + print("请查看帮助文件查看指令格式。") + return False + +print('音轨载入函数加载完成!') + +def funBuild(cmd: list): + if '/file' in cmd: + from msctspt.funcOpera import makeFuncFiles + makepath = cmd[cmd.index('/file')+1] + if makepath[-1] != '/': + makepath += '/' + makeFuncFiles(dataset[0], makepath) + elif '/directory' in cmd: + from msctspt.funcOpera import makeFunDir + makepath = cmd[cmd.index('/directory')+1] + if makepath[-1] != '/': + makepath += '/' + makeFunDir(dataset[0], makepath) + elif '/mcpack' in cmd: + import zipfile + from msctspt.funcOpera import makeFunDir + makepath = cmd[cmd.index('/mcpack')+1] + if makepath[-1] != '/': + makepath += '/' + + if not os.path.exists('./temp/'): + os.makedirs('./temp/') + makeFunDir(dataset[0], './temp/') + shutil.move('./temp/'+dataset[0]['mainset']['PackName'] + + "Pack/behavior_packs/"+dataset[0]['mainset']['PackName']+"/functions", './') + shutil.move('./temp/'+dataset[0]['mainset']['PackName'] + "Pack/behavior_packs/" + + dataset[0]['mainset']['PackName']+"/manifest.json", './') + with zipfile.ZipFile(makepath+dataset[0]['mainset']['PackName']+'.mcpack', "w") as zipobj: + for i in os.listdir('./functions/'): + zipobj.write('./functions/'+i) + zipobj.write('./manifest.json') + shutil.move('./functions', './temp/') + shutil.move('./manifest.json', './temp/') + shutil.rmtree("./temp/") + else: + log("无参数,无法读入。") + print("请查看帮助文件查看指令格式。") + return False + +print("函数建立函数加载完成") + + + + + + + + + + + + + + + +def __main__(): + + if sys.platform == 'win32': + os.system("cls") + else: + os.system("clear") + + if sys.platform in ('win32', 'linux'): + print("您当前的运行环境为标准桌面,您可以打开 Musicreater.py 运行窗口模式的 音·创") + print("您也可以输入 win 指令在不退出命令行模式的同时打开窗口模式\n") + + print(__author__+" 音·创 —— 当前核心版本 "+__version__+'\n') + + nowWorkPath = os.path.split(os.path.realpath(__file__))[0] + + while True: + + strcmd = input("MSCT "+nowWorkPath+">") + cmd = strcmd.lower().split(' ') + + if cmd[0] == 'exit': + exitapp(cmd[1:]) + elif cmd[0] == 'save': + saveProject(cmd[1:]) + elif cmd[0] == 'load': + loadMusic(cmd[1:]) + elif cmd[0] == 'win': + def run(cmd): + os.system(cmd) + if sys.platform == 'win32': + NewThread(run, ("python "+os.path.split(os.path.realpath(__file__)) + [0]+"/Musicreater.py",)).start() + else: + NewThread(run, ("python3 "+os.path.split(os.path.realpath(__file__)) + [0]+"/Musicreater.py",)).start() + elif cmd[0] == 'chdir': + nowWorkPath = os.path.realpath(cmd[1]) + os.chdir(nowWorkPath) + elif cmd[0] == 'build': + funBuild(cmd[1:]) + else: + os.system(strcmd) + + +if __name__ == '__main__': + __main__ \ No newline at end of file diff --git a/msctspt/__init__.py b/src/musicreater/__init__.py similarity index 100% rename from msctspt/__init__.py rename to src/musicreater/__init__.py diff --git a/src/musicreater/__main__.py b/src/musicreater/__main__.py new file mode 100644 index 0000000..4e1ca4b --- /dev/null +++ b/src/musicreater/__main__.py @@ -0,0 +1,4 @@ +from musicreater.app import main + +if __name__ == '__main__': + main().main_loop() diff --git a/src/musicreater/app.py b/src/musicreater/app.py new file mode 100644 index 0000000..7bc5901 --- /dev/null +++ b/src/musicreater/app.py @@ -0,0 +1,133 @@ +""" +音·创(Musicreater)是由金羿(W-YI)开发的一款《我的世界》基岩版音乐生成辅助软件 +""" + + +# W-YI 金羿 +# QQ 2647547478 +# 音·创 开发交流群 861684859 +# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com +# 版权所有 Team-Ryoun 金羿 +# 若需转载或借鉴 请附作者 + + +# 代码写的并非十分的漂亮,还请大佬多多包涵;本软件源代码依照Apache软件协议公开 + + +import sys + +import toga +from toga.style import Pack +from toga.style.pack import COLUMN, ROW + +from musicreater.Cmd_Msct import * +from musicreater.msctspt.bugReporter import version + +from musicreater.resources.ChineseLang import LANGUAGE + + + +__version__ = version.version[1]+version.version[0] +__author__ = 'W-YI (金羿)' + + + + + +if sys.platform == 'win32': + os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('\\')]) + log("更新执行位置,当前文件位置"+__file__) +else: + try: + os.chdir(__file__[:len(__file__) - + __file__[len(__file__)::-1].index('/')]) + except: + pass + log("其他平台:"+sys.platform+"更新执行位置,当前文件位置"+__file__) + + + + + + +class Musicreater(toga.App): + '''音·创 本体\n + W-YI 金羿\n + QQ 2647547478\n + 音·创 开发交流群 861684859\n + Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com\n + 版权所有 Team-Ryoun 金羿\n + 若需转载或借鉴 请附作者\n + ''' + + + + def startup(self): + + + # Start to draw the window + + main_box = toga.Box(style=Pack(direction=COLUMN)) + + self.noticeLabel = toga.Label('MSCT >>>',style=Pack(padding=(0, 5))) + + self.inputBox = toga.TextInput(style=Pack(flex=1)) + #dispImage = toga.ImageView("./resources/oddevenmatrix.png") + + cmd_box = toga.Box(style=Pack(direction=ROW, padding=5)) + + cmd_box.add(self.noticeLabel) + cmd_box.add(self.inputBox) + # cmd_box.add(dispImage) + + button = toga.Button( + LANGUAGE['main']['run'], + on_press=self.showMessage, + style=Pack(padding=5) + ) + + + main_box.add(cmd_box) + main_box.add(button) + + + self.main_window = toga.MainWindow(title=self.formal_name) + self.main_window.content = main_box + self.main_window.show() + + self.main_window.info_dialog('',"{} {} —— {} {}".format(__author__,LANGUAGE['main']['name'],LANGUAGE['main']['version'],__version__)) + + self.nowWorkPath = os.path.split(os.path.realpath(__file__))[0] + + + def showMessage(self, widget): + + strcmd = self.inputBox.value + + cmd = strcmd.lower().split(' ') + + if cmd[0] == 'exit': + if exitapp(cmd[1:]) == False: + self.main_window.info_dialog('',LANGUAGE['command']['FormatError']) + elif cmd[0] == 'save': + if saveProject(cmd[1:]) == False: + self.main_window.info_dialog('',LANGUAGE['command']['FormatError']) + elif cmd[0] == 'load': + if loadMusic(cmd[1:]) == False: + self.main_window.info_dialog('',LANGUAGE['command']['FormatError']) + elif cmd[0] == 'chdir': + self.main_window.info_dialog('',LANGUAGE['command']['NotAvailable']) + return + nowWorkPath = os.path.realpath(cmd[1]) + os.chdir(nowWorkPath) + elif cmd[0] == 'build': + if funBuild(cmd[1:]) == False: + self.main_window.info_dialog('',LANGUAGE['command']['FormatError']) + else: + return + os.system(strcmd) + + + +def main(): + return Musicreater() diff --git a/fcwslib/__init__.py b/src/musicreater/fcwslib/__init__.py similarity index 100% rename from fcwslib/__init__.py rename to src/musicreater/fcwslib/__init__.py diff --git a/src/musicreater/log/2021-12-31 00_13_19.msct.log b/src/musicreater/log/2021-12-31 00_13_19.msct.log new file mode 100644 index 0000000..95ae719 --- /dev/null +++ b/src/musicreater/log/2021-12-31 00_13_19.msct.log @@ -0,0 +1,2 @@ +00:13:19 更新执行位置,当前文件位置F:\W-YI\Programming\音·创\程序\src\musicreater\Cmd_Msct.py +00:13:19 更新执行位置,当前文件位置F:\W-YI\Programming\音·创\程序\src\musicreater\app.py diff --git a/msctspt/MSCT Dev Log.txt b/src/musicreater/msctspt/MSCT Dev Log.txt similarity index 100% rename from msctspt/MSCT Dev Log.txt rename to src/musicreater/msctspt/MSCT Dev Log.txt diff --git a/nmcsup/__init__.py b/src/musicreater/msctspt/__init__.py similarity index 100% rename from nmcsup/__init__.py rename to src/musicreater/msctspt/__init__.py diff --git a/msctspt/bdxOpera_CP.py b/src/musicreater/msctspt/bdxOpera_CP.py similarity index 100% rename from msctspt/bdxOpera_CP.py rename to src/musicreater/msctspt/bdxOpera_CP.py diff --git a/msctspt/bugReporter.py b/src/musicreater/msctspt/bugReporter.py similarity index 94% rename from msctspt/bugReporter.py rename to src/musicreater/msctspt/bugReporter.py index d8969be..9343152 100644 --- a/msctspt/bugReporter.py +++ b/src/musicreater/msctspt/bugReporter.py @@ -59,7 +59,7 @@ class report(): from email.mime.text import MIMEText; from email.mime.multipart import MIMEMultipart; from email.header import Header; - from nmcsup.log import log + from musicreater.nmcsup.log import log log("发送错误报告") import os; log("添加标题与正文") @@ -81,7 +81,6 @@ class report(): try: smtp = smtplib.SMTP() smtp.connect("smtp.163.com"); - #smtp.login("RyounDevTeam@163.com","RyounDaiYi99"); #SIQQKQQYCZRVIDFJ是授权密码 smtp.login("RyounDevTeam@163.com","SIQQKQQYCZRVIDFJ"); smtp.sendmail("RyounDevTeam@163.com",["RyounDevTeam@163.com",],msg.as_string()) @@ -100,15 +99,15 @@ class report(): class version: libraries = ('mido','amulet','amulet-core','amulet-nbt','piano_transcription_inference','pypinyin','briefcase','toga','pyinstaller','py7zr','websockets','torch') - '''当前所需库,有一些是开发用的,用户不需要安装''' + '''当前开发所需库''' - version = ('0.0.4.3','Beta',) + version = ('0.0.0','Gamma',) '''当前版本''' def __init__(self) -> None: self.libraries = version.libraries - '''当前所需库,有一些是开发用的,用户不需要安装''' + '''当前开发所需库''' self.version = version.version '''当前版本''' diff --git a/msctspt/funcOpera.py b/src/musicreater/msctspt/funcOpera.py similarity index 98% rename from msctspt/funcOpera.py rename to src/musicreater/msctspt/funcOpera.py index c106a3f..4566605 100644 --- a/msctspt/funcOpera.py +++ b/src/musicreater/msctspt/funcOpera.py @@ -2,7 +2,6 @@ """音·创 的函数操作和一些其他功能""" -from nmcsup.log import log @@ -107,8 +106,9 @@ def funSplit(bigFile,maxCmdLen : int = 10000 ): def makeFuncFiles(musicset, path='./'): + from musicreater.nmcsup.log import log '''在指定目录下生成函数文件''' - from nmcsup.trans import Note2Cmd + from musicreater.nmcsup.trans import Note2Cmd commands = [] starts = [] log("=========================正在在此处生成文件:"+path) @@ -147,6 +147,7 @@ def makeFuncFiles(musicset, path='./'): def makeFunDir(musicset, path='./'): + from musicreater.nmcsup.log import log '''在指定目录下生成函数包文件夹''' import os import uuid diff --git a/msctspt/threadOpera.py b/src/musicreater/msctspt/threadOpera.py similarity index 100% rename from msctspt/threadOpera.py rename to src/musicreater/msctspt/threadOpera.py diff --git a/msctspt/transfer.py b/src/musicreater/msctspt/transfer.py similarity index 97% rename from msctspt/transfer.py rename to src/musicreater/msctspt/transfer.py index d8a6492..9c57018 100644 --- a/msctspt/transfer.py +++ b/src/musicreater/msctspt/transfer.py @@ -69,9 +69,9 @@ def note2bdx(filePath:str,dire:list,Notes : list,ScoreboardName:str,Instrument:s :return 返回一个BdxConverter类(实际上没研究过),同时在指定位置生成.bdx文件''' - from msctspt.transfer import formCmdBlock - from nmcsup.trans import Note2Cmd - from msctspt.bdxOpera_CP import BdxConverter + from musicreater.msctspt.transfer import formCmdBlock + from musicreater.nmcsup.trans import Note2Cmd + from musicreater.msctspt.bdxOpera_CP import BdxConverter cmd = Note2Cmd(Notes,ScoreboardName,Instrument, PlayerSelect,isProsess) cdl = [] for i in cmd: @@ -116,8 +116,8 @@ def note2webs(Notes : list,Instrument:str, speed:float = 5.0, PlayerSelect:str=' import time import fcwslib import asyncio - from nmcsup.log import log - from nmcsup.vers import VER + from musicreater.nmcsup.log import log + from musicreater.nmcsup.vers import VER async def run_server(websocket, path): log('服务器连接创建') @@ -162,7 +162,7 @@ def note2RSworld(world:str,startpos:list,notes:list,instrument:str,speed:float = ''' - from msctspt.values import height2note,instuments + from musicreater.msctspt.values import height2note,instuments def formNoteBlock(note:int,instrument:str='note.harp',powered:bool = False): diff --git a/msctspt/values.py b/src/musicreater/msctspt/values.py similarity index 100% rename from msctspt/values.py rename to src/musicreater/msctspt/values.py diff --git a/nmcsup/NFC Dev Log.txt b/src/musicreater/nmcsup/NFC Dev Log.txt similarity index 100% rename from nmcsup/NFC Dev Log.txt rename to src/musicreater/nmcsup/NFC Dev Log.txt diff --git a/nmcsup/NMC Dev Log.txt b/src/musicreater/nmcsup/NMC Dev Log.txt similarity index 100% rename from nmcsup/NMC Dev Log.txt rename to src/musicreater/nmcsup/NMC Dev Log.txt diff --git a/src/musicreater/nmcsup/__init__.py b/src/musicreater/nmcsup/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/nmcsup/const.py b/src/musicreater/nmcsup/const.py similarity index 100% rename from nmcsup/const.py rename to src/musicreater/nmcsup/const.py diff --git a/nmcsup/log.py b/src/musicreater/nmcsup/log.py similarity index 100% rename from nmcsup/log.py rename to src/musicreater/nmcsup/log.py diff --git a/nmcsup/nmcreader.py b/src/musicreater/nmcsup/nmcreader.py similarity index 90% rename from nmcsup/nmcreader.py rename to src/musicreater/nmcsup/nmcreader.py index 266ea6d..109aa0d 100644 --- a/nmcsup/nmcreader.py +++ b/src/musicreater/nmcsup/nmcreader.py @@ -4,14 +4,14 @@ -from nmcsup.log import log -from nmcsup.const import notes +from musicreater.nmcsup.log import log +from musicreater.nmcsup.const import notes #从格式文本文件读入一个音轨并存入一个列表 def ReadFile(fn : str) -> list: - from nmcsup.trans import note2list + from musicreater.nmcsup.trans import note2list log('打开'+fn+"并读取音符") try: nat = open(fn, 'r', encoding='UTF-8').read().split(" ") @@ -31,7 +31,7 @@ def ReadFile(fn : str) -> list: #从midi读入多个音轨,返回多个音轨列表 def ReadMidi(midfile : str ) -> list: import mido - from msctspt.threadOpera import NewThread + from musicreater.msctspt.threadOpera import NewThread Notes = [] try: mid = mido.MidiFile(midfile) @@ -70,7 +70,7 @@ def ReadMidi(midfile : str ) -> list: def ReadOldProject(fn:str) -> list: import json - from nmcsup.trans import note2list + from musicreater.nmcsup.trans import note2list log("读取文件:"+fn) try: with open(fn, 'r', encoding='UTF-8') as c: diff --git a/nmcsup/trans.py b/src/musicreater/nmcsup/trans.py similarity index 97% rename from nmcsup/trans.py rename to src/musicreater/nmcsup/trans.py index c39aba5..cfa5419 100644 --- a/nmcsup/trans.py +++ b/src/musicreater/nmcsup/trans.py @@ -13,7 +13,7 @@ from nmcsup.log import log # 输入一个列表 [ [str, float ], [], ... ] 音符str 值为持续时间float def note2list(Notes : list) -> list: - from nmcsup.const import notes + from musicreater.nmcsup.const import notes def change(base): enwo = { 'a': 'A', @@ -58,7 +58,7 @@ def note2list(Notes : list) -> list: def mcnote2freq(Notes): - from nmcsup.const import notes + from musicreater.nmcsup.const import notes mcnback = {} for i,j in notes.items(): mcnback[j[0]] = i @@ -197,7 +197,7 @@ def Cmd2World(cmd:list,world:str,dire:list): #音符转成方块再加载到世界里头 def Blocks2World(world:str,dire:list,Datas:list): - from nmcsup.const import Blocks + from musicreater.nmcsup.const import Blocks level = amulet.load_level(world) i = 0 def setblock(block:str,pos:list): @@ -231,7 +231,7 @@ def Notes2Player(Note,dire:list,CmdData:dict): for i in Note: Notes[i[0]] = '' Notes = list(Notes.keys()) - from nmcsup.const import Blocks + from musicreater.nmcsup.const import Blocks Cmds = [] for j in Notes: Cmds.append('execute @e[x='+str(dire[0])+',y='+str(dire[1])+',z='+str(dire[2])+',dy='+str(255-dire[1])+',name='+CmdData['Ent']+'] ~ ~ ~ detect ~ ~ ~ '+Blocks[j]+' 0 execute @a '+CmdData['Pls']+' ~ ~ ~ playsound '+CmdData['Ins']+' @s ~ ~ ~ 1000 '+str(j)+' 1000\n') diff --git a/nmcsup/vers.py b/src/musicreater/nmcsup/vers.py similarity index 98% rename from nmcsup/vers.py rename to src/musicreater/nmcsup/vers.py index 2a524cc..a2c9bc6 100644 --- a/nmcsup/vers.py +++ b/src/musicreater/nmcsup/vers.py @@ -2,7 +2,7 @@ -from msctspt.bugReporter import version +from musicreater.msctspt.bugReporter import version #以下下两个值请在 msctspt/bugReporter 的version类中修改 diff --git a/src/musicreater/resources/ChineseLang.py b/src/musicreater/resources/ChineseLang.py new file mode 100644 index 0000000..2982ed7 --- /dev/null +++ b/src/musicreater/resources/ChineseLang.py @@ -0,0 +1,11 @@ +LANGUAGE = { + 'main':{ + "name":"音·创", + "version":"当前版本", + "run":"执行指令", + }, + 'command':{ + "NotAvailable":"此指令不可用。", + "FormatError":"指令格式错误,请查看 命令行操作.md 以查阅指令。" + } +} \ No newline at end of file diff --git a/nmcsup/EptWorld.zip b/src/musicreater/resources/EptWorld.zip similarity index 100% rename from nmcsup/EptWorld.zip rename to src/musicreater/resources/EptWorld.zip diff --git a/src/musicreater/resources/__init__.py b/src/musicreater/resources/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/musicreater/resources/musicreater.icns b/src/musicreater/resources/musicreater.icns new file mode 100644 index 0000000..27b43d3 Binary files /dev/null and b/src/musicreater/resources/musicreater.icns differ diff --git a/src/musicreater/resources/musicreater.ico b/src/musicreater/resources/musicreater.ico new file mode 100644 index 0000000..4fbd5f3 Binary files /dev/null and b/src/musicreater/resources/musicreater.ico differ diff --git a/src/musicreater/resources/musicreater.png b/src/musicreater/resources/musicreater.png new file mode 100644 index 0000000..c71a178 Binary files /dev/null and b/src/musicreater/resources/musicreater.png differ diff --git a/src/musicreater/resources/mySayings.txt b/src/musicreater/resources/mySayings.txt new file mode 100644 index 0000000..a76f2b3 --- /dev/null +++ b/src/musicreater/resources/mySayings.txt @@ -0,0 +1,11 @@ +生命灵动 当用激情跃起奋发之力 +奇偶数阵 +学海无涯 应用爱意徜徉 +在生命的起源寻找灵魂的慰藉 +纪念那一段辉煌灿烂的青春年华 +以梦想为驱使 创造属于自己的未来 +集青春之力 绽放爱意之花 +那个曾与我相伴的人 依稀在我的心头留恋 +我爱你 我 爱 你 +你是我灵魂中绽放出最艳丽的花朵 +心之所向 意之所属 \ No newline at end of file diff --git a/查看代码数.py b/查看代码数.py index 1e5ce50..52fa44d 100644 --- a/查看代码数.py +++ b/查看代码数.py @@ -1,11 +1,13 @@ # -*- conding: utf8 -*- import os -from msctspt.funcOpera import keepart +from src.musicreater.msctspt.funcOpera import keepart l = 0 + + for path,dir_list,file_list in os.walk(r"./") : for file_name in file_list: if keepart(file_name,'.',None) == '.py': diff --git a/补全库.py b/补全库.py deleted file mode 100644 index 8fccb46..0000000 --- a/补全库.py +++ /dev/null @@ -1,2 +0,0 @@ -from msctspt.bugReporter import version -version.installLibraries(version) \ No newline at end of file