Пример #1
0
    def command_update_rotation(self):
        command = self.commandQLE.text()
        regex = r'(,*\s*){0,1}(transpose=\d(,\s*transpose=\d)*|vflip|hflip)(\s*,*\s*){0,1}'

        rotate = self.rotateQCB.currentIndex()
        if rotate == 0:  # none
            _filter = ''
        elif rotate == 1:  # 90 clockwise
            _filter = 'transpose=1'
        elif rotate == 2:  # 90 clockwise + vertical flip
            _filter = 'transpose=3'
        elif rotate == 3:  # 90 counter clockwise
            _filter = 'transpose=2'
        elif rotate == 4:  # 90 counter clockwise + vertical flip
            _filter = 'transpose=0'
        elif rotate == 5:  # 180
            _filter = 'transpose=2,transpose=2'
        elif rotate == 6:  # horizontal flip
            _filter = 'hflip'
        elif rotate == 7:  # vertical flip
            _filter = 'vflip'

        self.commandQLE.setText(
            utils.update_cmdline_text(command, _filter, regex,
                                      bool(rotate != 0), 0, 3))
    def command_update_subtitles(self):
        command = self.commandQLE.text()
        regex = r"(,*\s*){0,1}(subtitles=\'.*\')(\s*,*\s*){0,1}"

        text = self.embedQLE.text()
        _filter = "subtitles='{0}'".format(text) if text else ""

        self.commandQLE.setText(utils.update_cmdline_text(command, _filter, regex, bool(text), 0, 2))
Пример #3
0
    def command_update_subtitles(self):
        command = self.commandQLE.text()
        regex = r'(,*\s*){0,1}(subtitles=\'.*\')(\s*,*\s*){0,1}'

        text = self.embedQLE.text()
        _filter = "subtitles='{0}'".format(text) if text else ''

        self.commandQLE.setText(
            utils.update_cmdline_text(command, _filter, regex, bool(text), 0,
                                      2))
    def command_update_size(self):
        command = self.commandQLE.text()
        text1 = self.widthQLE.text()
        text2 = self.heightQLE.text()

        if not (text1 == "-1" or text2 == "-1"):
            self.preserveaspectQChB.setChecked(False)

        if (text1 or text2) and not (text1 and text2) or (text1 == "-" or text2 == "-"):
            return

        regex = r"(\s+|^)-s(:v){0,1}\s+\d+x\d+(\s+|$)"
        if re.search(regex, command):
            command = re.sub(regex, "", command)

        regex = r"(,*\s*){0,1}(scale=-?\d+:-?\d+)(\s*,*\s*){0,1}"
        _filter = "scale={0}:{1}".format(text1, text2) if text1 and text2 else ""

        self.commandQLE.setText(utils.update_cmdline_text(command, _filter, regex, bool(text1 and text2), 0, 2))
    def command_update_rotation(self):
        command = self.commandQLE.text()
        regex = r"(,*\s*){0,1}(transpose=\d(,\s*transpose=\d)*|vflip|hflip)(\s*,*\s*){0,1}"

        rotate = self.rotateQCB.currentIndex()
        if rotate == 0:  # none
            _filter = ""
        elif rotate == 1:  # 90 clockwise
            _filter = "transpose=1"
        elif rotate == 2:  # 90 clockwise + vertical flip
            _filter = "transpose=3"
        elif rotate == 3:  # 90 counter clockwise
            _filter = "transpose=2"
        elif rotate == 4:  # 90 counter clockwise + vertical flip
            _filter = "transpose=0"
        elif rotate == 5:  # 180
            _filter = "transpose=2,transpose=2"
        elif rotate == 6:  # horizontal flip
            _filter = "hflip"
        elif rotate == 7:  # vertical flip
            _filter = "vflip"

        self.commandQLE.setText(utils.update_cmdline_text(command, _filter, regex, bool(rotate != 0), 0, 3))
Пример #6
0
    def command_update_size(self):
        command = self.commandQLE.text()
        text1 = self.widthQLE.text()
        text2 = self.heightQLE.text()

        if not (text1 == '-1' or text2 == '-1'):
            self.preserveaspectQChB.setChecked(False)

        if (text1 or text2) and not (text1 and text2) or (text1 == '-'
                                                          or text2 == '-'):
            return

        regex = r'(\s+|^)-s(:v){0,1}\s+\d+x\d+(\s+|$)'
        if re.search(regex, command):
            command = re.sub(regex, '', command)

        regex = r'(,*\s*){0,1}(scale=-?\d+:-?\d+)(\s*,*\s*){0,1}'
        _filter = "scale={0}:{1}".format(text1,
                                         text2) if text1 and text2 else ''

        self.commandQLE.setText(
            utils.update_cmdline_text(command, _filter, regex,
                                      bool(text1 and text2), 0, 2))