Skip to content

Commit

Permalink
english version
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoxia committed Oct 7, 2015
1 parent a1552fd commit 3ba2d44
Show file tree
Hide file tree
Showing 19 changed files with 178 additions and 87 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
# Byte-compiled / optimized / DLL files
*.swp
__pycache__/
*.py[cod]

Expand Down
18 changes: 16 additions & 2 deletions search/admin.py
@@ -1,9 +1,23 @@
from django.contrib import admin
from search.models import Hash, FileList, StatusReport, RecKeywords
from search.models import Hash, FileList, StatusReport, RecKeywords, Extra


# Register your models here.
admin.site.register(Hash)
class ExtraInline(admin.StackedInline):
model = Extra


class HashAdmin(admin.ModelAdmin):
inlines = [ExtraInline]


class ExtraAdmin(admin.ModelAdmin):
raw_id_fields = ['hash']
list_display = ('hash', 'blacklist')


admin.site.register(Hash, HashAdmin)
admin.site.register(Extra, ExtraAdmin)
admin.site.register(FileList)
admin.site.register(StatusReport)
admin.site.register(RecKeywords)
22 changes: 22 additions & 0 deletions search/migrations/0007_extra.py
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('search', '0006_auto_20150912_1630'),
]

operations = [
migrations.CreateModel(
name='Extra',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('blacklist', models.BooleanField(default=False, verbose_name=b'\xe9\xbb\x91\xe5\x90\x8d\xe5\x8d\x95')),
('hash', models.OneToOneField(to='search.Hash')),
],
),
]
16 changes: 16 additions & 0 deletions search/models.py
Expand Up @@ -36,6 +36,11 @@ def list_with_files(self, ids):
for y in items:
if x['info_hash'] == y['info_hash']:
x['files'] = json.loads(y['file_list'])
items = Extra.objects.filter(hash_id__in=ids).values()
for x in res:
for y in items:
if x['id'] == y['hash_id']:
x['extra'] = y
return res

class Hash(models.Model):
Expand All @@ -59,6 +64,17 @@ class Hash(models.Model):
def __unicode__(self):
return self.name

def is_blacklisted(self):
try:
return self.extra.blacklist
except:
return False


class Extra(models.Model):
hash = models.OneToOneField(Hash)
blacklist = models.BooleanField('黑名单', default=False)


class FileList(models.Model):
info_hash = models.CharField(max_length=40, primary_key=True)
Expand Down
9 changes: 9 additions & 0 deletions search/timermiddleware.py
@@ -1,3 +1,6 @@
# coding: utf-8
import traceback
from django.conf import settings
from time import time

class TimerMiddleware:
Expand All @@ -17,3 +20,9 @@ def process_response(self, request, response):
response['X-Request-Time'] = '%fsms' % total
return response


class ProcessExceptionMiddleware(object):
def process_response(self, request, response):
if response.status_code != 200 and settings.DEBUG:
traceback.print_exc()
return response
8 changes: 4 additions & 4 deletions search/urls.py
Expand Up @@ -4,10 +4,10 @@


urlpatterns = [
url(r'^json_search', json_search),
url(r'^json_info', json_info),
url(r'^json_status', json_status),
url(r'^json_helper', json_helper),
url(r'^json_search$', json_search),
url(r'^json_info$', json_info),
url(r'^json_status$', json_status),
url(r'^json_helper$', json_helper),
]


5 changes: 5 additions & 0 deletions ssbc/deployment.py
@@ -0,0 +1,5 @@
from .settings import *

DEBUG=False


6 changes: 4 additions & 2 deletions ssbc/settings.py
Expand Up @@ -23,7 +23,7 @@
SECRET_KEY = 'fvewrf=&i9mjawldfkbxt%(oqi%3g1s=18o+n*5b-t4-k&-o=e'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True

ALLOWED_HOSTS = ['*',]

Expand All @@ -39,6 +39,7 @@
'django.contrib.staticfiles',
'search',
'web',
'top',
)

MIDDLEWARE_CLASSES = (
Expand All @@ -51,6 +52,7 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'search.timermiddleware.TimerMiddleware',
'search.timermiddleware.ProcessExceptionMiddleware',
)

ROOT_URLCONF = 'ssbc.urls'
Expand Down Expand Up @@ -94,7 +96,7 @@
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/

LANGUAGE_CODE = 'zh-hans'
LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

Expand Down
3 changes: 2 additions & 1 deletion ssbc/urls.py
Expand Up @@ -19,7 +19,7 @@
import web.views

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^top/', include('top.urls')),
url(r'^api/', include('search.urls')),
url(r'^$', web.views.index, name='index'),
url(r'^info/(\d{1,10})$', web.views.hash, name='hash'),
Expand All @@ -29,4 +29,5 @@
url(r'^search/(.*?)$', web.views.search),
url(r'^list/(.+?)/(\d*)$', web.views.search_old),
url(r'^howto/$', web.views.howto, name='howto'),
url(r'^admin/', include(admin.site.urls)),
]
3 changes: 3 additions & 0 deletions start.sh
@@ -0,0 +1,3 @@
#!/bin/sh
/home/job/ssbc/env/bin/gunicorn -k gevent -b :8002 ssbc.wsgi -k gevent --env DJANGO_SETTINGS_MODULE=ssbc.deployment --pid /tmp/ssbc.pid -w 6

