make links relative

This commit is contained in:
j 2014-04-24 14:12:11 +00:00
parent 679160e641
commit 68e4ac8f56

View file

@ -1182,6 +1182,7 @@ class Item(models.Model):
media_path = media_path.encode('utf-8') media_path = media_path.encode('utf-8')
if isinstance(video, unicode): if isinstance(video, unicode):
video = video.encode('utf-8') video = video.encode('utf-8')
media_path = os.path.relpath(media_path, os.path.dirname(video))
os.symlink(media_path, video) os.symlink(media_path, video)
size = v.media.size size = v.media.size
duration = v.duration duration = v.duration
@ -1197,6 +1198,7 @@ class Item(models.Model):
media_path = media_path.encode('utf-8') media_path = media_path.encode('utf-8')
if isinstance(video, unicode): if isinstance(video, unicode):
video = video.encode('utf-8') video = video.encode('utf-8')
media_path = os.path.relpath(media_path, os.path.dirname(video))
os.symlink(media_path, video) os.symlink(media_path, video)
size += v.media.size size += v.media.size
duration += v.duration duration += v.duration