-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpymusic.py
30 lines (23 loc) · 917 Bytes
/
pymusic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Import libraries
import tkinter as tk
from youtube_dlg import youtube_dlGui # Assuming youtube-dl-gui is installed
# Create the main window
window = tk.Tk()
window.title("YouTube Music Downloader")
# Entry field for YouTube URL
url_entry = tk.Entry(window)
url_entry.pack(padx=10, pady=10)
# Download button
def download_clicked():
url = url_entry.get()
# Call youtube-dl-gui to download audio format (e.g., MP3)
youtube_dlGui.main(url, "-f bestaudio") # Modify format as needed
download_button = tk.Button(window, text="Download", command=download_clicked)
download_button.pack(padx=10, pady=10)
# Optional: Playback functionality using pygame (replace with placeholder)
def play_music():
# Implement music playback logic using downloaded file
play_button = tk.Button(window, text="Play", command=play_music) # Placeholder
play_button.pack(padx=10, pady=10)
# Run the main loop
window.mainloop()