0

I've made an application that uses the obs virtual camera and I want to distribute it to my friends. The problem is that my friends are lazy and aren't bothering to install obs manually. I was hoping that I could install obs through the program itself so everything would be set up for them automatically. Is there a way to do this?

Ultra
  • 51
  • 1
  • 9

2 Answers2

2

Yes, this is possible. The best way would be to use the os library.

Code:

import os
#importing os so we can use os.system
os.system("curl https://cdn-fastly.obsproject.com/downloads/OBS-Studio-27.0.1-Full-Installer-x64.exe -o installer.exe")
#os.system runs a command
os.system("installer.exe")

They would have to go through the install process, but that's basically just pressing next.

mcdonalds291
  • 2,024
  • 1
  • 5
  • 14
0

For fully automated install, you can use this script:

import os
import zipfile

os.system("curl https://github.com/CatxFish/obs-virtual-cam/releases/download/2.0.4/OBS-VirtualCam2.0.4.zip -L -o OBS-VirtualCam2.0.4.zip")

with zipfile.ZipFile("OBS-VirtualCam2.0.4.zip", 'r') as zip_ref:
    zip_ref.extractall("C:/Program Files/")
os.system('regsvr32 "C:\Program Files\OBS-VirtualCam\bin\32bit\obs-virtualsource.dll"')
os.system('regsvr32 "C:\Program Files\OBS-VirtualCam\bin\64bit\obs-virtualsource.dll"')

full install using cmd tutorial can be found in obs-studio github page

This script does this using python.

Ali Ent
  • 1,420
  • 6
  • 17
  • Thanks. I am running into an issue. This is the error I'm getting. – Ultra Aug 29 '21 at 19:28
  • Traceback (most recent call last): File "D:\Users\Admin\Desktop\test3.py", line 6, in with zipfile.ZipFile("OBS-VirtualCam2.0.4.zip", 'r') as zip_ref: File "D:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\zipfile.py", line 1257, in __init__ self._RealGetContents() File "D:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\zipfile.py", line 1324, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file – Ultra Aug 29 '21 at 19:28
  • The problem is that the file isn't downloading correctly. I can tell because winrar isn't recognizing it as a zip either. – Ultra Aug 29 '21 at 19:42
  • Try this using cmd `curl https://github.com/CatxFish/obs-virtual-cam/releases/download/2.0.4/OBS-VirtualCam2.0.4.zip -o OBS-VirtualCam2.0.4.zip` if the problem exists, maybe _curl_ has issues. – Ali Ent Aug 29 '21 at 19:47
  • Or instead of -o flag, use -L -o flags. – Ali Ent Aug 29 '21 at 19:50
  • You're welcome, I've changed some other parts, use the new code. Hope this time don't give you any error. – Ali Ent Aug 29 '21 at 19:58
  • I've used the new code. I'm getting a permission error this time. PermissionError: [WinError 5] Access is denied: 'C:\\Program Files\\OBS-VirtualCam' – Ultra Aug 29 '21 at 20:00
  • Try `Run As Administrator` . Open cmd using Administrator and run your code. `python your_python_file_name.py` – Ali Ent Aug 29 '21 at 20:04
  • If this didn't solve the problem, you will have to take `Program Files` folder ownership, that isn't a good and safe way. – Ali Ent Aug 29 '21 at 20:08