2 changes: 1 addition & 1 deletion web/static/css/ssbc.css
Expand Up @@ -5,7 +5,7 @@
}

.div-search-box{margin-top: 50px; }
.div-search-box .logo img{height: 120px;margin-left: -50px; margin-bottom:20px;}
.div-search-box .logo img{width:100%; margin-bottom:20px;}
.div-search-box .logo{text-align: center;}
.copyright{text-align: center;color: gray;padding-top: 10px;}
.good{text-align: center; padding-top: 30px; font-size: 0.9em; color: gray; }
Expand Down
3 changes: 1 addition & 2 deletions web/templates/base.html
@@ -1,13 +1,12 @@
{% load staticfiles %}
<!DOCTYPE html>
<html lang="zh-CN">
<html lang="en-US">
<head>
<meta charset="utf-8">
{% block metas %}
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% endblock %}
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>{% block title%}Bootstrap 101 Template{%endblock%}</title>

{% block styles %}
Expand Down
12 changes: 5 additions & 7 deletions web/templates/foot.html
Expand Up @@ -2,13 +2,11 @@
<nav class="navbar navbar-default nav-foot" role="navigation">
<div class="container">
<div class="">
<h5>关于本站</h5>
<p>磁力巴巴(原手撕包菜)是一个基于DHT协议的BT资源搜索引擎,所有资源来源于爬虫24小时从DHT网络自动抓取,所有排行数据由程序自动生成。我们不存储任何资源和种子文件,只索引种子meta信息并提供搜索服务。

<a href="/howto/">在线播放</a>
<a rel="nofollow" href="http://jingyan.baidu.com/article/642c9d34c2bca2644a46f72b.html">下载种子</a>
<h5>关于磁力链接</h5>
<p>磁力链接(Magnet URI Scheme)是一种新型的分享形式,每个链接对应一个BT种子文件。您可以通过软件下载磁力链接指向的资源,例如迅雷、BitComet、QQ旋风,也可以使用云点播服务在线观看影视资源,例如迅雷云播、百度云盘等。
<h5>About CiLiBaBa</h5>
<p>CiLiBaBa(原手撕包菜) is a Torrent Search Engine based on DHT protocol. All resources are automatically indexed from the DHT network. Instead of torrent files, we store meta information only for indexing.
<h5>About Magnet Links</h5>
<p>Magnet URI Scheme is a de facto standard defining a uniform resource identifier (URI) scheme for Magnet links, which mainly refer to resources available for download via peer-to-peer networks. --Wikipedia
</p>
</div>
<div class="navbar-header">
<div class="copyright">
Expand Down
24 changes: 4 additions & 20 deletions web/templates/index.html
@@ -1,10 +1,10 @@
{% extends 'layout.html' %}
{% load staticfiles %}
{% block title %}磁力搜索_磁力链接_种子搜索_番号搜索-磁力巴巴{% endblock %}
{% block title %}CiLiBaBa - 磁力搜索_磁力链接_种子搜索_番号搜索_MagnetSearch{% endblock %}
{% block metas %}
{{block.super}}
<meta name="keywords" content="磁力巴巴,cilibaba,磁力助手,手撕包菜,磁力搜索,磁力链接,种子搜索网站,BT搜索,DHT搜索,番号搜索">
<meta name="description" content="磁力巴巴是一个专业提供磁力连接搜索的网站,索引全网上千万磁力链接,可以使用迅雷、百度云等下载磁力链接的内容">
<meta name="description" content="CiLiBaBa,专业提供磁力连接搜索的网站,全网最新,千万磁力链接,可以使用迅雷、百度云等下载和浏览磁力链接的内容">
{% endblock %}

{% block content %}
Expand All @@ -16,9 +16,9 @@
</div>
<div>
<div class="input-group">
<input placeholder="搜索电影、电视剧、明星、游戏..." autocomplete="off" type="text" class="form-control x-kw" name="s">
<input placeholder="Movies, actors, or what do you want?" autocomplete="off" type="text" class="form-control x-kw" name="s">
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span> 磁力搜索</button>
<button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span> Search</button>
</span>
</div>
</div>
Expand All @@ -28,9 +28,6 @@
<a href="/search/{{r.keyword|urlencode}}/">{{r.keyword}}</a> &nbsp;&nbsp;&nbsp;&nbsp;
{% endfor %}
</p>
<p class="tips2">
<p><a href="/howto/">如何免费在线播放磁力链接?</a>
</p>
</div>
<div class="div-ads-front" style="margin-top: 40px; text-align:center; margin-left: 0px;">
</div>
Expand All @@ -46,22 +43,9 @@
$(function(){
$('.x-kw').focus();
});

$('.x-m-ok').click(function(){
ga('send', 'event', 'ads', 'click', 'ok', {'hitCallback': function(){
window.location = '/yunhelper/';
}});
return false;
});
$('.x-m-cancel').click(function(){
ga('send', 'event', 'ads', 'click', 'cancel');
return true;
});
setTimeout(function(){
$('.good').fadeIn('slow');
}, 500);


