Skip to content

Commit 085ab82

Browse files
author
flyingrub
committed
fix
1 parent d875165 commit 085ab82

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

scdl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Python Soundcloud Music Downloader."""
22

3-
__version__ = 'v1.0.0'
3+
__version__ = 'v1.0.1'

scdl/scdl.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,25 +317,27 @@ def settags(track):
317317
Set the tags to the mp3
318318
"""
319319
print("Settings tags...")
320+
user = client.get('/users/' + str(track.user_id), allow_redirects=False)
320321

321322
artwork_url = track.artwork_url
323+
if artwork_url is None:
324+
artwork_url = user.avatar_url
322325
artwork_url = artwork_url.replace('large', 't500x500')
323326
urllib.request.urlretrieve(artwork_url, '/tmp/scdl.jpg')
324327

325-
user = client.get('/users/' + str(track.user_id), allow_redirects=False)
326-
327328
tags = MP3(filename)
328329
tags["TIT2"] = TIT2(encoding=3, text=track.title)
329330
tags["TALB"] = TALB(encoding=3, text='Soundcloud')
330331
tags["TPE1"] = TPE1(encoding=3, text=user.username)
331332
tags["TCON"] = TCON(encoding=3, text=track.genre)
332-
tags["APIC"] = APIC(
333-
encoding=3,
334-
mime='image/jpeg',
335-
type=3,
336-
desc='Cover',
337-
data=open('/tmp/scdl.jpg', 'rb').read()
338-
)
333+
if artwork_url is not None:
334+
tags["APIC"] = APIC(
335+
encoding=3,
336+
mime='image/jpeg',
337+
type=3,
338+
desc='Cover',
339+
data=open('/tmp/scdl.jpg', 'rb').read()
340+
)
339341
tags.save()
340342

341343
def signal_handler(signal, frame):

0 commit comments

Comments
 (0)