Пример #1
0
def run_proc(data):
    """ Measure time and run process
    """
    a = time.time()
    run_local(data)
    b = time.time()
    return b-a
Пример #2
0
    def join(self, remove_files=True):
        if not self.parts:
            raise Exception("Nothing to join.")

        for part, audio in zip(self.parts, self.audio_parts):
            name = part[0]
            output, extra = name.rsplit("_", 1)
            output += ".mp4"

            proc.run_local(command.join(part, output, audio=audio))

            if remove_files:
                for f in part:
                    os.remove(f)

        if remove_files and self.audio_parts:
            os.remove(self.audio_parts[0])
Пример #3
0
    def probe(self, json=False, **kw):
        """ Get the `ffprobe` information in a dict-like object

        :param json: Use the `json` print format. Disabled by default
        :param kw: Other kw arguments to `command.probe` function
        :return: Parsed output in a dict
        """
        if self._probe is None or DEBUG >= 2:
            sout, _ = proc.run_local(command.probe(self.filename, json=json, **kw))
            sout = sout.decode()
            if json:
                self._probe = json.loads(sout)
            else:
                self._probe = parse.probe(sout)
        return self._probe
Пример #4
0
 def separate(self):
     output = None if not self.out else self.out.format("{0}", ".m4a")
     cmd = command.separate(self.filename, output)
     proc.run_local(cmd)
     self.audio_parts = [cmd[-1] for i in range(len(self.flavors))]
Пример #5
0
 def conv_original(self, convert=True):
     output = None if not self.out else self.out.format("{0}", "{1}")
     cmd = command.convert(self.filename, {}, output=output, audio=False)
     if convert:
         proc.run_local(cmd)
     return self.as_t(cmd[-1])