Пример #1
0
def update():
    clear()
    global aup
    if (ydpip == True):
        print(Style.BRIGHT + f"What do you want to update?" + Style.RESET_ALL +
              "\n1. All\n2. yt-dl\n3. dependencies\n4. change autoupdate=",
              end="")
        TF(aup, False)
        print(f"\n5. change branch=", end="")
        BC(curb)
        print("\n0. GoBack")
        cmd = readchar("#")
        if (cmd == "1"):  #All
            clear()
            upytdl()
            upyd()
            print(Fore.RED, "\n!!!restart for changes to take effect!!!\n",
                  Style.RESET_ALL)
        elif (cmd == "2"):  #yt-dl
            clear()
            upytdl()
            print(Fore.RED, "\n!!!restart for changes to take effect!!!\n",
                  Style.RESET_ALL)
        elif (cmd == "3"):  #youtube-dl
            clear()
            upyd()
            print("")
        elif (cmd == "4"):
            aup = not aup
            savepath("", py, pip, ydpip, aup, Vcodec, Acodec, Vqual, Abit)
            loadpath("hid")
            clear()
            print(f"autoupdate={aup}\n")
        elif (cmd == '5'):
            clear()
            print(f"What branch do you wat to change to? You are in a {curb}")
            if (curb == "master"):
                otherb = "testing"
            else:
                otherb = "master"
            print(f"do you want to switch to ")
            BC(otherb, False, True)
            print(" [Y/n]")
            cmd = readchar("#")
            if (cmd == "y"):
                os.system("git pull --recurse-submodules")
                os.system(f"git checkout {otherb}")
                print(Fore.RED, "\n!!!restart for changes to take effect!!!\n",
                      Style.RESET_ALL)
            else:
                clear()
                name()
        else:
            clear()
            name()
    else:
        upytdl()
Пример #2
0
def update():
    clear()
    if settings.Youtubedl.fromPip:
        print(Style.BRIGHT + f"What do you want to update?" + Style.RESET_ALL +
              "\n1. All\n2. yt-dl\n3. dependencies\n4. change autoupdate=",
              end="")
        TF(settings.autoUpdate, False)
        print(f"\n5. change branch=", end="")
        BC(curb)
        print("\n0. GoBack")
        cmd = readchar("#")
        if (cmd == "1"):  # All
            clear()
            upytdl()
            upyd()
            print(Fore.RED, "\n!!!restart for changes to take effect!!!\n",
                  Style.RESET_ALL)
        elif (cmd == "2"):  # yt-dl
            clear()
            upytdl()
            print(Fore.RED, "\n!!!restart for changes to take effect!!!\n",
                  Style.RESET_ALL)
        elif (cmd == "3"):  # youtube-dl
            clear()
            upyd()
            print("")
        elif (cmd == "4"):
            settings.autoUpdate = not settings.autoUpdate
            settings.toJson(settingsPath)
            loadpath("hid")
            clear()
            print(f"autoupdate={settings.autoUpdate}\n")
        elif (cmd == '5'):
            clear()
            print(f"What branch do you wat to change to? You are in a {curb}")
            if (curb == "master"):
                otherb = "testing"
            else:
                otherb = "master"
            print(f"do you want to switch to ")
            BC(otherb, False, True)
            print(" [Y/n]")
            cmd = readchar("#")
            if (cmd == "y"):
                os.system("git pull --recurse-submodules")
                os.system(f"git checkout {otherb}")
                print(Fore.RED, "\n!!!restart for changes to take effect!!!\n",
                      Style.RESET_ALL)
            else:
                clear()
                name()
        else:
            clear()
            name()
    else:
        upytdl()
