Exemple #1
0
def main(project_settings):
    '''
    jd下载公共程序的入口程序,各个渠道在各自的脚本(如jd_chinahr_run.py、jd_liepin_run.py等)中加载完参数后,调用此方法开启各自的程序
    '''
    signal.signal(signal.SIGTERM, recive_stop_signal)
    
    # 初始化utils模块,设置各个渠道单独的参数和公共参数
    for i in project_settings:
        common_settings.__setattr__(i, project_settings[i])

    utils.set_setting(project_settings)
    logger = utils.get_logger()
    logger.info('=====================================================\nmain program start!!!')

    # 开启多线程,从调度获取任务、处理任务、返回任务
    process_thread_list = []
    for i in xrange(common_settings.DOWNLOAD_THREAD_NUMBER):
        new_thread = threading.Thread(target=process_thread, name='Thread-' + str(i))
        new_thread.start()
        process_thread_list.append(new_thread)

    # 等待任务结束
    for i in process_thread_list:
        i.join()

    logger.info('all thread has done, quit!!!')
Exemple #2
0
def setUrl():
    user = utils.set_setting(addon_id, 'userurl',
                             'http://ivuetvguide.com/ivueguide/')
    url = utils.set_setting(addon_id, 'mainurl',
                            'http://ivuetvguide.com/ivueguide/')
    logos = utils.set_setting(addon_id, 'logos',
                              'http://ivuetvguide.com/ivueguide/logos/')
Exemple #3
0
def main():
    '''
    :return:
    '''
    utils.set_setting([])
    # 实例化类
    jian = JianLi()
    # 调用相对应的函数
    jian.login()
    link = jian.search("大客户销售")
Exemple #4
0
 def pin_check(self, pin):
     r = self._http("/oauth/pin/" + pin + "?client_id=" + APIKEY,
                    headers=self.headers)
     log("PIN Check = " + str(r))
     if r["result"] == "OK":
         set_setting('token', r["access_token"])
         self.headers["authorization"] = "Bearer " + r["access_token"]
         return self.get_user_settings()
     elif r["result"] == "KO":
         return False
Exemple #5
0
 def _http(self, url, headers={}, body=None, is_json=True):
     try:
         con = httplib.HTTPSConnection("api.simkl.com")
         con.request("GET", url, headers=headers, body=body)
         r = con.getresponse().read().decode("utf-8")
         if r.find('user_token_failed') != -1:
             self.isLoggedIn = False
             set_setting('token', '')
             notify(get_str(32031))
             return False
         return json.loads(r) if is_json else r
     except Exception:
         return None
Exemple #6
0
def checkSettings():
    username = utils.get_setting(addon_id, 'username')
    password = utils.get_setting(addon_id, 'password')
    userid = utils.get_setting(addon_id, 'userid')
    if not username:
        retval = dlg.input('Enter Ivue Guide Username',
                           type=xbmcgui.INPUT_ALPHANUM)
        if retval and len(retval) > 0:
            utils.set_setting(addon_id, 'username', str(retval))
            username = utils.get_setting(addon_id, 'username')

    if not password:
        retval = dlg.input('Enter Ivue Guide Password',
                           type=xbmcgui.INPUT_ALPHANUM,
                           option=xbmcgui.ALPHANUM_HIDE_INPUT)
        if retval and len(retval) > 0:
            utils.set_setting(addon_id, 'password', str(retval))
            password = utils.get_setting(addon_id, 'password')

    if not userid:
        retval = dlg.input('Enter Ivue Guide UserID',
                           type=xbmcgui.INPUT_ALPHANUM,
                           option=xbmcgui.ALPHANUM_HIDE_INPUT)
        if retval and len(retval) > 0:
            utils.set_setting(addon_id, 'userid', str(retval))
            userid = utils.get_setting(addon_id, 'userid')
