Coder Social home page Coder Social logo

waringer / alexa-radio Goto Github PK

View Code? Open in Web Editor NEW
6.0 5.0 4.0 344 KB

Alexa Skill zum abspielen von Musikfiles die auf einem (lokalem) WebServer liegen

License: BSD 3-Clause "New" or "Revised" License

Shell 3.54% Go 96.46%
alexa alexa-custom-skill golang mp3

alexa-radio's Introduction

Alexa-Radio

--- Deutsch ---

Amazon Echo/Alexa Skill zum abspielen von Musik von einem NAS / Webserver Der Skill ist noch in der Entwicklung und hat noch nicht alle Funktionen.

Dokumentation des Skills in der Wiki

Eine Anleitung für die Installation und Inbetriebnahme des Skill ist hier zu finden. Ich danke Holger Hasenmüller vielmals für diese Anleitung!

--- English ---

Amazon Echo/Alexa Skill to play music from a NAS / webserver Skill is still in development and not is not feature complete.

Documentation in the Wiki

alexa-radio's People

Contributors

bschirrmeister avatar waringer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

alexa-radio's Issues

implement Multiroom

actual amazon do not support multiroom for custom skills, or i don't have found it

Service Reloads / No connection to radio service

Hallo,

Ich versuche diesen Skill zum Laufen zu bringen, habe jedoch einige Probleme damit.
U.a kann die Alexa API such nicht zu meinem Endpoint verbinden.
Vielleicht ist mein Setup auch nicht OK. Ich kann sehen, dass sich der alexa-radio Dienst ständg neu startet.

