MCPcopy
hub / github.com/pyload/pyload / run

Method run

module/plugins/hoster/YoutubeCom.py:144–187  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

142 self.output_filename = output_filename
143
144 def run(self):
145 if self.CMD is None or self.output_filename is None:
146 return False
147
148 maps = []
149 args = []
150 meta = []
151 for i, stream in enumerate(self.streams):
152 args.extend(["-i", stream[1]])
153 maps.extend(["-map", "%s:%s:0" % (i, stream[0])])
154 if stream[0] == 's':
155 meta.extend(["-metadata:s:s:0:%s" % i, "language=%s" % stream[2]])
156
157 args.extend(maps)
158 args.extend(meta)
159 args.extend(["-y",
160 "-vcodec", "copy",
161 "-acodec", "copy",
162 "-scodec", "copy",
163 "-ss", "00:%s:%s.00" % (self.start_time[0], self.start_time[1]),
164 "-sub_charenc", "utf8"])
165
166 call = [self.CMD] + args + [self.output_filename]
167 p = Popen(
168 call,
169 stdout=subprocess.PIPE,
170 stderr=subprocess.PIPE)
171
172 renice(p.pid, self.priority)
173
174 duration = self._find_duration(p)
175 if duration:
176 last_line = self._progress(p, duration)
177 else:
178 last_line = ""
179
180 out, err = (_r.strip() if _r else "" for _r in p.communicate())
181 if err or p.returncode:
182 self.error_message = last_line
183 return False
184
185 else:
186 self.error_message = ""
187 return True
188
189 def _find_duration(self, process):
190 duration = 0

Callers 1

_postprocessMethod · 0.45

Calls 6

_find_durationMethod · 0.95
_progressMethod · 0.95
PopenClass · 0.85
reniceFunction · 0.85
extendMethod · 0.80
communicateMethod · 0.80

Tested by

no test coverage detected