mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 06:50:20 +01:00
txtp tools: tweaks
This commit is contained in:
parent
96348f12db
commit
df53c0c6fc
@ -59,8 +59,12 @@ class App(object):
|
||||
|
||||
def start(self):
|
||||
print("TXTP dumper start")
|
||||
|
||||
filenames = []
|
||||
for filename in self.args.files:
|
||||
if os.path.isfile(filename): #for files in paths with regex-like format
|
||||
filenames += [filename]
|
||||
else:
|
||||
filenames += glob.glob(filename)
|
||||
|
||||
for filename in filenames:
|
||||
|
@ -24,7 +24,7 @@ class Cli(object):
|
||||
" %(prog)s * -r -fss 1\n"
|
||||
" - make .txtp for all files in any subdirs with at least 1 subsong\n"
|
||||
" (ignores formats without subsongs)\n\n"
|
||||
" %(prog)s bgm.fsb -in -fcm 2 -fms 5.0\n"
|
||||
" %(prog)s bgm.fsb -in -fcm 2 -fsm 5.0\n"
|
||||
" - make .txtp for subsongs with at least 2 channels and 5 seconds\n\n"
|
||||
" %(prog)s *.scd -r -fd -l 2\n"
|
||||
" - make .txtp for all .scd in subdirs, ignoring dupes, one .txtp per 2ch\n\n"
|
||||
@ -53,6 +53,7 @@ class Cli(object):
|
||||
"* may be inside <...> for conditional text\n"))
|
||||
p.add_argument('-z', dest='zero_fill', help="Zero-fill subsong number (default: auto per subsongs)", type=int)
|
||||
p.add_argument('-ie', dest='no_internal_ext', help="Remove internal name's extension if any", action='store_true')
|
||||
p.add_argument('-ip', dest='allow_internal_paths', help="Replace internal name's / paths with ~ (otherwise removed)", action='store_true')
|
||||
p.add_argument('-m', dest='mini_txtp', help="Create mini-txtp", action='store_true')
|
||||
p.add_argument('-s', dest='subsong_start', help="Start subsong", type=int)
|
||||
p.add_argument('-S', dest='subsong_end', help="End subsong", type=int)
|
||||
@ -270,7 +271,11 @@ class TxtpMaker(object):
|
||||
return None
|
||||
|
||||
txt = self.info.stream_name
|
||||
# remove paths #todo maybe config/replace?
|
||||
# remove paths
|
||||
if self.cfg.allow_internal_paths:
|
||||
txt = txt.replace("\\", "~")
|
||||
txt = txt.replace("/", "~")
|
||||
else:
|
||||
pos = txt.rfind('\\')
|
||||
if pos >= 0:
|
||||
txt = txt[pos+1:]
|
||||
@ -613,6 +618,7 @@ class App(object):
|
||||
# subsongs should treat repeat names separately? pass flag?
|
||||
#maker.reset(rename_map)
|
||||
|
||||
processing = False
|
||||
while True:
|
||||
try:
|
||||
# main call to vgmstream
|
||||
@ -623,9 +629,11 @@ class App(object):
|
||||
# basic parse of vgmstream info
|
||||
maker.parse(output_b)
|
||||
|
||||
processing = True
|
||||
except (subprocess.CalledProcessError, ValueError) as e:
|
||||
log.debug("ignoring CLI error in %s #%s: %s", filename_in, target_subsong, str(e))
|
||||
errors += 1
|
||||
if not processing: #stop but only if first subsong fails
|
||||
break
|
||||
|
||||
if target_subsong == subsong_start:
|
||||
@ -647,7 +655,7 @@ class App(object):
|
||||
target_subsong += 1
|
||||
|
||||
if target_subsong % 200 == 0:
|
||||
log.info("%s/%s subsongs... (%s dupes, %s errors)", target_subsong, maker.info.stream_count, dupes, errors)
|
||||
log.info("%s/%s subsongs... (%s done, %s dupes, %s errors)", target_subsong, maker.info.stream_count, created, dupes, errors)
|
||||
|
||||
if os.path.exists(filename_out):
|
||||
os.remove(filename_out)
|
||||
|
Loading…
Reference in New Issue
Block a user