> Oct 19 01:58:17 SERVERNAME systemd[1]: alexa-radio.service: Service hold-off time over, scheduling restart.
> Oct 19 01:58:17 SERVERNAME radio[26059]: 2019/10/19 01:58:17 Alexa-Radio startet 2019-10-17_08:38:33 - 5b546e6868d6c27e839310fcae33e3743a978a19
> Oct 19 01:58:17 SERVERNAME radio[26059]: [negroni] listening on 127.0.0.1:3081
> Oct 19 01:58:48 SERVERNAME systemd[1]: alexa-radio.service: Watchdog timeout (limit 30s)!
> Oct 19 01:58:48 SERVERNAME radio[26059]: SIGABRT: abort
> Oct 19 01:58:48 SERVERNAME radio[26059]: PC=0x45d911 m=0 sigcode=0
> Oct 19 01:58:48 SERVERNAME radio[26059]: goroutine 0 [idle]:
> Oct 19 01:58:48 SERVERNAME radio[26059]: runtime.futex(0xbc2aa8, 0x80, 0x0, 0x0, 0xc000000000, 0x180, 0x178, 0x40c10d, 0x7ffd818555c8, 0x40c42f, ...)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/runtime/sys_linux_amd64.s:535 +0x21
> Oct 19 01:58:48 SERVERNAME radio[26059]: runtime.futexsleep(0xbc2aa8, 0x100000000, 0xffffffffffffffff)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/runtime/os_linux.go:44 +0x46
> Oct 19 01:58:48 SERVERNAME radio[26059]: runtime.notesleep(0xbc2aa8)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/runtime/lock_futex.go:151 +0x9f
> Oct 19 01:58:48 SERVERNAME radio[26059]: runtime.stopm()
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/runtime/proc.go:1928 +0xc0
> Oct 19 01:58:48 SERVERNAME radio[26059]: runtime.findrunnable(0xc00002e000, 0x0)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/runtime/proc.go:2391 +0x53f
> Oct 19 01:58:48 SERVERNAME radio[26059]: runtime.schedule()
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/runtime/proc.go:2524 +0x2be
> Oct 19 01:58:48 SERVERNAME radio[26059]: runtime.park_m(0xc000001980)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/runtime/proc.go:2610 +0x9d
> Oct 19 01:58:48 SERVERNAME radio[26059]: runtime.mcall(0x0)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/runtime/asm_amd64.s:318 +0x5b
> Oct 19 01:58:48 SERVERNAME radio[26059]: goroutine 1 [IO wait]:
> Oct 19 01:58:48 SERVERNAME radio[26059]: internal/poll.runtime_pollWait(0x7fa4181cce08, 0x72, 0x0)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/runtime/netpoll.go:184 +0x55
> Oct 19 01:58:48 SERVERNAME radio[26059]: internal/poll.(*pollDesc).wait(0xc0000f2218, 0x72, 0x0, 0x0, 0x87ef65)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/internal/poll/fd_poll_runtime.go:87 +0x45
> Oct 19 01:58:48 SERVERNAME radio[26059]: internal/poll.(*pollDesc).waitRead(...)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/internal/poll/fd_poll_runtime.go:92
> Oct 19 01:58:48 SERVERNAME radio[26059]: internal/poll.(*FD).Accept(0xc0000f2200, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/internal/poll/fd_unix.go:384 +0x1f8
> Oct 19 01:58:48 SERVERNAME radio[26059]: net.(*netFD).accept(0xc0000f2200, 0xc000117ad8, 0xc000077880, 0x7fa41826c6d0)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/net/fd_unix.go:238 +0x42
> Oct 19 01:58:48 SERVERNAME radio[26059]: net.(*TCPListener).accept(0xc0000925a0, 0xc000117b08, 0x40e188, 0x30)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/net/tcpsock_posix.go:139 +0x32
> Oct 19 01:58:48 SERVERNAME radio[26059]: net.(*TCPListener).Accept(0xc0000925a0, 0x849980, 0xc000087e90, 0x800080, 0xbb4790)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/net/tcpsock.go:261 +0x47
> Oct 19 01:58:48 SERVERNAME radio[26059]: net/http.(*Server).Serve(0xc000160000, 0x9163a0, 0xc0000925a0, 0x0, 0x0)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/net/http/server.go:2896 +0x286
> Oct 19 01:58:48 SERVERNAME radio[26059]: net/http.(*Server).ListenAndServe(0xc000160000, 0xc000160000, 0xf)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/net/http/server.go:2825 +0xb7
> Oct 19 01:58:48 SERVERNAME radio[26059]: net/http.ListenAndServe(...)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/net/http/server.go:3080
> Oct 19 01:58:48 SERVERNAME radio[26059]: github.com/codegangsta/negroni.(*Negroni).Run(0xc000087ce0, 0xc000117dd8, 0x1, 0x1)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/home/karl/go/path/src/github.com/codegangsta/negroni/negroni.go:143 +0x190
> Oct 19 01:58:48 SERVERNAME radio[26059]: main.runAlexa(0xc000087350, 0xc000024620, 0x9, 0xc00009c300, 0x4)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/home/karl/alexa-radio/Alexa-Radio/radio/radio.go:78 +0x13b
> Oct 19 01:58:48 SERVERNAME radio[26059]: main.main()
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/home/karl/alexa-radio/Alexa-Radio/radio/radio.go:69 +0x465
> Oct 19 01:58:48 SERVERNAME radio[26059]: goroutine 5 [select]:
> Oct 19 01:58:48 SERVERNAME radio[26059]: database/sql.(*DB).connectionOpener(0xc000120000, 0x9172e0, 0xc000068180)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/database/sql/sql.go:1052 +0xe8
> Oct 19 01:58:48 SERVERNAME radio[26059]: created by database/sql.OpenDB
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/database/sql/sql.go:722 +0x15d
> Oct 19 01:58:48 SERVERNAME radio[26059]: goroutine 6 [select]:
> Oct 19 01:58:48 SERVERNAME radio[26059]: database/sql.(*DB).connectionResetter(0xc000120000, 0x9172e0, 0xc000068180)
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/database/sql/sql.go:1065 +0xfb
> Oct 19 01:58:48 SERVERNAME radio[26059]: created by database/sql.OpenDB
> Oct 19 01:58:48 SERVERNAME radio[26059]: #011/usr/lib/go-1.13/src/database/sql/sql.go:723 +0x193
> Oct 19 01:58:48 SERVERNAME radio[26059]: rax    0xca
> Oct 19 01:58:48 SERVERNAME radio[26059]: rbx    0xbc2960
> Oct 19 01:58:48 SERVERNAME radio[26059]: rcx    0x45d913
> Oct 19 01:58:48 SERVERNAME radio[26059]: rdx    0x0
> Oct 19 01:58:48 SERVERNAME radio[26059]: rdi    0xbc2aa8
> Oct 19 01:58:48 SERVERNAME radio[26059]: rsi    0x80
> Oct 19 01:58:48 SERVERNAME radio[26059]: rbp    0x7ffd81855590
> Oct 19 01:58:48 SERVERNAME radio[26059]: rsp    0x7ffd81855548
> Oct 19 01:58:48 SERVERNAME radio[26059]: r8     0x0
> Oct 19 01:58:48 SERVERNAME radio[26059]: r9     0x0
> Oct 19 01:58:48 SERVERNAME radio[26059]: r10    0x0
> Oct 19 01:58:48 SERVERNAME radio[26059]: r11    0x286
> Oct 19 01:58:48 SERVERNAME radio[26059]: r12    0xff
> Oct 19 01:58:48 SERVERNAME radio[26059]: r13    0x0
> Oct 19 01:58:48 SERVERNAME radio[26059]: r14    0x90237a
> Oct 19 01:58:48 SERVERNAME radio[26059]: r15    0x0
> Oct 19 01:58:48 SERVERNAME radio[26059]: rip    0x45d911
> Oct 19 01:58:48 SERVERNAME radio[26059]: rflags 0x286
> Oct 19 01:58:48 SERVERNAME radio[26059]: cs     0x33
> Oct 19 01:58:48 SERVERNAME radio[26059]: fs     0x0
> Oct 19 01:58:48 SERVERNAME radio[26059]: gs     0x0
> Oct 19 01:58:48 SERVERNAME systemd[1]: alexa-radio.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
> Oct 19 01:58:48 SERVERNAME systemd[1]: alexa-radio.service: Unit entered failed state.
> Oct 19 01:58:48 SERVERNAME systemd[1]: alexa-radio.service: Failed with result 'exit-code'.
> Oct 19 01:58:48 SERVERNAME systemd[1]: alexa-radio.service: Service hold-off time over, scheduling restart.
> Oct 19 01:58:48 SERVERNAME radio[26067]: 2019/10/19 01:58:48 Alexa-Radio startet 2019-10-17_08:38:33 - 5b546e6868d6c27e839310fcae33e3743a978a19
> Oct 19 01:58:48 SERVERNAME radio[26067]: [negroni] listening on 127.0.0.1:3081


In den Apache Logs sehe ich , dass die Verbindung nicht zustande kommt.

==> error.log <==
[Sat Oct 19 02:07:05.234778 2019] [proxy:error] [pid 25710] (13)Permission denied: AH00952: HTTP: error creating fam 2 socket for target 127.0.0.1
[Sat Oct 19 02:07:05.238105 2019] [proxy:error] [pid 25710] AH00959: ap_proxy_connect_backend disabling worker for (127.0.0.1) for 60s
[Sat Oct 19 02:07:05.238144 2019] [proxy_http:error] [pid 25710] [client 54.240.197.82:8582] AH01114: HTTP: failed to make connection to backend: 127.0.0.1

==> modsec_audit.log <==
--dbc22272-A--
[19/Oct/2019:02:07:05 +0200] XapTqX8AAQEAAGRuZDYAAAAA 54.240.197.82 8582 46.38.236.146 443
--dbc22272-B--
POST /echo/radio HTTP/1.1
Content-Type: application/json; charset=utf-8
Accept: application/json
Accept-Charset: utf-8
Signature: U88jaejTTwOWLXBLDq4VH9dycfNxtCA7a/dY+jmPaE2hmCNJezmFqArJoEb9LLD8XFh3aY4l/b1vlGcO/FdAgYgkOa7pOmSgjSKTvmkr7Vq9fEUURpjULfUeOeQ7beC6OpaZCv8JIk4hdqUd2ge9RNhwNyaD9hHlEsY5TWOBnYIZDJPdXXDXeRctujORl9u8FGyTli1xbOEGdVVEGskvMopa26jSynXuvQwJYrHjgEgOMYv01V2bWuqleoOBjduS3en6ifKkx5dqiO1B389m5Vvjf3V7+Vwpamqz8efISOa9JwzdeIJf6v5H+hOje+ka9c0ULgK4MH4sIVFQABlg8w==
SignatureCertChainUrl: https://s3.amazonaws.com/echo.api/echo-api-cert-7.pem
Content-Length: 3637
Host: cd.familok.de
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.x (Java/1.8.0_222)

--dbc22272-F--
HTTP/1.1 503 Service Unavailable
Content-Length: 299
Connection: close
Content-Type: text/html; charset=iso-8859-1

--dbc22272-H--
Apache-Error: [file "mod_proxy_http.c"] [line 1994] [level 3] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
Apache-Handler: proxy-server
Stopwatch: 1571443625229358 9519 (- - -)
Stopwatch2: 1571443625229358 9519; combined=7, p1=0, p2=0, p3=0, p4=0, p5=7, sr=0, sw=0, l=0, gc=0
Producer: ModSecurity for Apache/2.9.2 (http://www.modsecurity.org/); OWASP_CRS/2.2.9.
Server: Apache

--dbc22272-Z--

Hier meine Apache Konfig:

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName PUBLIC.TLD
        DocumentRoot /var/www/cd


        #apparmor change_hat
        AADefaultHatName cd

        # URL Zeile vom Browser wird auf http://192.168.83.10:3088 umgeschrieben, somit intern Zugriff, extern kein Zugriff
        <Directory "/soundfiles/">
#            Require host allow api.eu.amazonalexa.com

            RedirectMatch ^/soundfiles/(.*)$ http://192.168.83.10:3088/$1
        </Directory>
        RewriteEngine on
        # Weiterleitung an Skill Radio, welcher auf Port 3081 im Webserver läuft

 #       <Directory "/echo/radio">
 #           Require host allow api.eu.amazonalexa.com
 #       </Directory>

        SSLProxyEngine On
        Proxypass               "/echo/radio" "http://127.0.0.1:3081/echo/radio"
        ProxyPassReverse        "/echo/radio" "http://127.0.0.1:3081/echo/radio"


        <IfModule mod_security2.c>
            SecRuleEngine Off
            # Ausnahmen Alexa API
            SecRuleRemoveById 950120             # Possible Remote File Inclusion (RFI) Attack: Off-Domain Reference/Link
            SecRuleRemoveById 981231             # SQL Comment Sequence Detected
        </IfModule>


SSLCertificateFile /etc/letsencrypt/live/PUBLIC.TLD/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/PUBLIC.TLD/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

und hier die radio.conf

 {
   "bindingIP": "127.0.0.1",
   "bindingPort": 3081,
   "amazonAppID": "amzn1.ask.skill.xxxx",
   "pidFile": "/var/run/alexa_radio.pid",
   "streamURL": "https://PUBLIC.TLD/soundfiles/",
   "dbUser": "alexa-cd",
   "dbPassword": "yyy",
   "dbName": "alexaradio",
   "dbServer": "localhost:3306",
   "scannerConfiguration": [
     {
       "useTags": true,
       "fileAccessMode": "nfs",
       "removeNoLongerExisting": true,
       "localBasePath": "",
       "nfsServer": "192.168.83.11",
       "nfsShare": "/Musik",
       "validExtensions": {
         ".flac": false,
         ".mp3": true,
         ".ogg": false
       },
       "pathIncludes": [
         "/"
       ],
       "pathExcludes": null,
       "tagExtractors": {
         "2": ".*\\/(?P\u003cartist\u003e.*)\\/(?P\u003calbum\u003e.*)\\/(?P\u003cfilename\u003e.*)",
         "3": ".*\\/(?P\u003cartist\u003e.*)\\/(?P\u003calbum\u003e.*)\\/.*\\/(?P\u003cfilename\u003e.*)"
       }
     }
   ]
 }

Vielleicht als Besonderheit zu erwähnen:
Der öffentliche Webserver hat den Skill installiert und die DB. Dieser Server hat keine Verbindung zum LAN. Der Scanner kann hier also nicht funktionieren.
Die DB wird allerdings von einem Scanner befüllt, der in im LAN steht per SSH Tunnel.
Der interne Scanner ist auf eine Rasperry Pi installiert; auf diesem sehe ich aber auch die Service Reloads.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.