platypush/platypush/entities/audio.py

37 lines
840 B
Python
Raw Normal View History

2023-01-22 21:04:46 +01:00
from sqlalchemy import Column, Integer, ForeignKey
from platypush.common.db import is_defined
2023-01-22 21:04:46 +01:00
from .dimmers import Dimmer
from .switches import Switch
if not is_defined('volume'):
2023-01-22 21:04:46 +01:00
class Volume(Dimmer):
__tablename__ = 'volume'
id = Column(
Integer, ForeignKey(Dimmer.id, ondelete='CASCADE'), primary_key=True
)
__table_args__ = {'extend_existing': True}
2023-01-22 21:04:46 +01:00
__mapper_args__ = {
'polymorphic_identity': __tablename__,
}
if not is_defined('muted'):
2023-01-22 21:04:46 +01:00
class Muted(Switch):
__tablename__ = 'muted'
id = Column(
Integer, ForeignKey(Switch.id, ondelete='CASCADE'), primary_key=True
)
__table_args__ = {'extend_existing': True}
2023-01-22 21:04:46 +01:00
__mapper_args__ = {
'polymorphic_identity': __tablename__,
}