Commit 4c7fd675 authored by nextime's avatar nextime

Renamed "video" to "mediasources"

parent 37ee5d0c
RENAME TABLE video TO mediasources;
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div id="websectionlist" class="panel drawer-container scrollable"> <div id="websectionlist" class="panel drawer-container scrollable">
<a href="<?=$BASEGUIPATH."/cameras"?>" class="btn btn-block btn-default">Telecamere Home</a> <a href="<?=$BASEGUIPATH."/cameras"?>" class="btn btn-block btn-default">Telecamere Home</a>
<? <?
$v=DB::query("SELECT id,button_name,position FROM video WHERE websection='camera' AND active=1 ORDER BY position,id"); $v=DB::query("SELECT id,button_name,position FROM mediasources WHERE websection='camera' AND active=1 ORDER BY position,id");
$links=array(); $links=array();
foreach($v as $cam) foreach($v as $cam)
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div id="websectionlist" class="panel drawer-container scrollable"> <div id="websectionlist" class="panel drawer-container scrollable">
<a href="<?=$BASEGUIPATH."/video"?>" class="btn btn-block btn-default">Video Home</a> <a href="<?=$BASEGUIPATH."/video"?>" class="btn btn-block btn-default">Video Home</a>
<? <?
$v=DB::query("SELECT id,button_name,position FROM video WHERE websection='video' AND active=1 ORDER BY position,id"); $v=DB::query("SELECT id,button_name,position FROM mediasources WHERE websection='video' AND active=1 ORDER BY position,id");
$links=array(); $links=array();
foreach($v as $cam) foreach($v as $cam)
{ {
......
...@@ -11,7 +11,7 @@ $panels=FALSE; ...@@ -11,7 +11,7 @@ $panels=FALSE;
if($GUISUBSECTION!="" && is_numeric($GUISUBSECTION)) if($GUISUBSECTION!="" && is_numeric($GUISUBSECTION))
{ {
$pos=1; $pos=1;
$v=DB::query("SELECT id,button_name,position,videostream,force_input_codec FROM video WHERE websection='camera' AND active=1 AND id='".$GUISUBSECTION."'"); $v=DB::query("SELECT id,button_name,position,videostream,force_input_codec FROM mediasources WHERE websection='camera' AND active=1 AND id='".$GUISUBSECTION."'");
if(is_array($v) && count($v)>0) { if(is_array($v) && count($v)>0) {
$panels=array(); $panels=array();
foreach($v as $cam) { foreach($v as $cam) {
...@@ -31,7 +31,7 @@ if(!$panels) ...@@ -31,7 +31,7 @@ if(!$panels)
if(!is_array($panels) or count($panels)<1) { if(!is_array($panels) or count($panels)<1) {
$v=DB::query("SELECT id,button_name,position,videostream,force_input_codec FROM video WHERE websection='camera' AND active=1 ORDER BY position,id LIMIT 3"); $v=DB::query("SELECT id,button_name,position,videostream,force_input_codec FROM mediasources WHERE websection='camera' AND active=1 ORDER BY position,id LIMIT 3");
if(is_array($v) && count($v)>0) { if(is_array($v) && count($v)>0) {
$pos=1; $pos=1;
foreach($v as $cam) { foreach($v as $cam) {
......
...@@ -10,7 +10,7 @@ $DEFPANELS = array(); ...@@ -10,7 +10,7 @@ $DEFPANELS = array();
$panels=FALSE; $panels=FALSE;
if($GUISUBSECTION!="" && is_numeric($GUISUBSECTION)) if($GUISUBSECTION!="" && is_numeric($GUISUBSECTION))
{ {
$v=DB::query("SELECT id,button_name,position,videostream FROM video WHERE websection='video' AND active=1 AND id='".$GUISUBSECTION."'"); $v=DB::query("SELECT id,button_name,position,videostream FROM mediasources WHERE websection='video' AND active=1 AND id='".$GUISUBSECTION."'");
if(is_array($v) && count($v)>0) { if(is_array($v) && count($v)>0) {
$panels=array(); $panels=array();
$pos=1; $pos=1;
...@@ -28,7 +28,7 @@ if(!$panels) ...@@ -28,7 +28,7 @@ if(!$panels)
if(!is_array($panels) or count($panels)<1) { if(!is_array($panels) or count($panels)<1) {
$v=DB::query("SELECT id,button_name,position,videostream FROM video WHERE websection='video' AND active=1 ORDER BY position,id LIMIT 3"); $v=DB::query("SELECT id,button_name,position,videostream FROM mediasources WHERE websection='video' AND active=1 ORDER BY position,id LIMIT 3");
if(is_array($v) && count($v)>0) { if(is_array($v) && count($v)>0) {
$pos=1; $pos=1;
foreach($v as $cam) { foreach($v as $cam) {
......
...@@ -136,8 +136,8 @@ class SequenceData(DBObject): ...@@ -136,8 +136,8 @@ class SequenceData(DBObject):
class Timers(DBObject): class Timers(DBObject):
TABLENAME="timers" TABLENAME="timers"
class Videos(DBObject): class MediaSources(DBObject):
TABLENAME="video" TABLENAME="mediasources"
class QServers(DBObject): class QServers(DBObject):
TABLENAME="qservers" TABLENAME="qservers"
...@@ -529,7 +529,7 @@ def resetDynActions(): ...@@ -529,7 +529,7 @@ def resetDynActions():
def resetBoards(): def resetBoards():
return Registry.getConfig().delete("dmboards") return Registry.getConfig().delete("dmboards")
def resetDynVideos(): def resetDynMediaSources():
return Registry.getConfig().delete('video', where=["dynamic=1"]) return Registry.getConfig().delete('video', where=["dynamic=1"])
def getVideoProxyList(): def getVideoProxyList():
......
...@@ -488,9 +488,9 @@ class domotikaService(service.Service): ...@@ -488,9 +488,9 @@ class domotikaService(service.Service):
def resetActionList(self, *a, **kw): def resetActionList(self, *a, **kw):
return dmdb.resetDynActions() return dmdb.resetDynActions()
def resetVideoList(self, *a, **kw): def resetMediaSourcesList(self, *a, **kw):
self.upnp_detected_ips=[] self.upnp_detected_ips=[]
return dmdb.resetDynVideos() return dmdb.resetDynMediaSources()
def autoDetectBoards(self, *a, **kw): def autoDetectBoards(self, *a, **kw):
log.info("Start building boardlist") log.info("Start building boardlist")
...@@ -2227,7 +2227,7 @@ class domotikaService(service.Service): ...@@ -2227,7 +2227,7 @@ class domotikaService(service.Service):
return [{'data': ACTION_STATUS.values(), 'command': 'updateactions'}] return [{'data': ACTION_STATUS.values(), 'command': 'updateactions'}]
def web_on_getIpCamList(self): def web_on_getIpCamList(self):
return dmdb.Videos.find(where=['type=? AND active=1','ipcam'], return dmdb.MediaSources.find(where=['type=? AND active=1','ipcam'],
orderby="position,button_name,ip ASC") orderby="position,button_name,ip ASC")
def web_on_getRelayList(self): def web_on_getRelayList(self):
...@@ -2291,7 +2291,7 @@ class domotikaService(service.Service): ...@@ -2291,7 +2291,7 @@ class domotikaService(service.Service):
self.resetBoards() self.resetBoards()
self.resetRelayist() self.resetRelayist()
self.resetAnalogList() self.resetAnalogList()
#self.resetVideoList() #self.resetMediaSourcesList()
self.resetActionList() self.resetActionList()
self.resetPwmList() self.resetPwmList()
self.resetOutputList() self.resetOutputList()
...@@ -2445,13 +2445,13 @@ class domotikaService(service.Service): ...@@ -2445,13 +2445,13 @@ class domotikaService(service.Service):
def upnp_on_configGet(self, section, var): def upnp_on_configGet(self, section, var):
return self.config.get(section, var) return self.config.get(section, var)
def upnp_on_addVideoDevice(self, device): def upnp_on_addMediaSource(self, device):
if not device['host'] in self.upnp_detected_ips: if not device['host'] in self.upnp_detected_ips:
self.upnp_detected_ips.append(device['host']) self.upnp_detected_ips.append(device['host'])
log.debug("UPNP DETECTED DEVICE FROM UPNP: "+str(device)) log.debug("UPNP DETECTED DEVICE FROM UPNP: "+str(device))
p=pluggableMediasouces.getVideodevPlugin(device['modelNumber'], device['manufacturer']) p=pluggableMediasouces.getMediaSourcePlugin(device['modelNumber'], device['manufacturer'])
if p: if p:
videodev = p.getVideoDev(device['host'], self.devadminpwd) videodev = p.getMediaSource(device['host'], self.devadminpwd)
videodev.setUPNPLocation(device['location']) videodev.setUPNPLocation(device['location'])
videodev.addDevice() videodev.addDevice()
else: else:
......
...@@ -30,17 +30,17 @@ from dmlib import constants as C ...@@ -30,17 +30,17 @@ from dmlib import constants as C
log = logging.getLogger( 'Core' ) log = logging.getLogger( 'Core' )
class IVideoDev(Interface): class IMediaSource(Interface):
""" Base plugin Interface """ """ Base plugin Interface """
def getVideoDev(self, host, adminpwd): def getMediaSource(self, host, adminpwd):
""" """
Return a DMBoard object Return a DMBoard object
""" """
class IVideoDevPlugin(Interface): class IMediaSourcePlugin(Interface):
""" Implement a VideoDevice """ """ Implement a MediaSourceice """
def context2section(ctx): def context2section(ctx):
...@@ -51,8 +51,8 @@ def context2section(ctx): ...@@ -51,8 +51,8 @@ def context2section(ctx):
return section return section
class BaseVideoDev(object): class BaseMediaSource(object):
implements(IVideoDevPlugin) implements(IMediaSourcePlugin)
upnp_location=False upnp_location=False
adminpwd='domotika' adminpwd='domotika'
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
# #
############################################################################## ##############################################################################
from domotika.mediasources import ivideodev from domotika.mediasources import imediasource
from domotika.mediasources.ivideodev import context2section, BaseVideoDev from domotika.mediasources.imediasource import context2section, BaseMediaSource
from domotika.db import dmdb from domotika.db import dmdb
from domotika.lang import lang from domotika.lang import lang
from zope.interface import implements from zope.interface import implements
...@@ -33,7 +33,7 @@ from dmlib import constants as C ...@@ -33,7 +33,7 @@ from dmlib import constants as C
import logging import logging
try: try:
log = logging.getLogger('Core').getChild('Video.Sitecom.LN406') log = logging.getLogger('Core').getChild('MediaSource.Sitecom.LN406')
except: except:
log = logging.getLogger('Core') log = logging.getLogger('Core')
...@@ -48,14 +48,14 @@ except: ...@@ -48,14 +48,14 @@ except:
import sha1 import sha1
class VideoDevPlugin(BaseVideoDev): class MediaSourcePlugin(BaseMediaSource):
def __init__(self, host, adminpwd='domotika'): def __init__(self, host, adminpwd='domotika'):
self.host = host self.host = host
self.adminpwd = adminpwd self.adminpwd = adminpwd
def addDevice(self): def addDevice(self):
return dmdb.Videos.find(where=['ip=?', self.host], limit=1).addCallback(self.getSitecomName) return dmdb.MediaSources.find(where=['ip=?', self.host], limit=1).addCallback(self.getSitecomName)
def getSitecomName(self, res): def getSitecomName(self, res):
wu.getPage("http://"+self.host+'/util/query.cgi', wu.getPage("http://"+self.host+'/util/query.cgi',
...@@ -69,7 +69,7 @@ class VideoDevPlugin(BaseVideoDev): ...@@ -69,7 +69,7 @@ class VideoDevPlugin(BaseVideoDev):
except: except:
hname=self.host hname=self.host
c=dmdb.Videos() c=dmdb.MediaSources()
c.ip=self.host c.ip=self.host
#c.videostream='rtsp://admin:'+self.adminpwd+'@'+host+'/img/media.sav' #c.videostream='rtsp://admin:'+self.adminpwd+'@'+host+'/img/media.sav'
c.controlapi='http://admin:'+self.adminpwd+'@'+self.host+'/' c.controlapi='http://admin:'+self.adminpwd+'@'+self.host+'/'
...@@ -88,13 +88,13 @@ class VideoDevPlugin(BaseVideoDev): ...@@ -88,13 +88,13 @@ class VideoDevPlugin(BaseVideoDev):
c.save().addCallback(log.info) c.save().addCallback(log.info)
log.info("SITECOM LN406 "+self.host+" CAMERA ADDED") log.info("SITECOM LN406 "+self.host+" CAMERA ADDED")
class VideoDev(object): class MediaSource(object):
implements(IPlugin, ivideodev.IVideoDev) implements(IPlugin, imediasource.IMediaSource)
def getVideoDev(self, host, adminpwd): def getMediaSource(self, host, adminpwd):
log.info("Found plugin for host "+str(host)) log.info("Found plugin for host "+str(host))
return VideoDevPlugin(host, adminpwd) return MediaSourcePlugin(host, adminpwd)
videodev=VideoDev() mediasource=MediaSource()
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
# #
############################################################################## ##############################################################################
from domotika.mediasources import ivideodev from domotika.mediasources import imediasource
from domotika.mediasources.ivideodev import context2section, BaseVideoDev from domotika.mediasources.imediasource import context2section, BaseMediaSource
from domotika.db import dmdb from domotika.db import dmdb
from domotika.lang import lang from domotika.lang import lang
from zope.interface import implements from zope.interface import implements
...@@ -33,7 +33,7 @@ from dmlib import constants as C ...@@ -33,7 +33,7 @@ from dmlib import constants as C
import logging import logging
try: try:
log = logging.getLogger('Core').getChild('Video.Sitecom.LN406') log = logging.getLogger('Core').getChild('MediaSource.Sitecom.LN406')
except: except:
log = logging.getLogger('Core') log = logging.getLogger('Core')
...@@ -48,14 +48,14 @@ except: ...@@ -48,14 +48,14 @@ except:
import sha1 import sha1
class VideoDevPlugin(BaseVideoDev): class MediaSourcePlugin(BaseMediaSource):
def __init__(self, host, adminpwd='domotika'): def __init__(self, host, adminpwd='domotika'):
self.host = host self.host = host
self.adminpwd = adminpwd self.adminpwd = adminpwd
def addDevice(self): def addDevice(self):
return dmdb.Videos.find(where=['ip=?', self.host], limit=1).addCallback(self.getSitecomName) return dmdb.MediaSources.find(where=['ip=?', self.host], limit=1).addCallback(self.getSitecomName)
def getSitecomName(self, res): def getSitecomName(self, res):
wu.getPage("http://"+self.host+'/util/query.cgi', wu.getPage("http://"+self.host+'/util/query.cgi',
...@@ -69,7 +69,7 @@ class VideoDevPlugin(BaseVideoDev): ...@@ -69,7 +69,7 @@ class VideoDevPlugin(BaseVideoDev):
except: except:
hname=self.host hname=self.host
c=dmdb.Videos() c=dmdb.MediaSources()
c.ip=self.host c.ip=self.host
#c.videostream='rtsp://admin:'+self.adminpwd+'@'+host+'/img/media.sav' #c.videostream='rtsp://admin:'+self.adminpwd+'@'+host+'/img/media.sav'
c.controlapi='http://admin:'+self.adminpwd+'@'+self.host+'/' c.controlapi='http://admin:'+self.adminpwd+'@'+self.host+'/'
...@@ -88,13 +88,13 @@ class VideoDevPlugin(BaseVideoDev): ...@@ -88,13 +88,13 @@ class VideoDevPlugin(BaseVideoDev):
c.save().addCallback(log.info) c.save().addCallback(log.info)
log.info("SITECOM LN406 "+self.host+" CAMERA ADDED") log.info("SITECOM LN406 "+self.host+" CAMERA ADDED")
class VideoDev(object): class MediaSource(object):
implements(IPlugin, ivideodev.IVideoDev) implements(IPlugin, imediasource.IMediaSource)
def getVideoDev(self, host, adminpwd): def getMediaSource(self, host, adminpwd):
log.info("Found plugin for host "+str(host)) log.info("Found plugin for host "+str(host))
return VideoDevPlugin(host, adminpwd) return MediaSourcePlugin(host, adminpwd)
videodev=VideoDev() mediasource=MediaSource()
import logging import logging
import ivideodev import imediasource
import importlib import importlib
import os import os
...@@ -12,10 +12,10 @@ except ImportError: ...@@ -12,10 +12,10 @@ except ImportError:
else: else:
for i in os.listdir('domotika/mediasources/modules'): for i in os.listdir('domotika/mediasources/modules'):
if os.path.isdir('domotika/mediasources/modules/'+i): if os.path.isdir('domotika/mediasources/modules/'+i):
list(getPlugins(ivideodev.IVideoDev, importlib.import_module('domotika.mediasources.modules.'+i))) # To refresh cache list(getPlugins(imediasource.IMediaSource, importlib.import_module('domotika.mediasources.modules.'+i))) # To refresh cache
def getVideodevPlugin(name, manufacturer='generic'): def getMediaSourcePlugin(name, manufacturer='generic'):
try: try:
if os.path.isdir('domotika/mediasources/modules/'+str(manufacturer)): if os.path.isdir('domotika/mediasources/modules/'+str(manufacturer)):
mod = importlib.import_module('domotika.mediasources.modules.'+str(manufacturer)) mod = importlib.import_module('domotika.mediasources.modules.'+str(manufacturer))
...@@ -23,7 +23,7 @@ def getVideodevPlugin(name, manufacturer='generic'): ...@@ -23,7 +23,7 @@ def getVideodevPlugin(name, manufacturer='generic'):
mod = importlib.import_module('domotika.mediasources.modules.generic') mod = importlib.import_module('domotika.mediasources.modules.generic')
except: except:
return None return None
for p in getPlugins(ivideodev.IVideoDev, mod ): for p in getPlugins(imediasource.IMediaSource, mod ):
qual = "%s.%s" % (p.__module__, p.__class__.__name__) qual = "%s.%s" % (p.__module__, p.__class__.__name__)
log.debug("Calling Board Module "+qual) log.debug("Calling Board Module "+qual)
if p.__module__.split('.')[-1]==name: if p.__module__.split('.')[-1]==name:
......
...@@ -75,7 +75,7 @@ class DomotikaUPNP(object): ...@@ -75,7 +75,7 @@ class DomotikaUPNP(object):
log.info('DEVICE DATA: '+str(descr)) log.info('DEVICE DATA: '+str(descr))
if 'Network Camera' in descr['deviceType']: if 'Network Camera' in descr['deviceType']:
log.debug("FOUND A CAMERA TO ADD") log.debug("FOUND A CAMERA TO ADD")
self.core.addVideoDevice(descr) self.core.addMediaSource(descr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment