match places/events in any case, update url-list in torrent to match current url

This commit is contained in:
j 2012-01-17 16:09:45 +05:30
commit 06069b71e2
4 changed files with 19 additions and 10 deletions

View file

@ -901,6 +901,14 @@ class Item(models.Model):
self.update_timeline()
break
def get_torrent(self, request):
if self.torrent:
self.torrent.seek(0)
data = ox.torrent.bdecode(self.torrent.read())
url = request.build_absolute_uri("%s/torrent/"%self.get_absolute_url())
data['url-list'] = ['%s%s' % (url, u.split('torrent/')[1]) for u in data['url-list']]
return ox.torrent.bencode(data)
def make_torrent(self):
streams = self.streams()
if streams.count() == 0: