From c023462ef307b789feb79f840584e863dba7eade Mon Sep 17 00:00:00 2001 From: boyska Date: Sun, 12 May 2024 16:20:25 +0200 Subject: [PATCH] audiobanner: supports --intro and --outro + small refactoring --- audiobanner/bannerizza.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/audiobanner/bannerizza.py b/audiobanner/bannerizza.py index 289f7cf..6e673a7 100644 --- a/audiobanner/bannerizza.py +++ b/audiobanner/bannerizza.py @@ -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")