Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default streams for first startup #1023

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions amplipi/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
DEFAULT_CONFIG = { # This is the system state response that will come back from the amplipi box
"version": 1,
"sources": [ # this is an array of source objects, each has an id, name, type specifying whether source comes from a local (like RCA) or streaming input like pandora
{"id": 0, "name": "Input 1", "input": ""},
{"id": 1, "name": "Input 2", "input": ""},
{"id": 2, "name": "Input 3", "input": ""},
{"id": 3, "name": "Input 4", "input": ""},
Comment on lines -22 to -25
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that these being called inputs is used anywhere, but they are outputs so I made sure they were named that in line with the streamer section as well
Correct me if needed

{"id": 0, "name": "Output 1", "input": ""},
{"id": 1, "name": "Output 2", "input": ""},
{"id": 2, "name": "Output 3", "input": ""},
{"id": 3, "name": "Output 4", "input": ""},
],
# NOTE: streams and groups seem like they should be stored as dictionaries with integer keys
# this does not make sense because JSON only allows string based keys
Expand All @@ -34,6 +34,10 @@
{"id": RCAs[3], "name": "Input 4", "type": "rca", "index": 3, "browsable": False, "disabled": False},
{"id": 1000, "name": "Groove Salad", "type": "internetradio", "url": "http://ice6.somafm.com/groovesalad-32-aac",
"logo": "https://somafm.com/img3/groovesalad-400.jpg", "browsable": False, "disabled": False},
{"id": 1001, "name": "AmpliPi 1", "type": "spotify", "disabled": False, "browsable": False},
{"id": 1002, "name": "AmpliPi 2", "type": "spotify", "disabled": False, "browsable": False},
{"id": 1003, "name": "AmpliPi 1", "type": "airplay", "disabled": False, "ap2": False, "browsable": False},
{"id": 1004, "name": "AmpliPi 2", "type": "airplay", "disabled": False, "ap2": True, "browsable": False}
Comment on lines +37 to +40
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should probably be called AmpliPro 1/2 as well right?

],
"zones": [ # this is an array of zones, array length depends on # of boxes connected
{"id": 0, "name": "Zone 1", "source_id": 0, "mute": True, "disabled": False,
Expand Down Expand Up @@ -79,6 +83,10 @@
{"id": AUX_STREAM_ID, "name": "Aux", "type": "aux", "browsable": False, "disabled": False},
{"id": 1000, "name": "Groove Salad", "type": "internetradio", "url": "http://ice6.somafm.com/groovesalad-32-aac",
"logo": "https://somafm.com/img3/groovesalad-400.jpg", "browsable": False, "disabled": False},
{"id": 1001, "name": "AmpliPro 1", "type": "spotify", "disabled": False, "browsable": False},
{"id": 1002, "name": "AmpliPro 2", "type": "spotify", "disabled": False, "browsable": False},
{"id": 1003, "name": "AmpliPro 1", "type": "airplay", "disabled": False, "ap2": False, "browsable": False},
{"id": 1004, "name": "AmpliPro 2", "type": "airplay", "disabled": False, "ap2": True, "browsable": False}
],
"zones": [ # this is an array of zones, array length depends on # of boxes connected
],
Expand Down
7 changes: 7 additions & 0 deletions scripts/cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ until $(curl --output /dev/null --silent --fail http://amplipi.local); do
done
echo "" # newline

# connecting default streams
echo -e "\nConnecting Groove Salad, Spotify, Airplay sources"
curl -X PATCH http://amplipi.local/api/sources/0 -H "Content-Type: application/json" -d '{"input": "stream=1000"}'
curl -X PATCH http://amplipi.local/api/sources/1 -H "Content-Type: application/json" -d '{"input": "stream=1001"}'
curl -X PATCH http://amplipi.local/api/sources/2 -H "Content-Type: application/json" -d '{"input": "stream=1004"}'
curl -X PATCH http://amplipi.local/api/zones -H "Content-Type: application/json" -d '{"zones": [0, 1, 2, 3, 4, 5], "update": {"mute": true, "source_id": 0}}'

# remove old known_hosts entries
echo -e "\nCleaning old ~/.ssh/known_hosts entries on local machine"
ssh-keygen -f ~/.ssh/known_hosts -R amplipi.local
Expand Down