Skip to content

Commit

Permalink
Taking video and/or audio device name in configuration file instead o…
Browse files Browse the repository at this point in the history
…f device number if audioinput or videoinput is not a number.
  • Loading branch information
FrancoisSchnell committed Jul 7, 2014
1 parent f7ae73b commit af42ef4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions MediaCours.conf
Expand Up @@ -64,6 +64,7 @@ previewPlayer=browser

# For video usage give videoInput (integer) and audioinput (integer)
# video can be a webcam/camcorder/aquisition card/frame grabber/... seen by Windows OS
# instead of the number you can give the exact name of the device but the name must be perfectly accurate
videoinput=0
audioinput=0

Expand Down
17 changes: 14 additions & 3 deletions MediaCours.py
Expand Up @@ -27,7 +27,7 @@
__version__="2.5"

## Python import (base Python 2.4)
import sys,os,time,datetime,tarfile,ConfigParser,threading,shutil,gettext,zipfile,pickle
import sys,os,time,datetime,tarfile,ConfigParser,threading,shutil,gettext,zipfile,pickle,codecs
import subprocess, socket, winsound, traceback, webbrowser, platform
from thread import start_new_thread, exit
from urllib2 import urlopen
Expand Down Expand Up @@ -249,6 +249,8 @@ def readParam(param):
try:
#if 1:
fconf=open(confFile,"r")
#fconf=codecs.open(confFile,encoding='utf-8')

config= ConfigParser.ConfigParser()
config.readfp(fconf)
if config.has_option(section,"language") == True: language=readParam("language")
Expand Down Expand Up @@ -2631,15 +2633,24 @@ def getAudioVideoInputFfmpeg(pathData=pathData):
print "inputList", inputList
print "audioinputList", audioinputList
print "videoinputList", videoinputList

# Audio input from configuration file
try:
audioinputName=audioinputList[int(audioinput)]
if (audioinput.isdigit()==False):
audioinputName=audioinput
else:
audioinputName=audioinputList[int(audioinput)]
except IndexError:
audioinputName="None"
dialog=wx.MessageDialog(None,message="No audio source found, please restart the client and be sure that \n an audio source is seen by Windows or is setup properly in the config file.",
caption="Audiovideocours Error Message", style=wx.OK|wx.ICON_INFORMATION)
dialog.ShowModal()
# Video input from configuration file
try:
videoinputName= videoinputList[int(videoinput)]
if (videoinput.isdigit()==False):
videoinputName=videoinput
else:
videoinputName= videoinputList[int(videoinput)]
except IndexError:
videoinputName="None"
if 0:
Expand Down

0 comments on commit af42ef4

Please sign in to comment.