Exemple #7
0
    def get_caps(self):
        caps_resp = self._session.get("all/results/torznab",
                                      params={
                                          "t": "caps",
                                          "apikey": self._api_key
                                      })

        if caps_resp.status_code != httplib.OK:
            notify(translation(32700).format(caps_resp.reason),
                   image=get_icon_path())
            log.error("Jackett return %s", caps_resp.reason)
            set_setting('settings_validated', caps_resp.reason)
            return

        err = self.get_error(caps_resp.content)
        if err is not None:
            notify(translation(32700).format(err["description"]),
                   image=get_icon_path())
            log.error("got code %s: %s", err["code"], err["description"])
            set_setting('settings_validated', err["description"])
            return

        set_setting('settings_validated', 'Success')

        xml = ET.ElementTree(ET.fromstring(caps_resp.content)).getroot()

        # todo handle gracefully, doesn't exist for individual trackers
        # self._caps["limits"] = xml.find("limits").attrib

        self._caps["search_tags"] = {}
        for type_tag in xml.findall('searching/*'):
            self._caps["search_tags"][type_tag.tag] = {
                "enabled":
                type_tag.attrib["available"] == "yes",
                "params": [
                    p for p in type_tag.attrib['supportedParams'].split(",")
                    if p
                ],
            }

        log.info("Found capabilities: %s", repr(self._caps))
def checkSettings():
        username = utils.get_setting(addon_id,'username')
        password = utils.get_setting(addon_id,'password')
        userid = utils.get_setting(addon_id,'userid')
        if not username:
                retval = dlg.input('Enter Ivue Guide Username', type=xbmcgui.INPUT_ALPHANUM)
                if retval and len(retval) > 0:
                        utils.set_setting(addon_id, 'username', str(retval))
                        username = utils.get_setting(addon_id, 'username')
        
        if not password:
                retval = dlg.input('Enter Ivue Guide Password', type=xbmcgui.INPUT_ALPHANUM, option=xbmcgui.ALPHANUM_HIDE_INPUT)
                if retval and len(retval) > 0:
                        utils.set_setting(addon_id, 'password', str(retval))
                        password = utils.get_setting(addon_id, 'password')
		
        if not userid:
                retval = dlg.input('Enter Ivue Guide UserID', type=xbmcgui.INPUT_ALPHANUM, option=xbmcgui.ALPHANUM_HIDE_INPUT)
                if retval and len(retval) > 0:
                        utils.set_setting(addon_id, 'userid', str(retval))
                        userid = utils.get_setting(addon_id, 'userid')
Exemple #9
0
def setSettings(username, password, userid):
    username = utils.set_setting(addon_id, 'username', username)
    password = utils.set_setting(addon_id, 'password', password)
    userid = utils.set_setting(addon_id, 'userid', userid)
Exemple #10
0
import datetime
import json
import requests
import lxml.html as xmlh
import re
from five_eight_module import SearchCondition

reload(sys)
sys.setdefaultencoding("utf-8")
sys.path.append("../common")
sys.path.append("..")
current_file_path = os.path.abspath(__file__)
current_dir_file_path = os.path.dirname(__file__)
import utils

utils.set_setting({"PROJECT_NAME": 'jd_58_create_task', })

logger = utils.get_logger()

sql = '''
select cityName,url,secondFunction,thirdFunction,thirdFunctionURL
from spider.jd_task_entrence
where source = 'FIVE_EIGHT'
and valid = 1
'''


def get_entrence():
    result = []
    entrence = utils.query_by_sql(sql)
    if entrence:
Exemple #11
0
    # use_keyword = '0' if datetime.datetime.now().hour < 12 else '1'
    
    if cities:
        city_dict = {i[1]: i for i in cities}
        for i in city_order:
            if i in city_dict:
                city_result.append(city_dict[i])
                city_dict.pop(i)
        city_result = city_result + city_dict.values()

    for city in city_result:
        for function in functions:
            add_task_data = {
                "callSystemID": 'morgan-rencaia-resume-1', 
                "source": 'REN_CAI', 
                "traceID": str(uuid.uuid1()), 
                # "executeParam": json.loads(i.strip()), 
                # "executeParam": json.dumps({'residence_ids': city[6], 'residence_name': city[1], 
                "executeParam": json.dumps({ 'function_ids3': function[8], 'function_id_name': function[7], 'residence_ids': city[6], 'residence_name': city[1], 
                'use_keyword': use_keyword}, ensure_ascii=False), 
                "taskType": "RESUME_FETCH",
                "deadline": deadline,
            }
            add_task_result = utils.download(url=add_task_url, is_json=True, headers=headers, method='post', data=add_task_data)
            
    logger.info('done.')

