Namaz vakitlerinde masaüstü bildirimler gönderebilecek ve bir yandan da ezan okuyacak bir program yapmayı öğreniyoruz.
Video serisi boyunca kullandığımız siteler:
https://pypi.org/project/win10toast/
https://aladhan.com/prayer-times-api
Kodlar:
from win10toast import ToastNotifier class AnaSayfa(Tk): def __init__(self): Tk.__init__(self) self.cerceve1 = Frame(self, bg="#769fcd") self.cerceve1.pack(side=TOP, fill=X) self.cerceve2 = Frame(self, bg="#b9d7ea") self.cerceve2.pack(side=TOP, fill=X) Label(self.cerceve1, text="YOUTUBE İNDİRME PROGRAMI", font=("Baloo 2", 17, "bold"), bg="#769fcd").pack() Button(self.cerceve1, text="VİDEO / SES", font=("Baloo 2", 12), bg="#769fcd", activebackground="#b9d7ea", width=25, command=lambda: Video(self)).pack() Button(self.cerceve1, text="OYNATMA LİSTESİ", font=("Baloo 2", 12), bg="#769fcd", activebackground="#b9d7ea", width=25, command=lambda: OynatmaListesi(self)).pack() class Video(Frame): def __init__(self, master): Frame.__init__(self, master) for widget in master.cerceve2.winfo_children(): widget.destroy() Label(master.cerceve2, text="VİDEO / SES", font=("Baloo 2", 13, "bold"), bg="#b9d7ea").pack() Label(master.cerceve2, text="URL", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() self.url = Entry(master.cerceve2, width=40, font=("Baloo 2", 11)) self.url.pack() self.url.bind("<1>", self.tikla) Label(master.cerceve2, text="KALİTE", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() kalite = ["Max. Kalite", "Min. Kalite", "360p", "Sadece Ses"] self.kalite_sec = ttk.Combobox(master.cerceve2, font=("Baloo 2", 12), width=24, value=kalite) self.kalite_sec.pack() self.kalite_sec.current(0) Label(master.cerceve2, text="KAYIT YERİ", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() self.kayit_yeri_gosterilen = Label(master.cerceve2, text=f"{os.getcwd()}", font=("Baloo 2", 9), bg="#b9d7ea") self.kayit_yeri_gosterilen.pack() Button(master.cerceve2, text="SEÇ", font=("Baloo 2", 12), bg="#b9d7ea", activebackground="#769fcd", width=25, command=self.kayit_yeri_sec).pack() Button(master.cerceve2, text="İNDİR", font=("Baloo 2", 12), bg="#b9d7ea", activebackground="#769fcd", width=25, command=self.indir).pack() self.indiriliyor = Label(master.cerceve2, text="", bg="#b9d7ea", font=("Baloo 2", 12)) self.indiriliyor.pack() def tikla(self, event): try: if "youtube" in self.clipboard_get(): self.url.delete(0, END) self.url.insert(0, self.clipboard_get()) except TclError: pass def kayit_yeri_sec(self): self.kayit_yeri_gosterilen.config(text=filedialog.askdirectory()) def indir(self): self.yt = YouTube(self.url.get()) if self.kalite_sec.get() == "Max. Kalite": self.yt.streams.get_highest_resolution().download(self.kayit_yeri_gosterilen['text']) elif self.kalite_sec.get() == "Min. Kalite": self.yt.streams.get_lowest_resolution().download(self.kayit_yeri_gosterilen['text']) elif self.kalite_sec.get() == "360p": self.yt.streams.get_by_resolution("360p").download(self.kayit_yeri_gosterilen['text']) elif self.kalite_sec.get() == "Sadece Ses": self.yt.streams.get_audio_only().download(self.kayit_yeri_gosterilen['text']) self.indiriliyor.config(text="İndirme Tamamlandı!!!") bildirim = ToastNotifier() bildirim.show_toast( "Vuhuuu!", "İndirme tamamlandı!!", icon_path="softic.ico", duration=10, threaded=True ) class OynatmaListesi(Frame): def __init__(self, master): Frame.__init__(self, master) for widget in master.cerceve2.winfo_children(): widget.destroy() Label(master.cerceve2, text="OYNATMA LİSTESİ", font=("Baloo 2", 13, "bold"), bg="#b9d7ea").pack() Label(master.cerceve2, text="URL", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() self.url = Entry(master.cerceve2, width=40, font=("Baloo 2", 11)) self.url.pack() self.url.bind("<1>", self.tikla) Label(master.cerceve2, text="KALİTE", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() kalite = ["Max. Kalite", "Min. Kalite", "360p", "Sadece Ses"] self.kalite_sec = ttk.Combobox(master.cerceve2, font=("Baloo 2", 12), width=24, value=kalite) self.kalite_sec.pack() self.kalite_sec.current(0) Label(master.cerceve2, text="KAYIT YERİ", font=("Baloo 2", 12, "bold"), bg="#b9d7ea").pack() self.kayit_yeri_gosterilen = Label(master.cerceve2, text=f"{os.getcwd()}", font=("Baloo 2", 9), bg="#b9d7ea") self.kayit_yeri_gosterilen.pack() Button(master.cerceve2, text="SEÇ", font=("Baloo 2", 12), bg="#b9d7ea", activebackground="#769fcd", width=25, command=self.kayit_yeri_sec).pack() Button(master.cerceve2, text="İNDİR", font=("Baloo 2", 12), bg="#b9d7ea", activebackground="#769fcd", width=25, command=self.indir).pack() self.indiriliyor = Label(master.cerceve2, text="", bg="#b9d7ea", font=("Baloo 2", 12)) self.indiriliyor.pack() def tikla(self, event): try: if "youtube" in self.clipboard_get(): self.url.delete(0, END) self.url.insert(0, self.clipboard_get()) except TclError: pass def kayit_yeri_sec(self): self.kayit_yeri_gosterilen.config(text=filedialog.askdirectory()) def indir(self): playlist = Playlist(self.url.get()) playlist._video_regex = re.compile(r"\"url\":\"(/watch\?v=[\w-]*)") if self.kalite_sec.get() == "Max. Kalite": for video in playlist.video_urls: YouTube(video).streams.get_highest_resolution().download(self.kayit_yeri_gosterilen['text']) elif self.kalite_sec.get() == "Min. Kalite": for video in playlist.video_urls: YouTube(video).streams.get_lowest_resolution().download(self.kayit_yeri_gosterilen['text']) elif self.kalite_sec.get() == "360p": for video in playlist.video_urls: YouTube(video).streams.get_by_resolution("360p").download(self.kayit_yeri_gosterilen['text']) elif self.kalite_sec.get() == "Sadece Ses": for video in playlist.video_urls: YouTube(video).streams.get_audio_only().download(self.kayit_yeri_gosterilen['text']) self.indiriliyor.config(text="İndirme Tamamlandı!!!") bildirim = ToastNotifier() bildirim.show_toast( "Vuhuuu!", "İndirme tamamlandı!!", icon_path="softic.ico", duration=10, threaded=True ) if __name__ == "__main__": app = AnaSayfa() app.configure(bg="#b9d7ea") app.title("Youtube İndirme Programı") app.iconphoto(True, PhotoImage(file="sft.png")) app.geometry("600x475+250+75") app.resizable(False, False) app.mainloop()