本文整理汇总了Python中sync.Sync.sync方法的典型用法代码示例。如果您正苦于以下问题:Python Sync.sync方法的具体用法?Python Sync.sync怎么用?Python Sync.sync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sync.Sync
的用法示例。
在下文中一共展示了Sync.sync方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from sync import Sync [as 别名]
# 或者: from sync.Sync import sync [as 别名]
def run(self):
sync = Sync(show_progress=self._isManual, run_silent=self._runSilent, api=globals.traktapi)
sync.sync()
if utilities.getSettingAsBool('tagging_enable') and utilities.getSettingAsBool('tagging_tag_after_sync'):
q = queue.SqliteQueue()
q.append({'action': 'updateTags'})
示例2: op_sync
# 需要导入模块: from sync import Sync [as 别名]
# 或者: from sync.Sync import sync [as 别名]
def op_sync (self):
conf = self.get_config()
pname = self._load_profile()
sync = Sync(conf, pname, self.get_db(), dr=self.is_dry_run())
if self.is_dry_run():
sync.prep_lists(self.get_sync_dir())
else:
try:
startt = conf.get_curr_time()
result = sync.sync(self.get_sync_dir())
if result:
conf.set_last_sync_start(pname, val=startt)
conf.set_last_sync_stop(pname)
logging.info('Updating item inventory...')
sync.save_item_lists()
logging.info('Updating item inventory...done')
else:
logging.info('timestamps not reset for profile %s due to '
'errors (previously identified).', pname)
except Exception, e:
logging.critical('Exception (%s) while syncing profile %s',
str(e), pname)
logging.critical(traceback.format_exc())
return False
示例3: op_sync
# 需要导入模块: from sync import Sync [as 别名]
# 或者: from sync.Sync import sync [as 别名]
def op_sync (self):
conf = self.get_config()
pname = self._load_profile()
startt_old = conf.get_last_sync_start(pname)
stopt_old = conf.get_last_sync_stop(pname)
if self.is_sync_all():
# This is the case the user wants to force a sync ignoring the
# earlier sync states. This is useful when ASynK code changes -
# and let's say we add support for synching a enw field, or some
# such.
#
# This works by briefly resetting the last sync start and stop
# times to fool the system. If the user is doing a dry run, we
# will restore his earlier times dutifully.
if self.is_dry_run():
logging.debug('Temporarily resetting last sync times...')
conf.set_last_sync_start(pname, val=utils.time_start)
conf.set_last_sync_stop(pname, val=utils.time_start)
sync = Sync(conf, pname, [x.get_db() for x in self.get_colls()],
dr=self.is_dry_run())
if self.is_dry_run():
sync.prep_lists(self.get_sync_dir())
# Since it is only a dry run, resetting to the timestamps to the
# real older sync is sort of called for.
conf.set_last_sync_start(pname, val=startt_old)
conf.set_last_sync_stop(pname, val=stopt_old)
logging.debug('Reset last sync timestamps to real values')
else:
try:
startt = conf.get_curr_time()
result = sync.sync(self.get_sync_dir())
if result:
conf.set_last_sync_start(pname, val=startt)
conf.set_last_sync_stop(pname)
logging.info('Updating item inventory...')
sync.save_item_lists()
logging.info('Updating item inventory...done')
else:
logging.info('timestamps not reset for profile %s due to '
'errors (previously identified).', pname)
except Exception, e:
logging.critical('Exception (%s) while syncing profile %s',
str(e), pname)
logging.critical(traceback.format_exc())
return False
示例4: run
# 需要导入模块: from sync import Sync [as 别名]
# 或者: from sync.Sync import sync [as 别名]
def run(self):
sync = Sync(show_progress=self._isManual, api=globals.traktapi)
sync.sync()
示例5: IsilistAPI
# 需要导入模块: from sync import Sync [as 别名]
# 或者: from sync.Sync import sync [as 别名]
import json
import sys
from enko import EnkoAPI
from isilist_api import IsilistAPI
from repository import UserLists
from sync import Sync
from transformer import ISIEnkoTransformer
if __name__ == "__main__":
isilist_api = IsilistAPI()
email, password = sys.argv[1], sys.argv[2]
isilist_api.init(email, password)
sync = Sync(isilist_api.get_sync())
sync.sync()
user_lists = UserLists.extract_as_enko()
user_lists = [ISIEnkoTransformer.transform(user_list) for user_list in user_lists]
enko_api = EnkoAPI()
enko_api.process_sales(user_lists, '2016-01-01')