本文整理汇总了Python中ImageUtils.ImageUtils.get_urls方法的典型用法代码示例。如果您正苦于以下问题:Python ImageUtils.get_urls方法的具体用法?Python ImageUtils.get_urls怎么用?Python ImageUtils.get_urls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageUtils.ImageUtils
的用法示例。
在下文中一共展示了ImageUtils.get_urls方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_url
# 需要导入模块: from ImageUtils import ImageUtils [as 别名]
# 或者: from ImageUtils.ImageUtils import get_urls [as 别名]
def process_url(self, url, url_index, child):
self.debug('process_url: %s' % url)
userid = self.db.get_user_id(child.author)
if type(child) == Post:
base_fname = '%s-%d' % (child.id, url_index)
postid = child.id
commid = None
elif type(child) == Comment:
base_fname = '%s-%s-%d' % (child.post_id, child.id, url_index)
postid = child.post_id
commid = child.id
working_dir = path.join(ImageUtils.get_root(), 'content', child.author)
# A single URL can contain multiple medias (i.e. albums)
try:
(media_type, albumname, medias) = ImageUtils.get_urls(url)
except Exception, e:
self.debug('%s: process_url: unable to get URLs for %s: %s' % (child.author, url, str(e)))
return
示例2: process_url
# 需要导入模块: from ImageUtils import ImageUtils [as 别名]
# 或者: from ImageUtils.ImageUtils import get_urls [as 别名]
def process_url(self, url, url_index, child):
self.debug('%s: process_url: %s' % (child.author, url))
# Ignore duplicate albums
if self.db.album_exists(url):
self.debug('''%s: process_url: album %s already exists in database.
Permalink: %s
Object: %s''' % (child.author, url, child.permalink(), str(child)))
return
userid = self.db.get_user_id(child.author)
if type(child) == Post:
base_fname = '%s-%d' % (child.id, url_index)
postid = child.id
commid = None
elif type(child) == Comment:
base_fname = '%s-%s-%d' % (child.post_id, child.id, url_index)
postid = child.post_id
commid = child.id
working_dir = path.join(ImageUtils.get_root(), 'content', child.author)
# A single URL can contain multiple medias (i.e. albums)
try:
(media_type, albumname, medias) = ImageUtils.get_urls(url)
except Exception, e:
self.debug('%s: process_url: unable to get URLs for %s: %s' % (child.author, url, str(e)))
if 'domain not supported' in str(e):
# Save domain-not-supported URLs to new file
user_dir = path.join(ImageUtils.get_root(), 'content', child.author)
f = open(path.join(user_dir, 'unsupported.txt'), 'a')
f.write(url)
f.write('\n')
f.flush()
f.close()
return
示例3: main
# 需要导入模块: from ImageUtils import ImageUtils [as 别名]
# 或者: from ImageUtils.ImageUtils import get_urls [as 别名]
def main(self):
url='http://i.reddituploads.com/565bfd920d114339930a3e2407a5d967'
ImageUtils.get_urls(url)