How to use the ytmdl.utility 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
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)

    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:
github deepjyoti30 / ytmdl / ytmdl.py View on Github external
def extract_data():
    """Extract the arguments and act accordingly."""
    args = arguments()

    if args.list is not None:
        songs = utility.get_songs(args.list)
        if len(songs) != 0:
            prepend.PREPEND(1)
            print("Downloading songs in {}".format(args.list))
            for song_name in songs:
                args.SONG_NAME = song_name
                main(args)
        else:
            prepend.PREPEND(2)
            print("{}: is empty".format(args.list))
    else:
        main(args)