Skip to content

Instantly share code, notes, and snippets.

@Dobby233Liu
Created May 23, 2021 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dobby233Liu/9ce836704f18415ffa66daa4667e004a to your computer and use it in GitHub Desktop.
Save Dobby233Liu/9ce836704f18415ffa66daa4667e004a to your computer and use it in GitHub Desktop.
dirty py3 to parse musiccmt.txt
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()
@Dobby233Liu
Copy link
Author

use https://github.com/wleeym08/ThGME/blob/master/main.c with thbgm.dat and thbgm.fmt to gen bgm files

@Dobby233Liu
Copy link
Author

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