Created
May 23, 2021 07:07
-
-
Save Dobby233Liu/9ce836704f18415ffa66daa4667e004a to your computer and use it in GitHub Desktop.
dirty py3 to parse musiccmt.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open("musiccmt.txt","r",encoding="shift-jis") as c: | |
cmt = c.readlines() | |
writemode=None | |
linen=0 | |
max=9 | |
total=0 | |
m3u8=open("musicroom.m3u8","w",encoding="utf-8") | |
m3u8.write("#EXTM3U\n") | |
str="" | |
for line in cmt: | |
if "#"==line[:1]: | |
if writemode!=None: | |
writemode.close() | |
writemode=None | |
continue | |
elif "@"==line[:1] and writemode==None: | |
total+=1 | |
if writemode!=None: | |
writemode.close() | |
writemode=None | |
writemode= open(line[len("@bgm/"):-1]+".txt", "w", encoding="utf-8") | |
print("erite"+line) | |
str="#EXTINF:%s,%s"+line[len("@bgm/"):-1]+".wav\n" | |
linen=0 | |
continue | |
if writemode!=None: | |
if linen >=max: | |
writemode.close() | |
writemode=None | |
linen=0 | |
print("ok") | |
continue | |
writemode.write(line) | |
print(line) | |
if linen==0: | |
m3u8.write(str%(total, line)) | |
linen+=1 | |
if writemode!=None: | |
writemode.close() | |
writemode=None | |
m3u8.close() |
and use this to generate music room files
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use https://github.com/wleeym08/ThGME/blob/master/main.c with thbgm.dat and thbgm.fmt to gen bgm files