add 'pandora_client install_programs update'
This commit is contained in:
parent
b950c187f4
commit
506df5939f
2 changed files with 10 additions and 7 deletions
|
@ -37,7 +37,7 @@ if __name__ == '__main__':
|
|||
parser.print_help()
|
||||
sys.exit(1)
|
||||
|
||||
actions = ('scan', 'sync', 'upload', 'upload_frames', 'extract', 'clean', 'cmd', 'import_srt', 'upload_document')
|
||||
actions = ('scan', 'sync', 'upload', 'upload_frames', 'extract', 'clean', 'cmd', 'import_srt', 'upload_document', 'install_programs')
|
||||
config = ('config', 'add_volume')
|
||||
server = ('server', 'client')
|
||||
if not args or args[0] not in actions + config + server:
|
||||
|
|
|
@ -421,23 +421,26 @@ class Client(object):
|
|||
self._config['url'] = url
|
||||
self.save_config()
|
||||
print "\nconfiguration updated."
|
||||
self.install_programs()
|
||||
|
||||
def install_programs(self, args=[]):
|
||||
update = 'update' in args
|
||||
#install required programs
|
||||
if sys.platform == 'darwin':
|
||||
osname = 'macosx'
|
||||
osext = 'macosx'
|
||||
elif sys.platform == 'win32':
|
||||
osname = 'exe'
|
||||
osext = 'exe'
|
||||
else:
|
||||
osname = 'linux'
|
||||
osext = 'linux'
|
||||
bindir = os.path.expanduser('~/.ox/bin')
|
||||
ox.makedirs(bindir)
|
||||
for p in ('ffmpeg', 'ffmpeg2theora'):
|
||||
path = os.path.join(bindir, p)
|
||||
if sys.platform == 'win32':
|
||||
p += '.exe'
|
||||
if not os.path.exists(path):
|
||||
if not os.path.exists(path) or update:
|
||||
print "installing %s in %s" % (p, bindir)
|
||||
ox.net.save_url('http://firefogg.org/bin/%s.%s' % (p, osname), path)
|
||||
ox.net.save_url('http://firefogg.org/bin/%s.%s' % (p, osext), path, True)
|
||||
os.chmod(path, 0755)
|
||||
|
||||
def add_volume(self, args):
|
||||
|
@ -470,7 +473,7 @@ class Client(object):
|
|||
return volumes
|
||||
|
||||
def scan(self, args):
|
||||
rescan = '--rescan' in args
|
||||
rescan = 'rescan' in args
|
||||
print "checking for new files ..."
|
||||
volumes = self.active_volumes()
|
||||
for name in sorted(volumes):
|
||||
|
|
Loading…
Reference in a new issue