示例#1
0
    def _load_metadata(self, filename):
        if not filename or not os.path.exists(filename):
            return {}

        encoding = util.guess_encoding(filename)
        extension_py = open(filename, "r", encoding=encoding).read()
        metadata = dict(re.findall(r"__([a-z_]+)__ = '([^']+)'", extension_py))

        # Support for using gpodder.gettext() as _ to localize text
        localized_metadata = dict(
            re.findall(r"__([a-z_]+)__ = _\('([^']+)'\)", extension_py))

        for key in localized_metadata:
            metadata[key] = gpodder.gettext(localized_metadata[key])

        return metadata
示例#2
0
    def _load_metadata(self, filename):
        if not filename or not os.path.exists(filename):
            return {}

        encoding = util.guess_encoding(filename)
        extension_py = open(filename, "r", encoding=encoding).read()
        metadata = dict(re.findall("__([a-z_]+)__ = '([^']+)'", extension_py))

        # Support for using gpodder.gettext() as _ to localize text
        localized_metadata = dict(re.findall("__([a-z_]+)__ = _\('([^']+)'\)",
            extension_py))

        for key in localized_metadata:
            metadata[key] = gpodder.gettext(localized_metadata[key])

        return metadata