Giter Site home page Giter Site logo

esoteric-git / tweet-queue-manager Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4 KB

Allows you to queue tweets in Apple Notes and automatically sync them to AWS DynamoDB for scheduled posting. This project is designed to work in conjunction with the tweet-pipeline repository, which handles the actual posting of tweets.

License: MIT License

Python 78.18% Shell 21.82%

tweet-queue-manager's Introduction

Tweet Queue Manager

Tweet Queue Manager is a system that allows you to queue tweets in Apple Notes and automatically sync them to AWS DynamoDB for scheduled posting. This project is designed to work in conjunction with the tweet-pipeline repository, which handles the actual posting of tweets.

Table of Contents

  1. System Overview
  2. Prerequisites
  3. Installation
  4. Configuration
  5. Usage
  6. Project Structure
  7. Deployment
  8. Related Projects

System Overview

The Tweet Queue Manager follows this workflow:

  1. You write tweets in an Apple Note named "Tweet_Queue".
  2. At 1 AM daily, a cron job triggers an Automator app that runs a macOS Shortcut.
  3. The macOS Shortcut contains an AppleScript that moves tweets from the Apple Note to a tweets.txt file.
  4. At 6 AM daily, another cron job runs sync_tweets.sh.
  5. sync_tweets.sh executes sync_tweets.py, which uploads the staged tweets from tweets.txt to a DynamoDB table in AWS.

Prerequisites

  • macOS with Apple Notes
  • Python 3.6+
  • AWS account with DynamoDB access
  • Automator and Shortcuts apps (built-in macOS applications)

Installation

  1. Clone this repository:

    git clone https://github.com/esoteric-git/tweet-queue-manager.git
    cd tweet-queue-manager
    
  2. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate
    
  3. Install the required Python packages:

    pip install -r requirements.txt
    

Configuration

  1. Create a .env file in the project root with the following content:

    AWS_REGION=your_aws_region
    AWS_ACCESS_KEY_ID=your_aws_access_key_id
    AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
    TABLE_NAME=your_dynamodb_table_name
    TWEETS_FILE_PATH=/path/to/tweets.txt
    TWITTER_ACCOUNT=your_twitter_account_name
    
  2. Update the paths in the AppleScript and cron jobs to match your system setup.

  3. Create the "Tweet_Queue" note in Apple Notes.

  4. Set up the Automator app and macOS Shortcut:

    • Create a new Automator application named run_tweet_script.app.
    • Add a "Run Shortcut" action and select the "Process Tweet_Queue" shortcut.
    • Save the Automator application.
  5. Create the "Process Tweet_Queue" shortcut in the Shortcuts app:

    • Create a new shortcut and add the provided AppleScript.
    • Adjust file paths as necessary.
  6. Set up cron jobs:

    • Open Terminal and run crontab -e.
    • Add the following lines (adjust paths as needed):
      0 1 * * * open /path/to/project/run_tweet_script.app
      0 6 * * * /path/to/project/venv/bin/python /path/to/project/sync_tweets.sh
      

Usage

  1. Write your tweets in the "Tweet_Queue" Apple Note, separating each tweet with a soccer ball emoji (⚽️).

  2. The system will automatically process your tweets daily:

    • At 1 AM, tweets will be moved from the Apple Note to tweets.txt.
    • At 6 AM, tweets will be uploaded to the DynamoDB table.
  3. Use the tweet-pipeline project to schedule and post the tweets from DynamoDB to Twitter.

Project Structure

tweet-queue-manager/ │ ├── run_tweet_script.app ├── sync_tweets.py ├── sync_tweets.sh ├── tweets.txt ├── tweet-queue.log ├── .env ├── requirements.txt └── venv/

  • run_tweet_script.app: Automator application to trigger the macOS Shortcut.
  • sync_tweets.py: Python script to upload tweets to DynamoDB.
  • sync_tweets.sh: Shell script to run the Python script with the virtual environment.
  • tweets.txt: Temporary storage for tweets between Apple Notes and DynamoDB.
  • tweet-queue.log: Log file for tracking script executions.
  • .env: The configuration file containing environment variables.
  • requirements.txt: A file listing the Python dependencies for the project.
  • venv/: The directory containing the Python virtual environment.

Deployment

This project is designed to run locally on a macOS system. Ensure that your Mac is powered on and connected to the internet at the scheduled cron job times for the system to function properly.

Related Projects

  • tweet-pipeline: A serverless CI/CD pipeline using AWS Lambda and Step Functions to schedule and post tweets to Twitter in a human-like cadence.

tweet-queue-manager's People

Contributors

esoteric-git avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.