Skip to content

Commit

Permalink
Merge branch 'fix-typo' of https://github.com/7aman/persepolis into 7…
Browse files Browse the repository at this point in the history
…aman-fix-typo
  • Loading branch information
alireza-amirsamimi committed Dec 31, 2019
2 parents c6f3339 + eecb4b8 commit 861d99c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 35 deletions.
8 changes: 4 additions & 4 deletions persepolis/scripts/check_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,22 @@ def getProxy():
proxy['ftp_proxy_port'] = proxysource['ftpProxy'].split(' ')[1].replace("/", "").replace("\n", "")
proxy['ftp_proxy_ip'] = proxysource['ftpProxy'].split(' ')[0].split('//')[1]
except:
logger.sendToLog('no manuall ftp proxy detected', 'INFO')
logger.sendToLog('no manual ftp proxy detected', 'INFO')

# get http proxy
try:
proxy['http_proxy_port'] = proxysource['httpProxy'].split(' ')[1].replace("/", "").replace("\n", "")
proxy['http_proxy_ip'] = proxysource['httpProxy'].split(' ')[0].split('//')[1]
except:
logger.sendToLog('no manuall http proxy detected', 'INFO')
logger.sendToLog('no manual http proxy detected', 'INFO')

# get https proxy
try:
proxy['https_proxy_port'] = proxysource['httpsProxy'].split(
' ')[1].replace("/", "").replace("\n", "")
proxy['https_proxy_ip'] = proxysource['httpsProxy'].split(' ')[0].split('//')[1]
except:
logger.sendToLog('no manuall https proxy detected', 'INFO')
logger.sendToLog('no manual https proxy detected', 'INFO')

# get socks proxy
try:
Expand All @@ -105,7 +105,7 @@ def getProxy():

# proxy disabled
else:
logger.sendToLog('no manuall proxy detected', 'INFO')
logger.sendToLog('no manual proxy detected', 'INFO')

# proxy file not exists
else:
Expand Down
10 changes: 5 additions & 5 deletions persepolis/scripts/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from persepolis.scripts.osCommands import moveFile, makeTempDownloadDir
from persepolis.scripts.useful_tools import freeSpace, humanReadbleSize
from persepolis.scripts.osCommands import moveFile, makeTempDownloadDir
from persepolis.scripts.useful_tools import freeSpace, humanReadableSize
from persepolis.scripts.bubble import notifySend
from persepolis.scripts import logger
from persepolis.constants import OS
Expand Down Expand Up @@ -468,10 +468,10 @@ def convertDownloadInformation(download_status):
file_size_back = file_size

# converting file_size to KiB or MiB or GiB
size_str = humanReadbleSize(file_size)
size_str = humanReadableSize(file_size)
downloaded_back = downloaded

downloaded_str = humanReadbleSize(downloaded)
downloaded_str = humanReadableSize(downloaded)

# find download percent from file_size and downloaded_size
file_size = file_size_back
Expand All @@ -495,7 +495,7 @@ def convertDownloadInformation(download_status):
estimate_time_left = int((file_size - downloaded)/download_speed)

# converting file_size to KiB or MiB or GiB
download_speed_str = humanReadbleSize(download_speed, 'speed') + '/s'
download_speed_str = humanReadableSize(download_speed, 'speed') + '/s'

eta = ""
if estimate_time_left >= 3600:
Expand Down
16 changes: 8 additions & 8 deletions persepolis/scripts/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ def checkDownloadInfo(self, list):
self.download_table.setItem(row, i, item)
except Exception as problem:
logger.sendToLog(
"Error occured while updating download table", "INFO")
"Error occurred while updating download table", "INFO")
logger.sendToLog(problem, "ERROR")

# update download_table (refreshing!)
Expand Down Expand Up @@ -2025,7 +2025,7 @@ def checkDownloadInfo(self, list):
# if download stopped:
if progress_window.status == "stopped":
# write message in log
stop_message = 'Download stoped - GID : '\
stop_message = 'Download stopped - GID : '\
+ str(gid)

