get_themepack.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 import os
00022 from time import time
00023 import functions
00024 
00025 # Gettext - Übersetzung
00026 functions.translation_gettext()
00027 #def _(string):
00028 #    return string
00029 
00030 
00031 ###################################################################
00032 #
00033 # download and extrackt themes 
00034 # RETURNS: 0 = ok, 1 = download error, 2 = extraction error
00035 # 
00036 def download_pack():
00037     home=functions.preparedirs()
00038     print ("Downloading themepack")
00039     ret = os.system("wget -cO %s xn--ngel-5qa.de/pyjama/release/themepack.tar.gz" % os.path.join(home, "themepack.tar.gz"))
00040     if ret <> 0:
00041         print ("Error downloading the themepack")
00042         return 1
00043     else:
00044         print ("Extracting themepack to '~/.pyjama/themes'")
00045         ret = os.system("tar -C %s -xf %s" % (home, os.path.join(home, "themepack.tar.gz")))
00046         if ret <> 0:
00047             print ("Error extracting the themepack")
00048             return 2
00049         else:
00050             print ("All done")
00051             return 0
00052 

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