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
|
#!/usr/bin/python
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 TJ, Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenShot Video Editor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenShot Video Editor. If not, see <http://www.gnu.org/licenses/>.
import sys, os
# get the real location of this launcher file (not the link location)
realfile = os.path.realpath(__file__)
realfile_dir = os.path.dirname(os.path.abspath(realfile))
# determine if running from the /openshot/bin folder
parent_folder_path = os.path.dirname(realfile_dir)
bin_path = os.path.join(parent_folder_path, 'openshot')
if os.path.exists(os.path.join(bin_path, 'openshot.py')):
# insert this path into the Python path
sys.path.insert(0, bin_path)
print "Added %s to system path" % bin_path
else:
# determine if running from the /usr/share/openshot folder
usr_share_path = os.path.join('/', 'usr', 'share', 'openshot')
if os.path.exists(usr_share_path):
# insert this path into the Python path
sys.path.insert(0, usr_share_path)
print "Added %s to system path" % usr_share_path
# If the openshot python code is found in the Python path, then
# we should be able to import openshot and call the main() method
try:
# RUN OPENSHOT
from openshot import main
main()
except ImportError:
try:
# RUN OPENSHOT
from openshot.openshot import main
main()
except ImportError:
# Failed to find the openshot library. NOTE: This /bin/openshot/ file
# requires that OpenShot be installed in /site-packages or /usr/share/openshot
print "-------------------------------------------------------"
print "Error: OpenShot has not been installed in the Python path."
print "(Both the site-packages and /usr/share/openshot folders were checked)"
print ""
print "Use the following command to install OpenShot:"
print " $ sudo python setup.py install"
print ""
|