diff --git a/bin/pandora_client b/bin/pandora_client index 86d290c..4a134ac 100755 --- a/bin/pandora_client +++ b/bin/pandora_client @@ -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: diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 3837005..121a7f2 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -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):