Don't crash when unable to unlink
This commit is contained in:
parent
49b4667703
commit
0e258a46dc
@ -388,16 +388,26 @@ class Photo(object):
|
|||||||
)
|
)
|
||||||
if p == False:
|
if p == False:
|
||||||
message("couldn't extract video frame", os.path.basename(original_path))
|
message("couldn't extract video frame", os.path.basename(original_path))
|
||||||
|
try:
|
||||||
os.unlink(tfn)
|
os.unlink(tfn)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
self.is_valid = False
|
self.is_valid = False
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
image = Image.open(tfn)
|
image = Image.open(tfn)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
try:
|
||||||
|
os.unlink(tfn)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
raise
|
raise
|
||||||
except:
|
except:
|
||||||
message("couldn't open video thumbnail", tfn)
|
message("couldn't open video thumbnail", tfn)
|
||||||
|
try:
|
||||||
os.unlink(tfn)
|
os.unlink(tfn)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
self.is_valid = False
|
self.is_valid = False
|
||||||
return
|
return
|
||||||
mirror = image
|
mirror = image
|
||||||
@ -411,7 +421,10 @@ class Photo(object):
|
|||||||
for size in Photo.thumb_sizes:
|
for size in Photo.thumb_sizes:
|
||||||
if size[1]:
|
if size[1]:
|
||||||
self._thumbnail(mirror, original_path, thumb_path, size[0], size[1])
|
self._thumbnail(mirror, original_path, thumb_path, size[0], size[1])
|
||||||
|
try:
|
||||||
os.unlink(tfn)
|
os.unlink(tfn)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def _video_transcode(self, transcode_path, original_path):
|
def _video_transcode(self, transcode_path, original_path):
|
||||||
transcode_path = os.path.join(transcode_path, video_cache(self._path))
|
transcode_path = os.path.join(transcode_path, video_cache(self._path))
|
||||||
|
Loading…
Reference in New Issue
Block a user