예제 #1
0
    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
예제 #2
0
파일: fields.py 프로젝트: Yangandgithub/ops
    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
예제 #3
0
    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