jlhughes 0 Posted April 15, 2022 Posted April 15, 2022 Hello!, a fellow dunce here. This is my first time post and I must admit to you that I am loosing my marbles and going completely demented at something which is probably entirely simple and I have simply lost the plot. Here's my trouble: http://172.16.10.34:8096/emby/Sessions/SESSION/Playing?ItemIds=ITEM&PlayCommand=PlayNow&api_key=API ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ I capture the ItemID via: http://172.16.10.34:8096/emby/Sessions?&api_key=API I use the ID underneath NowPlayingItem. The item in question is a TV channel that I would like to automate to a simple push button on OpenHAB which I have successfully connected together with the Java post, now I'm left with working out why the post is not executing the itemID or any other media ID for that matter. I get it, it's probably something simple and I will feel like a silly bugger, but I would really appreciate the assistance from someone that knows more about this then i
jlhughes 0 Posted April 15, 2022 Author Posted April 15, 2022 Hello! it's that dunce again. I FINALLY WORKED OUT that there were issues with the curl command and OpenHAB. I have since used a sneaky way to launch a bash script! and it's working dandy. Alas, thank you for thinking of helping me
jlhughes 0 Posted April 15, 2022 Author Posted April 15, 2022 Actually, if I may bother the community for a moment longer. The current workaround is a bit of a pain and it would be wonderful to have a quick explanation of where I went wrong with my URL? If it's possible to get the correct way to do it! I'd be able to automate so much more.
Luke 40096 Posted April 15, 2022 Posted April 15, 2022 Hi, I don't quite understand your question so please provide more detail. Thanks.
jlhughes 0 Posted April 16, 2022 Author Posted April 16, 2022 Sure! Essentially I was running this HTTP request as a post using a http post method from OpenHAB. The issue being that the actual URL for whatever reason does not work, I had to change the whole method of delivery as a curl command in a bash script. Did I do something wrong with the URL? Is there a way to push a http request to my emby for it to work without using a json like above?
Luke 40096 Posted April 16, 2022 Posted April 16, 2022 Without looking at exact examples of specifics I just don't know the answer, sorry.
Cheesegeezer 3102 Posted April 17, 2022 Posted April 17, 2022 On 16/04/2022 at 11:04, jlhughes said: Sure! Essentially I was running this HTTP request as a post using a http post method from OpenHAB. The issue being that the actual URL for whatever reason does not work, I had to change the whole method of delivery as a curl command in a bash script. Did I do something wrong with the URL? Is there a way to push a http request to my emby for it to work without using a json like above? I use hercules to check that commands and headers are sent correctly and can read the response. I use it with Vera. I know that there are usually extra header and http versions that should be included and also command suffixes.
jlhughes 0 Posted April 18, 2022 Author Posted April 18, 2022 Hellooooo! it seems I keep answering my own questions by trying to answer other questions with a lead in to resolving my own troubles. I have entirely resolved the issue by using this on my OpenHAB script's: var Exec = Java.type("org.openhab.core.model.script.actions.Exec"); Exec.executeCommandLine("/etc/openhab/scripts/playmedia.sh", "%SESSION-ID%","%MEDIA-ID%"); This directs to playmedia.sh: curl -X POST -F 'ItemIds='$2'' -F 'PlayCommand=PlayNow' 'http://IP:PORT/emby/Sessions/'$1'/Playing?api_key=APIKEY' I really hope this helps someone! It is a wonderful way around resolving the issues with script execution and parameters to run with Emby's API.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now