if __name__ == '__main__':
    utils.set_setting({"PROJECT_NAME": 'resume_rencaia_create_task',})
    create_task_from_mysql()
    def ended(self):
        log("Movie: Playback ended")
        # pre confirm
        steps = 0
        move = False
        delete = False
        preserve_playcount = False
        set_tag = False
        rate_lib = False
        rate_tag = False
        if setting("confirm") == "true":
            log("Movie: Show confirm dialog")
            monitor.waitForAbort(int(setting("wait_dialog")))
        if setting("fm_movies_manage") == "1":  # move
            if dialog.proceed(self.title, lang(30132)):
                move = True
                steps += self.MOVE_STEPS
        elif setting("fm_movies_manage") == "2":  # delete
            if dialog.proceed(self.title, lang(30133)):
                delete = True
                steps += self.DELETE_STEPS
        if setting("pt_movies_playcount") == "true":
            preserve_playcount = True
            steps += self.PRESERVE_PLAYCOUNT_STEPS
        if setting("pt_movies_tag") == "true":
            set_tag = True
            steps += self.SET_TAG_STEPS
        if setting("rt_movies_lib") == "true":
            rate_lib = True
            steps += self.RATE_LIB_STEPS
        if setting("rt_movies_tag") == "true":
            rate_tag = True
            steps += self.RATE_TAG_STEPS

            # pre settings
        if move:
            destination = setting("fm_movies_destination")
            if self.alt_method or destination.lower().startswith("smb://") or destination.lower().startswith("nfs://"):
                self.destination = xbmc.validatePath(destination)
                self.alt_method = True
            else:
                self.destination = os.path.abspath(destination)
            while not self.destination or self.destination == ".":
                destination = xbmcgui.Dialog().browse(3, lang(30525) % info("name"), "files")
                if (
                    self.alt_method
                    or destination.lower().startswith("smb://")
                    or destination.lower().startswith("nfs://")
                ):
                    self.destination = xbmc.validatePath(destination)
                    self.alt_method = True
                else:
                    self.destination = os.path.abspath(destination)
            log("fm_movies_destination |alt_method=%s|: %s" % (self.alt_method, self.destination))
            set_setting("fm_movies_destination", self.destination)

            # pre process
        progress = Progress(steps)
        if not setting("remove_video") == "true":
            if rate_tag:
                tag = setting("rt_movies_tag_text")
                while not tag:
                    tag = xbmcgui.Dialog().input(lang(30206))
                set_setting("rt_movies_tag_text", tag)
                # pre context
            if set_tag:
                tag = xbmcgui.Dialog().input(lang(30599) % self.title)
                while not tag:
                    tag = xbmcgui.Dialog().input(lang(30599) % self.title)
                self.tag = tag
            if rate_lib or rate_tag:
                rating = dialog.rating(self.title)
                while not rating:
                    rating = dialog.rating(self.title)
                self.rating = rating
            if preserve_playcount:
                self.__preserve_playcount(progress)
            if set_tag:
                self.__set_tag(progress)
            if rate_lib:
                self.__rate_lib(progress)
            if rate_tag:
                self.__rate_tag(progress)
        if move:
            self.__move(progress)
        elif delete:
            self.__delete(progress)

            # post confirm
        quit_menu = False
        logoff = False
        display_off = False
        if setting("ps_movies_quit_menu") == "true":
            if dialog.proceed(self.title, lang(30402)):
                quit_menu = True
        if setting("ps_movies_logoff") == "true":
            if dialog.proceed(self.title, lang(30407)):
                logoff = True
        if setting("ps_movies_display_off") == "true":
            if dialog.proceed(self.title, lang(30404)):
                display_off = True
                # post processing
        if quit_menu:
            self.show_quit_menu()
        if logoff:
            self.logoff_user()
        if display_off:
            self.turn_display_off()
