Advertising
- Mine
- Friday, February 23rd, 2007 at 11:56:11am UTC
- #!/usr/bin/python
- import os
- import sys
- import shutil
- import time
- import commands
- import re
- current_directory = os.getcwd()
- destination_directory = '/usr/local/thinliquidfilm'
- child = os.popen('which konqueror')
- data = child.read()
- data = data.replace('\n','')
- data = data.split('/')
- ind = data.index('bin')
- kdedir = data[:ind]
- kdedir = '/'.join(kdedir)
- print '*************************************'
- print ' installing thinliquidfilm'
- print '*************************************'
- print ''
- print ''
- print ''
- print 'Checking dependencies ...'
- print ''
- print ''
- try:
- import qt
- print 'pyqt is present'
- except:
- print 'Couldn\'t find pyqt. thin liquid film will not work without pyqt. Aborting installation.'
- sys.exit()
- print ''
- if os.popen('which ffmpeg').read() == '':
- print 'Couldn\'t find ffmpeg. thin liquid film will not work without ffmpeg. Aborting installation.'
- sys.exit()
- else:
- print 'ffmpeg is present'
- print ''
- codec_errors = 0
- cmd = ('ffmpeg -formats')
- output = commands.getoutput(cmd)
- match = re.findall('xvid', output)
- if len(match) > 0:
- print 'ffmpeg supports xvid'
- else:
- print 'ffmpeg does not support xvid. thin liquid film will not be able to read or encode xvid video files.'
- codec_errors += 1
- print ''
- match = re.findall('h264', output)
- if len(match) > 0:
- print 'ffmpeg supports h264'
- else:
- print 'ffmpeg does not support h264. thin liquid film will not be able to read or encode h264 video files.'
- codec_errors += 1
- if codec_errors == 2:
- print 'ffmpeg does not support either xvid or h264. thin liquid film will not work without one of those codecs being supported by ffmpeg. Aborting installation.'
- sys.exit()
- print ''
- try:
- import gpod
- print 'libgpod python bindings are present'
- except:
- print 'Couldn\'t find libgpod python bindings. You will need to install libgpod, and its python bindings to be able to upload videos to your ipod from thin liquid film'
- print ''
- if os.popen('which mplayer').read() == '':
- print 'Couldn\'t find mplayer. Without mplayer, you will not be able to preview encoded videos.'
- else:
- print 'mplayer is present'
- print ''
- print ''
- print 'Checking permissions for install process ...'
- print ''
- print ''
- # check we are root
- child = os.popen('touch /usr/local/test_thinliquidfilm &> /dev/null')
- err = child.close()
- if err:
- print 'You need to login as root to run this installation script. You can do this by typing \'su\' at the command line, and then entering your root password. If you are using *ubuntu, you should run this script with the command: \'sudo ./install.py\''
- sys.exit()
- else:
- print 'Permissions OK'
- print ''
- print ''
- time.sleep(1.0)
- print 'Clearing old installations ...'
- #clear old installs
- if os.path.isfile(kdedir + '/share/apps/konqueror/servicemenu/thinliquidfilm.desktop'):
- print 'Removing ' + kdedir + '/share/apps/konqueror/servicemenu/thinliquidfilm.desktop sevicemenu'
- os.remove(kdedir + '/share/apps/konqueror/servicemenu/thinliquidfilm.desktop')
- if os.path.isfile('/usr/local/bin/thinliquidfilm'):
- print 'Removing symlink to main application'
- os.remove('/usr/local/bin/thinliquidfilm')
- if os.path.exists('/usr/local/thinliquidfilm'):
- print 'Removing /usr/local/thinliquidfilm directory'
- shutil.rmtree('/usr/local/thinliquidfilm')
- print ''
- print ''
- print 'Old installations cleared'
- print ''
- print ''
- time.sleep(1.0)
- print 'Copying ' + current_directory + ' to /usr/local ...'
- shutil.copytree(current_directory,destination_directory)
- print ''
- print ''
- print 'Directory copied'
- print ''
- print ''
- time.sleep(1.0)
- print 'Creating symlink to main application file ...'
- os.symlink('/usr/local/thinliquidfilm/thinliquidfilm.py','/usr/local/bin/thinliquidfilm')
- print ''
- print ''
- print 'Symlink created'
- print ''
- print ''
- time.sleep(1.0)
- print 'Creating thinliquidfilm servicemenu'
- if os.path.isdir(kdedir + '/share/apps/konqueror/servicemenus/'):
- shutil.copyfile('/usr/local/thinliquidfilm/thinliquidfilm.desktop',kdedir + '/share/apps/konqueror/servicemenus/thinliquidfilm.desktop')
- print ''
- print ''
- print 'Servicemenu created'
- else:
- print ''
- print ''
- print 'Couldn\'t find servicemenu directory. Servicemenu entry not installed. You can install it manuall by copying the file "thinliquidfilm.desktop" from the install directory to the directory where konqueror\'s service menus are stored.'
- print ''
- print ''
- print '*************************************'
- print ' thinliquidfilm installed'
- print '*************************************'
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.