MCPcopy
hub / github.com/persepolisdm/persepolis / callBack

Method callBack

persepolis/scripts/mainwindow.py:1994–2182  ·  view source on GitHub ↗
(self, add_link_dictionary, download_later, category, single_video_link=False)

Source from the content-addressed store, hash-verified

1992
1993 # callback of AddLinkWindow
1994 def callBack(self, add_link_dictionary, download_later, category, single_video_link=False):
1995 exists = self.persepolis_db.searchLinkInAddLinkTable(add_link_dictionary['link'])
1996
1997 if exists:
1998 self.msgBox = QMessageBox()
1999 self.msgBox.setText(QCoreApplication.translate("mainwindow_src_ui_tr", "<b><center>This link has been added before!\
2000 Are you sure you want to add it again?</center></b>"))
2001 self.msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
2002 self.msgBox.setIcon(QMessageBox.Warning)
2003 reply = self.msgBox.exec_()
2004
2005 # do nothing if user clicks NO
2006 if reply != QMessageBox.Yes:
2007 return
2008
2009 category = str(category)
2010 # Persepolis identifies each download by the ID called GID. The GID must be
2011 # hex string of 16 characters.
2012 # if user presses ok button on add link window , a gid generates for download.
2013 gid = self.gidGenerator()
2014
2015 # add gid to add_link_dictionary
2016 add_link_dictionary['gid'] = gid
2017
2018 # download_info_file_list is a list that contains ['file_name' ,
2019 # 'status' , 'size' , 'downloaded size' ,'download percentage' ,
2020 # 'number of connections' ,'Transfer rate' , 'estimate_time_left' ,
2021 # 'gid' , 'link' , 'first_try_date' , 'last_try_date', 'category']
2022
2023 # if user or browser_plugin defined filename then file_name is valid in
2024 # add_link_dictionary['out']
2025 if add_link_dictionary['out']:
2026 file_name = add_link_dictionary['out']
2027
2028 # if file extension is m3u8 so it's single_video_link
2029 file_name_split = file_name.split('.')
2030 file_extension = file_name_split[-1]
2031
2032 # convert extension letters to lower case
2033 # for example "JPG" will be converted in "jpg"
2034 file_extension = file_extension.lower()
2035
2036 if file_extension == 'm3u8':
2037 single_video_link = True
2038
2039 else:
2040 file_name = '***'
2041
2042 # If user selected a queue in add_link window , then download must be
2043 # added to queue and and download must be started with queue so >>
2044 # download_later = True
2045 if str(category) != 'Single Downloads':
2046 download_later = True
2047
2048 if not (download_later):
2049 status = 'waiting'
2050 else:
2051 status = 'stopped'

Callers 2

checkPluginCallMethod · 0.95
videoFinderCallBackMethod · 0.95

Calls 14

gidGeneratorMethod · 0.95
categoryTreeSelectedMethod · 0.95
progressBarOpenMethod · 0.95
nowDateFunction · 0.90
QTableWidgetItemClass · 0.90
DownloadLinkClass · 0.90
notifySendFunction · 0.90
SpiderThreadClass · 0.85
insertInDownloadTableMethod · 0.80
insertInAddLinkTableMethod · 0.80

Tested by

no test coverage detected