Hotfix#1
This commit is contained in:
parent
6dc208970c
commit
9f4c5700b6
2 changed files with 26 additions and 11 deletions
18
app/run.py
18
app/run.py
|
|
@ -1,22 +1,32 @@
|
||||||
|
import argparse
|
||||||
from instagrapi import Client
|
from instagrapi import Client
|
||||||
import json, os
|
import json, os
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import library.lib as lib
|
import library.lib as lib
|
||||||
|
|
||||||
|
# Start timing the script
|
||||||
start_time = datetime.now()
|
start_time = datetime.now()
|
||||||
|
|
||||||
|
# Argument parser for command-line options
|
||||||
|
parser = argparse.ArgumentParser(description="Upload meal information to Instagram and Discord.")
|
||||||
|
parser.add_argument('--today', action='store_true', help="Use today's date instead of tomorrow's date for the MLSV_YMD timestamp.")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Set MLSV_YMD date based on the --today option
|
||||||
|
if args.today:
|
||||||
|
MLSV_YMD = datetime.now().strftime('%Y%m%d')
|
||||||
|
else:
|
||||||
|
MLSV_YMD = (datetime.now() + timedelta(days=1)).strftime('%Y%m%d')
|
||||||
|
|
||||||
print("🍪 | Retrieving saved account information.")
|
print("🍪 | Retrieving saved account information.")
|
||||||
cl = Client(json.load(open('./temp/cookies.json')))
|
cl = Client(json.load(open('./temp/cookies.json')))
|
||||||
print("🍪 | Account information was successfully retrieved.")
|
print("🍪 | Account information was successfully retrieved.")
|
||||||
|
|
||||||
print("📅 | Getting MLSV_YMD Timestamp")
|
print("📅 | Getting MLSV_YMD Timestamp")
|
||||||
MLSV_YMD = str((datetime.now() + timedelta(days=1)).strftime('%Y%m%d'))
|
|
||||||
print("📅 | Date:", MLSV_YMD)
|
print("📅 | Date:", MLSV_YMD)
|
||||||
|
|
||||||
print("🍲 | Getting Meal Info Image")
|
print("🍲 | Getting Meal Info Image")
|
||||||
lib.얻기(MLSV_YMD)
|
lib.얻기(MLSV_YMD)
|
||||||
#lib.얻기(MLSV_YMD)
|
|
||||||
|
|
||||||
|
|
||||||
print("📸 | Uploading Story")
|
print("📸 | Uploading Story")
|
||||||
cl.photo_upload_to_story(
|
cl.photo_upload_to_story(
|
||||||
|
|
@ -40,5 +50,5 @@ lib.디스코드(MLSV_YMD)
|
||||||
print("🗨️ | Uploaded at Discord")
|
print("🗨️ | Uploaded at Discord")
|
||||||
|
|
||||||
print("🎉 | All tasks completed.")
|
print("🎉 | All tasks completed.")
|
||||||
# calculate running time
|
# Calculate running time
|
||||||
print("🕒 | Running Time:", datetime.now() - start_time)
|
print("🕒 | Running Time:", datetime.now() - start_time)
|
||||||
|
|
|
||||||
15
app/run.sh
15
app/run.sh
|
|
@ -1,16 +1,21 @@
|
||||||
cd /code/app
|
cd /code/app
|
||||||
#rm -rf 20*.png
|
|
||||||
|
|
||||||
#rm -rf /etc/localtime
|
|
||||||
#ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
|
|
||||||
|
|
||||||
# If doesn't have temp folder, create it
|
# If doesn't have temp folder, create it
|
||||||
if [ ! -d "temp" ]; then
|
if [ ! -d "temp" ]; then
|
||||||
mkdir temp
|
mkdir temp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If doesn't have temp/cookies.json, create it
|
# If doesn't have temp/cookies.json, create it
|
||||||
if [ ! -f "temp/cookies.json" ]; then
|
if [ ! -f "temp/cookies.json" ]; then
|
||||||
python3 library/init-auth.py
|
python3 library/init-auth.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python3 run.py > temp/$(date +%Y%m%d-%H%M%S).log 2>&1
|
# Set the log file name with the current date and time
|
||||||
|
log_file="temp/$(date +%Y%m%d-%H%M%S).log"
|
||||||
|
|
||||||
|
# Run the Python script with or without --today and output to both the console and log file
|
||||||
|
if [[ "$1" == "--today" ]]; then
|
||||||
|
python3 run.py --today | tee "$log_file"
|
||||||
|
else
|
||||||
|
python3 run.py | tee "$log_file"
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue