本文整理汇总了Python中scanner.Scanner.add_series_to_db_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Scanner.add_series_to_db_by_id方法的具体用法?Python Scanner.add_series_to_db_by_id怎么用?Python Scanner.add_series_to_db_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scanner.Scanner
的用法示例。
在下文中一共展示了Scanner.add_series_to_db_by_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scan_files
# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import add_series_to_db_by_id [as 别名]
def scan_files(self):
for video_dir in config.tv_dirs:
self.progress.setLabelText("Scanning Files from %s into DB..." \
% (video_dir))
self.logger.info("Scanning files")
scanner = Scanner(video_dir)
scanner.set_series_list()
self.progress.setMaximum(len(scanner.series_list))
self.progress.setValue(0)
self.logger.debug(scanner.series_list)
for series_name in scanner.series_list:
self.progress.setValue(scanner.series_list.index(series_name))
self.progress.show()
match_list = scanner.get_series_id_list(series_name)
if len(match_list) == 0:
self.logger.info("No matches found on thetvdb.com for '%s'." % (series_name))
### FIXME ###
series_id = raw_input("Please input the ID for the correct series:")
elif len(match_list) == 1:
self.logger.info("Found match for '%s'." % (series_name))
series_id = match_list[0][0]
else:
match = False
list = ''
for i in range(0,len(match_list)):
if match_list[i][1] == series_name:
self.logger.info("Found match for '%s'." % (series_name))
series_id = match_list[i][0]
match = True
else:
list += "[%d] %s (%s)\n " % (i, match_list[i][1], \
match_list[i][0])
if not match:
selection = self.input_dialog.getInt(self, '', \
"Select best match:\n %s" % (list), \
0, 0, len(match_list) - 1)[0]
try:
series_id = match_list[selection][0]
except IndexError:
self.logger.info("That is not an option.")
if config.prefer_local:
self.logger.info("Adding info from local nfo files")
scanner.add_series_to_db_by_nfo(series_name)
else:
self.logger.info("Adding info from thetvdb.com")
scanner.add_series_to_db_by_id(series_id)
self.logger.info("Adding files to db.")
scanner.add_files_to_db(series_id, series_name)
dbTV.remove_shows_with_no_files()
scanner.__del__()
self.progress.setValue(len(scanner.series_list))
self.logger.info("Finished Scanning")
#Create a dom representing the shows in the database
shows = dbTV.make_shows_list()
#Turn that into a model
model = ShowListModel(shows)
#Set that as the model for the listView
self.ui.listView_shows.setModel(model)