Skip to content
Yorn edited this page Sep 28, 2020 · 5 revisions

There are a number of Communication Channels available with the audio server

  • http websocket
  • http REST
  • SNC (Simple Network Communication)
  • fileserver

REST API

Interact with database:

Request Audio File Information by Unique ID

Example Call

curl http://localhost:8080/database?uid=ee5fb664-9cbf-40ed-954c-7043f0926049

Result

[
  {
    "album": "Jamais Seule",
    "cover": "/img/ee5fb664-9cbf-40ed-954c-7043f0926049.jpeg",
    "performer": "Loane",
    "titel": "T'arrêtes Pas",
    "trackNo": 12,
    "uid": "ee5fb664-9cbf-40ed-954c-7043f0926049"
  }
]

Request Audio File Information search by Album Name

Example Call

curl http://localhost:8080/database?album=Beautiful%20Imperfection

Result

[
  {
    "album": "Beautiful Imperfection",
    "cover": "/img/67cbfaf9-f46e-4062-beaa-6b0cc3d95454.jpeg",
    "performer": "Asa",
    "titel": "Bamidélé",
    "trackNo": 13,
    "uid": "67cbfaf9-f46e-4062-beaa-6b0cc3d95454"
  },
  {
    "album": "Beautiful Imperfection",
    "cover": "/img/59444800-8f2c-4fc0-bc4b-5661921b5cd4.jpeg",
    "performer": "Asa",
    "titel": "Why can't we",
    "trackNo": 1,
    "uid": "59444800-8f2c-4fc0-bc4b-5661921b5cd4"
  },
  {
    "album": "Beautiful Imperfection",
    "cover": "/img/11190e02-371d-450c-a934-3c9dbeadaae6.jpeg",
    "performer": "Asa",
    "titel": "Be my man",
    "trackNo": 3,
    "uid": "11190e02-371d-450c-a934-3c9dbeadaae6"
  },
  {
    "album": "Beautiful Imperfection",
    "cover": "/img/fe34ace6-94a3-4a46-a438-d20cb1c5596b.jpeg",
    "performer": "Asa",
    "titel": "Maybe",
    "trackNo": 2,
    "uid": "fe34ace6-94a3-4a46-a438-d20cb1c5596b"
  },
  {
    "album": "Beautiful Imperfection",
    "cover": "/img/716ede52-1945-4975-802f-0168808effec.jpeg",
    "performer": "Asa",
    "titel": "Ok ok",
    "trackNo": 7,
    "uid": "716ede52-1945-4975-802f-0168808effec"
  },
  {
    "album": "Beautiful Imperfection",
    "cover": "/img/d1286f71-f40d-45ff-9ff8-a21ffaac8cdc.jpeg",
    "performer": "Asa",
    "titel": "Bimpé",
    "trackNo": 5,
    "uid": "d1286f71-f40d-45ff-9ff8-a21ffaac8cdc"
  },
  {
    "album": "Beautiful Imperfection",
    "cover": "/img/e0396b8a-39c2-49f0-a945-e3459448a901.jpeg",
    "performer": "Asa",
    "titel": "Dreamer girl",
    "trackNo": 8,
    "uid": "e0396b8a-39c2-49f0-a945-e3459448a901"
  },
  {
    "album": "Beautiful Imperfection",
    "cover": "/img/3c991a08-038b-46f8-ab12-3c0589b17f59.jpeg",
    "performer": "Asa",
    "titel": "Preacher man",
    "trackNo": 4,
    "uid": "3c991a08-038b-46f8-ab12-3c0589b17f59"
  },
  {
    "album": "Beautiful Imperfection",
    "cover": "/img/87b42a89-4f24-493f-8ff6-9201052f93a9.jpeg",
    "performer": "Asa",
    "titel": "The way I feel",
    "trackNo": 6,
    "uid": "87b42a89-4f24-493f-8ff6-9201052f93a9"
  }
]

Request Audio File Information search by Title Name

curl http://localhost:8080/database?title=Dreamer%20girl

Result

[
  {
    "album": "Beautiful Imperfection",
    "cover": "/img/e0396b8a-39c2-49f0-a945-e3459448a901.jpeg",
    "performer": "Asa",
    "title": "Dreamer girl",
    "trackNo": 8,
    "uid": "e0396b8a-39c2-49f0-a945-e3459448a901"
  }
]

Request Audio File Information search by performer Name

Example Call:

curl http://localhost:8080/database?performer=Depeche%20Mode

Result