Пример #3
0
def firstrun():
    clear()
    global settings
    settings = Settings.loadDefault()
    print(
        "this program requires ffmpeg and ffprobe, please put them into the yt-dl directory"
    )
    print(
        "What's the name of your python executable.\n<enter> for python (apologise fo inconvenience)"
    )
    settings.Python.python = input("#")
    if (settings.Python.python == ""):
        settings.Python.python = "python"
    print("What's the name of your pip executable.\n<Enter> for pip")
    settings.Python.pip = input("#")
    if (settings.Python.pip == ""):
        settings.Python.pip = "pip"
    print(
        "Have you installed youtube-dl with pip? (yes if you installed requirements) [Y/n]"
    )
    cmd = readchar("#")
    if (cmd == "y"):
        settings.Youtubedl.fromPip = True
    else:
        settings.Youtubedl.fromPip = False
    print("\nDo you want autoudate on launch? [Y/n]")
    cmd = readchar("#")
    if (cmd == "y"):
        settings.autoUpdate = True
    else:
        settings.autoUpdate = False
    print()
    settings.Ffmpeg.videoCodec = "libx265"  # libx265, h264_nvenc
    settings.Ffmpeg.audioCodec = "opus"  # opus, acc
    settings.Ffmpeg.videoQuality = "24,24,24"  # 24
    settings.Ffmpeg.audioBitrate = "190k"  # 190
    settings.toJson(settingsPath)
    loadpath()
    print("Do you want a Launch script? [Y/n] or p=" + Fore.BLUE +
          "Powershell" + Style.RESET_ALL)
    cmd = readchar("#")
    if (cmd == "y"):
        launchs()
    elif (cmd == "p"):
        launchs(True)
    else:
        pass
    loadpath("hid")
    about()
Пример #4
0
def slpath():
    loadpath()
    print(
        "1. change download path\n2. delete settings\n3. generate Launch script\n0. GoBack"
    )
    cmd = readchar("#")
    if (cmd == "1"):
        savepath()
        clear()
        loadpath()
    elif (cmd == "2"):
        os.remove(settings)
        firstrun()
    elif (cmd == "3"):
        print("press p=" + Fore.BLUE + "PowerShell" + Style.RESET_ALL +
              " or <Enter>")
        cmd = input("#")
        if (cmd == "p"):
            launchs(True)
        else:
            launchs()
        clear()
        name()
    else:
        clear()
        name()
Пример #5
0
def about():
    clear()
    name(False)
    print(f"HorseArmored inc (C){year}\n" +
          f"Version: {ver} cli ({curb} branch)\n" +
          f"Last updated on: {lstupdt}\n" +
          f"My webpage: https://koleckolp.comli.com/\n" +
          f"Project page: https://github.com/KoleckOLP/yt-dl\n" +
          f"need help? ask here: https://discord.gg/W88375j\n" +
          f"youtube-dl (C)2008-2011 Ricardo Garcia Gonzalez\n" +
          f"           (C)2011-{year} youtube-dl developers\n" +
          f"ffmpeg (C)2000-{year} FFmpeg team\n" +
          f"Thanks to kangalioo who always helps a ton!\n" +
          f"Thanks to siscode for featuring my project\n" +
          f"and helping me improve it.\n" +
          f"You can find them both on gihub.")
    print(Style.BRIGHT + "Do you want to see whats new? [Y/n]" +
          Style.RESET_ALL)
    cmd = readchar("#")
    if (cmd == "y"):
        clear()
        fh = open("whatsnew.md", "r")
        print(fh.read() + "\n")
        fh.close()
    else:
        clear()
        name()
