def main():
    parser = argparse.ArgumentParser(description='', version='%(prog)s ' + __version__)
    parser.add_argument('-o', '--output', help='output path to store photos',
                        default='~/Music')
    parser.add_argument('username', help='vk.com username')
    parser.add_argument('-p','--password', help='vk.com password')
    parser.add_argument('-s','--sort', help='sort by artist folder', action='store_true')

    args = parser.parse_args()

    # expand user path if necessary
    if args.output.startswith('~'):
        args.output = os.path.expanduser(args.output)

    start_time = datetime.datetime.now()
    try:
        password = args.password or getpass("Password: ")

        # Initialize vk.com connection
        connection = connect(args.username, password)

        # Request list of audios
        audios_response = get_audios(connection)
        audios_count = audios_response['count']
        audios = audios_response['items']
 
        print((audios_count, 's' if audios_count > 1 else '') % "Found %s album%s:")
        ix = 0

        if len(audios):
            print("Found %s audio%s:\n" % (audios_count, 's' if audios_count > 1 else ''))
            print('%3s. %-80s %s' % ('No', 'Title', 'Duration'))
            ix = 0
            for audio in audios:
                ix += 1
                print('%3d. %-80s %s' % (ix, get_title(audio), datetime.timedelta(seconds=audio['duration'])))
            print("\r")

            processed = 1

            prev_s_len = 0  # A length of the previous output line.
            for audio in audios:
                percent = round(float(processed) / float(audios_count) * 100, 2)
                output_s = "\rExporting %-75s %s of %s (%d%%)" % (get_title(audio), processed, audios_count, percent)
                # Pad with spaces to clear the previous line's tail.
                # It's ok to multiply by negative here.
                output_s += ' '*(prev_s_len - len(output_s))
                
                sys.stdout.write(output_s)
                prev_s_len = len(output_s)
                sys.stdout.flush()

                output = os.path.join(args.output, audio['artist'] if args.sort else '')
                title = audio['title'] if args.sort else get_title(audio)

                try:
                    download(audio, output, title)
                except Exception as e:
                    time.sleep(1)
                
                processed += 1

                if processed%50==0:
                    time.sleep(5)

        else:
            print("\nNo audios found! Exiting...")
            sys.exit(0)

    except Exception as e:
        print(e)
        sys.exit(1)

    except KeyboardInterrupt:
        print('\nVKMusic exporting stopped by keyboard')
        sys.exit(0)

    finally:
        print("\nDone in %s" % (datetime.datetime.now() - start_time))
dataset/ETHPy150Open korzhyk/VKMusic/vkmusic/runner.py/main/swapped operands of `%`