Coder Social home page Coder Social logo

morganestes / calendarhangout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yeraze/calendarhangout

0.0 2.0 0.0 262 KB

Python script to process Google Calendar and Add Hangout links to Description.

License: GNU General Public License v2.0

Python 100.00%

calendarhangout's Introduction

CalendarHangout

Python script to process Google Calendar and Add Hangout links to Description.

Prereqs

Before running this, you need to get:

  • Python
  • The py-applescript python module
  • The pyobjc python module (which you may already have)
  • The dateutils module
  • The GData Python Client v3 - Included
    • Or you can install it globally via easy_install --upgrade google-api-python-client
  • client_secrets.json file
    • Easiest way to get that is via The Google Developer Console
    • Create a new project, give it a good name like "Calendar Hangouts" (This can take a minute or two)
    • Select "Enable an API" and turn on the "Calendar API"
    • Under "APIs & Auth", click "Credentials"
    • Click "Create a new Client ID", and select "Installed Application", select platform "Other"
    • Then select "Download JSON"

Now, that list of prereqs may seem daunting to the Python-uninitiated, but it's not bad. Just do this:

easy_install pip
pip install py_applescript
pip install dateutils
pip install --upgrade google-api-python-client

If you're a Homebrew User, then you'll optionally also need to do:

pip install pyobjc

That one takes a while.

Note: if you receive errors about GameKit when trying to run the script, your pyobjc library may be out of date. Clone the pyobjc repo (make sure to use commit a2cdc24) and install it locally.

If any of those complain about permission denied, then just prefix the command with sudo and it should work.

First Run

Before your first run (which you'll need to do manually from the commandline)

  1. Create a ~/.hangoutFix directory
  2. Place your shiny new client_secrets.json file in it.
  3. Change the "CalendarID" at the Top of hangoutFix.py to your calendar, or use the --calendar flag.
  4. Now run it.. It will redirect you to your browser to enable access.
  5. Once you've granted access, it should take off and update.

You can safely Ctrl-C it if you don't want it to do the total run right now. Keep in mind, that you can't break while it's running the applescript, so you'll have to kill it between updates.

Using launchctl

This script won't work inside of cron.. Don't ask me, blame apple.

Because of that, if you really want to automate it, you'll need to do so via launchctl.

So, edit the com.yeraze.hangoutFix.plist file here to reflect the directory of where you placed the newly corrected hangoutFix.py script, and the calendar ID/email to use. Then:

  • ln -s com.yeraze.hangoutFix.plist ~/Library/LaunchAgents
  • launchctl load com.yeraze.hangoutFix.plist
  • launchctl start com.yeraze.hangoutFix

That should start off the job. After that one completes, it should start another every 4 hours!

Note If you get a strange error like:

Could not open job overrides database at: /private/var/db/launchd.db/com.apple.launchd/overrides.plist: 13: Permission denied
launch_msg(): Socket is not connected

Then this means you're in tmux, aren't you? Either exit tmux and try it again, or read up on reattach-to-user-namespace.

calendarhangout's People

Contributors

morganestes avatar yeraze avatar

Watchers

 avatar  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.