audiobanner: supports --intro and --outro

+ small refactoring
This commit is contained in:
boyska 2024-05-12 16:20:25 +02:00
parent 0df98bacad
commit c023462ef3

View file

@ -13,10 +13,17 @@ def mix(args):
'-o', 'orig_@n_@m.mp3',
'-t', interval,
args.original])
ffmpegconcat = 'concat:%s' % args.banner
parts = []
if args.intro:
parts.append(args.intro)
for part in sorted(os.listdir(tempdir)):
ffmpegconcat += '|%s|%s' % (os.path.join(tempdir, part),
args.banner)
parts += [os.path.join(tempdir, part),
args.banner]
parts.pop()
if args.outro:
parts.append(args.outro)
ffmpegconcat = 'concat:%s' % "|".join(parts)
cmd = ['ffmpeg', '-i', ffmpegconcat,
'-loglevel', 'error', '-n',
@ -26,7 +33,9 @@ def mix(args):
def get_parser():
p = argparse.ArgumentParser("audiobanner")
p.add_argument("--interval", help='In seconds', default=60, type=int)
p.add_argument("--interval", help='In seconds', default=600, type=int)
p.add_argument("--intro", type=str)
p.add_argument("--outro", type=str)
p.add_argument("original")
p.add_argument("banner")
p.add_argument("destination")