5 Commits

Author SHA1 Message Date
Ali Parlakci
b5d6165802 Update version 2018-07-24 22:13:38 +03:00
Ali Parlakci
b98815376f Bug fix 2018-07-24 22:13:11 +03:00
Ali Parlakci
d9586f99b8 Use else in try blocks 2018-07-24 22:11:12 +03:00
Ali Parlakci
76711892a2 Merge branch 'master' of https://github.com/aliparlakci/bulk-downloader-for-reddit 2018-07-24 22:10:28 +03:00
Ali Parlakci
bfea548eab Print credits in the same line 2018-07-24 22:10:19 +03:00
2 changed files with 10 additions and 8 deletions

View File

@@ -22,7 +22,7 @@ from src.tools import (GLOBAL, createLogFile, jsonFile, nameCorrector,
__author__ = "Ali Parlakci" __author__ = "Ali Parlakci"
__license__ = "GPL" __license__ = "GPL"
__version__ = "1.5.0" __version__ = "1.5.1"
__maintainer__ = "Ali Parlakci" __maintainer__ = "Ali Parlakci"
__email__ = "parlakciali@gmail.com" __email__ = "parlakciali@gmail.com"
@@ -467,7 +467,7 @@ def downloadPost(SUBMISSION):
if SUBMISSION['postType'] in downloaders: if SUBMISSION['postType'] in downloaders:
print(SUBMISSION['postType'].upper()) print(SUBMISSION['postType'].upper(),end=" ")
if SUBMISSION['postType'] == "imgur": if SUBMISSION['postType'] == "imgur":
@@ -484,11 +484,11 @@ def downloadPost(SUBMISSION):
+ " Seconds") + " Seconds")
print( print(
"Client: {} - User: {} - Reset {}".format( "==> Client: {} - User: {} - Reset {}".format(
credit['ClientRemaining'], credit['ClientRemaining'],
credit['UserRemaining'], credit['UserRemaining'],
USER_RESET USER_RESET
) ),end=""
) )
if not (credit['UserRemaining'] == 0 or \ if not (credit['UserRemaining'] == 0 or \
@@ -509,6 +509,7 @@ def downloadPost(SUBMISSION):
raise ImgurLimitError('{} LIMIT EXCEEDED\n'.format(KEYWORD.upper())) raise ImgurLimitError('{} LIMIT EXCEEDED\n'.format(KEYWORD.upper()))
print()
downloaders[SUBMISSION['postType']] (directory,SUBMISSION) downloaders[SUBMISSION['postType']] (directory,SUBMISSION)
else: else:

View File

@@ -61,13 +61,14 @@ def getFile(fileDir,tempDir,imageURL,indent=0):
tempDir, tempDir,
reporthook=dlProgress) reporthook=dlProgress)
os.rename(tempDir,fileDir) os.rename(tempDir,fileDir)
print(" "*indent+"Downloaded"+" "*10)
break
except ConnectionResetError as exception: except ConnectionResetError as exception:
print(" "*indent + str(exception)) print(" "*indent + str(exception))
print(" "*indent + "Trying again\n") print(" "*indent + "Trying again\n")
except FileNotFoundError: except FileNotFoundError:
raise FileNameTooLong raise FileNameTooLong
else:
print(" "*indent+"Downloaded"+" "*10)
break
else: else:
raise FileAlreadyExistsError raise FileAlreadyExistsError
@@ -90,10 +91,10 @@ class Erome:
print(post["postSubmitter"]+"_"+title+"_"+post['postId']+extension) print(post["postSubmitter"]+"_"+title+"_"+post['postId']+extension)
fileDir = directory / ( fileDir = directory / (
POST["postSubmitter"]+"_"+title+"_"+POST['postId']+extension post["postSubmitter"]+"_"+title+"_"+post['postId']+extension
) )
tempDir = directory / ( tempDir = directory / (
POST["postSubmitter"]+"_"+title+"_"+POST['postId']+".tmp" post["postSubmitter"]+"_"+title+"_"+post['postId']+".tmp"
) )
imageURL = "https:" + IMAGES[0] imageURL = "https:" + IMAGES[0]