@@ -0,0 +1,1522 @@
+#!/usr/bin/env python3%0A%0A# This is for playing multiple audio streams at the same time.%0A# Video is not presently implemented.%0A#%0A# See https://superuser.com/a/1325668 for more information.%0A%0Aimport subprocess%0Aimport sys%0A%0Adef execute(file_args, mpv_args):%0A    args = %5B'mpv'%5D%0A    args.extend(mpv_args)%0A    args.extend(file_args)%0A    ret = subprocess.call(args)%0A    sys.exit(ret)%0A%0Adef single_play(mpv_args, file):%0A    args = %5Bfile%5D%0A    execute(args, mpv_args)%0A%0Adef double_play(mpv_args, file0, file1):%0A    args = %5B%0A        '--lavfi-complex=%5Baid1%5D%5Baid2%5Damix%5Bao%5D',%0A        file0,%0A        f'--external-file=%7Bfile1%7D',%0A    %5D%0A    execute(args, mpv_args)%0A%0Adef multi_play(mpv_args, files):%0A    # build the lavfi-complex argument%0A    lavfi = %5B'--lavfi-complex='%5D%0A    for i in range(len(files)):%0A        lavfi.append(f'%5Baid%7Bi+1%7D%5D')%0A    lavfi.append(f'amix=inputs=%7Blen(files)%7D%5Bao%5D')%0A%0A    args = %5B''.join(lavfi)%5D%0A    del lavfi%0A%0A    # add the audio files%0A    args.append(files%5B0%5D)%0A    for file in files%5B1:%5D:%0A        args.append(f'--external-file=%7Bfile%7D')%0A%0A    # run%0A    execute(args, mpv_args)%0A%0Aif __name__ == '__main__':%0A    mpv_args = %5B%5D%0A    files = %5B%5D%0A%0A    # Gather arguments%0A    for arg in sys.argv%5B1:%5D:%0A        if arg.startswith('-'):%0A            mpv_args.append(arg)%0A        else:%0A            files.append(arg)%0A%0A    # Use the correct mpv invocation%0A    if len(files) == 1:%0A        single_play(mpv_args, files%5B0%5D)%0A    elif len(files) == 2:%0A        double_play(mpv_args, files%5B0%5D, files%5B1%5D)%0A    else:%0A        multi_play(mpv_args, files)%0A

Add initial multiplay.py