Skip to content

Commit

Permalink
added playlists support and fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
artyshko committed Aug 30, 2019
1 parent 0454c5a commit f1df1e8
Show file tree
Hide file tree
Showing 63 changed files with 33 additions and 54 deletions.
20 changes: 15 additions & 5 deletions GUI/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ def artist(uri):

lf_artist_info = lastfm.getArtistsInfo(sp_artist_info['name'])

print(len(sp_artist_alb))
print(len(sp_artist_alb_full))

#creating tags
name = str(sp_artist_info['name']).replace(' ','')

Expand Down Expand Up @@ -176,7 +173,6 @@ def search(q):

query = ' '.join(str(q).split('+'))

print(query)

results = user.search(query)

Expand Down Expand Up @@ -222,7 +218,6 @@ def song(uri):
def album(uri):

sp_album_data = user.getAlbumInfo(uri)[0]
print(sp_album_data['art_id'])
sp_artist_alb = user.getArtistsAlbums(sp_album_data['art_id'])
sp_artist_r_a = user.getArtistsRelatedArtists(sp_album_data['art_id'])

Expand Down Expand Up @@ -295,6 +290,21 @@ def downloadAlbum(uri):
}
)

@app.route("/downloadPlaylist/<uri>", methods=['GET','POST'])
def downloadPlaylist(uri):

if request.method == 'POST':

music = expanduser("~") + '/Music'

subprocess.Popen(["python3", f"{os.getcwd()}/main.py", '-sp', f'https://open.spotify.com/playlist/{uri}', '-p', music])

return json.dumps(
{
'status': True
}
)

@app.route('/login', methods=['GET','POST'])
def login():

Expand Down
2 changes: 0 additions & 2 deletions GUI/run.sh

This file was deleted.

7 changes: 2 additions & 5 deletions GUI/spotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,5 @@ def getAlbum(self, uri):
except: return None

if __name__ == '__main__':
u = Spotify.User()
s = Spotify()

res = u.search('Love')
print(res)

u = Spotify.User()
Binary file removed GUI/static/images/1.gif
Binary file not shown.
Binary file removed GUI/static/images/1.jpg
Binary file not shown.
Binary file removed GUI/static/images/1.webp
Binary file not shown.
Binary file removed GUI/static/images/10.jpg
Binary file not shown.
Binary file removed GUI/static/images/11.jpg
Binary file not shown.
Binary file removed GUI/static/images/2.gif
Binary file not shown.
Binary file removed GUI/static/images/2.jpg
Binary file not shown.
Binary file removed GUI/static/images/2.webp
Binary file not shown.
Binary file removed GUI/static/images/3.gif
Binary file not shown.
Binary file removed GUI/static/images/3.jpg
Binary file not shown.
Binary file removed GUI/static/images/4.gif
Binary file not shown.
Binary file removed GUI/static/images/4.jpg
Binary file not shown.
Binary file removed GUI/static/images/5.gif
Binary file not shown.
Binary file removed GUI/static/images/5.jpg
Binary file not shown.
Binary file removed GUI/static/images/6.gif
Binary file not shown.
Binary file removed GUI/static/images/6.jpg
Binary file not shown.
Binary file removed GUI/static/images/7.gif
Binary file not shown.
Binary file removed GUI/static/images/7.jpg
Binary file not shown.
Binary file removed GUI/static/images/8.gif
Binary file not shown.
Binary file removed GUI/static/images/8.jpg
Binary file not shown.
Binary file removed GUI/static/images/9.jpg
Binary file not shown.
Binary file removed GUI/static/images/a1.jpg
Binary file not shown.
Binary file removed GUI/static/images/a10.jpg
Binary file not shown.
Binary file removed GUI/static/images/a2.jpg
Binary file not shown.
Binary file removed GUI/static/images/a3.jpg
Binary file not shown.
Binary file removed GUI/static/images/a4.jpg
Binary file not shown.
Binary file removed GUI/static/images/a5.jpg
Binary file not shown.
Binary file removed GUI/static/images/a6.jpg
Diff not rendered.
Binary file removed GUI/static/images/a7.jpg
Diff not rendered.
Binary file removed GUI/static/images/a8.jpg
Diff not rendered.
Binary file removed GUI/static/images/a9.jpg
Diff not rendered.
Binary file removed GUI/static/images/c1.jpeg
Diff not rendered.
Binary file removed GUI/static/images/c2.jpeg
Diff not rendered.
Binary file removed GUI/static/images/h1.jpeg
Diff not rendered.
Binary file removed GUI/static/images/h2.jpeg
Diff not rendered.
Binary file removed GUI/static/images/h3.jpeg
Diff not rendered.
Binary file removed GUI/static/images/h4.jpeg
Diff not rendered.
Binary file removed GUI/static/images/loader.gif
Diff not rendered.
Binary file removed GUI/static/images/p1.jpeg
Diff not rendered.
Binary file removed GUI/static/images/p10.jpeg
Diff not rendered.
Binary file removed GUI/static/images/p2.jpeg
Diff not rendered.
Binary file removed GUI/static/images/p3.jpeg
Diff not rendered.
Binary file removed GUI/static/images/p4.jpeg
Diff not rendered.
Binary file removed GUI/static/images/p5.jpeg
Diff not rendered.
Binary file removed GUI/static/images/p6.jpeg
Diff not rendered.
Binary file removed GUI/static/images/p7.jpeg
Diff not rendered.
Binary file removed GUI/static/images/p8.jpeg
Diff not rendered.
Binary file removed GUI/static/images/p9.jpeg
Diff not rendered.
Binary file removed GUI/static/images/t.mp4
Binary file not shown.
Binary file removed GUI/static/images/t.ogg
Binary file not shown.
Binary file removed GUI/static/images/t.webm
Binary file not shown.
Binary file removed GUI/static/images/t1.jpg
Diff not rendered.
Binary file removed GUI/static/images/t2.jpeg
Diff not rendered.
Binary file removed GUI/static/images/t3.jpeg
Diff not rendered.
4 changes: 2 additions & 2 deletions GUI/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ <h2>Songs</h2>


