1
0
mirror of https://github.com/obskyr/khinsider.git synced 2025-08-30 08:20:24 +02:00

Skip previous downloaded files from the album.

This commit is contained in:
ali-shamakhi
2016-08-21 21:50:32 +04:30
parent faef28190f
commit fb480771f6

View File

@@ -164,8 +164,18 @@ def download(ostName, path="", verbose=False):
songInfos = getFileList(ostName)
totalSongs = len(songInfos)
for songNumber, (name, url) in enumerate(songInfos):
downloadSong(url, path, name, verbose=verbose,
songNumber=songNumber + 1, totalSongs=totalSongs)
if not os.path.isfile(path + '/' + name): # if file does not exist
downloadSong(url, path, name, verbose=verbose,
songNumber=songNumber + 1, totalSongs=totalSongs)
else:
if verbose:
numberStr = ""
if songNumber is not None and totalSongs is not None:
numberStr += str(songNumber+1).zfill(len(str(totalSongs)))
numberStr += "/"
numberStr += str(totalSongs)
numberStr += ": "
print("File Exists {}{}... Skipped.".format(numberStr, name))
def downloadSong(songUrl, path, name="song", numTries=3, verbose=False,
songNumber=None, totalSongs=None):
"""Download a single song at `songUrl` to `path`."""