Exemple #13
0
def setUrl():
	user = utils.set_setting(addon_id, 'userurl', 'http://ivuetvguide.com/ivueguide/') 
	url = utils.set_setting(addon_id, 'mainurl', 'http://ivuetvguide.com/ivueguide/')
	logos = utils.set_setting(addon_id, 'logos', 'http://ivuetvguide.com/ivueguide/logos/')	
Exemple #14
0
        u'石家庄': '7',
        u'邢台': '11',
        u'衡水': '17',
        u'保定': '12',
        u'沧州': '15',
        u'扬州': '66',
    }

    for city in [u'石家庄', u'邢台', u'衡水', u'保定', u'沧州']:
        for function in functions:
            add_task_data = {
                "callSystemID": "morgan-zhaopingou-resume-1",
                "source": 'ZHAO_PIN_GOU',
                "traceID": str(uuid.uuid1()),
                # "executeParam": json.loads(i.strip()), 
                "executeParam": json.dumps(
                    {"fenleiName": function[4], "pFenLeiName": function[1], "positionName": function[7],
                     "hopeAdressStr": city_dict[city], "fId": int(function[5]), "pFId": int(function[2]),
                     "pId": int(function[8]), "id": int(function[11])}, ensure_ascii=False),
                "taskType": "RESUME_FETCH",
                "deadline": deadline
            }
            add_task_result = utils.download(url=add_task_url, is_json=True, headers=headers, method='post',
                                             data=add_task_data)


if __name__ == '__main__':
    utils.set_setting({"PROJECT_NAME": 'resume_zhaopingou_create_task', })
    # create_task_for_meituan()
    create_task_from_mysql()
Exemple #15
0
            "resourceType": "JD_SEARCH",
            'protocolType': 'HTTP',
            "source": "ZHI_LIAN",
            "trackId": track_id,
        }
        utils.save_data(sql, sql_val, kafka_data)
        logger.info('保存数据库成功')
        flg = True
    except Exception:
        logger.error('保存数据库异常 %s %s' % (page_url, traceback.format_exc()))
        flg = False
    return flg


if __name__ == '__main__':
    utils.set_setting(project_settings)
    # data = {"cityCode": "639", "pageNum": 1, "cityName": "苏州", "funcName": "无线电工程师", "funcCode": "318",
    #         "cityUrl": "https://sou.zhaopin.com/Jobs/searchresult.ashx?jl=639"}

    # https://sou.zhaopin.com/jobs/searchresult.ashx?bj=4010200&sj=006&jl=%E8%A5%BF%E5%AE%89&sm=0&p=1
    data = {
        'cityCode': '530',
        'cityName': '北京',
        'funcName': '销售代表',
        'funcCode': '006',
        'pageNum': 1,
        'cityUrl': 'https://sou.zhaopin.com/jobs/searchresult.ashx?jl=530',
    }
    #
    data = parse_list(data)
    # print utils.get_proxy()
Exemple #16
0
import traceback
import uuid
import time
import datetime
import json

reload(sys)
sys.setdefaultencoding("utf-8")
sys.path.append("../common")
current_file_path = os.path.abspath(__file__)
current_dir_file_path = os.path.dirname(__file__)
import utils

utils.set_setting({
    "PROJECT_NAME": 'batch',
})

logger = utils.get_logger()

update_sql = '''
UPDATE jd_task_entrence
SET valid = 0
WHERE source = 'FIVE_ONE'
and valid = 1
AND concat(code,'_',thirdFunctionCode)
IN (%s)
'''


def filter(key):
Exemple #17
0
#!coding:utf8

import ConfigParser
import sys

import uuid
import json

sys.path.append('../common')
import utils

