add LLM generated files
This commit is contained in:
parent
45b41107c8
commit
15fa581e6a
@ -0,0 +1,4 @@
|
|||||||
|
# Update package list and install pip
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y python3-pip
|
18
install.sh
Normal file
18
install.sh
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install Python dependencies
|
||||||
|
pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
# Copy the systemd service file
|
||||||
|
sudo cp src/screenmonitor.service /etc/systemd/system/
|
||||||
|
|
||||||
|
# Reload systemd to recognize the new service
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
|
||||||
|
# Enable the service to start on boot
|
||||||
|
sudo systemctl enable screenmonitor
|
||||||
|
|
||||||
|
# Start the service
|
||||||
|
sudo systemctl start screenmonitor
|
||||||
|
|
||||||
|
echo "Service installed and started successfully."
|
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
pillow
|
||||||
|
pyautogui
|
||||||
|
schedule
|
40
src/screenmonitor.py
Normal file
40
src/screenmonitor.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import os
|
||||||
|
import random
|
||||||
|
import time
|
||||||
|
from datetime import datetime
|
||||||
|
from PIL import Image, ImageFilter
|
||||||
|
import pyautogui
|
||||||
|
import schedule
|
||||||
|
|
||||||
|
|
||||||
|
def capture_screenshot(folder):
|
||||||
|
# Capture screenshot
|
||||||
|
screenshot = pyautogui.screenshot()
|
||||||
|
|
||||||
|
# Apply blur
|
||||||
|
blurred_screenshot = screenshot.filter(ImageFilter.GaussianBlur(10))
|
||||||
|
|
||||||
|
# Compress and save
|
||||||
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
filename = os.path.join(folder, f"screenshot_{timestamp}.jpeg")
|
||||||
|
blurred_screenshot.save(filename, "JPEG", quality=20)
|
||||||
|
print(f"Screenshot saved to {filename}")
|
||||||
|
|
||||||
|
|
||||||
|
def job():
|
||||||
|
capture_screenshot("/path/to/folder")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Schedule screenshots at random intervals
|
||||||
|
for _ in range(10): # Number of times to schedule
|
||||||
|
random_interval = random.randint(1, 60) # Random interval in minutes
|
||||||
|
schedule.every(random_interval).minutes.do(job)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
schedule.run_pending()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
11
src/screenmonitor.service
Normal file
11
src/screenmonitor.service
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=My Custom Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/python3 /path/to/my_service/src/script.py
|
||||||
|
Restart=always
|
||||||
|
User=your_user
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user