[
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/e42332fb-568d-4e91-a434-cfa61d6d0cd5.jpeg",
    "performer": "Depeche Mode",
    "title": "My Little Universe",
    "trackNo": 5,
    "uid": "e42332fb-568d-4e91-a434-cfa61d6d0cd5"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/e2d84b37-3a2d-49ac-ac32-057744f0b8ce.jpeg",
    "performer": "Depeche Mode",
    "title": "Angel",
    "trackNo": 2,
    "uid": "e2d84b37-3a2d-49ac-ac32-057744f0b8ce"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/94e1453c-c3fc-4e29-b627-579488f1dbbc.jpeg",
    "performer": "Depeche Mode",
    "title": "The Child Inside",
    "trackNo": 8,
    "uid": "94e1453c-c3fc-4e29-b627-579488f1dbbc"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/484991dc-3881-4084-8696-751312b3f692.jpeg",
    "performer": "Depeche Mode",
    "title": "Slow",
    "trackNo": 6,
    "uid": "484991dc-3881-4084-8696-751312b3f692"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/1733e2f1-35b6-41cb-969c-dfa681867561.jpeg",
    "performer": "Depeche Mode",
    "title": "Heaven",
    "trackNo": 3,
    "uid": "1733e2f1-35b6-41cb-969c-dfa681867561"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/9196998e-66e1-4edf-9a03-30d1bb2fa24e.jpeg",
    "performer": "Depeche Mode",
    "title": "Secret To The End",
    "trackNo": 4,
    "uid": "9196998e-66e1-4edf-9a03-30d1bb2fa24e"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/00af3bdf-4fcd-4854-a2bb-b544f0ede69e.jpeg",
    "performer": "Depeche Mode",
    "title": "Welcome To My World",
    "trackNo": 1,
    "uid": "00af3bdf-4fcd-4854-a2bb-b544f0ede69e"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/9af9f826-1b55-491a-b8d9-b5cc8eb5a4de.jpeg",
    "performer": "Depeche Mode",
    "title": "Should Be Higher",
    "trackNo": 10,
    "uid": "9af9f826-1b55-491a-b8d9-b5cc8eb5a4de"
  }
]

Request Audio File Information by overall search

Example Call:

curl http://localhost:8080/database?overall=Delta%20Machine%20%28Deluxe%29

Result

[
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/e42332fb-568d-4e91-a434-cfa61d6d0cd5.jpeg",
    "performer": "Depeche Mode",
    "title": "My Little Universe",
    "trackNo": 5,
    "uid": "e42332fb-568d-4e91-a434-cfa61d6d0cd5"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/e2d84b37-3a2d-49ac-ac32-057744f0b8ce.jpeg",
    "performer": "Depeche Mode",
    "title": "Angel",
    "trackNo": 2,
    "uid": "e2d84b37-3a2d-49ac-ac32-057744f0b8ce"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/94e1453c-c3fc-4e29-b627-579488f1dbbc.jpeg",
    "performer": "Depeche Mode",
    "title": "The Child Inside",
    "trackNo": 8,
    "uid": "94e1453c-c3fc-4e29-b627-579488f1dbbc"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/484991dc-3881-4084-8696-751312b3f692.jpeg",
    "performer": "Depeche Mode",
    "title": "Slow",
    "trackNo": 6,
    "uid": "484991dc-3881-4084-8696-751312b3f692"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/1733e2f1-35b6-41cb-969c-dfa681867561.jpeg",
    "performer": "Depeche Mode",
    "title": "Heaven",
    "trackNo": 3,
    "uid": "1733e2f1-35b6-41cb-969c-dfa681867561"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/9196998e-66e1-4edf-9a03-30d1bb2fa24e.jpeg",
    "performer": "Depeche Mode",
    "title": "Secret To The End",
    "trackNo": 4,
    "uid": "9196998e-66e1-4edf-9a03-30d1bb2fa24e"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/00af3bdf-4fcd-4854-a2bb-b544f0ede69e.jpeg",
    "performer": "Depeche Mode",
    "title": "Welcome To My World",
    "trackNo": 1,
    "uid": "00af3bdf-4fcd-4854-a2bb-b544f0ede69e"
  },
  {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/9af9f826-1b55-491a-b8d9-b5cc8eb5a4de.jpeg",
    "performer": "Depeche Mode",
    "title": "Should Be Higher",
    "trackNo": 10,
    "uid": "9af9f826-1b55-491a-b8d9-b5cc8eb5a4de"
  }
]

Interact with player

curl -XPOST localhost:8080/player?play=true
{ "result": "ok" }

curl -XPOST localhost:8080/player?pause=true
curl -XPOST localhost:8080/player?stop=true
curl -XPOST localhost:8080/player?volume=20
curl -XPOST localhost:8080/player?prev=true
curl -XPOST localhost:8080/player?next=true

Interaction with playlist

Example call:

curl http://localhost:8080/playlist?albumList=magma
identical to curl http://localhost:8080/database?albumList=magma

