def _get_info(self): if self._info is None: if not self.hash: self._info = {} else: driver = get_path_driver(self.hash, self.optionset) try: info = driver.options(self.hash) info.update(driver.file(self.hash)) # get image dimensions if not 'dim' in info and 'mime' in info and info['mime'].startswith('image'): info['dim'] = driver.dimensions(self.hash) # calculate thumbnail url if 'tmb' in info and 'tmbUrl' in info: info['tmb'] = '%s%s' % (info['tmbUrl'], info['tmb']) del info['tmbUrl'] if 'archivers' in info: del info['archivers'] if 'extract' in info: del info['extract'] self._info = info except: self._info = {'error': _('This file is no longer valid')} return self._info
def _get_info(self): if self._info is None: if not self.hash: self._info = {} else: driver = get_path_driver(self.hash, self.optionset) try: info = driver.options(self.hash) info.update(driver.file(self.hash)) #get image dimensions if not 'dim' in info and 'mime' in info and info['mime'].startswith('image'): info['dim'] = driver.dimensions(self.hash) #calculate thumbnail url if 'tmb' in info and 'tmbUrl' in info: info['tmb'] = '%s%s' % (info['tmbUrl'], info['tmb']) del info['tmbUrl'] if 'archivers' in info: del info['archivers'] if 'extract' in info: del info['extract'] self._info = info except: self._info = { 'error' : _('This file is no longer valid') } return self._info
def _get_info(self): if self._info is None: if not self.hash: self._info = {} else: driver = get_path_driver(self.hash, self.optionset) try: info = driver.options(self.hash) info.update(driver.file(self.hash)) # get image dimensions if not "dim" in info and "mime" in info and info["mime"].startswith("image"): info["dim"] = driver.dimensions(self.hash) # calculate thumbnail url if "tmb" in info and "tmbUrl" in info: info["tmb"] = "%s%s" % (info["tmbUrl"], info["tmb"]) del info["tmbUrl"] if "archivers" in info: del info["archivers"] if "extract" in info: del info["extract"] self._info = info except: self._info = {"error": _("This file is no longer valid")} return self._info