本文整理汇总了Python中opencontext_py.libs.rootpath.RootPath.convert_to_https方法的典型用法代码示例。如果您正苦于以下问题:Python RootPath.convert_to_https方法的具体用法?Python RootPath.convert_to_https怎么用?Python RootPath.convert_to_https使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opencontext_py.libs.rootpath.RootPath
的用法示例。
在下文中一共展示了RootPath.convert_to_https方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_media_files
# 需要导入模块: from opencontext_py.libs.rootpath import RootPath [as 别名]
# 或者: from opencontext_py.libs.rootpath.RootPath import convert_to_https [as 别名]
def get_media_files(self, solr_rec):
""" get media record and thumbnai if it exists """
if 'uuid' in solr_rec:
uuid = solr_rec['uuid']
if uuid in self.media_file_data:
if self.media_file_data[uuid] is not False:
rp = RootPath()
for file_type, file_uri in self.media_file_data[uuid].items():
if file_type == 'oc-gen:thumbnail':
self.thumbnail_scr = rp.convert_to_https(file_uri)
elif file_type == 'oc-gen:preview':
self.preview_scr = rp.convert_to_https(file_uri)
elif file_type == 'oc-gen:fullfile':
self.fullfile_scr = rp.convert_to_https(file_uri)
示例2: get_thumbnail
# 需要导入模块: from opencontext_py.libs.rootpath import RootPath [as 别名]
# 或者: from opencontext_py.libs.rootpath.RootPath import convert_to_https [as 别名]
def get_thumbnail(self, solr_rec):
""" get media record and thumbnai if it exists """
if 'uuid' in solr_rec:
uuid = solr_rec['uuid']
if uuid in self.thumbnail_data:
if self.thumbnail_data[uuid] is not False:
self.thumbnail_href = self.thumbnail_data[uuid]['href']
self.thumbnail_uri = self.thumbnail_data[uuid]['uri']
self.thumbnail_scr = self.thumbnail_data[uuid]['scr']
rp = RootPath()
self.thumbnail_scr = rp.convert_to_https(self.thumbnail_scr)
else:
# did not precache thumbnail data, get an indivitual record
self.get_thumbnail_from_database(solr_rec)