Result:

[
  {
    "album": "Magma",
    "cover": "/img/a54da931-9705-4975-b4ee-65559cc7b87a.jpeg",
    "performer": "Selig",
    "uid": "fa753377-e3a0-4790-915e-be167f0822e4"
  }
]

Request all playlists

Example Call:

curl http://localhost:8080/playlist?showLists

Result:

{
  "playlists": [
    {
      "playlist": "I love Music",
      "uid": "5646f6a1-1b2a-41ac-b506-403e0f8a4750"
    },
    {
      "playlist": "Das magische Baumhaus",
      "uid": "d70c1ae9-cdf3-42fa-b0b1-140ed999b7d0"
    },
    {
      "playlist": "Die Hosen",
      "uid": "ca0ddbe1-9eb5-47ae-8c04-26a5e093beff"
    },
    {
      "playlist": "WDR",
      "uid": "37d1260e-6ba2-4761-beab-3d46d25a797b"
    },
    {
      "playlist": "German Music",
      "uid": "de02f199-fcd0-4793-b85f-ef1d216d2690"
    },
    {
      "playlist": "Rock & Pop",
      "uid": "33d29517-aa8c-4aca-9058-4c235f4de01a"
    },
    {
      "playlist": "Smooth Pop",
      "uid": "9de02f19-fcd0-4793-b85f-0ef1d216d269"
    },
    {
      "playlist": "Das magische Baumhaus - 02 - Der geheimnisvolle Ritter",
      "uid": "39e66059-7675-4a03-8e0d-7ee07853d85f"
    },
    {
      "playlist": "Das magische Baumhaus - 01 - Tal der Dinosaurier",
      "uid": "f4c40510-e236-4da6-8d56-3a54a8e10437"
    },
    {
      "playlist": "Das magische Baumhaus - 03 -  Das Geheimnis der Mumie",
      "uid": "f364c66f-b434-4bb4-8cd4-e8b0c11d34a2"
    },
    {
      "playlist": "Das magische Baumhaus - 10 - Rätsel der Geisterstadt",
      "uid": "2a216e75-876f-4d12-8e5e-df246a988593"
    },
    {
      "playlist": "Das magische Baumhaus - 06 - Gefahr am Amazonas",
      "uid": "348d8162-b252-4f38-87d9-d3d64bf1eff4"
    },
    {
      "playlist": "Das magische Baumhaus - 09 - Der Ruf der Delfine",
      "uid": "51db45b2-f25f-49fb-931d-4db9b472a69e"
    },
    {
      "playlist": "Gotteszahl",
      "uid": "78883e6c-6adc-4416-9564-fee3a08cccfd"
    },
    {
      "playlist": "Beautiful Imperfection",
      "uid": "873dd450-49f4-4e22-a359-8c8e18ad1ed0"
    },
    {
      "playlist": "Joyful (International)",
      "uid": "4f6d7c43-0985-4672-969c-a46891a9ec3f"
    },
    {
      "playlist": "Jamais Seule",
      "uid": "c3aa110b-ed29-4793-a27d-68927a26292f"
    },
    {
      "playlist": "159/Nacht der Tiger",
      "uid": "b5daec63-78dc-48d0-a8f7-357fab629485"
    },
    {
      "playlist": "Magma",
      "uid": "563a0d11-81bf-4cbb-8a5d-82982d4153c2"
    },
    {
      "playlist": "Delta Machine (Deluxe)",
      "uid": "da5d232f-97a0-4dc3-a9e5-df485028a4fb"
    },
    {
      "playlist": "Moon Safari",
      "uid": "7f4217db-806f-4f72-b645-1af27c31761a"
    }
  ]
}

Request a playlist by ID

Example Call:

curl http://localhost:8080/playlist?show=c3aa110b-ed29-4793-a27d-68927a26292f

Result:

