-
Notifications
You must be signed in to change notification settings - Fork 0
/
preInstallTest.py
88 lines (65 loc) · 2.44 KB
/
preInstallTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Encoding: UTF-8
import os, sys
ffprobePath = "/usr/bin/ffprobe"
ffmpegPath = "/usr/bin/ffmpeg"
avprobePath = "/usr/bin/avprobe"
avconvPath = "/usr/bin/avconv"
rtmpdumpPath = "/usr/bin/rtmpdump"
modulesRequired = "BeautifulSoup, codecs, colorama, ConfigParser, datetime, django, getopt, grp, HTMLParser, json, os, re, requests, shlex, socket, stat, subprocess, termcolor, urllib2, urlparse, xml"
index = 0
moduleErrors = []
ffmpegWarning = False
ffprobeWarning = False
rtmpdumpWarning = False
print "Checking if prerequisites are installed"
print "\nChecking ffmpeg/avconv..."
if os.path.isfile(ffmpegPath):
print "--- ffmpeg found"
elif os.path.isfile(avconvPath):
print "--- avconv found"
else:
print "*** You don't have neither ffmpeg or avconv in the paths given in this script"
print " If it's installed, correct the paths in config.ini and everything should run"
ffmpegWarning = True
print "\nChecking ffprobe/avprobe..."
if os.path.isfile(ffprobePath):
print "--- ffprobe found"
elif os.path.isfile(avprobePath):
print "--- avprobe found"
else:
print "*** You don't have neither ffprobe or avprobe in the paths given in this script"
print " If it's installed, correct the paths in config.ini and everything should run"
ffprobeWarning = True
print "\nChecking rtmpdump..."
if os.path.isfile(rtmpdumpPath):
print "--- rtmpdump found"
else:
print "*** You don't have rtmpdump in the path given in this script"
rtmpdumpWarning = True
print "\nChecking python modules..."
modules = modulesRequired.split(",")
for module in modules:
module = module.strip()
try:
__import__(module)
except ImportError:
print "*** '%s' is not installed" % module
moduleErrors.append(module)
else:
print "--- '%s' is installed" % module
if ffmpegWarning or ffprobeWarning or moduleErrors:
print "\nThe following problems was found:"
if ffmpegWarning:
print "\nffmpeg/avconv could not be found"
if ffprobeWarning:
print "\nffprobe/avprobe could not be found"
if rtmpdumpWarning:
print "\nrtmpdump could not be found"
if moduleErrors:
print "\nPython modules:"
for module in moduleErrors:
print "%s could not be imported" % module
else:
print "\nEverything is hunky-dory!\nGo on and download!"