This repository was archived by the owner on Feb 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmake.py
More file actions
68 lines (54 loc) · 2.2 KB
/
make.py
File metadata and controls
68 lines (54 loc) · 2.2 KB
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
# ------------------------------------------------------------------------------
# - Copyright (c) 2012 Christian Ertler.
# - All rights reserved. This program and the accompanying materials
# - are made available under the terms of the GNU Public License v3.0
# - which accompanies this distribution, and is available at
# - http://www.gnu.org/licenses/gpl.html
# -
# - Contributors:
# - Christian Ertler - initial API and implementation
# ------------------------------------------------------------------------------
import os, sys, subprocess, shutil
__plugin_dir = os.path.expanduser("~/.local/share/rhythmbox/plugins/")
__plugin_name = "RhythmRemote"
def __cmd_exists(cmd):
try:
subprocess.call([cmd, '--version'])
except OSError:
print "%s not found on path" % myexec
def __unlink_project():
if (os.path.lexists(__plugin_dir + __plugin_name.lower())):
try:
os.unlink(__plugin_dir + __plugin_name.lower())
except:
shutil.rmtree(__plugin_dir + __plugin_name.lower())
def __install():
__unlink_project()
shutil.copytree(os.path.abspath("."), __plugin_dir + __plugin_name.lower()) # TODO
def __run():
__unlink_project()
os.symlink(os.path.abspath("."), __plugin_dir + __plugin_name.lower())
os.execvp("rhythmbox", ["rhythmbox", "-D", __plugin_name.lower()])
def __check_dependencies():
try:
import bottle
except:
print("You need to install bottle (pip install bottle or apt-get install python-bottle or ...)")
exit(1)
try:
subprocess.call(["rhythmbox", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except OSError:
print("Either Rhythmbox is not installed or not in your PATH environment variable.")
print("Please install Rhythmbox properly to continue.")
exit(1)
def __initialize_environment():
if not os.path.exists(__plugin_dir):
os.makedirs(__plugin_dir)
print("Created Rhythmbox plugin-directory in: " + __plugin_dir)
if __name__ == "__main__":
__check_dependencies()
__initialize_environment()
if len(sys.argv) > 1 and sys.argv[1] == "install":
__install()
else:
__run()