Example #1
0
#!/usr/bin/python
# vim: set fileencoding=UTF-8

# Facekeeper v1.0
# (C) 2010 bu <*****@*****.**>, Zero <*****@*****.**>

# 引入需要的 Library
import gearman.worker, FK_Common, FK_FB

# set up a grabber object
encoder = FK_FB.Encoder()

worker = gearman.worker.GearmanWorker(["127.0.0.1"])
worker.register_task("FB_encodePage", encoder.encode)
worker.work()
Example #2
0
#!/usr/bin/python
# vim: set fileencoding=UTF-8

# Facekeeper v1.0
# (C) 2010 bu <*****@*****.**>, Zero <*****@*****.**>

import FK_Common,gearman.worker, db_conn, FK_SE
	
db = db_conn.MySQL()
Parser = FK_SE.Parser(db)

worker = gearman.worker.GearmanWorker(["127.0.0.1"])
worker.register_task("parseSEPage", Parser.parse)
worker.work()
Example #3
0
#!/usr/bin/python
# vim: set fileencoding=UTF-8

# Facekeeper v1.0
# (C) 2010 bu <*****@*****.**>, Zero <*****@*****.**>

# 引入需要的 Library
import gearman.worker, FK_Common, FK_FB

# set up a grabber object
grabber = FK_FB.URLGenerater(FK_FB.Group())

worker = gearman.worker.GearmanWorker(["127.0.0.1"])
worker.register_task("FB_fetchGroup", grabber.grab)
worker.work()
Example #4
0
#!/usr/bin/python
# vim: set fileencoding=UTF-8

# Facekeeper v1.0
# (C) 2010 bu <*****@*****.**>, Zero <*****@*****.**>

# 引入需要的 Library
import gearman.worker,os, datetime, yaml

def backup(job):
    config_text = open("/var/www/Facekeeper/config/database.yml")

    ENV = "production"

    config  = yaml.load(config_text)
  
    command = "mysqldump -u" + config[ENV]["user"]+" -p"+config[ENV]["password"]+" "+config[ENV]["name"] +" | bzip2 -9f > /var/www/Facekeeper/backup/" + datetime.datetime.today().strftime("%Y%m%d%H%M%S") + ".bz2"
    os.system(command)

def delete_backup(job):
    job_content = eval(job.arg)

    command = "rm -f /var/www/Facekeeper/backup/" + job_content["file"]
    os.system(command)
    

worker = gearman.worker.GearmanWorker(["127.0.0.1"])
worker.register_task("system_backup", backup)
worker.register_task("delete_backup", delete_backup)
worker.work()
Example #5
0
#!/usr/bin/python
# vim: set fileencoding=UTF-8

# Facekeeper v1.0
# (C) 2010 bu <*****@*****.**>, Zero <*****@*****.**>

# 引入需要的 Library
import gearman.worker, FK_Common, FK_FB

# set up a grabber object
grabber = FK_FB.URLGenerater(FK_FB.Fans())

worker = gearman.worker.GearmanWorker(["127.0.0.1"])
worker.register_task("FB_fetchFans", grabber.grab)
worker.work()
Example #6
0
#!/usr/bin/python
# vim: set fileencoding=UTF-8

# Facekeeper v1.0
# (C) 2010 bu <*****@*****.**>, Zero <*****@*****.**>

# 引入需要的 Library
import gearman.worker, FK_Common, FK_FB

# set up a grabber object
grabber = FK_FB.Parser()

worker = gearman.worker.GearmanWorker(["127.0.0.1"])
worker.register_task("FB_parsePage", grabber.parse)
worker.work()
Example #7
0
#!/usr/bin/python
# vim: set fileencoding=UTF-8

# Facekeeper v1.0
# (C) 2010 bu <*****@*****.**>, Zero <*****@*****.**>

import gearman.worker, db_conn, FK_Common, FK_Page

db = db_conn.MySQL()
Parser = FK_Page.Parser(db)

worker = gearman.worker.GearmanWorker(["127.0.0.1"])
worker.register_task("matchKeyword", Parser.parse)
worker.work()
Example #8
0
#!/usr/bin/python
# vim: set fileencoding=UTF-8

# Facekeeper v1.0
# (C) 2010 bu <*****@*****.**>, Zero <*****@*****.**>

import gearman.worker, FK_Common ,FK_Page

# set up a grabber object
grabber = FK_Page.Grabber()

worker = gearman.worker.GearmanWorker(["127.0.0.1"])
worker.register_task("grabPage", grabber.grab)
worker.work()
Example #9
0
#!/usr/bin/python
# vim: set fileencoding=UTF-8

# Facekeeper v1.0
# (C) 2010 bu <*****@*****.**>, Zero <*****@*****.**>

import gearman.worker, FK_Common ,FK_Tube

# set up a grabber object
grabber = FK_Tube.VidGrabber()

worker = gearman.worker.GearmanWorker(["127.0.0.1"])
worker.register_task("grabVidInfo", grabber.grab)
worker.work()