Skip to content
This repository was archived by the owner on Dec 30, 2024. It is now read-only.

Commit cdba883

Browse files
committed
Updated source code from v1.67 to v1.68
1 parent 9ffc23d commit cdba883

File tree

2 files changed

+67
-17
lines changed

2 files changed

+67
-17
lines changed

downloader.py

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
# fmt: off
12
from datetime import datetime
2-
from os import path as ospath, remove, rename
3+
from os import environ, getcwd, listdir
4+
from os import path as ospath
5+
from os import pathsep, remove, rename
6+
from platform import system
37
from sys import exit
48
from threading import Thread
5-
from tkinter import messagebox, Toplevel
9+
from tkinter import messagebox
610
from urllib import request
711

812
from mutagen.flac import FLAC, Picture
@@ -18,24 +22,71 @@
1822
from youtube_search import YoutubeSearch
1923
from ytmusicapi import YTMusic
2024

21-
__version__ = "v1.67"
25+
# fmt: on
26+
27+
__version__ = "v1.68"
2228
__supported_filetypes__ = (".m4a", ".mp3", ".wav", ".flac")
2329

24-
response = (
25-
get("https://api.github.com/repos/rickyrorton/spotify-downloader/releases/latest")
26-
).json()
27-
data = response["tag_name"]
28-
if data.lower() != __version__.lower():
29-
ch = messagebox.askokcancel(
30-
"UPDATE APP",
31-
f"Press OK to update your app to the latest version {data} from the github repository",
32-
)
33-
if ch:
34-
from webbrowser import open_new_tab
3530

36-
open_new_tab("https://github.com/rickyrorton/spotify-downloader/releases")
37-
exit()
31+
def checkversion():
32+
response = (
33+
get(
34+
"https://api.github.com/repos/rickyrorton/spotify-downloader/releases/latest"
35+
)
36+
).json()
37+
data = response["tag_name"]
38+
if data.lower() != __version__.lower():
39+
ch = messagebox.askokcancel(
40+
"UPDATE APP",
41+
f"Press OK to update your app to the latest version {data} from the github repository",
42+
)
43+
if ch:
44+
from webbrowser import open_new_tab
45+
46+
open_new_tab("https://github.com/rickyrorton/spotify-downloader/releases")
47+
elif __name__ != "__main__":
48+
exit()
3849

50+
51+
t = Thread(target=checkversion())
52+
t.start()
53+
t.join()
54+
55+
56+
def checkffmpeg():
57+
ffmpeg = ["ffmpeg.exe", "ffplay.exe", "ffprobe.exe"]
58+
dirs = environ["PATH"].split(pathsep)[0:-1]
59+
dirs.append(getcwd())
60+
ffmpeg_present = False
61+
for i in dirs:
62+
if all(j in listdir(i) for j in ffmpeg) and len(listdir(i)) != 0:
63+
ffmpeg_present = True
64+
break
65+
66+
if not ffmpeg_present:
67+
ch = messagebox.askokcancel(
68+
"DOWNLOAD FFMPEG",
69+
f"Download ffmpeg to use formats like mp3,press OK to download ffmpeg",
70+
)
71+
if ch:
72+
if system() == "Windows":
73+
request.urlretrieve(
74+
"https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-essentials.7z",
75+
ospath.join(getcwd(), "ffmpeg.7z"),
76+
)
77+
messagebox.showinfo(
78+
"INSTALL FFMPEG",
79+
"FFMPEG has been downloaded,extract the contents of the bin folder and place them in the same directory as the downloader",
80+
)
81+
82+
83+
try:
84+
checkffmpeg()
85+
except:
86+
messagebox.showinfo(
87+
"FFMPEG Check failed",
88+
"FFMPEG executables couldnt be found to download formats other than m4a ffmpeg has to be downloaded manually",
89+
)
3990
ytm = YTMusic()
4091

4192

gui.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
Image, ImageTk)
1616

1717
import downloader
18-
1918
# fmt: on
2019

2120

0 commit comments

Comments
 (0)