How to use the ytmdl.prepend function in ytmdl

To help you get started, we’ve selected a few ytmdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deepjyoti30 / ytmdl / ytmdl.py View on Github external
# Declare a var to store the name of the yt video
    yt_title = data[choice]['title']

    prepend.PREPEND(1)
    print('Downloading ', end='')
    print(Fore.LIGHTMAGENTA_EX, end='')
    print(yt_title, end=' ')
    print(Style.RESET_ALL, end='')
    print('in', end=' ')
    print(Fore.LIGHTYELLOW_EX, end='')
    print(defaults.DEFAULT.SONG_QUALITY + 'kbps', end='')
    print(Style.RESET_ALL)
    path = yt.dw(link, yt_title)

    if not path:
        prepend.PREPEND(2)
        print('Something went wrong while downloading!\a')
        sys.exit(0)
    else:
        prepend.PREPEND(1)
        print('Downloaded!')

    prepend.PREPEND(1)
    print('Converting to mp3...')

    conv_name = utility.convert_to_mp3(path)

    if not conv_name:
        prepend.PREPEND(2)
        print('Something went wrong while converting!\a')
        exit(-1)
github deepjyoti30 / ytmdl / ytmdl.py View on Github external
prepend.PREPEND(1)
    print('Getting song data...')

    # TRACK_INFO = song.getData(song_name)
    TRACK_INFO = metadata.SEARCH_SONG(song_name, filters=[args.artist, args.album])

    # declare a variable to store the option
    option = 0

    if TRACK_INFO is False:
        # prepend.PREPEND(2)
        # print('Data \a')
        # exit(0)
        pass
    elif len(TRACK_INFO) == 0:
        prepend.PREPEND(2)
        print('No data was found!\a')
        sys.exit(0)
    else:
        prepend.PREPEND(1)
        print('Setting data...')

        option = song.setData(TRACK_INFO, is_quiet, conv_name)

        if type(option) is not int:
            prepend.PREPEND(2)
            print('Something went wrong while writing data!\a')
            sys.exit(0)

    # Get the directory where song is moved

    DIR = dir.cleanup(TRACK_INFO, option)
github deepjyoti30 / ytmdl / ytmdl / song.py View on Github external
prepend.PREPEND(1)
    print('Choose One')

    results = len(SONG_INFO)

    if results > 5:
        results = 5

    PRINT_WHOLE = True

    beg = 0
    while True:
        # Print the results first
        if PRINT_WHOLE:
            print_choice(beg, results, SONG_INFO, type)
        prepend.PREPEND(1)
        choice = input('Enter Choice [a valid choice] ')
        choice = int(choice)
        # If the choice is 6 then try to print more results
        if choice <= results and choice > 0:
            break
        elif choice == 0:
            PRINT_WHOLE = True
            beg = results
            results = beg + 5
        else:
            PRINT_WHOLE = False

    choice = int(choice)
    choice -= 1
    return choice