</script>
{% endblock %}

46 changes: 29 additions & 17 deletions web/templates/info.html
@@ -1,10 +1,10 @@
{% extends 'layout.html' %}

{% block title %}{{info.name}} 的磁力链接 - 磁力巴巴{% endblock %}
{% block title %}{{info.name}} Magnet Downloads - CiLiBaBa{% endblock %}
{% block metas %}
{{block.super}}
<meta name="keywords" content="{{keywords|join:','}},磁力链接,BT下载,迅雷下载,在线播放" />
<meta name="description" content="{{info.name}}的磁力连接" />
<meta name="keywords" content="{{keywords|join:','}},磁力链接,CiLiBaBa,Magnet Downloads" />
<meta name="description" content="{{info.name}} magnet links and torrent files." />
{% endblock %}

{% block content %}
Expand All @@ -17,45 +17,51 @@ <h4>{{info.name}}</h4>

<table>
<tr>
<th class="col-lg-2">创建时间</th>
<th class="col-lg-2">Creation Time</th>
<td>{{info.create_time}}</td>
</tr>
<tr>
<th class="col-lg-2">更新时间</th>
<th class="col-lg-2">Last Access Time</th>
<td>{{info.last_seen}}</td>
</tr>
<tr>
<th class="col-lg-2">文件大小</th>
<th class="col-lg-2">File Size</th>
<td>{{info.length | filesizeformat}}</td>
</tr>
<tr>
<th class="col-lg-2">关键词</th>
<th class="col-lg-2">Keywords</th>
<td>
{% for kw in keywords %}
<a alt="{{kw}} 磁力搜索" href="/search/{{kw|urlencode}}/">{{kw}}</a>
{% endfor %}
</td>
</tr>
<tr>
<th class="col-lg-2">请求数</th>
<th class="col-lg-2">Total Requests</th>
<td>{{info.requests}}</td>
</tr>
<tr>
<th class="col-lg-2">文件数</th>
<th class="col-lg-2">Total Files</th>
<td>{{info.files|length}}</td>
</tr>
<tr>
<th class="col-lg-2">磁力链接</th>
<th class="col-lg-2">Magnet Link</th>
<td>
<a target="_blank" rel="nofollow" href="{{magnet_url}}">{{info.info_hash}}</a>
{% if info.extra.blacklist %}
<p style="color:red;">
Sorry! The related magnet link for this resource is deleted.
</p>
{% else %}
<a target="_blank" rel="nofollow" href="{{magnet_url}}">magnet:?xt=urn:btih:{{info.info_hash}}</a>
&nbsp; &nbsp;
<a target="_blank" ref="nofollow" href="{{magnet_url}}"><span class="glyphicon glyphicon-download-alt"></span> 磁力链接</a>
<a target="_blank" ref="nofollow" href="{{magnet_url}}"><span class="glyphicon glyphicon-download-alt"></span> Download (磁力链接)</a>
&nbsp; &nbsp;
<a class="title x-play" rel="nofollow"
href="http://pan.baidu.com/disk/home?ssbc_magnet={{info.info_hash}}"
data-url="http://pan.baidu.com/disk/home?ssbc_magnet={{info.info_hash}}"
target="_blank">
<span class="glyphicon glyphicon-play"></span> 在线观看</a>
<span class="glyphicon glyphicon-play"></span> Play (在线观看)</a>
{% endif %}
</td>
</tr>
</table>
Expand All @@ -64,7 +70,7 @@ <h4>{{info.name}}</h4>
<a alt="download 2345" href="http://download.2345.cn/silence/2345Explorer_333561_silence.exe"><img src="/static/gaoqing.png"></a>
-->

<h4>文件列表</h4>
<h4>File List</h4>
<div class="files">
<ul>
{% if info.files %}
Expand All @@ -77,10 +83,15 @@ <h4>文件列表</h4>
</ul>
</div>

<h4>下载资源</h4>
<h4>Download Torrent</h4>
<div>
If you want to get the torrent file or original data of {{info.name}}, please use uTorrent, BitTorrent or Thunder.<br/>
<a rel="nofollow" href="{{download_url}}" alt="Get {{info.name}}" target="_blank">Click here to locate the torrent file of {{info.name}}</a>
</div>

<h4>Copyright Infringement</h4>
<div>
如果您想下载{{info.name}}的BT种子文件或数据,请使用迅雷、QQ旋风、uTorrent等BT工具下载。<br/>
<a rel="nofollow" href="{{download_url}}" alt="下载{{info.name}}" target="_blank">点击这里下载 《{{info.name}}》</a>
If the content above is not authorized, please contact us via contact[AT]cilibaba.com.
</div>

</div>
Expand All @@ -90,5 +101,6 @@ <h4>下载资源</h4>
{% block scripts %}
{{block.super}}
<script>
$.get("{% url 'top_log'%}?type=hash&hash={{info.id}}");
</script>
{% endblock %}

0 comments on commit 3ba2d44

Please sign in to comment.