mirror of
https://github.com/obskyr/khinsider.git
synced 2025-09-08 20:20:50 +02:00
Added friendlier message when stopping a download.
Also fixed a docstring a bit, and added the magic word to an error message.
This commit is contained in:
@@ -134,7 +134,7 @@ def getImageInfo(soup):
|
|||||||
return images
|
return images
|
||||||
|
|
||||||
def getFileList(ostName):
|
def getFileList(ostName):
|
||||||
"""Get a list of songs from the OST with ID `ostName`."""
|
"""Get a list of files (songs & images) from the OST with ID `ostName`."""
|
||||||
# Each entry is in the format [name, url].
|
# Each entry is in the format [name, url].
|
||||||
soup = getOstContentSoup(ostName)
|
soup = getOstContentSoup(ostName)
|
||||||
songPageUrls = getSongPageUrlList(soup)
|
songPageUrls = getSongPageUrlList(soup)
|
||||||
@@ -197,7 +197,7 @@ def downloadSong(songUrl, path, name="song", numTries=3, verbose=False,
|
|||||||
outfile.write(song.content)
|
outfile.write(song.content)
|
||||||
except IOError:
|
except IOError:
|
||||||
if verbose:
|
if verbose:
|
||||||
print("Couldn't save {}. Check your permissions.".format(name))
|
print("Couldn't save {}. Please check your permissions.".format(name))
|
||||||
|
|
||||||
def search(term):
|
def search(term):
|
||||||
"""Return a list of OST IDs for the search term `term`."""
|
"""Return a list of OST IDs for the search term `term`."""
|
||||||
@@ -260,5 +260,7 @@ if __name__ == '__main__':
|
|||||||
if madeDir:
|
if madeDir:
|
||||||
os.rmdir(outPath)
|
os.rmdir(outPath)
|
||||||
return
|
return
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("Stopped download.")
|
||||||
|
|
||||||
doIt()
|
doIt()
|
||||||
|
Reference in New Issue
Block a user