Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
added support for gif files when renaming downloaded image (#38) closes
Browse files Browse the repository at this point in the history
#37

previously gif files would be downloaded with the default .jpg extension. now the mime type is detected for gifs and the files are renamed appropriately.
  • Loading branch information
antonc42 authored and prodicus committed May 27, 2017
1 parent a4e7f23 commit 6f79005
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions xkcd_dl/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ def download_one(xkcd_dict, xkcd_num):
os.rename(file_name, "{description}.jpeg".format(
description=new_description)
)
elif 'gif' in magic_response:
os.rename(file_name, "{description}.gif".format(
description=new_description)
)

else:
print("{} does not exist! Please try with a different option".format(xkcd_number))
Expand Down

0 comments on commit 6f79005

Please sign in to comment.