Skip to content

Commit

Permalink
add formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
insaiyancvk committed Apr 3, 2021
1 parent b3ec4c0 commit f45441c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions modules/spotify_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def interface(self):
downloaded_songs = len(os.listdir())
if total_songs-downloaded_songs!=0:
print(f"\n{total_songs-downloaded_songs}/{total_songs} songs were not downloaded due to some error")
print("\n\n")
print("\t","="*100)
print(f"\n\n\t Your playlist is downloaded in \"/musicDL downloads/Playlists/{plName}\" folder on desktop\n\n")
print("\t","="*100)
Expand Down
6 changes: 3 additions & 3 deletions modules/ytDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def download_singles(self):
c = int(input("\nEnter the serial number: "))

cm.download_song(video_url[c-1],'','')
print("\n\n")
print("\t","="*100)
print(f"\n\n\t Your song is downloaded in \"/musicDL downloads/singles\" folder on desktop\n")
print("\t","="*100)
Expand Down Expand Up @@ -116,9 +117,8 @@ def download_playlist(self):
downloaded_songs = len(os.listdir())
if total_songs-downloaded_songs!=0:
print(f"\n{total_songs-downloaded_songs}/{total_songs} songs were not downloaded due to some error")
print("\n\n")
print("\t","="*100)
print(f"\n\n\t Your playlist is downloaded in \"/musicDL downloads/Playlists/{plName}\" folder on desktop\n")
print("\t","="*100)
print("\n")


print("\n")
15 changes: 11 additions & 4 deletions musicDL.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os, time, subprocess, requests, json
import os, time, subprocess, requests, json, sys
from send2trash import send2trash
from modules.ytDownloader import yt_downloader
from modules.spotify_downloader import spotify_downloader

ffmpeg = str(os.getcwd())+"/ffmpeg.exe"
cwd = str(os.getcwd())

def create_dir():
"""
Creates "musicDL downloads" directory on desktop when called. Takes no parameters.
Expand All @@ -18,6 +18,8 @@ def create_dir():
os.chdir("musicDL downloads")

def main():
path = sys.argv[0]
os.chdir(path[:path.rindex('\\')]+'\\')
if 'updater' in str(os.getcwd()):
cwd = str(os.getcwd()).replace('\\updater','\\')
else:
Expand Down Expand Up @@ -50,8 +52,13 @@ def main():
except:
pass
create_dir()
print()
print(f"\n Enter \n\n 1 - download a song \n 2 - download a YouTube Playlist\n 3 - download from Spotify")
ch = int(input("\n Enter the serial number: "))
try:
ch = int(input("\n Enter the serial number: "))
except ValueError:
print("Invalid input, try 1/2/3\n")
main()
yt = yt_downloader(ffmpeg)
spdl = spotify_downloader(ffmpeg)
if ch == 1:
Expand Down Expand Up @@ -84,10 +91,10 @@ def main():
n = input("Do you want to continue? (Y/N): ")
if n.lower() == 'y':
main()
os.chdir(cwd)
else:
print("\nSee you later!\n")
time.sleep(3)
cwd = str(os.getcwd())
main()
#TODO 1: create playlist and singles directories in musicDL downloads foler ✔
#TODO 2: Ask user to give a name to the playlist and download the music to that folder ✔
Expand Down

0 comments on commit f45441c

Please sign in to comment.