Skip to content

Commit

Permalink
#5
Browse files Browse the repository at this point in the history
need test
  • Loading branch information
carey036 committed Oct 15, 2022
1 parent 0535606 commit 87d240d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ Gen epub and mobi Books from RSS with github action

ref crontab

if you want to get Rss before N hours, you can write the hours num to /conf/time.txt, the num must less than 10000

5. enable github action, and do a test by clicking star

## Example for Css
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ Gen epub and mobi Books from RSS with github action

参考crontab

如果你想抓取N个小时前的rss,可以在/conf/time.txt中写入一个小于10000的数字。

5. 打开github action,点击star进行测试

## CSS示例
Expand Down
10 changes: 7 additions & 3 deletions src/genBook.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ def get_start(fname):
'''
with open("./config/time.txt","r+") as f:
timeStamp = int(f.read())
#获取完start立即写入,确保时间间隔为最小
f.seek(0)
f.write(str(int(time.mktime(datetime.now(pytz.timezone('UTC')).timetuple()))))
#write new time stamp after read it
if(timeStamp<10000):#if time stamp is a num which is less than 100, it means that we should calculate the stamp before N hours
timeStamp = int(time.mktime(datetime.now(pytz.timezone('UTC')).timetuple())) - (timeStamp * 3600)
else: # calculate time stamp do not need to write new time stamp to the file
f.seek(0)
f.write(str(int(time.mktime(datetime.now(pytz.timezone('UTC')).timetuple()))))
f.close()

'''
#获取完start立即写入,确保时间间隔为最小
logging.info("save this stamp to file.")
Expand Down

0 comments on commit 87d240d

Please sign in to comment.