Skip to content

Commit

Permalink
Added new button and impoved ux.
Browse files Browse the repository at this point in the history
  • Loading branch information
StDensity committed May 14, 2024
1 parent f3be301 commit 48a4696
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions YouTubeToMP3/YouTubeToMP3.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ def download_mp3():
filename_text = filename.get()

try:
download_info_label.configure(text="Downloading.")
yt = YouTube(video_url)
video = yt.streams.filter(only_audio=True).first()
out_file = video.download(output_path=folder_path)
new_file = (f"{folder_path}/{filename_text}.mp3")
os.rename(out_file, new_file)

download_info_label.configure(text="MP3 downloaded & saved successfully.")

time.sleep(7)
root.destroy()


except:
download_info_label.configure(text="Download Error.")

def close():
root.destroy()
exit(0)

ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("dark-blue")

Expand Down Expand Up @@ -70,6 +73,10 @@ def download_mp3():
download_button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)

download_info_label = ctk.CTkLabel(master=frame, text="")
download_info_label.place(relx=0.5, rely=0.63, anchor=tkinter.CENTER)
download_info_label.place(relx=0.5, rely=0.58, anchor=tkinter.CENTER)

# Close button
close_button = ctk.CTkButton(master=frame, text="Close", command=close)
close_button.place(relx=0.5, rely=0.66, anchor=tkinter.CENTER)

root.mainloop()

0 comments on commit 48a4696

Please sign in to comment.