MCPcopy Index your code
hub / github.com/pyload/pyload / Ffmpeg

Class Ffmpeg

module/plugins/hoster/YoutubeCom.py:72–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71
72class Ffmpeg(object):
73 _RE_DURATION = re.compile(r'Duration: (\d{2}):(\d{2}):(\d{2})\.(\d{2}),')
74 _RE_TIME = re.compile(r'time=(\d{2}):(\d{2}):(\d{2})\.(\d{2})')
75 _RE_VERSION = re.compile((r'ffmpeg version (.+?) '))
76
77 CMD = None
78 priority = 0
79 streams = []
80 start_time = (0, 0)
81 output_filename = None
82 error_message = ""
83
84 def __init__(self, priority, plugin=None):
85 self.plugin = plugin
86 self.priority = priority
87
88 self.streams = []
89 self.start_time = (0, 0)
90 self.output_filename = None
91 self.error_message = ""
92
93 self.find()
94
95 @classmethod
96 def find(cls):
97 """
98 Check for ffmpeg
99 """
100 if cls.CMD is not None:
101 return True
102
103 try:
104 if os.name == "nt":
105 ffmpeg = os.path.join(pypath, "ffmpeg.exe") if isexecutable(os.path.join(pypath, "ffmpeg.exe")) \
106 else "ffmpeg.exe"
107
108 else:
109 ffmpeg = "ffmpeg"
110
111 cmd = which(ffmpeg) or ffmpeg
112
113 p = Popen([cmd, "-version"],
114 stdout=subprocess.PIPE,
115 stderr=subprocess.PIPE)
116 out, err = (_r.strip() if _r else "" for _r in p.communicate())
117 except OSError:
118 return False
119
120 m = cls._RE_VERSION.search(out)
121 if m is not None:
122 cls.VERSION = m.group(1)
123
124 cls.CMD = cmd
125
126 return True
127
128 @property
129 def found(self):

Callers 1

processMethod · 0.85

Calls 1

compileMethod · 0.80

Tested by

no test coverage detected