get_imagepack.py

00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 
00004 # ----------------------------------------------------------------------------
00005 # pyjama - python jamendo audioplayer
00006 # Copyright (c) 2008 Daniel Nögel
00007 #
00008 # This program is free software: you can redistribute it and/or modify
00009 # it under the terms of the GNU General Public License as published by
00010 # the Free Software Foundation, either version 3 of the License, or
00011 # (at your option) any later version.
00012 #
00013 # This program is distributed in the hope that it will be useful,
00014 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 # GNU General Public License for more details.
00017 # You should have received a copy of the GNU General Public License
00018 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 # ----------------------------------------------------------------------------
00020 
00021 ## @package get_imagepack
00022 # This module just holds a function
00023 # to download and extract an image pack
00024 
00025 import os
00026 from time import time
00027 
00028 import functions
00029 
00030 # Gettext - Übersetzung
00031 functions.translation_gettext()
00032 #def _(string):
00033 #    return string
00034     
00035 
00036 ## Download and extrackt images 
00037 # @return: 
00038 # - 0 = ok
00039 # - 1 = download error
00040 # - 2 = extraction error
00041 # 
00042 def download_pack():
00043     home=functions.preparedirs()
00044     print ("Downloading imagepack")
00045     ret = os.system("wget -cO %s xn--ngel-5qa.de/pyjama/release/imagepack.tar.gz" % os.path.join(home, "imagepack.tar.gz"))
00046     if ret <> 0:
00047         print ("Error downloading the imagepack")
00048         return 1
00049     else:
00050         print ("Extracting imagepack to '~/.pyjama/images'")
00051         ret = os.system("tar -C %s -xf %s" % (home, os.path.join(home, "imagepack.tar.gz")))
00052         if ret <> 0:
00053             print ("Error extracting the imagepack")
00054             return 2
00055         else:
00056             print ("All done")
00057             return 0
00058 

Generated on Thu Jun 4 19:08:24 2009 for Pyjama by  doxygen 1.5.8