Example #1
0
    def __init__(self, parent):
        self.__parent = parent
        self.__home = functions.preparedirs()
        ## The directory in which pyjama stores cached queries
        self.cachedir = os.path.join(self.__home, "cache")
        ## Counter for queries from cache
        self.cache_counter = 0
        ## Counter for queries from jamendo
        self.jamendo_counter = 0

        self.__last_query = None

        self.__ignore_cache = None

        self.__parent.Events.add_event("jamendo-query")
        
        # Somehow simplejsons behaviour
        # changed some times so i had to
        # do it this way. 
        # If this new behaviour won't change
        # again, the strict-statement is
        # obsolete
        try:
            self.json = json.JSONDecoder(strict=False)
        except:
            self.json = json.JSONDecoder()
Example #2
0
    def __init__(self, parent=None):
        ## Pointer to Pyjama
        self.parent = parent
        home = functions.preparedirs()
        install_dir = functions.install_dir()

        ## stores the config file URI
        self.home_config = os.path.join(home, 'pyjama.cfg')

        ## Parser Object Pointer
        self.config = ConfigParser.SafeConfigParser()
        self.config.readfp(open(os.path.join(install_dir, 'pyjama.cfg')))
        self.config.read([self.home_config])

        ## List holding options from pyjama.cfg
        self.options = {}

        sections = self.config.sections()
        for section in sections:
            items = self.config.items(section)
            for item, value in items:
                pos = value.find("#")
                pos = value.find(";")
                if pos > -1:
                    value = value[0:pos]
                if value.isdigit():
                    self.options[item] = int(value)
                elif (self.isbool(value)):
                    self.options[item] = self.parsebool(value)
                else:
                    self.options[item] = value
Example #3
0
    def __init__(self, parent=None):
        self.pyjama = parent
        self.home = functions.preparedirs()
        self.db = os.path.join(self.home, "pyjama.db")

        if self.pyjama:
            self.events = self.pyjama.Events
            self.events.add_event("dbtools_message")

        self.download_fkt = self.download_wget
        self.extract_fkt = self.extract_gzip
Example #4
0
def download_pack():
    home=functions.preparedirs()
    print ("Downloading themepack")
    ret = os.system("wget -cO %s xn--ngel-5qa.de/pyjama/release/themepack.tar.gz" % os.path.join(home, "themepack.tar.gz"))
    if ret <> 0:
        print ("Error downloading the themepack")
        return 1
    else:
        print ("Extracting themepack to '~/.pyjama/themes'")
        ret = os.system("tar -C %s -xf %s" % (home, os.path.join(home, "themepack.tar.gz")))
        if ret <> 0:
            print ("Error extracting the themepack")
            return 2
        else:
            print ("All done")
            return 0