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'
|
||||
|
||||
# Use unicorn as the app server
|
||||
# gem 'unicorn'
|
||||
gem 'unicorn'
|
||||
|
||||
# Deploy with Capistran
|
||||
# gem 'capistrano'
|
||||
|
||||
@@ -112,18 +112,18 @@ class Crawlobject < ActiveRecord::Base
|
||||
def json
|
||||
JSON.parse(self.raw)
|
||||
end
|
||||
def self.crawl_news
|
||||
def self.crawl_news(id)
|
||||
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|
|
||||
cc=Crawlobject.new(:raw=>r.to_json)
|
||||
cc.objtype=5
|
||||
cc.objtype=id
|
||||
cc.parse_object
|
||||
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
|
||||
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.parse_object
|
||||
cc.calc_hash
|
||||
|
||||
@@ -262,7 +262,7 @@ class Lva < ActiveRecord::Base
|
||||
def read_et_forum
|
||||
lva=self
|
||||
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|
|
||||
if Crawlobject.where(:objhash=>Digest::SHA512.hexdigest(a.to_json), :objtype=>1).count ==0
|
||||
aa = Crawlobject.new(:raw=>a.to_json)
|
||||
|
||||
@@ -111,6 +111,9 @@
|
||||
<%= render 'beispiele/form_bulk' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<% @crawlobjects.each do |co| %>
|
||||
@@ -119,7 +122,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<%= render 'beispiele' %>
|
||||
|
||||
</div>
|
||||
<% cache("neuigkeiten_startpage_"+ cache_array_key(@neuigkeiten)) do %>
|
||||
|
||||
<div class="span5">
|
||||
<ul class="unstyled linklist">
|
||||
<% @neuigkeiten.each do |n| %>
|
||||
@@ -52,7 +52,7 @@
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="span3">
|
||||
<% cache("calendar_" + cache_array_key(@calentries)+params[:month].to_s+params[:year].to_s) do %>
|
||||
<%= render 'calendars/calentries', :object=>@calentries %>
|
||||
|
||||
@@ -4,3 +4,6 @@ end
|
||||
every 1.day, :at =>'4:00 am' do
|
||||
rake "-s neuigkeit_cache:update"
|
||||
end
|
||||
every 1.day, :at =>'3:00 am' do
|
||||
rake "-s crawler:run"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user