use saveUrl
This commit is contained in:
parent
2cbb4ae0fc
commit
0ff1282c14
4 changed files with 3 additions and 27 deletions
|
@ -19,12 +19,7 @@ def getPoster(id, url=None):
|
||||||
if not url:
|
if not url:
|
||||||
data = oxweb.criterion.getData(id)
|
data = oxweb.criterion.getData(id)
|
||||||
url = data['posterUrl']
|
url = data['posterUrl']
|
||||||
if not os.path.exists(dirname):
|
oxlib.net.saveUrl(url, filename)
|
||||||
os.makedirs(dirname)
|
|
||||||
data = oxlib.net.getUrl(url)
|
|
||||||
f = open(filename, 'w')
|
|
||||||
f.write(data)
|
|
||||||
f.close()
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
def archivePosters(init=False):
|
def archivePosters(init=False):
|
||||||
|
|
|
@ -17,13 +17,6 @@ def getPosterFilename(id, url):
|
||||||
|
|
||||||
def getPoster(id, url):
|
def getPoster(id, url):
|
||||||
filename = getPosterFilename(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
|
return filename
|
||||||
|
|
||||||
def archivePosters(init=False):
|
def archivePosters(init=False):
|
||||||
|
|
|
@ -19,13 +19,7 @@ def getPosterFilename(id, url):
|
||||||
|
|
||||||
def getPoster(id, url):
|
def getPoster(id, url):
|
||||||
filename = getPosterFilename(id, url)
|
filename = getPosterFilename(id, url)
|
||||||
if not os.path.exists(filename):
|
oxlib.net.saveUrl(url, 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
|
return filename
|
||||||
|
|
||||||
def archivePosters(init=False):
|
def archivePosters(init=False):
|
||||||
|
|
|
@ -20,13 +20,7 @@ def getPoster(id, url=''):
|
||||||
url_hash = hashlib.sha1(url).hexdigest()
|
url_hash = hashlib.sha1(url).hexdigest()
|
||||||
filename = os.path.join(dirname, '%s.jpg' % url_hash)
|
filename = os.path.join(dirname, '%s.jpg' % url_hash)
|
||||||
filename = os.path.normpath(filename)
|
filename = os.path.normpath(filename)
|
||||||
if not os.path.exists(filename):
|
oxlib.net.saveUrl(url, 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
|
return filename
|
||||||
|
|
||||||
def archivePosters(init=False):
|
def archivePosters(init=False):
|
||||||
|
|
Loading…
Reference in a new issue