diff options
author | nathansmithsmith <nathansmith7@mailfence.com> | 2023-11-09 04:52:18 +0000 |
---|---|---|
committer | nathansmithsmith <nathansmith7@mailfence.com> | 2023-11-09 04:52:18 +0000 |
commit | d342ab7261da15a716ee49bcec5ecbcd1d953822 (patch) | |
tree | 7086901436dc082a95d59f6169a3eaeef2639c91 | |
parent | b0edf6f418fbc860f3dd864fb5ee71ee0a108c1d (diff) | |
download | youload-d342ab7261da15a716ee49bcec5ecbcd1d953822.tar.gz youload-d342ab7261da15a716ee49bcec5ecbcd1d953822.tar.bz2 youload-d342ab7261da15a716ee49bcec5ecbcd1d953822.zip |
Better layout and better design
-rw-r--r-- | XavierRenegadeAngelFullEpisodes/Xavier Renegade Angel Episode 1 - What Life D-D-Doth.mp4 | bin | 0 -> 37015758 bytes | |||
-rw-r--r-- | src/youload_app.py | 63 |
2 files changed, 48 insertions, 15 deletions
diff --git a/XavierRenegadeAngelFullEpisodes/Xavier Renegade Angel Episode 1 - What Life D-D-Doth.mp4 b/XavierRenegadeAngelFullEpisodes/Xavier Renegade Angel Episode 1 - What Life D-D-Doth.mp4 Binary files differnew file mode 100644 index 0000000..e11298b --- /dev/null +++ b/XavierRenegadeAngelFullEpisodes/Xavier Renegade Angel Episode 1 - What Life D-D-Doth.mp4 diff --git a/src/youload_app.py b/src/youload_app.py index 9079923..037ac30 100644 --- a/src/youload_app.py +++ b/src/youload_app.py @@ -3,6 +3,8 @@ from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button +from kivy.uix.floatlayout import FloatLayout +from kivy.uix.gridlayout import GridLayout from kivy.uix.textinput import TextInput from kivy.uix.label import Label @@ -12,29 +14,40 @@ from youload_playlist import YouLoadPlayList class YouloadApp(App): def build(self): - layout = BoxLayout(padding=10, orientation='vertical') + layout = BoxLayout(orientation='vertical') # Data members self.url = "https://youtube.com/playlist?list=PLuZUmvZz4WI78uqT5S71yBHNBMJ97HzhY&si=SI2qN9MgxmmK2rbf" self.is_downloading = False - self.download_thread = threading.Thread(target=self.download_playlist_thread) self.stop_download = False # Url input. - url_input = TextInput(text=self.url, multiline=False) + url_input = TextInput(text=self.url, multiline=False, size_hint=(0.75, 1.0)) url_input.bind(text=self.uid_url_input) # Submit button. - submit = Button(text="Download") - submit.bind(on_press=self.submit_cb) + self.submit = Button(text="Download", size_hint=(0.25, 1.0)) + self.submit.bind(on_press=self.submit_cb) + + # Url and submit layout. + url_and_submit = BoxLayout(size_hint=(1.0, 0.1)) + url_and_submit.add_widget(url_input) + url_and_submit.add_widget(self.submit) + + # Download status. + self.download_status = Label(text="Nothing downloading") + + # Info line. + info_line = BoxLayout(size_hint=(1.0, 0.1)) + info_line.add_widget(self.download_status) # Info display. - self.info_display = Label(text="") + self.downloads_display = Label(text="", size_hint=(1.0, 0.8)) # Everything else (: - layout.add_widget(url_input) - layout.add_widget(self.info_display) - layout.add_widget(submit) + layout.add_widget(url_and_submit) + layout.add_widget(info_line) + layout.add_widget(self.downloads_display) return layout @@ -43,26 +56,46 @@ class YouloadApp(App): # Download the videos in a different thread so the ui still works. def download_playlist_thread(self): - playlist = YouLoadPlayList(self.url) + try: + playlist = YouLoadPlayList(self.url) + except KeyError: + self.download_status.text = "Error getting playlist" + return + playlist.prepare_for_download() - self.info_display.text = f"Downloading {self.url}\n" + self.downloads_display.text = f"Downloading {self.url}\n" self.is_downloading = True + self.submit.text = "Stop" # Download each video for i in range(playlist.video_count): - self.info_display.text += playlist.download_video(i) + "\n" + self.download_status.text = f"Downloading {i+1}/{playlist.video_count}" + self.downloads_display.text += playlist.download_video(i) + "\n" # Stop this mother fucker if self.stop_download: - return + break + self.submit.text = "Download" + self.download_status.text = "Download complete" self.is_downloading = False + def stop_download(self): + self.stop_download = True + def submit_cb(self, instance): + # Is already downloading something. + if self.is_downloading: + self.download_status.text = "Stopping download" + self.stop_download() + return + + # Start download thread. + download_thread = threading.Thread(target=self.download_playlist_thread) self.stop_download = False - self.download_thread.start() + download_thread.start() def on_stop(self): - self.stop_download = True + self.stop_download() |