Пример #6
0
def firstrun(py=""):
    clear()
    print(
        "this program requires ffmpeg and ffprobe, please put them into the yt-dl directory"
    )
    print(
        "What's the name of your python executable.\n<enter> for python (apologise fo inconvenience)"
    )
    py = input("#")
    if (py == ""):
        py = "python"
    print("What's the name of your pip executable.\n<Enter> for pip")
    pip = input("#")
    if (pip == ""):
        pip = "pip"
    print(
        "Have you installed youtube-dl with pip? (yes if you installed requirements) [Y/n]"
    )
    cmd = readchar("#")
    if (cmd == "y"):
        ydpip = True
    else:
        ydpip = False
    print("\nDo you want autoudate on launch? [Y/n]")
    cmd = readchar("#")
    if (cmd == "y"):
        aup = True
    else:
        aup = False
    print()
    Vcodec = "libx265"  #libx265, h264_nvenc
    Acodec = "opus"  #opus, acc
    Vqual = "24,24,24"  #24
    Abit = "190k"  #190
    savepath("chp", py, pip, ydpip, aup, Vcodec, Acodec, Vqual, Abit)
    loadpath()
    print("Do you want a Launch script? [Y/n] or p=" + Fore.BLUE +
          "Powershell" + Style.RESET_ALL)
    cmd = readchar("#")
    if (cmd == "y"):
        launchs()
    elif (cmd == "p"):
        launchs(True)
    else:
        pass
    loadpath("hid")
    about()
Пример #7
0
def debug():
    print(Fore.MAGENTA + "Welcome to debug menu:", Style.RESET_ALL)
    while (True):
        cmd = input(">")
        if (cmd == "all"):
            print("Paths:")
            for p in sys.path:
                print(p)
            print("\nSaves:")
            if (os.path.exists(
                    os.path.realpath(os.path.dirname(sys.argv[0])) +
                    os.path.sep + ".git")):
                git = True
            else:
                git = False
            loadpath()
            print("Variables:")
            print(
                f"python executable name: {settings.Python.python}\npip executable name: {settings.Python.pip}"
            )
            print("youtube-dl from pip: ", end="")
            TF(settings.Youtubedl.fromPip)
            print("ffmpeg in yt-dl dir: ", end="")
            TF(fdir)
            print("yt-dl from git: ", end="")
            TF(git)
            print("autoupdate: ", end="")
            TF(settings.autoUpdate)
            print(
                f"videoCodec: {settings.Ffmpeg.videoCodec}\naudioCodec: {settings.Ffmpeg.audioCodec}\nvideoQuality: {settings.Ffmpeg.videoQuality}\naudioBitrate: {settings.Ffmpeg.audioBitrate}"
            )
            if is_venv():
                venv = True
            else:
                venv = False
            print("in venv: ", end="")
            TF(venv)
        elif (cmd == "deldown"):
            print("Are you sure you want to delete all audio and videos [Y/n]")
            cmd = readchar("")
            if (cmd == "y"):
                if (os.name == 'nt'):
                    os.system('del ' + settings.Youtubedl.audioDir)
                    os.system('del ' + settings.Youtubedl.videoDir)
                elif (os.name == 'posix'):
                    os.system('rm ' + settings.Youtubedl.audioDir + os.pathsep)
                    os.system('rm ' + settings.Youtubedl.videoDir + os.pathsep)
            else:
                print("no than lol.")
        elif (cmd == "help"):
            print(
                "You are not supposed to be here, this place is for debugging.\nall - shows program variables\ndeldown - deletes your specific video and audio download folders\n<Enter> - return back to main menu"
            )
        else:
            clear()
            name()
            break
Пример #8
0
from call import settings, name, loadpath, autoupdt, firstrun, audiod, videod, subd, reencode, update, slpath, about, debug

clear()

if (os.path.exists(settings)):
    name()
    loadpath()
    autoupdt()
else:
    firstrun()

while (True):
    print(
        "1. Audio\t5. Re-encode\n2. Video\t6. Update\n3. Exit\t\t7. Download path\n4. Subtitles\t8. About, Changelog"
    )
    cmd = readchar("#")

    if (cmd == "1"):  #audio
        audiod()
    elif (cmd == "2"):  #video
        videod()
    elif (cmd == "3"):  #exit
        print("See you later alligator.")
        break
    elif (cmd == "4"):  #subtitles
        subd()
    elif (cmd == "5"):  #re-encode
        reencode()
    elif (cmd == "6"):  #update
        update()
    elif (cmd == "7"):  #save load path