1 Star 2 Fork 5

永夜归返/genshin-impact-helper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
docker.py 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
Frank Zhang 提交于 2021-01-27 19:21 . feature: add docker support (#125)
import datetime
import os
import signal
import time
from settings import *
from crontab import CronTab
time_format = "%Y-%m-%d %H:%M:%S"
def stop_me(_signo, _stack):
log.info("Docker container has stoped....")
exit(-1)
def main():
signal.signal(signal.SIGINT, stop_me)
log.info("使用DOCKER运行原神签到")
env = os.environ
cron_signin = env["CRON_SIGNIN"]
cron = CronTab(cron_signin, loop=True, random_seconds=True)
def next_run_time():
nt = datetime.datetime.now().strftime(time_format)
delayt = cron.next(default_utc=False)
nextrun = datetime.datetime.now() + datetime.timedelta(seconds=delayt)
nextruntime = nextrun.strftime(time_format)
log.info(f"Current running datetime: {nt}")
log.info(f"Next run datetime: {nextruntime}")
def sign():
log.info("Starting signing")
os.system("python3 ./genshin.py")
sign()
next_run_time()
while True:
ct = cron.next(default_utc=False)
time.sleep(ct)
sign()
next_run_time()
if __name__ == '__main__':
main()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/return-at-night/genshin-impact-helper.git
[email protected]:return-at-night/genshin-impact-helper.git
return-at-night
genshin-impact-helper
genshin-impact-helper
master

搜索帮助