Exemplo n.º 1
0
    def save(self, widget=None):
        """Save anime data to local cache. This function is executed when
        the 'save' button is pressed and when the application shuts down.
        """

        #if self.al.config.no_user_defined == False:
        utils.cache_data('%s/%s_animelist.cpickle' % (self.al.HOME, self.al.config.settings['username']), self.data)

        self.al.gui['statusbar'].update('Anime: Saving data to local cache...')
        self.al.gui['statusbar'].clear(1000)
Exemplo n.º 2
0
        def get_data(refresh):
            # Get data from cache or download it from MAL and save it to the local cache.

            filename = '%s/%s_animelist.cpickle' % (self.al.HOME, self.al.config.settings['username'])

            if refresh == False:
                if os.path.exists(filename):
                    self.data = utils.get_cache(filename)
                    if self.data is None:
                        refresh = True
                else:
                    refresh = True

            if refresh:
                self.data = self.al.mal.anime.list()
                utils.cache_data(filename, self.data)