Functional ClearQueu mode

Add Command mode
This commit is contained in:
AxelC
2019-07-07 22:51:52 +02:00
parent 48d752afa9
commit 2416af32db
4 changed files with 16 additions and 9 deletions

View File

@@ -72,6 +72,10 @@ sudo systemctl start musiccards.service
```bash
sudo systemctl status musiccards.service
```
- Restart service after file update
```bash
sudo systemctl restart musiccards.service
```
## HomeAssistant Setup for Google Music
TO BE CHECKED

9
box.py
View File

@@ -43,17 +43,18 @@ while True:
cardList.update_list()
# Find the card in bdd
card = cardList.get_card(read_id).cmd
card = cardList.get_card(read_id)
if card is not None:
# Card execution
print('Command : ', card.cmd)
print('Modes : ', card.mode)
print('Modes : ', card.str_modes())
# Update the previous card memory
if (previousCard == read_id) and ("cancel" == cfg.multiReadMode):
if (previousCard == read_id) and ("cancel" == cfg.multiReadMode) and (not card.has_mode("Command")):
# Cancel the read
print('Multi read : card canceled')
else:
# Update the previous card memory
previousCard = read_id
if card.has_mode("ClearQueue"):

View File

@@ -1,11 +1,13 @@
# Card Id, Command, Mode, Comment
# Command cards
0013397903,playpause, Command,
0013403195,next, Command,
0013354327,volume/+5, Command,
0005690629,volume/-5, Command,
# For Parents
0013397903,playpause, ,
0013403195,next, ,
0013354327,volume/+5, ,
0005690629,volume/-5, ,
0013365376,spotify/now/spotify:album:4yYVqX2KierVI3nDV0M2UL, , M - Lettre Infinie
0013193487,spotify/now/spotify:playlist:37i9dQZF1DWXTHBOfJ8aI7, , Légendes du Rock
0003586576,spotify/now/spotify:album:45Hm9e77uZVaRnEIYzzpzM, , Adebert 2
1 # Card Id, Command, Mode, Comment
2 # For Parents # Command cards
3 0013397903,playpause, , 0013397903,playpause, Command,
4 0013403195,next, Command,
5 0013354327,volume/+5, Command,
6 0005690629,volume/-5, Command,
7 # For Parents
8 0013365376,spotify/now/spotify:album:4yYVqX2KierVI3nDV0M2UL, , M - Lettre Infinie
9 0013193487,spotify/now/spotify:playlist:37i9dQZF1DWXTHBOfJ8aI7, , Légendes du Rock
10 0013403195,next, , 0003586576,spotify/now/spotify:album:45Hm9e77uZVaRnEIYzzpzM, , Adebert 2
0013354327,volume/+5, ,
0005690629,volume/-5, ,
0013365376,spotify/now/spotify:album:4yYVqX2KierVI3nDV0M2UL, , M - Lettre Infinie
0013193487,spotify/now/spotify:playlist:37i9dQZF1DWXTHBOfJ8aI7, , Légendes du Rock
11 0003586576,spotify/now/spotify:album:45Hm9e77uZVaRnEIYzzpzM, , Adebert 2 0013381409,spotify/now/spotify:album:3qU4wXm0Qngbtnr5PiLbFX, , Caravan Palace
12 0013381409,spotify/now/spotify:album:3qU4wXm0Qngbtnr5PiLbFX, , Caravan Palace 0013356493,spotify/now/spotify:album:5lFcL4pj96ZRsoIiHpFl79, , Shaka Ponk
13 0013356493,spotify/now/spotify:album:5lFcL4pj96ZRsoIiHpFl79, , Shaka Ponk 0005585628,spotify/now/spotify:album:0bUTHlWbkSQysoM3VsWldT, , Gorillaz

View File

@@ -5,7 +5,7 @@ addr=$1 # Mendatory - exemple : http://192.168.0.140:5005
cmd=$2 # Mendatory - exemple : volume/50
echo "Execute the command '$cmd' on the server at '$addr'"
echo "Execute the command $addr/$cmd"
# Execute the sonos api request using curl