use saveUrl

This commit is contained in:
j 2009-07-13 12:29:32 +02:00
parent 2cbb4ae0fc
commit 0ff1282c14
4 changed files with 3 additions and 27 deletions

View file

@ -19,12 +19,7 @@ def getPoster(id, url=None):
if not url:
data = oxweb.criterion.getData(id)
url = data['posterUrl']
if not os.path.exists(dirname):
os.makedirs(dirname)
data = oxlib.net.getUrl(url)
f = open(filename, 'w')
f.write(data)
f.close()
oxlib.net.saveUrl(url, filename)
return filename
def archivePosters(init=False):

View file

@ -17,13 +17,6 @@ def getPosterFilename(id, url):
def getPoster(id, url):
filename = getPosterFilename(id, url)
if not os.path.exists(filename):
if not os.path.exists(dirname):
os.makedirs(dirname)
data = oxlib.net.getUrl(url)
f = open(filename, 'w')
f.write(data)
f.close()
return filename
def archivePosters(init=False):

View file

@ -19,13 +19,7 @@ def getPosterFilename(id, url):
def getPoster(id, url):
filename = getPosterFilename(id, url)
if not os.path.exists(filename):
if not os.path.exists(dirname):
os.makedirs(dirname)
data = oxlib.net.getUrl(url)
f = open(filename, 'w')
f.write(data)
f.close()
oxlib.net.saveUrl(url, filename)
return filename
def archivePosters(init=False):

View file

@ -20,13 +20,7 @@ def getPoster(id, url=''):
url_hash = hashlib.sha1(url).hexdigest()
filename = os.path.join(dirname, '%s.jpg' % url_hash)
filename = os.path.normpath(filename)
if not os.path.exists(filename):
if not os.path.exists(dirname):
os.makedirs(dirname)
data = oxlib.net.getUrl(url)
f = open(filename, 'w')
f.write(data)
f.close()
oxlib.net.saveUrl(url, filename)
return filename
def archivePosters(init=False):