utils.set_setting({
    "PROJECT_NAME": 'jd_chinahr_create_task',
})
logger = utils.get_logger()

sql = '''
select cityName, code,thirdFunction
from spider.jd_task_entrence
where source = 'CH_HR'
and valid = 1
'''


def get_entrence():
    result = []
    entrence = utils.query_by_sql(sql)
    if entrence:
        for item in entrence:
            record = (item[0].encode('utf-8'), item[1].encode('utf-8'),
                      item[2].encode('utf-8'))
Exemple #18
0
    token = '5e96775c55f137f76e3d14f1e6d1189f'
    print get_coin_number(cookie, None)
    # print awake_one_task(task)
    # print get_list(cookie, 2, token, task, None)
    # print get_list(cookie, 1, token, task, None)
    # print get_list_with_keyword(cookie, 1, token, task, None)
    # a=  get_resume('http://www.jianlika.com/Resume/view/token/1ff18ddd.html', cookie)
    # a = get_resume_has_real_rid('2567308023', '117659691', cookie)
    # a = charge_resume('a0ee5mmk0e', cookie)
    # f=open('123', 'w')
    # f.write(json.dumps(a, ensure_ascii=False))
    # f.close()


if __name__ == '__main__':
    utils.set_setting([])
    formatter = logging.Formatter(
        fmt=
        "%(asctime)s %(filename)s %(funcName)s [line:%(lineno)d] %(levelname)s %(message)s",
        datefmt="%Y-%m-%d %H:%M:%S")
    stream_handler = logging.StreamHandler()

    rotating_handler = logging.handlers.RotatingFileHandler(
        '%s/%s.log' % ('/data/logs', 'resume_test'), 'a', 50 * 1024 * 1024,
        100, None, 0)

    stream_handler.setFormatter(formatter)
    rotating_handler.setFormatter(formatter)
    logger.addHandler(stream_handler)
    logger.addHandler(rotating_handler)
    logger.setLevel(logging.INFO)
def setUrl():
	user = utils.set_setting(addon_id, 'userurl', 'http://ivuetvguide.com/ivueguide/') 
	url = utils.set_setting(addon_id, 'mainurl', 'http://ivuetvguide.com/ivueguide/')
	logos = utils.set_setting(addon_id, 'logos', 'http://raw.githubusercontent.com/totaltec2014/ivue2/master/logos/')
