Merge branch 'master' of github.com:fetsite/fetsite
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -33,7 +33,7 @@ gem 'jquery-rails'
|
|||||||
# gem 'jbuilder'
|
# gem 'jbuilder'
|
||||||
|
|
||||||
# Use unicorn as the app server
|
# Use unicorn as the app server
|
||||||
# gem 'unicorn'
|
gem 'unicorn'
|
||||||
|
|
||||||
# Deploy with Capistran
|
# Deploy with Capistran
|
||||||
# gem 'capistrano'
|
# gem 'capistrano'
|
||||||
|
|||||||
@@ -112,18 +112,18 @@ class Crawlobject < ActiveRecord::Base
|
|||||||
def json
|
def json
|
||||||
JSON.parse(self.raw)
|
JSON.parse(self.raw)
|
||||||
end
|
end
|
||||||
def self.crawl_news
|
def self.crawl_news(id)
|
||||||
cfg = Rails.application.config
|
cfg = Rails.application.config
|
||||||
res = JSON.parse(`python #{Rails.root}/bin/#{cfg.crawlconfig[5]['bin']} #{cfg.crawlconfig[5]['url']}`)
|
res = JSON.parse(`python #{Rails.root}/bin/#{cfg.crawlconfig[id]['bin']} #{cfg.crawlconfig[id]['url']}`)
|
||||||
res.each do |r|
|
res.each do |r|
|
||||||
cc=Crawlobject.new(:raw=>r.to_json)
|
cc=Crawlobject.new(:raw=>r.to_json)
|
||||||
cc.objtype=5
|
cc.objtype=id
|
||||||
cc.parse_object
|
cc.parse_object
|
||||||
cc.calc_hash
|
cc.calc_hash
|
||||||
if Crawlobject.where(:objhash2=>cc.objhash2, :objtype=>5).count==0
|
if Crawlobject.where(:objhash2=>cc.objhash2, :objtype=>id).count==0
|
||||||
cc.save
|
cc.save
|
||||||
else
|
else
|
||||||
cc = Crawlobject.where(:objhash2=>cc.objhash2, :objtype=>5).first
|
cc = Crawlobject.where(:objhash2=>cc.objhash2, :objtype=>id).first
|
||||||
cc.raw=r.to_json
|
cc.raw=r.to_json
|
||||||
cc.parse_object
|
cc.parse_object
|
||||||
cc.calc_hash
|
cc.calc_hash
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ class Lva < ActiveRecord::Base
|
|||||||
def read_et_forum
|
def read_et_forum
|
||||||
lva=self
|
lva=self
|
||||||
url=lva.forumlink
|
url=lva.forumlink
|
||||||
ans = JSON.parse(`python ../microdata/downloadlogin.py #{url}`)
|
ans = JSON.parse(`python #{Rails.root}/bin/downloadlogin.py #{url}`)
|
||||||
ans.each do |a|
|
ans.each do |a|
|
||||||
if Crawlobject.where(:objhash=>Digest::SHA512.hexdigest(a.to_json), :objtype=>1).count ==0
|
if Crawlobject.where(:objhash=>Digest::SHA512.hexdigest(a.to_json), :objtype=>1).count ==0
|
||||||
aa = Crawlobject.new(:raw=>a.to_json)
|
aa = Crawlobject.new(:raw=>a.to_json)
|
||||||
|
|||||||
@@ -111,6 +111,9 @@
|
|||||||
<%= render 'beispiele/form_bulk' %>
|
<%= render 'beispiele/form_bulk' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<% @crawlobjects.each do |co| %>
|
<% @crawlobjects.each do |co| %>
|
||||||
@@ -119,7 +122,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<%= render 'beispiele' %>
|
<%= render 'beispiele' %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<% cache("neuigkeiten_startpage_"+ cache_array_key(@neuigkeiten)) do %>
|
|
||||||
<div class="span5">
|
<div class="span5">
|
||||||
<ul class="unstyled linklist">
|
<ul class="unstyled linklist">
|
||||||
<% @neuigkeiten.each do |n| %>
|
<% @neuigkeiten.each do |n| %>
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
|
||||||
<div class="span3">
|
<div class="span3">
|
||||||
<% cache("calendar_" + cache_array_key(@calentries)+params[:month].to_s+params[:year].to_s) do %>
|
<% cache("calendar_" + cache_array_key(@calentries)+params[:month].to_s+params[:year].to_s) do %>
|
||||||
<%= render 'calendars/calentries', :object=>@calentries %>
|
<%= render 'calendars/calentries', :object=>@calentries %>
|
||||||
|
|||||||
@@ -4,3 +4,6 @@ end
|
|||||||
every 1.day, :at =>'4:00 am' do
|
every 1.day, :at =>'4:00 am' do
|
||||||
rake "-s neuigkeit_cache:update"
|
rake "-s neuigkeit_cache:update"
|
||||||
end
|
end
|
||||||
|
every 1.day, :at =>'3:00 am' do
|
||||||
|
rake "-s crawler:run"
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user