Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Mine
Friday, February 23rd, 2007 at 11:56:11am UTC 

  1. #!/usr/bin/python
  2. import os
  3. import sys
  4. import shutil
  5. import time
  6. import commands
  7. import re
  8. current_directory = os.getcwd()
  9. destination_directory = '/usr/local/thinliquidfilm'
  10. child = os.popen('which konqueror')
  11. data = child.read()
  12. data = data.replace('\n','')
  13. data = data.split('/')
  14. ind = data.index('bin')
  15. kdedir = data[:ind]
  16. kdedir = '/'.join(kdedir)
  17.  
  18. print '*************************************'
  19. print '      installing thinliquidfilm'
  20. print '*************************************'
  21. print ''
  22. print ''
  23. print ''
  24. print 'Checking dependencies ...'
  25. print ''
  26. print ''
  27. try:
  28.     import qt
  29.     print 'pyqt is present'
  30. except:
  31.     print 'Couldn\'t find pyqt.  thin liquid film will not work without pyqt.  Aborting installation.'
  32.     sys.exit()
  33. print ''
  34. if os.popen('which ffmpeg').read() == '':
  35.     print 'Couldn\'t find ffmpeg.  thin liquid film will not work without ffmpeg.  Aborting installation.'
  36.     sys.exit()
  37. else:
  38.     print 'ffmpeg is present'
  39.     print ''
  40. codec_errors = 0
  41. cmd = ('ffmpeg -formats')
  42. output = commands.getoutput(cmd)
  43. match = re.findall('xvid', output)
  44. if len(match) > 0:
  45.     print 'ffmpeg supports xvid'
  46. else:
  47.     print 'ffmpeg does not support xvid.  thin liquid film will not be able to read or encode xvid video files.'
  48.     codec_errors += 1
  49. print ''
  50. match = re.findall('h264', output)
  51. if len(match) > 0:
  52.     print 'ffmpeg supports h264'
  53. else:
  54.     print 'ffmpeg does not support h264.  thin liquid film will not be able to read or encode h264 video files.'
  55.     codec_errors += 1
  56. if codec_errors == 2:
  57.     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.'
  58.     sys.exit()
  59. print ''
  60. try:
  61.     import gpod
  62.     print 'libgpod python bindings are present'
  63. except:
  64.     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'
  65. print ''
  66. if os.popen('which mplayer').read() == '':
  67.     print 'Couldn\'t find mplayer.  Without mplayer, you will not be able to preview encoded videos.'
  68. else:
  69.     print 'mplayer is present'
  70. print ''
  71. print ''
  72. print 'Checking permissions for install process ...'
  73. print ''
  74. print ''
  75. # check we are root
  76. child = os.popen('touch /usr/local/test_thinliquidfilm &> /dev/null')
  77. err = child.close()
  78. if err:
  79.     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\''
  80.     sys.exit()
  81. else:
  82.     print 'Permissions OK'
  83. print ''
  84. print ''
  85. time.sleep(1.0)
  86. print 'Clearing old installations ...'
  87. #clear old installs
  88. if os.path.isfile(kdedir + '/share/apps/konqueror/servicemenu/thinliquidfilm.desktop'):
  89.     print 'Removing ' + kdedir + '/share/apps/konqueror/servicemenu/thinliquidfilm.desktop sevicemenu'
  90.     os.remove(kdedir + '/share/apps/konqueror/servicemenu/thinliquidfilm.desktop')
  91. if os.path.isfile('/usr/local/bin/thinliquidfilm'):
  92.     print 'Removing symlink to main application'
  93.     os.remove('/usr/local/bin/thinliquidfilm')
  94. if os.path.exists('/usr/local/thinliquidfilm'):
  95.     print 'Removing /usr/local/thinliquidfilm directory'
  96.     shutil.rmtree('/usr/local/thinliquidfilm')
  97. print ''
  98. print ''
  99. print 'Old installations cleared'
  100. print ''
  101. print ''
  102. time.sleep(1.0)
  103. print 'Copying ' + current_directory + ' to /usr/local ...'
  104. shutil.copytree(current_directory,destination_directory)
  105. print ''
  106. print ''
  107. print 'Directory copied'
  108. print ''
  109. print ''
  110. time.sleep(1.0)
  111. print 'Creating symlink to main application file ...'
  112. os.symlink('/usr/local/thinliquidfilm/thinliquidfilm.py','/usr/local/bin/thinliquidfilm')
  113. print ''
  114. print ''
  115. print 'Symlink created'
  116. print ''
  117. print ''
  118. time.sleep(1.0)
  119. print 'Creating thinliquidfilm servicemenu'
  120. if os.path.isdir(kdedir + '/share/apps/konqueror/servicemenus/'):
  121.     shutil.copyfile('/usr/local/thinliquidfilm/thinliquidfilm.desktop',kdedir + '/share/apps/konqueror/servicemenus/thinliquidfilm.desktop')
  122.     print ''
  123.     print ''
  124.     print 'Servicemenu created'
  125. else:
  126.     print ''
  127.     print ''
  128.     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.'
  129. print ''
  130. print ''
  131. print '*************************************'
  132. print '      thinliquidfilm installed'
  133. 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.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

comments powered by Disqus
worth-right
worth-right