From b47b4e73b856b34afa07b1d72367dba4a7c6c005 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 7 Jan 2014 14:16:00 -0600 Subject: Remove release fields we can pull from the torrent This makes entering new releases a bit less cumbersome as we don't really need to enter either the file size or the torrent infohash. Signed-off-by: Dan McGee --- releng/models.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'releng/models.py') diff --git a/releng/models.py b/releng/models.py index 5ee2f325..c73e28d8 100644 --- a/releng/models.py +++ b/releng/models.py @@ -119,14 +119,13 @@ class Release(models.Model): release_date = models.DateField(db_index=True) version = models.CharField(max_length=50, unique=True) kernel_version = models.CharField(max_length=50, blank=True) - torrent_infohash = models.CharField(max_length=40, blank=True) md5_sum = models.CharField('MD5 digest', max_length=32, blank=True) sha1_sum = models.CharField('SHA1 digest', max_length=40, blank=True) - file_size = PositiveBigIntegerField(null=True, blank=True) created = models.DateTimeField(editable=False) available = models.BooleanField(default=True) info = models.TextField('Public information', blank=True) - torrent_data = models.TextField(blank=True) + torrent_data = models.TextField(blank=True, + help_text="base64-encoded torrent file") class Meta: get_latest_by = 'release_date' @@ -150,8 +149,9 @@ def magnet_uri(self): ] if settings.TORRENT_TRACKERS: query.extend(('tr', uri) for uri in settings.TORRENT_TRACKERS) - if self.torrent_infohash: - query.insert(0, ('xt', "urn:btih:%s" % self.torrent_infohash)) + metadata = self.torrent() + if metadata and 'info_hash' in metadata: + query.insert(0, ('xt', "urn:btih:%s" % metadata['info_hash'])) return "magnet:?%s" % '&'.join(['%s=%s' % (k, v) for k, v in query]) def info_html(self): -- cgit v1.2.3-54-g00ecf