Skip to content
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
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.9-slim-buster AS builder
RUN apt update && apt install git gcc libssl-dev -y
WORKDIR /asksonic
RUN git clone https://github.com/srichter/asksonic.git
RUN pip install --user wheel setuptools honcho
RUN pip install --user -r asksonic/requirements.txt

FROM python:3.9-slim-buster
COPY --from=builder /asksonic /opt
COPY --from=builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
WORKDIR /opt/asksonic
ENTRYPOINT ["honcho", "start", "-f", "Procfile.dev"]
3 changes: 2 additions & 1 deletion asksonic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
tracks_count = int(getenv('ASKS_TRACKS_COUNT', 50))

app = Flask(__name__)
ask = Ask(app, route_prefix, path='templates/en.yaml')
template_path = f"templates/{getenv('ASK_LANGUAGE', 'en')}.yaml"
ask = Ask(app, route_prefix, path=template_path)

logger = app.logger

Expand Down
10 changes: 9 additions & 1 deletion asksonic/intents/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from . import queue


@ask.intent('AMAZON.HelpIntent')
@ask.launch
def launch() -> question:
log('Launch')
Expand All @@ -18,6 +17,15 @@ def launch() -> question:
content=render_template('launch_content')
)

@ask.intent('AMAZON.HelpIntent')
def help_intent() -> question:
log('Help')
return question(render_template('help_text')) \
.simple_card(
title=render_template('help_title'),
content=render_template('help_content')
)


@ask.intent('AskSonicShuffleLibraryIntent')
def play_random_tracks() -> audio:
Expand Down
10 changes: 7 additions & 3 deletions asksonic/templates/en.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
launch_text: "Welcome to Ask Sonic. Ask me to play an artist, album, or song. You can also ask me to play a playlist or your entire library."
launch_title: "Welcome to AskSonic!"
launch_content: "Ask me to play an artist, album, or song. You can also ask me to play a playlist or your entire library."
launch_text: "Welcome to Ask Sonic!"
launch_title: "AskSonic"
launch_content: "Welcome to Ask Sonic!"

pausing: "Pausing"
resuming: "Resuming"
Expand All @@ -23,3 +23,7 @@ no_previous_track: "There is no previous song"
end_of_queue: "There is no more music queued"
artist_not_found: "I couldn't find the artist {{ artist }}"
album_not_found: "I couldn't find the album {{ album }} {{ 'by {}'.format(artist) if artist }}"

help_text: "Ask me to play an artist, album, or song. You can also ask me to play a playlist or your entire library."
help_title: "Help menu"
help_content: "Ask me to play an artist, album, or song. You can also ask me to play a playlist or your entire library."
29 changes: 29 additions & 0 deletions asksonic/templates/es.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
launch_text: "Bienvenido a AskSonic!"
launch_title: "AskSonic"
launch_content: "Bienvenido a AskSonic!"

pausing: "Pausando"
resuming: "Reanudando"
stopping: "Parando"
okay: "Okay"

playing_library: "Reproduciendo música desde tu librería"
playing_artist: "Reproduciendo música de {{ artist }}"
playing_album: "Reproduciendo álbum {{ album }} {{ 'de {}'.format(artist) if artist }}"

current_track: "Esta canción es "
track_information: "{{ title }} de {{ artist }}"
detailed_track_information: "{{ title }} de {{ artist }} del álbum {{ album }}"

artist_albums: "He encontrado estos albunes de {{ artist }}: {{ album_titles }}"

intent_not_supported: "Lo siento, aún no puedo hacer eso."
nothing_playing: "No se está reproduciendo música"
no_previous_track: "No hay canción previa"
end_of_queue: "No hay más música en cola"
artist_not_found: "No he podido encontrar el artista {{ artist }}"
album_not_found: "No he podido encontrar el álbum {{ album }} {{ 'de {}'.format(artist) if artist }}"

help_text: "Preguntame para reproducir un artista, álbum o canción. También puedes preguntarme para reproducir una lista de reproducción o tu biblioteca al completo."
help_title: "Menú de ayuda"
help_content: "Preguntame para reproducir un artista, álbum o canción. También puedes preguntarme para reproducir una lista de reproducción o tu biblioteca al completo."