Skip to content

Commit

Permalink
Use different hotkeys depending on type of OS
Browse files Browse the repository at this point in the history
  • Loading branch information
stypr committed Feb 20, 2021
1 parent 1edb692 commit 599ea87
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*_orig.py
*.pyc
*.ini
*.spec
__pycache__/
.DS_Store
Thumbs.db
.idea
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ $ pip3 install -r requirements.txt

3. You need to install Agora SDK for voice communication. Refer to [Agora-Python-SDK#installation](https://github.com/AgoraIO-Community/Agora-Python-SDK#installation).


## Usage

* For calling APIs from other script
Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@ECHO OFF

python -m PyInstaller --onefile .\cli.py --onefile --icon=icon.ico
python -m PyInstaller --onefile .\cli.py --icon=icon.ico
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

python3 -m PyInstaller --onefile ./cli.py
14 changes: 10 additions & 4 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""

import os
import sys
import threading
import configparser
import keyboard
Expand Down Expand Up @@ -256,9 +257,15 @@ def _wait_speaker_permission(client, channel_name, user_id):
# Add raise_hands key bindings for speaker permission
# Sorry for the bad quality
if not channel_speaker_permission:
print("[*] Press [Ctrl+Shift+H] to raise your hands for the speaker permission.")

if sys.platform == "darwin": # OSX
_hotkey = "9"
elif sys.platform == "win32": # Windows
_hotkey = "ctrl+shift+h"

print(f"[*] Press [{_hotkey}] to raise your hands for the speaker permission.")
keyboard.add_hotkey(
"ctrl+shift+h",
_hotkey,
_request_speaker_permission,
args=(client, channel_name, user_id)
)
Expand Down Expand Up @@ -359,10 +366,9 @@ def main():
if __name__ == "__main__":
try:
main()
except:
except Exception:
# Remove dump files on exit.
file_list = os.listdir(".")
for _file in file_list:
if _file.endswith(".dmp"):
os.remove(_file)

4 changes: 3 additions & 1 deletion clubhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

"""
clubhouse.py
Developed for education purposes only.
Please make sure to know what you're trying to do!
Sending an odd API request could result in a permanent ban on your account.
Expand Down Expand Up @@ -33,7 +34,8 @@ class Clubhouse:
API_URL = "https://www.clubhouseapi.com/api"
API_BUILD_ID = "304"
API_BUILD_VERSION = "0.1.28"
API_UA = f"clubhouse/{API_BUILD_ID} (iPhone; iOS 13.5.1; Scale/3.00)"
API_UA = f"clubhouse/{API_BUILD_ID} (iPhone; iOS 14.4; Scale/2.00)"
API_UA_STATIC = f"Clubhouse/{API_BUILD_ID} CFNetwork/1220.1 Darwin/20.3.0"

# Some useful information for commmunication
PUBNUB_PUB_KEY = "pub-c-6878d382-5ae6-4494-9099-f930f938868b"
Expand Down

0 comments on commit 599ea87

Please sign in to comment.