A Python script to track activity happening in the Blender orginization
Go to file
Alaska 47931d2e92 Add video tutorials to README 2024-05-03 21:09:56 +12:00
sub_files Add the ability for users to add people they want to ignore notifications from 2024-05-02 17:22:02 +12:00
.gitignore Change name of people_info.py 2024-04-27 14:22:18 +12:00
Extra info.txt Intial implementation 2024-04-24 20:28:07 +12:00
README.md Add video tutorials to README 2024-05-03 21:09:56 +12:00
blender-activity-tracker.py Update gmail password guide 2024-05-03 02:35:44 +12:00
example_people_info.py Add the ability for users to add people they want to ignore notifications from 2024-05-02 17:22:02 +12:00


Security warning:

To make use of some features of this tool, you will need to login to some of your accounts. These are entirely optional. However, if you do decide to use them, keep in mind that you will be storing the details to access these accounts on your computer. Which is a security risk. I have included encryption of these details so they aren't stored on your computer in plain text. But it's still a security risk.

What is this:

This is a Python tool that will track activity on https://projects.blender.org/org/blender/dashboard and will give updates to you. This is basically the same thing as https://blender.chat/channel/blender-status-activity, but you can filter which things to be updated on based on repo and labels.

To set this up, you will need to install a modern version of Python 3 (I'm using Python 3.9)

Then you must decide what details you want to track and how you want to be notified. The approach is as follows:

Decide what you want to track:

  1. Copy the file example_people_info.py to people_info.py.
  2. Inside the file people_info.py there is a action people.append({...
  3. Update this action with the information you want to track. Details about how to fill this out can be found in the code comments by it. If you would prefer a video tutorial on how to fill out this information, I have uploaded one here: https://youtu.be/4Bz4zxJOaUI (Accurate as of 3rd of May 2024)

Decide how you want to recieve the updates:

There are a few ways you can recieve updates. Printing updates to the terminal, sending messages on Blender/Rocket chat, and sending emails.

Printing to the terminal is currently enabled for all users.

To send updates via Blender chat you will need to give the Python script an account to send messages from. You will be prompted to fill out account credentials the first time you run the script when you enable Rocket chat on one of your users (done by providing providing a chat_id in the person details). You will need to install the Rocket chat API and Cryptography Python libraries with pip install rocketchat_API cryptography

To send updates via email, then you will need to provide a email account to send from. At the moment only Gmail accounts can send emails. You will be prompted to fill out account credentials the first time you run the script if you have enabled email on one of your users (done by providing providing a email_address in the person details). You will also need to install the Cryptography Python library with pip install cryptography

The authentication details for Blender chat and email are encrypted and saved to your computer in a file called account_info.json. If you forget your password to decrypt it. Just delete this file and re-run the script and you will be prompted to create a new password and fill out your credentials again.

A video tutorial for setting up Blender chat or Gmail messages can be found here: https://youtu.be/BwQcLfn_Ib4 (Accurate as of 3rd of May 2024)

Finally, you can run it with python blender-activity-tracker.py in a terminal

Extra notes:

I am using hyperlinks so you can click (or control + click) on a issue or pull request number and it will take you to that issue/pull request. This is not supported in some terminal applications (E.G. Default macOS terminal). You may want to modify the code in hyper_link_terminal in sub_files/send_messages.py if you have this issue.

You can add other ways to recieve updates. Find the function send_message in sub_files/send_messages.py and add an alternative method there. (Note: you may need to modify other parts of the code if you want to add an alternative method rather than just replace an existing one)

I am stil relatively inexperienced with programming and this is my first time working with the Gitea API and RocketChat API. So some of this is messy or unnecessary, and the support I can provide is limited. In fact there is no garuntee that I will provide support.

There may be errors that you encounter. Sorry about that.

Known issues:

At the moment the script can't detect when a label is added to a issue/pull request. This is because this change doesn't get added to the activity on https://projects.blender.org/org/blender/dashboard

It also can't detect what project a issue or pull request is assigned too. I just couldn't find this information in the Gitea API.

The script is also unable to provide hyperlinks directly to a comment on a pull request because it seems to have a hard time picking out which comment corresponds to which action in https://projects.blender.org/org/blender/dashboard.

Changing email provider:

At the moment the script is setup to send emails from a Gmail account. If Gmail is not your provider, then you will need to modify the line email_server = smtplib.SMTP_SSL("smtp.gmail.com", 465) in sub_files/email_tools.py to user your provider.