auto blogger
This commit is contained in:
parent
2a0e12c1c5
commit
6f9c66eeaa
File diff suppressed because one or more lines are too long
45
automations/newblog.py
Normal file
45
automations/newblog.py
Normal file
@ -0,0 +1,45 @@
|
||||
import blogs
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
markdown_page_directory = "/var/tmw/deadvey.com" # Leave empty if you don't have one
|
||||
post = ["","","",[],[]]
|
||||
|
||||
print("Blog title:")
|
||||
post[0] = input()
|
||||
|
||||
print("\nPost content:")
|
||||
post[1] = input()
|
||||
|
||||
print("\nImage (0 to finish):")
|
||||
image = input()
|
||||
while image != "0":
|
||||
post[3].append(image)
|
||||
print("Image (0 to finish):")
|
||||
image = input()
|
||||
|
||||
print("\nTag (0 to finish):")
|
||||
tag = input()
|
||||
while tag != "0":
|
||||
post[4].append(tag)
|
||||
print("Tag (0 to finish):")
|
||||
tag = input()
|
||||
|
||||
post[2] = datetime.today().strftime('%a, %d %b %Y %H:%M:%S')
|
||||
|
||||
print(post)
|
||||
blogs.blogs_array = blogs.blogs_array[::-1]
|
||||
blogs.blogs_array.insert(0,post)
|
||||
|
||||
with open("blogs.py", "w") as blogs_file:
|
||||
content = f'''blogs_array = {blogs.blogs_array}
|
||||
blogs_array = blogs_array[::-1]'''
|
||||
|
||||
blogs_file.write(content)
|
||||
|
||||
os.system("python3 write_blog_pages.py")
|
||||
os.system("python3 rss_feed.py")
|
||||
os.system("bash create_markdown_blogs_file.sh")
|
||||
if markdown_page_directory != ""
|
||||
os.system(f"python3 {markdown_page_directory}/automations/write_blog_pages.py")
|
||||
os.system(f"python3 {markdown_page_directory}/automations/rss_feed.py")
|
Loading…
x
Reference in New Issue
Block a user