Skip to content

Commit

Permalink
initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
RenZ0 committed Dec 31, 2011
0 parents commit 2839efc
Show file tree
Hide file tree
Showing 48 changed files with 7,374 additions and 0 deletions.
339 changes: 339 additions & 0 deletions LICENCE

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions NEWS
@@ -0,0 +1,2 @@
31/12/2011 php-show-controller 1.0.0
* Initial release
157 changes: 157 additions & 0 deletions README
@@ -0,0 +1,157 @@
PSC - Php-Show-Controller
-------------------------

PSC provides an interface to create DMX shows, and play those thanks to OLA.

Project Page: http://imaginux.com/lighting
Licence: GNU General Public Licence 2 (See LICENCE)


Requirements
------------

This software requires:

- webserver like apache with php/mysql support
- python 2.7 (earlier versions may also work)
- ola >= 0.8.14 (must be built with --enable-python-libs)


Installation
------------

First, you need to set up your webserver, for example on debian/ubuntu :
sudo apt-get install apache2 mysql-server php5-mysql phpmyadmin

Configure php with register_globals = On :
sudo gedit /etc/php5/apache2/php.ini
sudo /etc/init.d/apache2 restart

Create a new database, for example : psc
(you can use phpmyadmin to do this).
Import the sql file psc_base.sql.gz into the new database.

According to your webserver access, fill these files :
engine/config.py
psc/config.php

Move the psc folder into the webserver root :
sudo cp -r psc/ /var/www/

PSC is ready !


Getting Started
---------------

You need to have OLA working :
http://www.opendmx.net/index.php/OLA

You can get deb packages on my website :
http://imaginux.com/lighting/

Start OLA, for example :
olad -f (background)
or
olad -l3 (with log)

Configure OLA universes from :
http://127.0.0.1:9090

From the engine folder, simply run 'python server.py'.
Python will tell you if modules missing, like python-mysqldb.

Go to your webserver url (with your web browser), for example :
http://127.0.0.1/psc


How to use PSC ?
----------------

0) Set language in Preferences : en = english, fr = french.
RGB and CMY checkboxes are for display in scenario creation.
Engine Rate is set into database.

1) Add your fixtures infos in Profiles page :
Add each channel, default value and describe its function.
You can group some channels if you want, adding a dot between values.

RGB and CMY are special and names need to start with 'rgb' and 'cmy'.
You can make virtual fixtures using the 'Multi' feature.
Take care to not modify your profiles after scenario creation.

2) Set universes and addresses in Fixtures page.

3) Scenarios : add one and click on its name :
You will be able to define each step.

On the right of channel name, the o letter will display dmx info
(defined in your profile).

Color changes, included random and gradient are made on 'rgb'
channels by default.
Save the colors or values you want into the bank (Colors page).

Use the checkboxes to make partial changes.
Try the filter to show channels you want, and make fast changes
(with filter, 'ALL' button applies value on every channel seen).

You can disable, duplicate a step with X or # symbol.

D,w and R,w letters are used to generate many steps from original step :
D : first rgb color moves over rgb channels, going to last one.
R : first rgb color recover rgb channels, until all changed.
w is the same but rewind, it uses the last color instead of first one.
(these features only work with channels named like rgb1 to rgbX)

Use buttons (list, start...) to play the scenario
and see the result while you create.
Go to Steps page to change hold and fade times.

4) Play the scenarios you've created from Control page.
Control can be done with python too :

python test.py start.1 (where 1 is scenario's id)
python test.py stop.1
python test.py status.1
python test.py list
python test.py stopall
python test.py bo


Troubleshooting
---------------

Sometimes things don't always work as expected.
Often it's just a setting, please double check everything.

Keep in mind :
With php interface you change sql data.
Python engine reads sql data, and send it to OLA.
OLA use your hardware to send DMX signal.


Known Issues
------------

Currently it's better to play only one scenario at once.
One scenario can control more than one fixture (creating Multi),
but it's limited because of synchronization.
If you want to play many scenarios, you could set universe in HTP merge mode,
and it could work but there will be too much frames.
OLA port limiter will do its job according to your device and your settings.

It could be good to have a merge function, it's in todo list :)


Bugs
----

If you find a bug or want to submit new ideas, please send me an email :
renzo@imaginux.com


Copyright
---------

PSC is Copyright 2011 by Laurent Pierru <renzo@imaginux.com>
4 changes: 4 additions & 0 deletions TODO
@@ -0,0 +1,4 @@
*Add a merge function to allow playing multiple scenarios at once
*With ajax requests we can have better scenario editor
*Blackout should be done on every universe
*Declare all variables to allow register_globals = Off
61 changes: 61 additions & 0 deletions engine/com_sql.py
@@ -0,0 +1,61 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Copyright (C) 2011 Laurent Pierru <renzo@imaginux.com>

"""Php-Show-Controller. SQL Class"""

import sys
import MySQLdb
from config import DB_HOST,DB_USER,DB_PASS,DB_BASE

class ComSql(object):
def __init__(self):
'''Initialisation, connexion sur la base'''

#@ _CONNECT_
try:
self.conn = MySQLdb.connect (host = DB_HOST,
user = DB_USER,
passwd = DB_PASS,
db = DB_BASE)
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)
#@ _CONNECT_
self.cursor = self.conn.cursor (MySQLdb.cursors.DictCursor)

def requete_sql(self, req, *arg):
'''Renvoi le resultat de la requete SQL donné en argument'''
try:
#@ _RETRIEVE_1_
ret = self.cursor.execute(req, arg)
return self.cursor.fetchall()

#@ _CURSOR_CLOSE_
self.cursor.close()
#@ _CURSOR_CLOSE_

except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)

# #@ _TERMINATE_
# conn.commit ()
# conn.close ()
# #@ _TERMINATE_

12 changes: 12 additions & 0 deletions engine/config.py
@@ -0,0 +1,12 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-

# TCP
HOST="localhost"
PORT=9999

# SQL
DB_HOST="localhost"
DB_USER="root"
DB_PASS=""
DB_BASE="psc"

0 comments on commit 2839efc

Please sign in to comment.