Exemple #20
0
    def ended(self):
        if setting('ps_movies_quit_menu') == 'false' and setting('ps_movies_logoff') == 'false' and setting('ps_movies_display_off') == 'false' \
           and (not setting('fm_movies_manage') or setting('fm_movies_manage') == '0'): #movies management disabled and no post episode action set
        #if not setting('fm_movies_manage') or setting('fm_movies_manage') == '0': # movies management disabled
            log("Movie.ended: Not managing movies, stop further processing")
            return
        excludelist = setting('fm_movies_excludelist').lower().split(',')
        log("Movie.ended: excludelist=%s" % excludelist)
        if not excludelist == "" and any(self.path.lower().find(v.strip()) >= 1 for v in excludelist):
            log("Movie.ended: Exclude word matched, stop further processing")
            return
        excludefolder = setting('fm_movies_excludefolder').lower()
        if not excludefolder == "":
            #remove username/password of smb source url
            if excludefolder.startswith('smb://'):
                parsed = urlparse(excludefolder)
                parseresult = parsed._replace(netloc="{}".format(parsed.hostname))
                excludefolder = parseresult.geturl()
            if self.path.lower().startswith(excludefolder):
                log("Movie.ended: Movie in excluded folder, stop further processing")
                return
        includefolder = setting('fm_movies_includefolder').lower()
        if not includefolder == "":
            #remove username/password of smb source url
            if includefolder.startswith('smb://'):
                parsed = urlparse(includefolder)
                parseresult = parsed._replace(netloc="{}".format(parsed.hostname))
                includefolder = parseresult.geturl()
            if not self.path.lower().startswith(includefolder):
                log("Movie.ended: Movie not in included folder, stop further processing")
                return
        # pre confirm
        steps = 0
        move = False
        delete = False
        preserve_playcount = False
        set_tag = False
        rate_lib = False
        rate_tag = False
        if setting('confirm') == 'true':
            wait_dialog = setting('wait_dialog')
            log("Movie.ended: confirm dialog %s sec delayed" % wait_dialog)
            monitor.waitForAbort(int(setting('wait_dialog')))
        if setting('fm_movies_manage') == '2' or setting('fm_movies_manage') == '3': # delete
            if dialog.proceed(self.title, lang(30132)):
                delete = True
                steps += self.DELETE_STEPS
        if setting('fm_movies_manage') == '1' or (setting('fm_movies_manage') == '3' and not delete): # move
            if dialog.proceed(self.title, lang(30131)):
                move = True
                steps += self.MOVE_STEPS
        if setting('pt_movies_playcount') == 'true':
                preserve_playcount = True
                steps += self.PRESERVE_PLAYCOUNT_STEPS
        if setting('pt_movies_tag') == 'true':
                set_tag = True
                steps += self.SET_TAG_STEPS
        if setting('rt_movies_lib') == 'true':
                rate_lib = True
                steps += self.RATE_LIB_STEPS
        if setting('rt_movies_tag') == 'true':
                rate_tag = True
                steps += self.RATE_TAG_STEPS

        # pre settings
        if move:
            destination = setting('fm_movies_destination')
            if self.alt_method or destination.lower().startswith('smb://') or destination.lower().startswith('nfs://'):
                self.alt_method = True
            else:
                self.destination = os.path.abspath(destination)
            while not self.destination or self.destination == '.':
                destination = xbmcgui.Dialog.browse(3, lang(30525) % info('name'), 'files')
                if self.alt_method or destination.lower().startswith('smb://') or destination.lower().startswith('nfs://'):
                    self.alt_method = True
                else:
                    self.destination = os.path.abspath(destination)
            log("Movie.ended: self.destination=%s, alt_method=%s" % (self.destination, self.alt_method))
            set_setting('fm_movies_destination', self.destination)

        # pre process
        progress = Progress(steps)
        if not setting('remove_video') == 'true':
            if rate_tag:
                tag = setting('rt_movies_tag_text')
                while not tag:
                    tag = xbmcgui.Dialog.input(lang(30206))
                set_setting('rt_movies_tag_text', tag)
                # pre context
            if set_tag:
                tag = xbmcgui.Dialog.input(lang(30599) % self.title)
                while not tag:
                    tag = xbmcgui.Dialog.input(lang(30599) % self.title)
                self.tag = tag
            if rate_lib or rate_tag:
                rating = dialog.rating(self.title)
                while not rating:
                    rating = dialog.rating(self.title)
                self.rating = rating
            if preserve_playcount:
                self.__preserve_playcount(progress)
            if set_tag:
                self.__set_tag(progress)
            if rate_lib:
                self.__rate_lib(progress)
            if rate_tag:
                self.__rate_tag(progress)
        if move:
            self.__move(progress)
        elif delete:
            self.__delete(progress)

        # post confirm
        quit_menu = False
        logoff = False
        display_off = False
        if setting('ps_movies_quit_menu') == 'true':
            if dialog.proceed(self.title, lang(30402)):
                quit_menu = True
        if setting('ps_movies_logoff') == 'true':
            if dialog.proceed(self.title, lang(30407)):
                logoff = True
        if setting('ps_movies_display_off') == 'true':
            if dialog.proceed(self.title, lang(30404)):
                display_off = True
        # post processing
        if quit_menu:
            self.show_quit_menu()
        if logoff:
            self.logoff_user()
        if display_off:
            self.turn_display_off()
	def ended(self):
		log("Episode: Playback ended")
		# pre confirm
		steps = 0
		move = False
		delete = False
		preserve_playcount = False
		rate_lib = False
		if setting('confirm') == 'true':
			log("Episode: Show confirm dialog")
			wait_dialog = setting('wait_dialog')
			if not (wait_dialog == '' or wait_dialog == '0'):
				monitor.waitForAbort(int(wait_dialog))
		if setting('fm_episodes_manage') == '1': # move
			if dialog.proceed(self.title, lang(30132)):
				move = True
				steps += self.MOVE_STEPS
		elif setting('fm_episodes_manage') == '2': # delete
			if dialog.proceed(self.title, lang(30133)):
				delete = True
				steps += self.DELETE_STEPS
		if not setting('remove_video') == 'true':
			if setting('pt_episodes_playcount') == 'true':
				preserve_playcount = True
				steps += self.PRESERVE_PLAYCOUNT_STEPS
			if setting('rt_episodes_lib') == 'true':
				rate_lib = True
				steps += self.RATE_LIB_STEPS
		# pre settings
		if move:
			destination = setting('fm_episodes_destination')
			if self.alt_method or destination.lower().startswith('smb://') or destination.lower().startswith('nfs://'):
				self.destination = xbmc.validatePath(destination)
				self.alt_method = True
			else:
				self.destination = os.path.abspath(destination)
			while not self.destination or self.destination == '.':
				destination = xbmcgui.Dialog().browse(3, lang(30525) % info('name'), 'files')
				if self.alt_method or destination.lower().startswith('smb://') or destination.lower().startswith('nfs://'):
					self.destination = xbmc.validatePath(destination)
					self.alt_method = True
				else:
					self.destination = os.path.abspath(destination)
			log("set_setting fm_episodes_destination |alt_method=%s|: %s" % (self.alt_method, self.destination))
			set_setting('fm_episodes_destination', self.destination)
		# pre context
		# pre process
		progress = Progress(steps)
		if not setting('remove_video') == 'true':
			if rate_lib:
				rating = dialog.rating(self.title)
				while not rating:
					rating = dialog.rating(self.title)
				self.rating = rating
			if preserve_playcount:
				self.__preserve_playcount(progress)
			if rate_lib:
				self.__rate_lib(progress)
		if move:
			self.__move(progress)
		elif delete:
			self.__delete(progress)

		# post confirm
		quit_menu = False
		logoff = False
		display_off = False
		if setting('ps_episodes_quit_menu') == 'true':
			if dialog.proceed(self.title, lang(30402)):
				quit_menu = True
		if setting('ps_episodes_logoff') == 'true':
			if dialog.proceed(self.title, lang(30407)):
				logoff = True
		if setting('ps_episodes_display_off') == 'true':
			if dialog.proceed(self.title, lang(30404)):
				display_off = True
		# post processing
		if quit_menu:
			self.show_quit_menu()
		if logoff:
			self.logoff_user()
		if display_off:
			self.turn_display_off()
