db

openlp.core.lib.projector.db module

Provides the database functions for the Projector module.

The Manufacturer, Model, Source tables keep track of the video source strings used for display of input sources. The Source table maps manufacturer-defined or user-defined strings from PJLink default strings to end-user readable strings; ex: PJLink code 11 would map “RGB 1” default string to “RGB PC (analog)” string. (Future feature).

The Projector table keeps track of entries for controlled projectors.

class openlp.core.lib.projector.db.CommonBase[source]

Bases: object

Base class to automate table name and ID column.

id = Column(None, Integer(), table=None, primary_key=True, nullable=False)
class openlp.core.lib.projector.db.Manufacturer(**kwargs)[source]

Bases: openlp.core.lib.projector.db.CommonBase, sqlalchemy.ext.declarative.api.Base

Projector manufacturer table.

Manufacturer:
name: Column(String(30)) models: Relationship(Model.id)

Model table is related.

id
models
name
class openlp.core.lib.projector.db.Model(**kwargs)[source]

Bases: openlp.core.lib.projector.db.CommonBase, sqlalchemy.ext.declarative.api.Base

Projector model table.

Model:
name: Column(String(20)) sources: Relationship(Source.id) manufacturer_id: Foreign_key(Manufacturer.id)

Manufacturer table links here. Source table is related.

id
manufacturer_id
name
sources
class openlp.core.lib.projector.db.Projector(**kwargs)[source]

Bases: openlp.core.lib.projector.db.CommonBase, sqlalchemy.ext.declarative.api.Base

Projector table.

Projector:

ip: Column(String(100)) # Allow for IPv6 or FQDN port: Column(String(8)) pin: Column(String(20)) # Allow for test strings name: Column(String(20)) location: Column(String(30)) notes: Column(String(200)) pjlink_name: Column(String(128)) # From projector manufacturer: Column(String(128)) # From projector model: Column(String(128)) # From projector other: Column(String(128)) # From projector sources: Column(String(128)) # From projector serial_no: Column(String(30)) # From projector (Class 2) sw_version: Column(String(30)) # From projector (Class 2) model_filter: Column(String(30)) # From projector (Class 2) model_lamp: Column(String(30)) # From projector (Class 2)

ProjectorSource relates

id
ip
location
manufacturer
model
model_filter
model_lamp
name
notes
other
pin
port
serial_no
source_list
sources
sw_version
class openlp.core.lib.projector.db.ProjectorDB(*args, **kwargs)[source]

Bases: openlp.core.lib.db.Manager

Class to access the projector database.

add_projector(projector)[source]

Add a new projector entry

Parameters:projector – Projector() instance to add
Returns:bool True if entry added False if entry already in DB or db error
add_source(source)[source]

Add a new ProjectorSource record

Parameters:source – ProjectorSource() instance to add
delete_projector(projector)[source]

Delete an entry by record id

Parameters:projector – Projector() instance to delete
Returns:bool True if record deleted False if DB error
get_projector_all()[source]

Retrieve all projector entries.

Returns:List with Projector() instances used in Manager() QListWidget.
get_projector_by_id(dbid)[source]

Locate a DB record by record ID.

Parameters:dbid – DB record id
Returns:Projector() instance
get_projector_by_ip(ip)[source]

Locate a projector by host IP/Name.

Parameters:ip – Host IP/Name
Returns:Projector() instance
get_projector_by_name(name)[source]

Locate a projector by name field

Parameters:name – Name of projector
Returns:Projector() instance
get_source_by_code(code, projector_id)[source]

Retrieves the ProjectorSource by ProjectorSource.id

Parameters:
  • source – PJLink ID
  • projector_id – Projector.id
Returns:

ProjetorSource instance or None

get_source_by_id(source)[source]

Retrieves the ProjectorSource by ProjectorSource.id

Parameters:source – ProjectorSource id
Returns:ProjetorSource instance or None
get_source_list(projector)[source]

Retrieves the source inputs pjlink code-to-text if available based on manufacturer and model. If not available, then returns the PJLink code to default text.

Parameters:projector – Projector instance
Returns:dict key: (str) PJLink code for source value: (str) From ProjectorSource, Sources tables or PJLink default code list
init_schema(*args, **kwargs)[source]

Setup the projector database and initialize the schema.

Declarative uses table classes to define schema.

update_projector(projector=None)[source]

Update projector entry

Parameters:projector – Projector() instance with new information
Returns:bool True if DB record updated False if entry not in DB or DB error
class openlp.core.lib.projector.db.ProjectorSource(**kwargs)[source]

Bases: openlp.core.lib.projector.db.CommonBase, sqlalchemy.ext.declarative.api.Base

Projector local source table This table allows mapping specific projector source input to a local connection; i.e., ‘11’: ‘DVD Player’

Projector Source:
projector_id: Foreign_key(Column(Projector.id)) code: Column(String(3)) # PJLink source code text: Column(String(20)) # Text to display

Projector table links here

code
id
projector_id
text
class openlp.core.lib.projector.db.Source(**kwargs)[source]

Bases: openlp.core.lib.projector.db.CommonBase, sqlalchemy.ext.declarative.api.Base

Projector video source table.

Source:
pjlink_name: Column(String(15)) pjlink_code: Column(String(2)) text: Column(String(30)) model_id: Foreign_key(Model.id)

Model table links here.

These entries map PJLink input video source codes to text strings.

id
model_id
text