Skip to content

Commit 0127a5f

Browse files
author
Xiaoxia
committed
update magnet url
1 parent 99c2872 commit 0127a5f

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

supervisord.conf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,4 @@ environment=PATH="/home/job/env/bin"
2323
directory=/home/job/ssbc
2424
command=gunicorn -k gevent -b :8002 -w 2 ssbc.wsgi
2525

26-
[program:mongod]
27-
user=job
28-
command=/home/job/bin/mongod --storageEngine=wiredTiger --dbpath=/data/mongodb
29-
3026

web/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def hash(request, h):
3434
if 'files' in d['info']:
3535
d['info']['files'] = [y for y in d['info']['files'] if not y['path'].startswith(u'_')]
3636
d['info']['files'].sort(key=lambda x:x['length'], reverse=True)
37-
d['magnet_url'] = 'magnet:?' + urllib.urlencode({'xt':'urn:btih:%s'% (d['info']['info_hash']), 'dn':d['info']['name'].encode('utf8')})
37+
d['magnet_url'] = 'magnet:?xt=urn:btih:' + d['info']['info_hash'] + '&' + urllib.urlencode({'dn':d['info']['name'].encode('utf8')})
3838
d['download_url'] = 'http://www.so.com/s?' + urllib.urlencode({'ie':'utf-8', 'src': 'ssbc', 'q': d['info']['name'].encode('utf8')})
3939
return render(request, 'info.html', d)
4040

@@ -69,7 +69,7 @@ def search(request, keyword, p):
6969

7070
for x in d['result']['items']:
7171
x.update(j[str(x['id'])])
72-
x['magnet_url'] = 'magnet:?' + urllib.urlencode({'xt':'urn:btih:%s'% (x['info_hash']), 'dn':x['name'].encode('utf8')})
72+
x['magnet_url'] = 'magnet:?xt=urn:btih:' + x['info_hash'] + '&' + urllib.urlencode({'dn':x['name'].encode('utf8')})
7373
if 'files' in x:
7474
x['files'] = [y for y in x['files'] if not y['path'].startswith(u'_')][:5]
7575
x['files'].sort(key=lambda x:x['length'], reverse=True)

0 commit comments

Comments
 (0)