logger.sendToLog(stop_message, 'INFO')
Expand Down Expand Up @@ -2143,11 +2143,11 @@ def dragEnterEvent(self, droplink):
droplink.ignore()

def dropEvent(self, droplink):
link_clipborad = QApplication.clipboard()
link_clipborad.clear(mode=link_clipborad.Clipboard)
link_clipboard = QApplication.clipboard()
link_clipboard.clear(mode=link_clipboard.Clipboard)
link_string = droplink.mimeData().text()
link_clipborad.setText(str(link_string), mode=link_clipborad.Clipboard)
self.addLinkButtonPressed(button=link_clipborad)
link_clipboard.setText(str(link_string), mode=link_clipboard.Clipboard)
self.addLinkButtonPressed(button=link_clipboard)

# aria2 identifies each download by the ID called GID.
# The GID must be hex string of 16 characters,
Expand Down Expand Up @@ -5558,7 +5558,7 @@ def spiderUpdate(self, dict):
self.download_table.setItem(row, i, item)
except Exception as problem:
logger.sendToLog(
"Error occured while updating download table", "INFO")
"Error occurred while updating download table", "INFO")
logger.sendToLog(problem, "ERROR")

# this method deletes all items in data base
Expand Down Expand Up @@ -5927,7 +5927,7 @@ def videoFinderCompleted2(self, complete_dictionary):

elif error_message == 'ffmpeg error':
# show error message
notifySend(QCoreApplication.translate("mainwindow_src_ui_tr", "an error occured"),
notifySend(QCoreApplication.translate("mainwindow_src_ui_tr", "an error occurred"),
QCoreApplication.translate("mainwindow_src_ui_tr", "muxing error"),
10000, 'fail', parent=self)

Expand Down
10 changes: 5 additions & 5 deletions persepolis/scripts/persepolis.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def setPersepolisColorScheme(self, color_scheme):

# Clears unwanted args ( like args from Browers via NHM )
# unknown arguments (may sent by browser) will save in unknownargs.
args, unkownargs = parser.parse_known_args()
args, unknownargs = parser.parse_known_args()

# if --execute >> yes >>> persepolis main window will start.
# if --execute >> no >>> persepolis started before!
Expand All @@ -185,7 +185,7 @@ def setPersepolisColorScheme(self, color_scheme):

# This dirty trick will show Persepolis version when there are unknown args
# Unknown args are sent by Browsers for NHM
if args.parent_window or unkownargs:
if args.parent_window or unknownargs:

# Platform specific configuration
if os_type == OS.WINDOWS:
Expand Down Expand Up @@ -351,7 +351,7 @@ def setPersepolisColorScheme(self, color_scheme):

# start persepolis in system tray if browser executed
# and if user select this option in preferences window.
if str(persepolis_setting.value('settings/browser-persepolis')) == 'yes' and (args.parent_window or unkownargs):
if str(persepolis_setting.value('settings/browser-persepolis')) == 'yes' and (args.parent_window or unknownargs):
start_persepolis_if_browser_executed = True
start_in_tray = True
else:
Expand All @@ -360,7 +360,7 @@ def setPersepolisColorScheme(self, color_scheme):

def main():
# if lock_file is existed , it means persepolis is still running!
if lock_file_validation and (not((args.parent_window or unkownargs) and browser_url == False) or ((args.parent_window or unkownargs) and start_persepolis_if_browser_executed)):
if lock_file_validation and (not((args.parent_window or unknownargs) and browser_url == False) or ((args.parent_window or unknownargs) and start_persepolis_if_browser_executed)):

# set QT_AUTO_SCREEN_SCALE_FACTOR to 1 for "high DPI displays"
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'
Expand Down Expand Up @@ -450,7 +450,7 @@ def main():

sys.exit(persepolis_download_manager.exec_())

elif not((args.parent_window or unkownargs)):
elif not((args.parent_window or unknownargs)):

# this section warns user that program is still running and no need to run it again
# and creating a file to notify mainwindow for showing itself!
Expand Down
6 changes: 3 additions & 3 deletions persepolis/scripts/spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from persepolis.scripts.useful_tools import humanReadbleSize
from persepolis.scripts.useful_tools import humanReadableSize
from requests.cookies import cookiejar_from_dict
from http.cookies import SimpleCookie
from requests import Session
Expand Down Expand Up @@ -101,7 +101,7 @@ def spider(add_link_dictionary):
file_size = int(header['Content-Length'])

# converting file_size to KiB or MiB or GiB
file_size = humanReadbleSize(file_size)
file_size = humanReadableSize(file_size)

# return results
return filename, file_size
Expand Down Expand Up @@ -200,7 +200,7 @@ def addLinkSpider(add_link_dictionary):
file_size = int(header['Content-Length'])

# converting file_size to KiB or MiB or GiB
file_size = str(humanReadbleSize(file_size))
file_size = str(humanReadableSize(file_size))

# find file name
file_name = None
Expand Down
2 changes: 1 addition & 1 deletion persepolis/scripts/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def updateCheck(self, button):

except Exception as e:
self.status_label.setText(QCoreApplication.translate(
"update_src_ui_tr", 'An error occured while checking for updates.'))
"update_src_ui_tr", 'An error occurred while checking for updates.'))

