Skip to content

Commit

Permalink
removed optical
Browse files Browse the repository at this point in the history
  • Loading branch information
klay2000 committed Dec 22, 2023
1 parent b4cf649 commit ba73a15
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 1,005 deletions.
6 changes: 3 additions & 3 deletions amplipi/ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ def reinit(self, settings: models.AppSettings = models.AppSettings(), change_not
self.status = models.Status.parse_obj(default_config)
self.save()

# make sure the config file contains the auxoptical stream
# make sure the config file contains the aux stream
has_stream = False
for s in self.status.streams:
if s.type == "auxoptical":
if s.type == "aux":
has_stream = True
break

if not has_stream:
self.create_stream(models.Stream(type="auxoptical", name="Aux/Optical", optical=False))
self.create_stream(models.Stream(type="aux", name="Aux"))

# populate system info
self._online_cache = utils.TimeBasedCache(self._check_is_online, 5, 'online')
Expand Down
4 changes: 1 addition & 3 deletions amplipi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ class Stream(Base):
* internetradio
* spotify
* plexamp
* auxoptical
* aux
* file
* fmradio
* lms
Expand All @@ -485,7 +485,6 @@ class Stream(Base):
index: Optional[int] = Field(description='RCA index')
disabled: Optional[bool] = Field(description="Soft disable use of this stream. It won't be shown as a selectable option")
ap2: Optional[bool] = Field(description='Is Airplay stream AirPlay2?')
optical: Optional[bool] = Field(description='Is Aux/Optical stream optical?')

# add examples for each type of stream
class Config:
Expand Down Expand Up @@ -651,7 +650,6 @@ class StreamUpdate(BaseUpdate):
server: Optional[str]
ap2: Optional[bool] = Field(description='Is Airplay stream AirPlay2?')
disabled: Optional[bool] = Field(description="Soft disable use of this stream. It won't be shown as a selectable option")
optical: Optional[bool] = Field(description='Is AuxOptical stream optical?')

class Config:
schema_extra = {
Expand Down
26 changes: 10 additions & 16 deletions amplipi/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,11 +973,10 @@ def info(self) -> models.SourceInfo:
source.track = "Not currently supported"
return source

class AuxOptical(BaseStream):
""" A stream to play from the aux/optical input. """
def __init__(self, name: str, optical: bool, disabled: bool = False, mock: bool = False):
super().__init__('aux/optical', name, disabled=disabled, mock=mock)
self.optical = optical
class Aux(BaseStream):
""" A stream to play from the aux input. """
def __init__(self, name: str, disabled: bool = False, mock: bool = False):
super().__init__('aux', name, disabled=disabled, mock=mock)
self.bkg_thread = None

def reconfig(self, **kwargs):
Expand All @@ -986,9 +985,6 @@ def reconfig(self, **kwargs):
self.disabled = kwargs['disabled']
if 'name' in kwargs:
self.name = kwargs['name']
if 'optical' in kwargs:
self.optical = kwargs['optical']
reconnect_needed = True
if reconnect_needed:
last_src = self.src
self.disconnect()
Expand All @@ -1007,9 +1003,7 @@ def connect(self, src):
return

# Set input source
print(f'setting input source to {"optical" if self.optical else "aux"}...')

amixer_command = f'amixer -D usb71 set "PCM Capture Source" "{"IEC958 In" if self.optical else "Line"}"'
amixer_command = f'amixer -D usb71 set "PCM Capture Source" "Line"'

subprocess.check_call(amixer_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Expand Down Expand Up @@ -1041,9 +1035,9 @@ def disconnect(self):

def info(self) -> models.SourceInfo:
source = models.SourceInfo(name=self.full_name(),
track="Optical" if self.optical else "Aux",
track="Aux",
state=self.state,
img_url=f'static/imgs/{"optical" if self.optical else "aux"}_input.png')
img_url=f'static/imgs/aux_input.png')
return source

class FilePlayer(BaseStream):
Expand Down Expand Up @@ -1384,7 +1378,7 @@ def send_cmd(self, cmd):

# Simple handling of stream types before we have a type heirarchy
AnyStream = Union[RCA, AirPlay, Spotify, InternetRadio, DLNA, Pandora, Plexamp,
AuxOptical, FilePlayer, FMRadio, LMS, Bluetooth]
Aux, FilePlayer, FMRadio, LMS, Bluetooth]

def build_stream(stream: models.Stream, mock=False) -> AnyStream:
""" Build a stream from the generic arguments given in stream, discriminated by stream.type
Expand All @@ -1409,8 +1403,8 @@ def build_stream(stream: models.Stream, mock=False) -> AnyStream:
return InternetRadio(name, args['url'], args.get('logo'), disabled=disabled, mock=mock)
if stream.type == 'plexamp':
return Plexamp(name, args['client_id'], args['token'], disabled=disabled, mock=mock)
if stream.type == 'auxoptical':
return AuxOptical(name, args['optical'], disabled=disabled, mock=mock)
if stream.type == 'aux':
return Aux(name, disabled=disabled, mock=mock)
if stream.type == 'fileplayer':
return FilePlayer(name, args['url'], disabled=disabled, mock=mock)
if stream.type == 'fmradio':
Expand Down
1 change: 0 additions & 1 deletion docs/QUICK_START.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ All of the connections will be made to the back panel. Here's a quick reference
- **CONTROLLER**: Connections to the embedded Raspberry Pi Controller
- **SERVICE**: USB mini connection for re-imaging the Pi's EMMC
- **USB**: USB A ports for connecting peripherals such as additional storage devices
- **OPTICAL IN**: SPDIF audio input, planned to be used for extra inputs
- **AUX IN**: Additional stereo input, planned to be used for announcements
- **HDMI OUT**: The Pi's HMDI output, can be used for visualizations or development
- **ETHERNET**: Network connection, see [Networking](#networking)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "amplipi"
version = "0.3.1"
version = "0.3.0+4cf6490-aux-optical-stream-dirty"
description = "A Pi-based whole house audio controller"
authors = [
"Lincoln Lorenz <[email protected]>",
Expand Down
6 changes: 6 additions & 0 deletions web/src/pages/Settings/Streams/StreamTemplates.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@
{
"name": "Spotify Device",
"type": "spotify",
"noCreate": true,
"fields": []
},
{
"name": "Aux Port",
"type": "aux",
"fields": []
},
{
Expand Down
4 changes: 4 additions & 0 deletions web/src/utils/getIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import plexamp from "@/../static/imgs/plexamp.png";
import lms from "@/../static/imgs/lms.png";
import internetradio from "@/../static/imgs/internet_radio.png";
import rca from "@/../static/imgs/rca_inputs.jpg";
import aux from "@/../static/imgs/aux_input.png";

export const getIcon = (type) => {
if (type === null || type === undefined) {
Expand Down Expand Up @@ -44,6 +45,9 @@ export const getIcon = (type) => {
case "INTERNET RADIO":
return internetradio;

case "AUX":
return aux;

default:
return internetradio;
}
Expand Down
Binary file removed web/static/imgs/optical_input.png
Binary file not shown.
112 changes: 0 additions & 112 deletions web/static/imgs/optical_input.svg

This file was deleted.

Loading

0 comments on commit ba73a15

Please sign in to comment.