[
  {
    "album": "Jamais Seule",
    "cover": "/img/9744c81a-17d5-4c1c-bee8-101c53148f17.jpeg",
    "performer": "Loane",
    "titel": "Petit Bonheur",
    "trackNo": 1,
    "uid": "9744c81a-17d5-4c1c-bee8-101c53148f17"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/d743d2b9-7cd0-4298-8223-800211c884cb.jpeg",
    "performer": "Loane",
    "titel": "Jamais Seule",
    "trackNo": 2,
    "uid": "d743d2b9-7cd0-4298-8223-800211c884cb"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/ee7d4b05-d25a-4cd2-b6d7-728234eb2aa4.jpeg",
    "performer": "Loane",
    "titel": "Aimé",
    "trackNo": 3,
    "uid": "ee7d4b05-d25a-4cd2-b6d7-728234eb2aa4"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/d693b711-8f85-448f-94c9-a25315c88ae8.jpeg",
    "performer": "Loane",
    "titel": "Contre toi (version album)",
    "trackNo": 4,
    "uid": "d693b711-8f85-448f-94c9-a25315c88ae8"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/8cbf7bcb-3916-4225-8b6a-76e603f67c88.jpeg",
    "performer": "Loane",
    "titel": "Ce Que J'ai Connu",
    "trackNo": 5,
    "uid": "8cbf7bcb-3916-4225-8b6a-76e603f67c88"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/fdb4e6da-8528-4e72-9b89-7843c7a1ec1b.jpeg",
    "performer": "Loane",
    "titel": "Comme Si Quelqu'un",
    "trackNo": 6,
    "uid": "fdb4e6da-8528-4e72-9b89-7843c7a1ec1b"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/5985649b-66a2-4343-9a4f-64cd74ded731.jpeg",
    "performer": "Loane",
    "titel": "Femme Qui Court",
    "trackNo": 7,
    "uid": "5985649b-66a2-4343-9a4f-64cd74ded731"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/e55129be-162c-4384-bd89-439bce419ed9.jpeg",
    "performer": "Loane",
    "titel": "Maman",
    "trackNo": 8,
    "uid": "e55129be-162c-4384-bd89-439bce419ed9"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/dd370f88-9f97-4d2f-92fd-10cf2757455a.jpeg",
    "performer": "Loane",
    "titel": "Ailleurs",
    "trackNo": 9,
    "uid": "dd370f88-9f97-4d2f-92fd-10cf2757455a"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/48b20a74-0480-4a87-8a19-f432e1ba1f27.jpeg",
    "performer": "Loane",
    "titel": "Danser",
    "trackNo": 10,
    "uid": "48b20a74-0480-4a87-8a19-f432e1ba1f27"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/2467f1a1-88dc-4782-bb5d-82f0b18df6b8.jpeg",
    "performer": "Loane",
    "titel": "Je M'allège",
    "trackNo": 11,
    "uid": "2467f1a1-88dc-4782-bb5d-82f0b18df6b8"
  },
  {
    "album": "Jamais Seule",
    "cover": "/img/ee5fb664-9cbf-40ed-954c-7043f0926049.jpeg",
    "performer": "Loane",
    "titel": "T'arrêtes Pas",
    "trackNo": 12,
    "uid": "ee5fb664-9cbf-40ed-954c-7043f0926049"
  }
]

Change active playlist to playlist with given ID

Example Code:

curl http://localhost:8080/playlist?change=c3aa110b-ed29-4793-a27d-68927a26292f

Result:

{"result": "ok"}

Interact with wifi configuration

curl -XPOST "http://localhost:8080/wifi?ssid=hallo&psk=012345678"

Result:

{"result": "ok"}

SNC Communication

More information

about the simple network communication system at

SNC Project Page

SNC communicates on UPD with a system wide brocker.

Information posted by the audio server

Broadcast Information about the actual player status:

{
  "SongBroadcastMessage": {
    "album": "Delta Machine (Deluxe)",
    "cover": "/img/e42332fb-568d-4e91-a434-cfa61d6d0cd5.jpeg",
    "curPlaylistID": "6269a0f9-ab40-4312-a9af-67f32f1d7e10",
    "loop": false,
    "paused": false,
    "performer": "Depeche Mode",
    "playing": true,
    "playlistID": "6269a0f9-ab40-4312-a9af-67f32f1d7e10",
    "position": 9221,
    "shuffle": false,
    "songID": "e42332fb-568d-4e91-a434-cfa61d6d0cd5",
    "title": "My Little Universe",
    "volume": 80
  }
}

Information received by the audio server

Broadcast Information about the wifi status.

{
  "SsidMessage": [
    "netwprk A",
    "network B",
    "network C",
    "network D"
  ]
}

Direct message to start an audio file (name driven)

{
  "CmdMsg": "start",
  "data": {
    "album": "Moon Safari",
    "position": 0,
    "title": "Talisman"
  }
}

Direct message to start an audio file (ID driven)

{
  "CmdMsg": "start",
  "data": {
    "albumID": "6269a0f9-ab40-4312-a9af-67f32f1d7e10",
    "position": 0,
    "titleID": "e42332fb-568d-4e91-a434-cfa61d6d0cd5"
  }
}

Direct message to stop an audio file

{
  "CmdMsg": "stop"
}

Interact with Filesystem

Play a file externally from unique ID

mplayer http://localhost:8080/audio/716ede52-1945-4975-802f-0168808effec.mp3

Request a plain playlist by unique ID

curl http://localhost:8080/pl/fa753377-e3a0-4790-915e-be167f0822e4.m3u

Tag file configuration

generate file

::<title>