self.check_button.setText(QCoreApplication.translate("update_src_ui_tr", 'Check for new update'))

Expand Down
18 changes: 9 additions & 9 deletions persepolis/scripts/useful_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def osAndDesktopEnvironment():


# this function converts file_size to KiB or MiB or GiB
def humanReadbleSize(size, input_type='file_size'):
def humanReadableSize(size, input_type='file_size'):
labels = ['KiB', 'MiB', 'GiB', 'TiB']
i = -1
if size < 1024:
Expand Down Expand Up @@ -308,16 +308,16 @@ def muxer(parent, video_finder_dictionary):

# rename file if file already existed
i = 1
final_path_pluse_name = os.path.join(final_path, final_file_name)
final_path_plus_name = os.path.join(final_path, final_file_name)

while os.path.isfile(final_path_pluse_name):
while os.path.isfile(final_path_plus_name):

extension_length = len(file_name_split[-1]) + 1

new_name = final_file_name[0:-extension_length] + \
'_' + str(i) + final_file_name[-extension_length:]

final_path_pluse_name = os.path.join(final_path, new_name)
final_path_plus_name = os.path.join(final_path, new_name)
i = i + 1

# start muxing
Expand All @@ -330,7 +330,7 @@ def muxer(parent, video_finder_dictionary):
'-map', '1:a:0',
'-loglevel', 'error',
'-strict', '-2',
final_path_pluse_name],
final_path_plus_name],
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
Expand All @@ -351,7 +351,7 @@ def muxer(parent, video_finder_dictionary):
'-map', '1:a:0',
'-loglevel', 'error',
'-strict', '-2',
final_path_pluse_name],
final_path_plus_name],
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
Expand All @@ -374,7 +374,7 @@ def muxer(parent, video_finder_dictionary):
'-map', '1:a:0',
'-loglevel', 'error',
'-strict', '-2',
final_path_pluse_name],
final_path_plus_name],
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
Expand All @@ -385,8 +385,8 @@ def muxer(parent, video_finder_dictionary):
# muxing was finished successfully.
result_dictionary['error'] = 'no error'

result_dictionary['final_path'] = final_path_pluse_name
result_dictionary['final_size'] = humanReadbleSize(final_file_size)
result_dictionary['final_path'] = final_path_plus_name
result_dictionary['final_size'] = humanReadableSize(final_file_size)

else:
result_dictionary['error'] = 'ffmpeg error'
Expand Down

0 comments on commit 861d99c

Please sign in to comment.