<div class='conc-main-slider lazy' style='width:80%; margin-left: 18%;' >
<a class='no-link' href='jsdfhsa.html'>
<a class='no-link' href='{{ url_for('new_releases')}}'>
<div class="line cursor-pointer-all-obj">

<div class="image-shadow-line" style="background: rgb(251,111,74);
Expand Down Expand Up @@ -306,4 +306,4 @@ <h2><p class="item-text-20">@SpotifyMusicDownloaderBot</p></h2>
</div>


{% endblock %}
{% endblock %}
38 changes: 3 additions & 35 deletions GUI/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
width:100%;
}
body{
background: rgb(38,38,38);
background: linear-gradient(180deg, rgba(38,38,38,1) 0%, rgba(21,21,21,1) 37%, rgba(0,0,0,1) 92%);
background:rgb(28,28,30);
}
.container-fluid{
height: 100%;
Expand Down Expand Up @@ -74,42 +73,11 @@ <h1 class='logo-text'>SMD</h1>
<h6 class='desc'>Linux v1.6.8-dev</h6>
</div>
<div class="text-center">
<h5>Loading</h5>

<div class="lds-ripple"><div></div><div></div></div>
</div>
</div>


<script>
$(document).ready(function(){
$.post(
'http://0.0.0.0:8050/shutdown',
function(data) {

})
};

$('#search').keypress(function(e) {

if(e.which == 10 || e.which == 13) {

window.location.replace("http://0.0.0.0:8050/search/"+$('#search').val().replace(/ /g,'+'));

}

});
$(function() {
$(".download-link").on("click",function(e) {
e.preventDefault(); // cancel the link itself

$.post(
this.href,
function(data) {

});
});
});


</script>
</body>
</html>
2 changes: 1 addition & 1 deletion GUI/templates/playlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<span class="badge badge-success download-button-song">
<i class="fab fa-spotify"></i> Listen on Spotify
</span>
<a class='no-link download-link' href="{{ url_for('downloadAlbum', uri=info.alb_id)}}">
<a class='no-link download-link' href="{{ url_for('downloadPlaylist', uri=info.id)}}">
<span class="badge badge-primary download-button-song">
<i class="fas fa-arrow-alt-circle-down"></i> Download
</span>
Expand Down
2 changes: 1 addition & 1 deletion GUI/templates/playlists.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<i class="fab fa-spotify"></i> Listen on Spotify
</span>
</a>
<a class='no-link' href='https://open.spotify.com/'>
<a class='no-link download-link' href="{{ url_for('downloadPlaylist', uri=album.id) }}">
<span class="btn btn-outline-primary download-button" style='padding: 2px 2px 2px 2px;border: 0px solid #fff;'>
<i class="fas fa-arrow-alt-circle-down"></i> Download full playlist
</span>
Expand Down
7 changes: 6 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def downloadBySpotifyUri(self, uri, path):
notify.send(f'{info["artist"][0]} - {info["name"]}', downloaded=False)

info['uri'] = str(info['uri']).split('/')[-1]
info['uri'] = str(info['uri']).split('?')[0]

fixed_name = f'{info["artist"][0]} - {info["name"]}'
fixed_name = fixed_name.replace('.','')
Expand Down Expand Up @@ -205,6 +206,9 @@ def downloadBySpotifyUriPlaylistMode(self, playlist_uri, path):
for info, i in zip(playlist,range(len(playlist))):

print(f'Downloading {i+1} of {len(playlist)}')

info['uri'] = str(info['uri']).split('/')[-1]
info['uri'] = str(info['uri']).split('?')[0]

notify.send(f'{info["artist"][0]} - {info["name"]}', downloaded=False)

Expand Down Expand Up @@ -255,6 +259,7 @@ def downloadBySpotifyUriAlbumMode(self, album_uri, path):
for info, i in zip(playlist['tracks'],range(len(playlist['tracks']))):

info['uri'] = str(info['uri']).split('/')[-1]
info['uri'] = str(info['uri']).split('?')[0]

notify.send(f'{info["artist"][0]} - {info["name"]}', downloaded=False)

Expand Down Expand Up @@ -534,7 +539,7 @@ def help():
CLI.logo()

print('\t\t Spotify Music Downloader')
print('\t\t version 1.6.0-dev\n')
print('\t\t version 1.6.8-dev\n')

print(' ./main.py [argument][value] - startup with arguments\n')

Expand Down
5 changes: 3 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/bash
python3 GUI/qtw.py & python3 GUI/backend.py
#!/bin/bash
python3 GUI/spotify.py 2>/dev/null
python3 GUI/qtw.py 2>/dev/null & python3 GUI/backend.py 2>/dev/null

0 comments on commit f1df1e8

Please sign in to comment.