Commit 4c7fd675 authored by nextime's avatar nextime

Renamed "video" to "mediasources"

parent 37ee5d0c
RENAME TABLE video TO mediasources;
......@@ -3,7 +3,7 @@
<div id="websectionlist" class="panel drawer-container scrollable">
<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();
foreach($v as $cam)
{
......
......@@ -3,7 +3,7 @@
<div id="websectionlist" class="panel drawer-container scrollable">
<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();
foreach($v as $cam)
{
......
......@@ -11,7 +11,7 @@ $panels=FALSE;
if($GUISUBSECTION!="" && is_numeric($GUISUBSECTION))
{
$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) {
$panels=array();
foreach($v as $cam) {
......@@ -31,7 +31,7 @@ if(!$panels)
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) {
$pos=1;
foreach($v as $cam) {
......
......@@ -10,7 +10,7 @@ $DEFPANELS = array();
$panels=FALSE;
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) {
$panels=array();
$pos=1;
......@@ -28,7 +28,7 @@ if(!$panels)
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) {
$pos=1;
foreach($v as $cam) {
......
......@@ -136,8 +136,8 @@ class SequenceData(DBObject):
class Timers(DBObject):
TABLENAME="timers"
class Videos(DBObject):
TABLENAME="video"
class MediaSources(DBObject):
TABLENAME="mediasources"
class QServers(DBObject):
TABLENAME="qservers"
......@@ -529,7 +529,7 @@ def resetDynActions():
def resetBoards():
return Registry.getConfig().delete("dmboards")
def resetDynVideos():
def resetDynMediaSources():
return Registry.getConfig().delete('video', where=["dynamic=1"])
def getVideoProxyList():
......
......@@ -488,9 +488,9 @@ class domotikaService(service.Service):
def resetActionList(self, *a, **kw):
return dmdb.resetDynActions()
def resetVideoList(self, *a, **kw):
def resetMediaSourcesList(self, *a, **kw):
self.upnp_detected_ips=[]
return dmdb.resetDynVideos()
return dmdb.resetDynMediaSources()
def autoDetectBoards(self, *a, **kw):
log.info("Start building boardlist")
......@@ -2227,7 +2227,7 @@ class domotikaService(service.Service):
return [{'data': ACTION_STATUS.values(), 'command': 'updateactions'}]
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")
def web_on_getRelayList(self):
......@@ -2291,7 +2291,7 @@ class domotikaService(service.Service):
self.resetBoards()
self.resetRelayist()
self.resetAnalogList()
#self.resetVideoList()
#self.resetMediaSourcesList()
self.resetActionList()
self.resetPwmList()
self.resetOutputList()
......@@ -2445,13 +2445,13 @@ class domotikaService(service.Service):
def upnp_on_configGet(self, 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:
self.upnp_detected_ips.append(device['host'])
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:
videodev = p.getVideoDev(device['host'], self.devadminpwd)
videodev = p.getMediaSource(device['host'], self.devadminpwd)
videodev.setUPNPLocation(device['location'])
videodev.addDevice()
else:
......
......@@ -30,17 +30,17 @@ from dmlib import constants as C
log = logging.getLogger( 'Core' )
class IVideoDev(Interface):
class IMediaSource(Interface):
""" Base plugin Interface """
def getVideoDev(self, host, adminpwd):
def getMediaSource(self, host, adminpwd):
"""
Return a DMBoard object
"""
class IVideoDevPlugin(Interface):
""" Implement a VideoDevice """
class IMediaSourcePlugin(Interface):
""" Implement a MediaSourceice """
def context2section(ctx):
......@@ -51,8 +51,8 @@ def context2section(ctx):
return section
class BaseVideoDev(object):
implements(IVideoDevPlugin)
class BaseMediaSource(object):
implements(IMediaSourcePlugin)
upnp_location=False
adminpwd='domotika'
......
......@@ -21,8 +21,8 @@
#
##############################################################################
from domotika.mediasources import ivideodev
from domotika.mediasources.ivideodev import context2section, BaseVideoDev
from domotika.mediasources import imediasource
from domotika.mediasources.imediasource import context2section, BaseMediaSource
from domotika.db import dmdb
from domotika.lang import lang
from zope.interface import implements
......@@ -33,7 +33,7 @@ from dmlib import constants as C
import logging
try:
log = logging.getLogger('Core').getChild('Video.Sitecom.LN406')
log = logging.getLogger('Core').getChild('MediaSource.Sitecom.LN406')
except:
log = logging.getLogger('Core')
......@@ -48,14 +48,14 @@ except:
import sha1
class VideoDevPlugin(BaseVideoDev):
class MediaSourcePlugin(BaseMediaSource):
def __init__(self, host, adminpwd='domotika'):
self.host = host
self.adminpwd = adminpwd
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):
wu.getPage("http://"+self.host+'/util/query.cgi',
......@@ -69,7 +69,7 @@ class VideoDevPlugin(BaseVideoDev):
except:
hname=self.host
c=dmdb.Videos()
c=dmdb.MediaSources()
c.ip=self.host
#c.videostream='rtsp://admin:'+self.adminpwd+'@'+host+'/img/media.sav'
c.controlapi='http://admin:'+self.adminpwd+'@'+self.host+'/'
......@@ -88,13 +88,13 @@ class VideoDevPlugin(BaseVideoDev):
c.save().addCallback(log.info)
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))
return VideoDevPlugin(host, adminpwd)
return MediaSourcePlugin(host, adminpwd)
videodev=VideoDev()
mediasource=MediaSource()
......@@ -21,8 +21,8 @@
#
##############################################################################
from domotika.mediasources import ivideodev
from domotika.mediasources.ivideodev import context2section, BaseVideoDev
from domotika.mediasources import imediasource
from domotika.mediasources.imediasource import context2section, BaseMediaSource
from domotika.db import dmdb
from domotika.lang import lang
from zope.interface import implements
......@@ -33,7 +33,7 @@ from dmlib import constants as C
import logging
try:
log = logging.getLogger('Core').getChild('Video.Sitecom.LN406')
log = logging.getLogger('Core').getChild('MediaSource.Sitecom.LN406')
except:
log = logging.getLogger('Core')
......@@ -48,14 +48,14 @@ except:
import sha1
class VideoDevPlugin(BaseVideoDev):
class MediaSourcePlugin(BaseMediaSource):
def __init__(self, host, adminpwd='domotika'):
self.host = host
self.adminpwd = adminpwd
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):
wu.getPage("http://"+self.host+'/util/query.cgi',
......@@ -69,7 +69,7 @@ class VideoDevPlugin(BaseVideoDev):
except:
hname=self.host
c=dmdb.Videos()
c=dmdb.MediaSources()
c.ip=self.host
#c.videostream='rtsp://admin:'+self.adminpwd+'@'+host+'/img/media.sav'
c.controlapi='http://admin:'+self.adminpwd+'@'+self.host+'/'
......@@ -88,13 +88,13 @@ class VideoDevPlugin(BaseVideoDev):
c.save().addCallback(log.info)
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))
return VideoDevPlugin(host, adminpwd)
return MediaSourcePlugin(host, adminpwd)
videodev=VideoDev()
mediasource=MediaSource()
import logging
import ivideodev
import imediasource
import importlib
import os
......@@ -12,10 +12,10 @@ except ImportError:
else:
for i in os.listdir('domotika/mediasources/modules'):
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:
if os.path.isdir('domotika/mediasources/modules/'+str(manufacturer)):
mod = importlib.import_module('domotika.mediasources.modules.'+str(manufacturer))
......@@ -23,7 +23,7 @@ def getVideodevPlugin(name, manufacturer='generic'):
mod = importlib.import_module('domotika.mediasources.modules.generic')
except:
return None
for p in getPlugins(ivideodev.IVideoDev, mod ):
for p in getPlugins(imediasource.IMediaSource, mod ):
qual = "%s.%s" % (p.__module__, p.__class__.__name__)
log.debug("Calling Board Module "+qual)
if p.__module__.split('.')[-1]==name:
......
......@@ -75,7 +75,7 @@ class DomotikaUPNP(object):
log.info('DEVICE DATA: '+str(descr))
if 'Network Camera' in descr['deviceType']:
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