symlink does not like unicode, pass utf-8

This commit is contained in:
j 2014-01-16 17:26:17 +05:30
parent fd518a8844
commit 375a6ed659

View file

@ -1079,7 +1079,10 @@ class Item(models.Model):
quote(filename.encode('utf-8')))
video = "%s.webm" % base
v = streams[0]
os.symlink(v.media.path, video)
media_path = v.media.path
if isinstance(media_path, unicode):
media_path = media_path.encode('utf-8')
os.symlink(media_path, video)
size = v.media.size
duration = v.duration
else:
@ -1089,7 +1092,10 @@ class Item(models.Model):
for v in streams:
video = "%s/%s.Part %d.webm" % (base, filename, part)
part += 1
os.symlink(v.media.path, video)
media_path = v.media.path
if isinstance(media_path, unicode):
media_path = media_path.encode('utf-8')
os.symlink(media_path, video)
size += v.media.size
duration += v.duration
video = base