Exemple #22
0
#! /usr/bin/env python
# coding=utf8
import ConfigParser
import json
import sys
import uuid

reload(sys)
sys.setdefaultencoding("utf-8")
sys.path.append("../common")
import utils

utils.set_setting({
    "PROJECT_NAME": 'jd_zhilian_create_task',
})
logger = utils.get_logger()

sql = '''
select cityName,url,code,thirdFunction,thirdFunctionCode,thirdFunctionURL
from spider.jd_task_entrence
where source = 'ZHI_LIAN'
and valid = 1
'''


def get_entrence():
    result = []
    entrence = utils.query_by_sql(sql)
    if entrence:
        for item in entrence:
            record = (item[0], item[1].encode('utf-8'), item[2],
Exemple #23
0
                str(uuid.uuid1()),
                # "executeParam": json.loads(i.strip()),
                "executeParam":
                json.dumps(
                    {
                        'joblist': function[7],
                        'regionid': city[6],
                        'region_name': city[1],
                        'use_keyword': use_keyword
                    },
                    ensure_ascii=False),
                "taskType":
                "RESUME_FETCH",
                "deadline":
                deadline,
            }
            add_task_result = utils.download(url=add_task_url,
                                             is_json=True,
                                             headers=headers,
                                             method='post',
                                             data=add_task_data)

    logger.info('done.')


