Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisal-D authored May 8, 2024
1 parent 986f1e7 commit f951ece
Show file tree
Hide file tree
Showing 36 changed files with 4,765 additions and 93 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ PyTube Downloader is a user-friendly application that allows users to download Y
- **Automatic Download With Predefined Settings** Users can set predefined download settings such as preferred video quality, audio format, download location, and more. Once a YouTube URL is added, the video will load and then start to download automatically according to these predefined settings.
- **System Tray Icon Mode:** Users can easily minimize the application to the system tray for unobtrusive operation.
- **Theme Customization:** Personalize your experience with the ability to switch between dark and light themes. Additionally, customize the accent color to suit your preferences, creating a visually pleasing interface tailored to your style.
- **Scaling Preferences:** Users can scale the application interface from 100% to 200%, adjusting the size of widgets and elements for better readability and usability.

---

Expand All @@ -30,8 +31,8 @@ PyTube Downloader is a user-friendly application that allows users to download Y
![1](https://github.com/Thisal-D/PyTube-Downloader/assets/93121062/72489e71-95a6-4fa8-8da4-591a7d6e7adb)
![2](https://github.com/Thisal-D/PyTube-Downloader/assets/93121062/6f4ce65d-93d5-4451-9bce-5b68ad276faa)
![3](https://github.com/Thisal-D/PyTube-Downloader/assets/93121062/154d93da-3b39-49b5-b98a-a658907ac283)
![4](https://github.com/Thisal-D/PyTube-Downloader/assets/93121062/66318196-3d48-4c13-9ac4-93bbbce52248)
![5](https://github.com/Thisal-D/PyTube-Downloader/assets/93121062/cb8f9332-025e-40ba-91d8-d66c35cc2d42)
![4](https://github.com/Thisal-D/PyTube-Downloader/assets/93121062/c5d33638-f613-4256-8b0b-cc3f1b90457a)
![5](https://github.com/Thisal-D/PyTube-Downloader/assets/93121062/fb3e7215-921c-464c-8aa7-33b104a6af91)
![6](https://github.com/Thisal-D/PyTube-Downloader/assets/93121062/3517839d-1774-4b3d-b02d-d6c3cff94811)

---
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '0.0.4'
VERSION = '0.0.5'
179 changes: 101 additions & 78 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)
from settings import (
ThemeSettings,
GeneralSettings
GeneralSettings,
)
from utils import (
FileUtility
Expand Down Expand Up @@ -71,15 +71,11 @@ def __init__(self):
def create_widgets(self):
self.url_entry = ctk.CTkEntry(
master=self,
height=40,
placeholder_text="Enter Youtube URL"
)

self.video_radio_btn = ctk.CTkRadioButton(
master=self, text="Video",
radiobutton_width=16,
radiobutton_height=16,
width=60,
height=18,
command=lambda: self.select_download_mode("video")
)
Expand All @@ -88,18 +84,12 @@ def create_widgets(self):
self.playlist_radio_btn = ctk.CTkRadioButton(
master=self,
text="Playlist",
radiobutton_width=16,
radiobutton_height=16,
width=60,
height=18,
command=lambda: self.select_download_mode("playlist")
)

self.add_url_btn = ctk.CTkButton(
master=self,
text="Add +",
height=40,
width=100,
border_width=2,
command=self.add_video_playlist
)
Expand All @@ -115,21 +105,18 @@ def create_widgets(self):
self.navigate_added_frame_btn = ctk.CTkButton(
master=self,
text="Added",
height=40,
command=lambda: self.place_frame(self.added_content_scroll_frame, "added")
)

self.navigate_downloading_frame_btn = ctk.CTkButton(
master=self,
text="Downloading",
height=40,
command=lambda: self.place_frame(self.downloading_content_scroll_frame, "downloading")
)

self.navigate_downloaded_frame_btn = ctk.CTkButton(
master=self,
text="Downloaded",
height=40,
command=lambda: self.place_frame(self.downloaded_content_scroll_frame, "downloaded")
)

Expand All @@ -151,36 +138,24 @@ def create_widgets(self):
self.settings_panel = SettingPanel(
master=self,
theme_settings_change_callback=self.update_theme_settings,
general_settings_change_callback=self.update_general_settings
general_settings_change_callback=self.update_general_settings,
restart_callback=self.restart
)

self.settings_btn = ctk.CTkButton(
master=self,
text="⚡",
border_spacing=0,
hover=False,
width=30,
height=40,
command=self.open_settings
)

self.context_menu = ContextMenu(
master=self,
width=100,
height=120,
width=100 * GeneralSettings.settings["scale_r"],
height=120 * GeneralSettings.settings["scale_r"],
)

def place_widgets(self):
self.settings_btn.place(x=-5, y=4)
self.url_entry.place(x=43, y=4)
self.add_url_btn.place(y=4)
self.video_radio_btn.place(y=5)
self.playlist_radio_btn.place(y=25)
self.navigate_added_frame_btn.place(y=50, x=10)
self.navigate_downloading_frame_btn.place(y=50)
self.navigate_downloaded_frame_btn.place(y=50)
self.place_frame(self.added_content_scroll_frame, "added")

def place_forget_frames(self):
self.added_content_scroll_frame.place_forget()
self.downloading_content_scroll_frame.place_forget()
Expand Down Expand Up @@ -210,13 +185,86 @@ def place_label(self, frame_name: str):

def place_frame(self, frame: ctk.CTkScrollableFrame, frame_name: str):
self.place_forget_frames()
frame.place(y=90, x=10)
frame.place(y=90 * GeneralSettings.settings["scale_r"], x=10)
self.place_label(frame_name)

def place_widgets(self):
scale = GeneralSettings.settings["scale_r"]
self.settings_btn.place(x=-5, y=4)
self.url_entry.place(x=43 * scale, y=4)
self.add_url_btn.place(y=4)
self.video_radio_btn.place(y=5)
self.playlist_radio_btn.place(y=25 * scale)
self.navigate_added_frame_btn.place(y=50 * scale, x=10)
self.navigate_downloading_frame_btn.place(y=50 * scale)
self.navigate_downloaded_frame_btn.place(y=50 * scale)
self.place_frame(self.added_content_scroll_frame, "added")

def set_widgets_fonts(self):
scale = GeneralSettings.settings["scale_r"]
self.url_entry.configure(
font=ctk.CTkFont(
family="Segoe UI",
size=int(16 * scale),
weight="normal",
slant="italic",
underline=True
)
)

self.video_radio_btn.configure(font=("Segoe UI", 12 * scale, "bold"))
self.playlist_radio_btn.configure(font=("Segoe UI", 12 * scale, "bold"))
self.add_url_btn.configure(font=("Segoe UI", 15 * scale, "bold"))

font_style_1 = ctk.CTkFont(
family="Comic Sans MS",
size=int(16 * scale),
weight="bold",
slant="italic"
)
self.added_frame_info_label.configure(font=font_style_1)
self.downloading_frame_info_label.configure(font=font_style_1)
self.downloaded_frame_info_label.configure(font=font_style_1)

font_style_2 = ("Segoe UI", 15 * scale, "bold")
self.navigate_added_frame_btn.configure(font=font_style_2)
self.navigate_downloading_frame_btn.configure(font=font_style_2)
self.navigate_downloaded_frame_btn.configure(font=font_style_2)
self.settings_btn.configure(font=("arial", 25 * scale, "normal"))

def set_widgets_sizes(self):
scale = GeneralSettings.settings["scale_r"]
self.url_entry.configure(height=40 * scale)
self.video_radio_btn.configure(
radiobutton_width=16 * scale, radiobutton_height=16 * scale,
width=60 * scale, height=18 * scale
)
self.playlist_radio_btn.configure(
radiobutton_width=16 * scale, radiobutton_height=16 * scale,
width=60 * scale, height=18 * scale
)
self.add_url_btn.configure(
height=40 * scale,
width=100 * scale,
)
self.navigate_added_frame_btn.configure(
height=40 * scale
)
self.navigate_downloading_frame_btn.configure(
height=40 * scale
)
self.navigate_downloaded_frame_btn.configure(
height=40 * scale
)
self.settings_btn.configure(
width=30 * scale, height=40 * scale,
)

def configure_widgets_size(self):
scale = GeneralSettings.settings["scale_r"]
root_width = self.winfo_width()
root_height = self.winfo_height()
self.url_entry.configure(width=root_width - 250)
self.url_entry.configure(width=root_width - 250 * scale)

btn_width = (root_width - 26) / 3
self.navigate_added_frame_btn.configure(width=btn_width)
Expand All @@ -226,9 +274,9 @@ def configure_widgets_size(self):
self.navigate_downloading_frame_btn.place(x=btn_width + 10 + 3)
self.navigate_downloaded_frame_btn.place(x=btn_width * 2 + 10 + 6)

self.video_radio_btn.place(x=self.winfo_width() - 190)
self.playlist_radio_btn.place(x=self.winfo_width() - 190)
self.add_url_btn.place(x=self.winfo_width() - 110)
self.video_radio_btn.place(x=self.winfo_width() - 190 * scale)
self.playlist_radio_btn.place(x=self.winfo_width() - 190 * scale)
self.add_url_btn.place(x=self.winfo_width() - 110 * scale)

if self.added_frame_info_label_placed:
self.place_label("added")
Expand All @@ -237,7 +285,7 @@ def configure_widgets_size(self):
elif self.downloaded_frame_info_label_placed:
self.place_label("downloaded")

frame_height = root_height - 105
frame_height = root_height - 105 * scale
frame_width = root_width - 40
self.added_content_scroll_frame.configure(
height=frame_height,
Expand Down Expand Up @@ -564,40 +612,6 @@ def mouse_ot_downloaded_frame_info_label(_event):
self.downloaded_frame_info_label.bind("<Enter>", on_mouse_enter_downloaded_frame_info_label)
self.downloaded_frame_info_label.bind("<Leave>", mouse_ot_downloaded_frame_info_label)

def set_widgets_fonts(self):
self.url_entry.configure(
font=ctk.CTkFont(
family="arial",
size=16,
weight="normal",
slant="italic",
underline=True
)
)

self.video_radio_btn.configure(font=("Monospace", 12, "bold"))
self.playlist_radio_btn.configure(font=("Monospace", 12, "bold"))
self.add_url_btn.configure(font=("arial", 15, "bold"))

font_style_1 = ctk.CTkFont(
family="arial",
size=16,
weight="bold",
slant="italic"
)
self.added_frame_info_label.configure(font=font_style_1)
self.downloading_frame_info_label.configure(font=font_style_1)
self.downloaded_frame_info_label.configure(font=font_style_1)
font_style_2 = ctk.CTkFont(
family="arial",
size=15,
weight="bold",
)
self.navigate_added_frame_btn.configure(font=font_style_2)
self.navigate_downloading_frame_btn.configure(font=font_style_2)
self.navigate_downloaded_frame_btn.configure(font=font_style_2)
self.settings_btn.configure(font=("arial", 25, "normal"))

def select_download_mode(self, download_mode):
self.selected_download_mode = download_mode
if download_mode == "playlist":
Expand All @@ -612,7 +626,7 @@ def add_video_playlist(self):
if self.selected_download_mode == "video":
AddedVideo(
master=self.added_content_scroll_frame,
height=70,
height=70 * GeneralSettings.settings["scale_r"],
width=self.added_content_scroll_frame.winfo_width(),
# video url
video_url=yt_url,
Expand All @@ -623,7 +637,7 @@ def add_video_playlist(self):
else:
AddedPlayList(
master=self.added_content_scroll_frame,
height=85,
height=85 * GeneralSettings.settings["scale_r"],
width=self.added_content_scroll_frame.winfo_width(),

playlist_download_button_click_callback=self.download_playlist,
Expand All @@ -636,7 +650,7 @@ def download_video(self, video: AddedVideo):
self.downloading_frame_info_label.place_forget()
DownloadingVideo(
master=self.downloading_content_scroll_frame,
height=70,
height=70 * GeneralSettings.settings["scale_r"],
width=self.downloading_content_scroll_frame.winfo_width(),
# video info
channel_url=video.channel_url,
Expand All @@ -657,7 +671,7 @@ def download_playlist(self, playlist: AddedPlayList):
self.downloading_frame_info_label.place_forget()
DownloadingPlayList(
master=self.downloading_content_scroll_frame,
height=85,
height=85 * GeneralSettings.settings["scale_r"],
width=self.downloading_content_scroll_frame.winfo_width(),
# video info
channel_url=playlist.channel_url,
Expand All @@ -677,7 +691,7 @@ def downloaded_video(self, video: DownloadingVideo):
self.downloaded_frame_info_label.place_forget()
DownloadedVideo(
master=self.downloaded_content_scroll_frame,
height=70,
height=70 * GeneralSettings.settings["scale_r"],
width=self.downloaded_content_scroll_frame.winfo_width(),

thumbnails=video.thumbnails,
Expand All @@ -698,7 +712,7 @@ def downloaded_playlist(self, playlist: DownloadingPlayList):
self.downloaded_frame_info_label.place_forget()
DownloadedPlayList(
master=self.downloaded_content_scroll_frame,
height=85,
height=85 * GeneralSettings.settings["scale_r"],
width=self.downloaded_content_scroll_frame.winfo_width(),
# playlist url
channel_url=playlist.channel_url,
Expand Down Expand Up @@ -771,12 +785,19 @@ def on_app_closing(self):
GeneralSettings.save_settings()
self.clear_temporally_saved_files()
self.destroy()
os._exit(0)

def cancel_app_closing(self):
self.bind_events()

def restart(self):
self.on_app_closing()
if os.path.exists("PyTube Downloader.exe"):
os.startfile("PyTube Downloader.exe")
if os.path.exists("main.py"):
os.startfile("main.py")

def show_close_confirmation_dialog(self):
scale = GeneralSettings.settings["scale_r"]
self.restore_from_tray()
AlertWindow(
master=self,
Expand All @@ -785,7 +806,9 @@ def show_close_confirmation_dialog(self):
cancel_button_text="cancel",
ok_button_callback=self.on_app_closing,
cancel_button_callback=self.cancel_app_closing,
callback=self.cancel_app_closing
callback=self.cancel_app_closing,
width=int(450 * scale),
height=int(130 * scale),
)

def restore_from_tray(self):
Expand Down
10 changes: 5 additions & 5 deletions contributors.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONTRIBUTORS INFO
https://github.com/Thisal-D@%@Thisal Dilmith
https://github.com/childeyouyu@%@youyu
https://github.com/Navindu21@%@Navindu Pahasara
https://github.com/sooryasuraweera@%@Soorya Suraweera
CONTRIBUTORS INFO
https://github.com/Thisal-D@%@Thisal Dilmith
https://github.com/childeyouyu@%@youyu
https://github.com/Navindu21@%@Navindu Pahasara
https://github.com/sooryasuraweera@%@Soorya Suraweera
4 changes: 3 additions & 1 deletion data/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
"window_geometry": "900x500+0+0",
"max_simultaneous_downloads": 1,
"max_simultaneous_loads": 1,
"update_delay": 0.7
"update_delay": 0.7,
"scale": 100.0,
"scale_r": 1.0
}
Loading

0 comments on commit f951ece

Please sign in to comment.