diff --git a/Release 1.0.7z b/Release 1.0.7z deleted file mode 100644 index 3d94e16..0000000 Binary files a/Release 1.0.7z and /dev/null differ diff --git a/Release 1.0/README.txt b/Release 1.0/README.txt deleted file mode 100644 index d296a47..0000000 --- a/Release 1.0/README.txt +++ /dev/null @@ -1,21 +0,0 @@ -This document is a copy of README.md from Git. - -The SOURCE CODE directory contains a copy of 'main.py' and 'YT Download.py' for GitHub. - -~~~~~BEGINING OF README.md~~~~~ -# YT-Dowload -A portable yt-dlp wrapper with GUI - -## Credits -Icon: Image by https://pixabay.com/images/id-1834016/ - -Dependencies: - -YT-DLP: https://github.com/yt-dlp/yt-dlp - -PySimpleGUI: https://github.com/PySimpleGUI/PySimpleGUI - -FFmpeg: https://ffmpeg.org/ - -Thank you for using YT Download! - diff --git a/Release 1.0/YT Download.py b/Release 1.0/YT Download.py deleted file mode 100644 index 2f4b933..0000000 --- a/Release 1.0/YT Download.py +++ /dev/null @@ -1,56 +0,0 @@ -import PySimpleGUI as sg -import main as dowloader - -sg.theme('DarkAmber') # Color Scheme - -# GUI layout -layout = [ [sg.Text("Thank you for using YT Download!")], - [sg.Text("YouTube URL:"), sg.InputText(key='URL')], - [sg.Checkbox('Download as an audio file (mp3)?', default=False, key='isAudio')], - [sg.Text('File path. Leave blank to save download to program location.')], - [sg.Input(key='DIR'), sg.FolderBrowse()], - [sg.Button('Download'), sg.Cancel()] - -] - -# Returns 'program directory' if dir is empy, otherwise returns dir -def format_dir(dir): - if dir == '': - return 'program directory.' - else: - return dir - -def incorrect_url_check(title): - if title == 'ERROR': - sg.popup('INVALID YOUTUBE URL', icon='logo.ico', title='YT Download') - return False - else: - return title - -# Main logic loop. Calls the apropriate functions in main.py -window = sg.Window('YT Download', layout, icon='logo.ico') -while True: - - event, values = window.read() # Check the active event and the value dictionary. - print(event, values) # Print event and values for debuging in the command line. - - - if event == sg.WIN_CLOSED or event == 'Cancel': # Break the loop if the window is closed or the 'Cancel' button is pressed - break - - if event == 'Download' and values['isAudio'] and values['URL'] != "": # When the 'Download' button is pressed, check to see if the 'isAudio' check box is checked and see if the url feild is not blank. - dir = format_dir(values['DIR']) # Then, call format_dir() and fetch the video title. Finially, download the audio and display the popup when done. - title = incorrect_url_check(dowloader.return_title(values['URL'])) - if title != False: - dowloader.logic(values['URL'], True, dir) - sg.popup(f'Downloaded {title} as a .mp3 file to {dir}', icon='logo.ico', title='YT Download') - elif event == 'Download' and not values['isAudio'] and values['URL'] != "": # When the 'Download' button is pressed, check to see if the 'isAudio' check box is not checked and see if the url feild is not blank. - dir = format_dir(values['DIR']) # Then, call format_dir() and fetch the video title. Finially, download the video and display the popup when done. - title = incorrect_url_check(dowloader.return_title(values['URL'])) - if title != False: - dowloader.logic(values['URL'], False, dir) - sg.popup(f'Downloaded {title} as a .mp4 file to {dir}', icon='logo.ico', title='YT Download') - elif event == 'Download' and values['URL'] == '': - sg.popup('Please make sure to provide a URL', icon='logo.ico', title='YT Download') - -window.close() # Kill the program \ No newline at end of file diff --git a/Release 1.0/logo.ico b/Release 1.0/logo.ico deleted file mode 100644 index fed1d53..0000000 Binary files a/Release 1.0/logo.ico and /dev/null differ diff --git a/Release 1.0/main.py b/Release 1.0/main.py deleted file mode 100644 index 047fb23..0000000 --- a/Release 1.0/main.py +++ /dev/null @@ -1,58 +0,0 @@ -from yt_dlp import YoutubeDL, utils - -print('TERMINAL Please keep this window open for YT Download to work.\n') # Only is seen in the Command Line. Anything that prints to the console will only be seen in the command line. - -video_options = { - # Download the best mp4 video available, or the best video if no mp4 available ["..." COPIED FROM: https://github.com/yt-dlp/yt-dlp#format-selection-examples] - 'format': "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b" -} - -audio_options = { - 'format': 'm4a/bestaudio/best', - 'postprocessors': [{ #FFmpeg Settings see: |yt-dlp/__init__.py --> .postprocessor| for a list of settings. - 'key': 'FFmpegExtractAudio', - 'preferredcodec': 'mp3', - }] -} - -# Handels downlaoding and retriving information -def YoutubeDownloader(settings, url, isDownload=False): - - if isDownload: # Downloads the audio or video file - with YoutubeDL(settings) as ydl: - ydl.download(url) - else: - with YoutubeDL() as ydl: # Returns the title of video the url points to. - try: - info = ydl.extract_info(url, download=False) - return info['title'] - except utils.DownloadError: - return 'ERROR' - - - -# Main logic. Sets directory when specified and calls YoutubeDownloader() -def logic(URL, ISaudio, DIR='skip'): - - dir = DIR - - if dir == 'skip': # No directory was specified. - pass - else: # Format both the video and audio options with the specified directory. - audio_options['outtmpl'] = dir + '/%(title)s.%(ext)s' - video_options['outtmpl'] = dir + '/%(title)s.%(ext)s' - - if ISaudio: # Download as audio or video - YoutubeDownloader(audio_options, URL, True) - else: - YoutubeDownloader(video_options, URL, True) - -def return_title(url): # Returns the title of video the url points to. - return YoutubeDownloader(None, url) - - -''' -Usefull testing things: - -https://youtu.be/I8sUC-dsW8A -''' \ No newline at end of file