if __name__ == '__main__':
    utils.set_setting({
        "PROJECT_NAME": 'resume_yunpin_create_task',
    })
    create_task_from_mysql()
Exemple #24
0
def setSettings(username,password,userid):
       username = utils.set_setting(addon_id, 'username', username)
       password = utils.set_setting(addon_id, 'password', password)
       userid = utils.set_setting(addon_id, 'userid', userid)
Exemple #25
0
            requests.get(url)
            continue
        #continue
        logger.info('start to deal with :' + username)
        try:
            cookie_dict = json.loads(cookie.get('cookie', '{}'))
        except Exception, e:
            logger.info('error when json cookie:' + username + ' ' + password)
            continue
        uid_list = uid_re.findall(cookie_dict.get('bps', ''))
        device_id = json.loads(cookie.get('extraContent',
                                          '{}')).get('device_id', '')
        if not uid_list:
            logger.info('not get uid in cookie:' + str(cookie))
            url = 'http://172.16.25.41:8002/acc/invalidCookie.json?userName=%s&password=%s' % (
                username, password)
            requests.get(url)
            #break
            continue
        uid = uid_list[0]
        vote_result = vote(uid, proxy, device_id, cookie_dict)
        if not vote_result:
            logger.info('vote failed:' + str(cookie))
        redis_client.set(
            time.strftime("%Y-%m-%d") + '_' + username + '_chinahr_0', 1000)


if __name__ == '__main__':
    utils.set_setting({'PROJECT_NAME': 'chinahr_create_account_to_redis'})
    main()
Exemple #26
0
def setUrl():
	user = utils.set_setting(addon_id, 'userurl', 'https://raw.githubusercontent.com/programacaotv/programacaotv/master/guide/') 
	url = utils.set_setting(addon_id, 'mainurl', 'https://raw.githubusercontent.com/programacaotv/programacaotv/master/guide/')
	logos = utils.set_setting(addon_id, 'logos', 'https://raw.githubusercontent.com/programacaotv/programacaotv/master/logos/')	
	   
Exemple #27
0
    logger.info('quit')
    mysql_cursor.close()
    mysql_conn.close()


# def test():
#     cookie = {'bps': 'buid=21553717031426', 'blt': '196327490886', 'blts': 'ca466f676ff792f3b8f', 'bst': '194551490886',
#               'bsts': 'a8bf09e630b3df80065', 'deviceID': '355340903541582'}
#     uid = '21553717031426'
#     proxy = None
#     device_id = '355340903541582'
#     print util.get_download_beans(cookie, uid, proxy, device_id)

if __name__ == '__main__':
    utils.set_setting(settings.project_settings)
    logger = utils.get_logger()
    global stop_tag
    # test()

    buy_resume_thread = threading.Thread(target=buy_thread, name='Buy_Thread')
    buy_resume_thread.start()

    awake_threads = []
    for x in xrange(common_settings.DOWNLOAD_THREAD_NUMBER):
        new_thread = threading.Thread(target=awake_thread,
                                      name='Thread-' + str(x))
        new_thread.start()
        awake_threads.append(new_thread)
        time.sleep(3)
Exemple #28
0
                str(uuid.uuid1()),
                # "executeParam": json.loads(i.strip()),
                "executeParam":
                json.dumps(
                    {
                        'model_name': 'liepin',
                        'job_code': function[8],
                        'job_name': function[7],
                        'area_code': city[6],
                        'area_name': city[1]
                    },
                    ensure_ascii=False),
                "taskType":
                "RESUME_FETCH",
                "deadline":
                deadline
            }
            add_task_result = utils.download(url=add_task_url,
                                             is_json=True,
                                             headers=headers,
                                             method='post',
                                             data=add_task_data)
    logger.info('done.')


if __name__ == '__main__':
    utils.set_setting({
        "PROJECT_NAME": 'resume_fenjianli_create_task',
    })
    create_task_from_mysql()