Exemplo n.º 1
0
 def confirm_click(self):
     config = CommonUtils.read_config()
     config.set('DEFAULT', 'gif_start', self.gifStartTime.text())
     config.set('DEFAULT', 'gif_end', self.gifEndTime.text())
     config.set('DEFAULT', 'gif_interval', self.gifInterval.text())
     config.write(open('setting.ini', 'w'))
     self.close()
Exemplo n.º 2
0
    def _process_video_list(self, video_list):
        config = CommonUtils.read_config()
        image_type = config.get('DEFAULT', 'default_img_type')
        qb_identifier_str = config.get('DEFAULT', 'qb_identifier')
        qb_identifier_arr = qb_identifier_str.split(",")
        for _video_path in video_list:
            _video_path = _video_path.replace("\\", "/")
            _video_name = _video_path[_video_path.rfind('/') +
                                      1:_video_path.rfind('.')]
            _hash = _video_name
            # _hash = file_md5(_video_path)
            is_exists, video_path_in_datebase = SqlUtils.hash_exists(_hash)
            if is_exists:
                if video_path_in_datebase != _video_path:
                    # reply = QMessageBox.question(None, _video_name, "数据库中已存在名称相同的视频,是否更新视频路径?",
                    #                              QMessageBox.Yes | QMessageBox.No)
                    # if reply == QMessageBox.Yes:
                    sql = "UPDATE video SET video_path = ?,video_name_local=? WHERE hash = ?"
                    SqlUtils.update_video(sql,
                                          (_video_path, _video_name, _hash))
                    self.status_text_label.setText("更新路径完成")
                    # self.statusbar.showMessage("更新路径完成", 5000)
            else:
                _identifier = ""
                _serious = ""
                _video_type = 0
                try:
                    _video_type = self.get_video_type(_video_name,
                                                      qb_identifier_arr)
                    if _video_type == 1:
                        _identifier, _serious = self._get_qb_identifier(
                            qb_identifier_arr, _video_name)
                        print(_video_name + " : " + _identifier)
                    else:
                        pass
                except Exception as e:
                    print(e)
                    pass
                video = VideoFileClip(_video_path)  # 打开视频
                video.close()  # 关闭视频
                video_width = str(video.size[0])
                video_height = str(video.size[1])
                resolution = video_width + ',' + video_height
                # todo 获取视频时长
                # video.duration

                sql = "INSERT INTO video (resolution,series,identifier,type,video_name_local,video_path,img_type,hash) VALUES (?,?,?,?,?,?,?,?)"
                SqlUtils.update_video(
                    sql, (resolution, _serious, _identifier, _video_type,
                          _video_name, _video_path, image_type, _hash))
                self.status_text_label.setText(_video_name + " : " +
                                               _identifier + " 已导入")
                # self.statusbar.showMessage(_video_name + " : " + _identifier + " 已导入", 5000)
                print(_hash)
        self.status_text_label.setText("导入完成")
Exemplo n.º 3
0
 def init_sql(self):
     video_count = SqlUtils._select_("SELECT count(id) FROM 'video'" +
                                     Const.Where)[0][0]
     config = CommonUtils.read_config()
     count_per_page = int(config.get('DEFAULT', 'count_per_page'))
     current_page_num = int(self.page_num_lineEdit.text())
     self.page_num_all_label.setText(
         str(math.ceil(video_count / count_per_page)))
     start = str((current_page_num - 1) * count_per_page)
     Const.Limit = " Limit " + start + "," + str(count_per_page)
     if self.like_order_radioButton.isChecked():
         Const.Order = " ORDER BY like_stars "
     if self.time_order_radioButton.isChecked():
         Const.Order = " ORDER BY id "
     if self.asc_order_radioButton.isChecked():
         Const.Order = Const.Order + "ASC"
     if self.desc_order_radioButton.isChecked():
         Const.Order = Const.Order + "DESC"
     Const.Gl_Refresh_Sql = Const.Sql + Const.Where + Const.Order + Const.Limit
     print()
Exemplo n.º 4
0
 def _init_setting(self):
     config = CommonUtils.read_config()
     self.gifStartTime.setText(config.get('DEFAULT', 'gif_start'))
     self.gifEndTime.setText(config.get('DEFAULT', 'gif_end'))
     self.gifInterval.setText(config.get('DEFAULT', 'gif_interval'))