From 654b2291a99c2c8e5c3ef0349efdcb5f2416e417 Mon Sep 17 00:00:00 2001 From: Kavish Devar Date: Fri, 27 Sep 2024 10:01:18 +0530 Subject: [PATCH] change mac address to a variable --- README.md | 4 ++-- main.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 90e33ab..ccab9fb 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ cd aln ## 3. Preprare Pair your AirPods with your machine before running this script! -:warning: **Note:** DO NOT FORGET TO EDIT THE `MAC_ADDRESS` VARIABLE IN `main.py`/`standalone.py` WITH YOUR AIRPODS MAC ADDRESS! +:warning: **Note:** DO NOT FORGET TO EDIT THE `AIRPODS_MAC` VARIABLE IN `main.py`/`standalone.py` WITH YOUR AIRPODS MAC ADDRESS! ## 4. Run! You can either choose the more polished version of the script, which currently only supports fetching the battery percentage, and in-ear status (but not actually controlling the media with that information), or the more experimental standalone version of the script, which supports the following features: @@ -35,4 +35,4 @@ python3 main.py ### Experimental version ```bash python3 standalone.py -``` \ No newline at end of file +``` diff --git a/main.py b/main.py index 77e491b..088e48f 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,8 @@ import time import sys import shutil + +AIRPODS_MAC = '28:2D:7F:C2:05:5B' class CustomFormatter(logging.Formatter): def format(self, record): # Format the log message with spaces around colons without altering the original message @@ -82,7 +84,7 @@ def main(): handler.setFormatter(formatter) logging.basicConfig(level=logging.DEBUG, handlers=[handler]) - connection = Connection('28:2D:7F:C2:05:5B') + connection = Connection(AIRPODS_MAC) connection.connect() logging.info('Sending Handshake') connection.send(enums.HANDSHAKE)