Permalink
Browse files

Taking video and/or audio device name in configuration file instead o…

…f device number if audioinput or videoinput is not a number.
  • Loading branch information...
1 parent f7ae73b commit af42ef446a6e25a9efa7a4dd08b94c01aa1efa7d @metadirective metadirective committed Jul 7, 2014
Showing with 15 additions and 3 deletions.
  1. +1 −0 MediaCours.conf
  2. +14 −3 MediaCours.py
View
@@ -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
View
@@ -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
@@ -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")
@@ -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:

0 comments on commit af42ef4

Please sign in to comment.