Advertisement
DeaD_EyE

get video sources from /sys/class/video4linux/

Jun 27th, 2019
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. from pathlib import Path
  2.  
  3.  
  4. def get_video():
  5.     result = []
  6.     path = Path('/sys/class/video4linux/')
  7.     for video in path.glob('video*'):
  8.         index = int((video / 'index').read_text())
  9.         name = (video / 'name').read_text().strip()
  10.         result.append((index, name))
  11.     return sorted(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement