-
Notifications
You must be signed in to change notification settings - Fork 6
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
More detailed instruction #2
Comments
Could you be a bit more specific in what you're looking for? The "how to use" section is step by step on how to get things running. I'm more than happy to add additional information, but I'm not sure what exactly you're looking for |
He might mean weather you are going to publish it on DockerHub? |
Hey, sorry my english is no t so good... If i use docker-compose with docker file.. which file i should edit? |
so the docker-compose is running http://xxx.xxx.xxx.xxx:3333/wsdl there is only a white site could i see a log ... to analyze whats the problem |
I think a more detailed how-to might help. I am struggling with quite a few point:
Since I couldnt find it I tried via docker-compose
|
I've spent a bit of time looking at this and have a few answers to the above.
Anyway, I've tried all these, and still not working. |
@jmt-gh, what sort of response should we be getting from the URLs: https://soap.server.com/wsdl or https://soap.server.com/manifest? I get a 200 response but 0 bytes return from the /wsdl, and this response from the /manifest: {
"schemaVersion": "1.0",
"endpoints": [
{
"type": "reporting",
"uri": "https://soap.server.com/wsdl/playback/v2.1/report"
}
]
} Seems like there should be a bit more in the wsdl response at least. By the way, if I use this for the env variable in the docker-compose:
The return from the manifest shows this:
When I remove the "", it displays correctly. |
should the abs uri only a http or could be https? |
i get {"schemaVersion":"1.0","endpoints":[{"type":"reporting","uri":"https://soabs.xxxx.de/wsdl/playback/v2.1/report"}]} |
I'd have thought whatever you have set up. Mine is https, so that's what I've put in. |
ok me too.. but the sonos app can´t read the libary |
Mine can't either, I get a connection error. There's no feedback on the log of the container, so it's quite hard to debug it. |
schade eigentlich wirkte das Projekt vielversprechend |
@jt196 did you ever get this working? |
Hacked away at it for half a day but never got it to work. I could add the service to Sonos by unchecking "Support Manifest File", that's about as far as I got. There were no logs on the Docker container when I tried to access it in Sonos, and Sonos itself have disabled a lot of the log checking functions in their speakers. I went a little through their docs, but had little success I'm afraid. |
Hi! |
@eendenhart no idea, but maybe post how you got so far here so maybe we can get a solution together? 404 is just a not found error, so likely you've entered the audiobookshelf URL incorrectly. |
I think the url is correct; I checked many times. What i did:
I got the error |
I've put a bit of time into this today and got a little further but still not working. First of all I turned on debugging in the servert.js file by uncommenting line 37. Now we can see incoming requests and how the SOAP server responds. Now for what I had been doing wrong:
The first few requests go through and seem to make it to audiobookshelf, however I'm hitting a wall with the error: TypeError: Cannot read properties of undefined (reading 'id') Edit: However, it still does not play any of the books, saying Sonos is unable to connect. I suspect the function getMediaMetadata on line 16 of sonos-service.js needs completing. |
@robwalster I've played around a little bit and made no progress at all. Some pointers that might be useful.
FROM node:16-alpine
ENV NODE_ENV=production
WORKDIR /app
COPY ["package.json", "package-lock.json", "./"]
RUN npm install --production && npm install -g nodemon
COPY . .
CMD ["nodemon", "server.js"]
async function buildLibraryMetadataResult(res) { if (!res || !res.results) { return null; }
Edit, 'scuse the crappy formating, didn't want to paste the whole lot here but the details tags don't play well with code. |
OK it appears to be an issue with the buildLibraryMetadata function. This is an object being fed into the loop: {
id: '70edd71c-0088-49b8-8ea5-210c8049ce09',
ino: '370123',
oldLibraryItemId: 'ab_vm3xuee9z2z7krgw7q',
libraryId: '96cfd553-cc4e-4a9b-9f67-866838eb62d7',
folderId: '92fb9312-b5e2-4aae-b1d4-96fd7e521299',
path: '/audiobooks/C.S. Forester/The Good Shepherd',
relPath: 'C.S. Forester/The Good Shepherd',
isFile: false,
mtimeMs: 1594763569000,
ctimeMs: 1641490864998,
birthtimeMs: 1641490864998,
addedAt: 1646732242162,
updatedAt: 1646820362213,
isMissing: false,
isInvalid: false,
mediaType: 'book',
media: {
id: '43c51480-1e3c-4b50-88b7-b7f045065474',
metadata: {
title: 'The Good Shepherd',
titleIgnorePrefix: 'Good Shepherd, The',
subtitle: null,
authorName: 'C.S. Forester',
authorNameLF: 'Forester, C.S.',
narratorName: 'Edoardo Ballerini',
seriesName: '',
genres: [Array],
publishedYear: '2020',
publishedDate: null,
publisher: 'Podium Audio',
description: 'The Good Shepherd is now a major motion picture, Greyhound , scripted by and starring Tom Hanks, directed by Aaron Schneider, and produced by Gary Goetzman. A convoy of 37 merchant ships is ploughing through icy, submarine-infested North Atlantic seas during the most critical days of World War II, when the German submarines had the upper hand and Allied shipping was suffering heavy losses. In charge is Commander George Krause, an untested veteran of the US Navy. Hounded by a wolf pack of German U-boats, he faces 48 hours of desperate peril trapped the bridge of the ship. Exhausted beyond measure, he must make countless and terrible decisions as he leads his small fighting force against the relentless U-boats.',
isbn: null,
asin: '1774244152',
language: 'English',
explicit: false,
abridged: false
},
coverPath: '/audiobooks/C.S. Forester/The Good Shepherd/The Good Shepherd - 001.mp3',
tags: [],
numTracks: 17,
numAudioFiles: 17,
numChapters: 33,
numMissingParts: 0,
numInvalidAudioFiles: 0,
duration: 28401.437333,
size: 454976356,
ebookFormat: null
},
numFiles: 17,
size: 454976356
} The function expects:
None of these exist in the object, so no wonder it's not returning any results. According to the API docs, these should be returned in library > library item > book But for some reason, it's not doing that. The reason I can see, looks like expected behaviour, getting library items will not retrieve the expected data. The audioFiles and the metadata.authors, metadata.narrators simply aren't there. |
With the data logging, this amended function will return a soap style object in the console: async function buildLibraryMetadataResult(res) {
if (!res || !res.results) {
return null;
}
let libraryItems = res.results;
let total = count;
let mediaMetadata = [];
for (const libraryItem of libraryItems) {
var mediaMetadataEntry = {
itemType: "audiobook",
id: libraryItem.id,
canPlay: true,
canResume: true,
title: libraryItem.media.metadata
? libraryItem.media.metadata.title
: null,
summary: libraryItem.media.metadata
? libraryItem.media.metadata.description
: null,
author: libraryItem.media.metadata.authorName,
narrator: libraryItem.media.metadata.narratorName,
albumArtURI: `${ABS_URI}${libraryItem.media.coverPath}?token=${ABS_TOKEN}`,
};
mediaMetadata.push(mediaMetadataEntry);
}
return {
getMetadataResult: {
count: count,
total: total,
index: 0,
mediaCollection: mediaMetadata,
},
};
} But I still can't get it to show the items... |
I've tried a bunch of stuff and still can't get it to work. The soap server is working correctly, and returning a correct response, with a properly structured soap xml. I've tested this on SoapUI - even to the point where I'm using the stock responses in the docs here and they still don't work. I'm wondering at this point whether the customsd form is being filled incorrectly. It's polling the server and SoapUI, but not happy with the result. Maybe unchecking the "Support Manifest File" is causing the issue? I can't add the service if I don't do this. |
I've put the updated/worked on files in a new repo. They should maybe get some folks a bit further along the line. I've also added notes about testing, debugging etc. Still can't get it working though! |
👋 Hello all. Sorry for not being particularly active on this project. I can't commit to helping resolve everything here, but I'll try and get things up and running locally again and see if there are any glaring issues I find. A few things to note:
|
tl;dr: I was able to get things up easily still, but not necessairly fully funcitonal and running. The latter due to API changes in ABS. OK, made some progress debugging. A few things:
Some initial things I had to change to make some progress:
I'll keep poking around, as well as update this repo with the new "debugging support" I've added to a few of thes methods to help. My gut is telling me there's a decent chunk of work that needs to be done here to get it working though, or at least working to the level it was prior. That said, the initial issues that were had in this issue definitely weren't related to this, and were most likely just environmental set up issues. |
Some more progress: Had to comment out some more due-to-API-changes fields:
This brings SONOS to actually trying to play the file, but throws an error modal in the app that says "Part01.mp3 is no longer available on audiobookshelf" which is interesting. Though the soap part of the server is actively running and participating at this point, as indicated by these messages in the docker output:
which is great |
ABS API reference: https://api.audiobookshelf.org |
OK. More progress. I have audio streaming to the speakers again. This is the function that actually generates the URL telling the speaker where to fetch the audio from. As with the other breakages, this is no longer valid, in a variety of ways.
The path needed now resembles something like: This brings up a couple things:
|
Number 3 doesn't need to happen. It's available in the libraryItem as the |
Anddd improved logging has been put in place. At least in the sense that there should now be some level of logging for most things -- if they are useful or not.. that's a different story haha. Please feel free to give all of this with the new readme a shot, and let me know how things go. |
hey nice.. step by step... if i want to open audiobookservice in sonos ... i get the message: Durchsuchen der Musikdateien nicht möglich but the logs... generate a information from my audiobookshelf |
This occurs when the Custom Service Descriptor is set up properly, but the app doesn't received anything when you browse to it. Most likely either the configuration in the docker-compose file is incorrect, or your speakers are unable to communicate with the server / application. If you post the log output here it could potentially help diagnose the issue. You'll want the full log output of you opening the app, clicking the ABS entry in the sonos app, etc. I would also double check the environment configurations are correct in the docker-compose.yml file. The values should not be wrapped in quotes, and you need to ensure the ABS library ID and API key are accurate |
OK dude, just retrying this. FYI The As per @mxdalchau and my previous experience, I'm getting an "Unable to browse music" message. I've tested this now on a smaller library as well as a test one with just 4 items. Neither works. The logs produce a list of library items. Here's my logs:
I can also confirm that if I make a Postman GET request to the ABS url with the login credentials, it returns a list of library items. So the request for information is producing a list of metadata, but that for whatever reason isn't displaying in the Sonos app. Incidentally, I finally ran the Sonos v2 upgrade, thinking this might be the culprit. It seems to have helped adding the service with the "support manifest file" checked, but still producing this error. I've also played around with changing the SOAP_URI variable, but adding /wsdl to the end doesn't seem to solve it. Incidentally, the list of library items is produced regardless of whether the SOAP_URI is entered correctly, but the Here's my docker compose settings if you notice any glaring errors. No quotes have been used here: version: "3.8"
services:
audiobookshelf-sonos:
build:
context: .
dockerfile: Dockerfile
container_name: audiobookshelf-sonos
environment:
- SOAP_URI=https://soap.domain.com # also tried with /wsdl
- ABS_URI=https://audiobooks.domain.com
- ABS_LIBRARY_ID=<my_library_id>
- ABS_TOKEN=<redacted>
- LOG_LEVEL=debug # set to debug, info, warn, error
ports:
- 3333:80
volumes:
- ./sonos.wsdl:/app/sonos.wsdl sonos.wsdl: <wsdl:service name="Sonos">
<wsdl:port name="SonosSoap" binding="tns:SonosSoap">
<soap:address location="https://soap.domain.com"/> <!-- UPDATE WITH SOAP_URI -->
</wsdl:port>
</wsdl:service> Note, also changing this to /customsd.htm
This adds to the Sonos services without erroring out. As it's working on your set up, I have a feeling it's likely something like a config error. I don't know whether this helps but here's some results to GET requests to the soap URIs. /manifest: {
"schemaVersion": "1.0",
"endpoints": [
{
"type": "reporting",
"uri": "https://soap.jamestorr.com/playback/v2.1/report"
}
]
} /wsdl: 200 response, empty. If I make a POST request with the body: <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:son="http://www.sonos.com/Services/1.1">
<soapenv:Header/>
<soapenv:Body>
<son:getMetadata>
<son:id>root</son:id>
<son:index>0</son:index>
<son:count>100</son:count>
</son:getMetadata>
</soapenv:Body>
</soapenv:Envelope> To the URL: <?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.sonos.com/Services/1.1">
<soap:Body>
<getMetadataResponse xmlns="http://www.sonos.com/Services/1.1">
<getMetadataResult>
<count>85</count>
<total>85</total>
<index>0</index>
<mediaCollection>
<itemType>audiobook</itemType>
<id>74162736-8a64-4b10-a0fc-4c431b398e47</id>
<canPlay>true</canPlay>
<canResume>true</canResume>
<title>Live At the Purple Onion</title>
<summary xsi:nil="true"></summary>
</mediaCollection>
--- continues for the rest of the library ---
</getMetadataResult>
</getMetadataResponse>
</soap:Body>
</soap:Envelope> Lots of info here, hope it helps. What might be useful would be:
|
Thought I'm gonna tell you how exactly I got this running pretty quickly, maybe it helps.
|
Was there any solution to this? Doesn't seem like it is doing for me either. |
I solved this by converting to /playback without any prefix. |
What exactly do you mean here? |
There is EXPRESS_APP.post(`${SOAP_ENDPOINT}/playback... in the server.js source file. I removed the SOAP_ENDPOINT part as the calls were not registering for me otherwise |
@fayeinmay , glad to hear you've got it working, and thanks for sharing the steps you took. Definetly makes me feel like I've got a bit of a sanity check that things work outside of my environment haha. The reason you've needed to make those changes is because you didn't register the secure URL in the same way it's laid out in the README:
In the end, you end up with the same result, but repo currently assuming you defined the URL with appended with the |
I'd say you're right, because I did redo the setup step twice and could've forgotten to append /wsdl, but I only needed to change the path on the http calls, not on the soap calls. Except you say for soap sonos does auto apply /wsdl as a suffix. |
haha I´m very stupid.... it doens´t work for me... version: '3.8' services:
proxy:
} manifest: on sonos Durchsuchen nicht möglich... audiobookshelf von docker..... |
@mxdalchau I doubt it! The only thing I think you're doing slightly differently is this:
instead of this:
I can't really think of any other reason why my config/set up isn't working. I'm on the most recent version of Sonos (v2), Audiobookshelf is up to date as well. I've tried removing and re-adding the service multiple times, tried several different speakers, tried multiple variations of the URIs. The only other points I can think of are:
I'm running mine behind a RP like @fayeinmay, so that shouldn't be the culprit... I'm stumped. |
[2024-01-26T18:21:58.935Z] [DEBUG] [buildLibraryMetadataResult - /app/utils.js:116] libraryItem for mediaMetadataEntry: {"id":"d3d47f08-6aaf-4278-a677-4af3a36c6e41","ino":"13510803856505204","oldLibraryItemId":null,"libraryId":"52a3f946-a069-4e9c-98a6-a91719a39b8d","folderId":"4b1f9440-c4c3-43fc-8079-1a2d771954a5","path":"/MaxKusData/Musik/Hoerspiele/John Sinclair Sonderedition/Horror-Disco - John Sinclair - Promis lesen Sinclair (Ungekürzt)","relPath":"John Sinclair Sonderedition/Horror-Disco - John Sinclair - Promis lesen Sinclair (Ungekürzt)","isFile":false,"mtimeMs":1700421236950,"ctimeMs":1703561864075,"birthtimeMs":0,"addedAt":1700421123319,"updatedAt":1704063629682,"isMissing":false,"isInvalid":false,"mediaType":"book","media":{"id":"07efccc3-c54d-4e30-9ff4-65078c7e561c","metadata":{"title":"Horror-Disco - John Sinclair - Promis lesen Sinclair (Ungekürzt)","titleIgnorePrefix":"Horror-Disco - John Sinclair - Promis lesen Sinclair (Ungekürzt)","subtitle":"John Sinclair - Promis lesen Sinclair (Ungekürzt)","authorName":"Jason Dark","authorNameLF":"Dark, Jason","narratorName":"","seriesName":"","genres":[],"publishedYear":"2023-11-17","publishedDate":null,"publisher":"Lübbe Audio","description":null,"isbn":null,"asin":null,"language":null,"explicit":false,"abridged":false},"coverPath":"/MaxKusData/Musik/Hoerspiele/John Sinclair Sonderedition/Horror-Disco - John Sinclair - Promis lesen Sinclair (Ungekürzt)/cover.jpg","tags":[],"numTracks":60,"numAudioFiles":60,"numChapters":60,"numMissingParts":0,"numInvalidAudioFiles":0,"duration":11536.378773999997,"size":200521291},"numFiles":63,"size":201067798} |
Yeah mine is displaying the metadata too, just no result in the app. |
After initial set up with a coinnection from the sonos app on my phone to abs-sonos I do not see any traffic come from speakers to abs-sonos when I select the application and I get a "unable to browse music" error Initial adding of the app via sonos app:
I can ping from the server to the speakers no problem and TLS is working properly. When I browse to /manifest I get a URL When I
I am not sure where you all are getting the metadata from, I poured over this thread but seem to have missed how you are getting that output from utils.js. If this is the current state let me know, I'll keep tinkering on my end. |
I made some progress on that. I get some output in the list and can play at least some of my audiobooks. My library is quite big which caused no results to show up. Also, progress tracking is not working for me so far. I'll try to get this in shape over the next days and open a PR. |
@dstapp would you be able to share your config with us (wsdl, Sonos service, version, env variables) as quite a few of us are stuck on not getting any items to display in the Sonos app. |
@jt196 Sure thing. Have a look here for my changes: #8 Setup wise, my SOAP_URI env var is in format of https://xyz/wsdl, my WSDL adjustment also includes "/wsdl" at the end, just the same. The rest worked for me with the instructions provided in the README.md. Please also see the caveats in my PR (200 file limit). Btw, m4a/m4b audiobooks indeed are a problem. While I can play them back initially, as soon as there is a progress stored to pick up the playback position from, it does not work. Seems like seeking is not implemented on Sonos side. |
I finally got https working properly on my domain, so I couldn't wait to get this app working. Sadly, easier said than done. I'm using @dstapp version, since it's had more recent changes. At this point, I'm trying to figure out where my issue lies. I'm beginning to think it may be within Sonos's side of things. The Custom Service Descriptor, set up at :1400/customsd.htm, I found is only successful if I designate it as a Container Type of "Sonos Sound Lab". After doing that, I can see the descriptor set up as "AudioBookShelf", per my naming, in the Sonos Windows app. I can't find labs on the mobile app. Though I see it in the Windows Desktop app, clicking on the service does nothing. Trying to check the other side of things, when I visit the URI in my browser displays the message "Cannot GET /". Appending "/wsdl" to the URL shows only a blank screen. Since things are clearly not working, I'm unsure where the issue is. Has anyone gotten this application to work recently, with progress and adjustments likely made to both Sonos and AudioBookShelf since? |
I've begun work on my own implementation in ruby which I have working on my system. I'll upload the project soon once I get some time to write up a readme. But in the meantime Sonos removed the ability to add services through the customsd end point with the new updates earlier this year (although it should still work on S1 systems). You now need to register your service via their developer portal: https://developer.sonos.com/s/?language=en_US You also can no longer register the service (even in development) with a local address and need a domain name so you'll need to set up a reverse proxy if you haven't already. Once it's registered via their developer portal it takes maybe an hour to show up as an available service on your system via the "Add services" screen. |
@robwalster As you mentioned, the services can no longer be registered on the app, would you mind giving a quick overview of the required fields on the developer portal that you had to fill in to get this working? As they are slightly different from the CDS route directly on the Sonos device. Thanks in advance. |
Commenting this thread to get notified when you will publish your project and have a readme ready. |
@awdel sure, First off, make sure your clicking to sign in to create a new content service and NOT a product. (I myself have just been caught out by this) Then I have the fields filled out as follows: Page 1 - General InformationGeneral Information
URL Schemes Website/Social Media URLs Stream Quality Page 2 - Sonos Music APILabels
End Points
Authentication
Page 3 - Brand AssetsService Logo Full Logo Badge Page 4 - Localization ResourcesLocalisation File Service Summary, Service Description, Service Promo Explicit Description Filter Page 5 - Integration CapabilitiesLeave All Blank Page 6 - Image Replacement RulesLeave All Blank Page 7 - Browse OptionsLeave All Blank Page 8 - Search CapabilitiesLeave All Blank Page 9 - Content ActionsLeave All Blank Page 10 - Service Deployment SettingsLeave everything as the default, Except Sonos ID Which needs to be the ID of your system Page 11 - Service ConfigurationFollow instructions on the page Page 12 - Object StorageFollow instructions on the page |
@robwalster Thank you so much for the detailed instructions, I really appreciate the time you took for this. I am still having an issue where the Sonos Integration does not connect to the server and am wondering about some ambiguity in the original server instructions regarding the URLs for specific settings if anyone can help: Should the URL for the SMAPI Endpoint in the Sonos Developer Portal be https://[mydomain]/wsdl or just https://[mydomain]? Additionally, is there an obvious and easy way to determine if my server is set up correctly, prior to setting up the Sonos Integration? When I navigate to https://[mydomain]/wsdl in my browser I get a 200 but no data in the response, but am unsure if this is what I should be seeing. Thank you in advance for anyone who is able to help with this. |
It's been a while since I run this project so not too sure on the docker env vars. But for your other questions, the SMAPI endpoint in the dev portal should just be https://[my domain] I have been using SOAPUI for testing. That should give you an idea if your server is working correctly as it will be able to pick up the wsdl file and generate test calls. |
Thanks very much @robwalster, I'll try that. |
I've been testing with SOAPUI and using the Endpoint Explorer I successfully get a result when hitting my /wsdl endpoint. Passing in a "getMetadata" body works both internally and on my external domain and I see the successful logs in docker. However, when trying to create a new SOAP project using the same endpoint I get a "Premature end of file" error, although loading the "sonos.wsdl" manually in to SOAPUI work fine. It seems as though the server is not serving the wsdl schema correctly, so SOAPUI is not able to build the list of operations. I assume this is why the Sonos Integration is also failing to load. As I am not accustomed to using SOAPUI, there is a distinct possibility that I have not set it up correctly, so if anyone is able to give me any pointers to help debug, it would be greatly appreciated. Thanks. |
Slight update: If I append a query string of ?wsdl in the browser so that the url is https://[mydomain]/wsdl?wsdl then I can see the full WSDL schema. In addition to this, it made sense to me that the soap:address in the sonos.wsdl file should be https://[mydomain]/wsdl as that is the endpoint needed for the APIs. Then if I use the same url with the query string (https://[mydomain]/wsdl?wsdl) when creating a new SOAP project in SOAPUI, it successfully builds the list of operations and I can successfully call my endpoints and return all the expected data. The final step is trying to understand why the Sonos Integration fails every time I try to add it to my services in the app. |
Hey,
could you write a more detailed instruction please?
thanks :)
The text was updated successfully, but these errors were encountered: