Skip to content

Commit

Permalink
perf: default camera index
Browse files Browse the repository at this point in the history
  • Loading branch information
rise0chen committed Dec 6, 2024
1 parent e7fccda commit 5028f7d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ jobs:
runs-on: ubuntu-latest
container: registry.cn-shanghai.aliyuncs.com/lebai/util:14.04
steps:
- name: Run on old node
run: |
apt update && apt -y install wget
touch "$HOME/.bashrc"
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install 14.21.3
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
- name: Install Tools
Expand Down
5 changes: 4 additions & 1 deletion camera/bin/src/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def search_camera():
camera_list.append(i)
cap.release()
lebai.set_item("plugin_camera_indexs", json.dumps(camera_list))
return camera_list

def init_camera():
index = (lebai.get_item("plugin_camera_index"))['value']
Expand All @@ -67,7 +68,9 @@ def init_camera():
def main():
cap = init_camera()
if not cap.isOpened():
search_camera()
cameras = search_camera()
if len(cameras) == 1:
lebai.set_item("plugin_camera_index", str(cameras[0]))
exit(1)

images_dir = os.path.join(current_dir, "../../images")
Expand Down

0 comments on commit 5028f7d

Please sign in to comment.