Taurec 60 Posted April 25, 2016 Share Posted April 25, 2016 Hi, my Emby Server is running at a seperate computer at the local netwok. (on this Computer is a Plex Server running as well) My "work" computer use Rainmeter for all information as Skin. (e.g. status of connected User on Plex, Status of the router, status of my NAS, Network traffic etc.) For the status of the connected User by Plex i as a website session/status. With regex i am able to get the information. Is there a possibility to do this simular with Server ? Hope somebody can help me. cu Taurec greeting from germany Link to comment Share on other sites More sharing options...
chef 3746 Posted April 25, 2016 Share Posted April 25, 2016 (edited) Yes this is possible. It has been a while since I wrote rainmeter configs, but what you would do is create anew httpclient, authenticate an admin user with emby api, then request session information objects which hold all the relevant information you want. But, I am not sure how to create anew httpclient in rainmeter. What you might have to do is write an external app which writes information in a rainmeter configuration style file, which you have rainmeter read from and update the skin on your desktop. I Like I say it has been a while since I messed with rainmeter, but it is possible. Maybe a bit resource hungry, but rainmeter is a bit resource hungry over all anyway. For more information on user authentication in the api, look at github, or maybe we could colabarate on a method... Edited April 25, 2016 by chef Link to comment Share on other sites More sharing options...
Taurec 60 Posted April 27, 2016 Author Share Posted April 27, 2016 Hello Chef, thx for your information. OK, i understand that at the moment a login as "admin user" are neccesary to get some information via api. Maybe it is a idea for an Plugin to create a Status page (e.g. http://localhost:8096/emby/web/status.html with common information like: Server: Taurecs Emby Version: Version 3.0.5932.0 Started at: 26.04.2016 07:30 running on: Qnap TVS-871T User online: 3 x User is watching: goodvideo.mkv x User is watching: betterTVShow.avi x User is downloading: ineedvideo.mp4 At the forum i can read a lot of requests for some Status information or User activity, may it is time to create this :-) (please don't tell me something about the report/activity list, this is nice to have but not really useful and not complete) Hope a plugin will come :-) cu Taurec Link to comment Share on other sites More sharing options...
chef 3746 Posted April 29, 2016 Share Posted April 29, 2016 (edited) @@Taurec I downloaded the rainmeter API to build an emby plugin for rainmeter. I just have to read through the templates and API docs to figure out what I am supposed to do... But we should be able to post emby I information in a rainmeter widget. Just not sure how we should authenticate the user to get the info (be it auto sign in, or text boxes each time). Looks pretty straight forward. Edited April 29, 2016 by chef Link to comment Share on other sites More sharing options...
chef 3746 Posted May 1, 2016 Share Posted May 1, 2016 (edited) First attempt resulted in utter failure. The rainmeter API is hard to get a grip on. Also it is based in .net 2.0, so i am not sure what happens when I use 4.5 in my dev environment. Edited May 1, 2016 by chef Link to comment Share on other sites More sharing options...
Taurec 60 Posted May 2, 2016 Author Share Posted May 2, 2016 @@chef Perhaps it is easier to generate a file only with a plugin. Then to use with rainmeter the file parser .cu TaurecP.S. I 'm really surprised that you started . Great. Link to comment Share on other sites More sharing options...
chef 3746 Posted May 2, 2016 Share Posted May 2, 2016 (edited) Okay. I can create a file with session info. That is super easy. But, if you are monitoring your server from a remote location (ie. Your office), it will difficult to parse the file. I was looking at the web parser plugin for rainmeter, it seems to parse HTML/XML style documents. Just so happens that emby will return JSON and XML... Just have to figure out the URL with all the proper headers to request info. I am use to using the API which creates the URLs for you, so this should be interesting... I will be back! Edited May 2, 2016 by chef Link to comment Share on other sites More sharing options...
chef 3746 Posted May 3, 2016 Share Posted May 3, 2016 So I got really close using the web parser plugin for rainmeter. I had to relearn RegExp again. It has been a while... Cool thing is that it is a skin for rainmeter that treats the emby api returns like an ATOM feed. But, it isn't quite working yet... Link to comment Share on other sites More sharing options...
Taurec 60 Posted May 3, 2016 Author Share Posted May 3, 2016 Hello Chef, I'm not really a programmer but if I can help with the regex, then let me know (source and request info) Speaking atom feed, what do you think of the idea of a plugin for an RSS feed?An RSS feed for users (with the information of the newly added media) and a RSS feed for administrators (the information mentioned above + newly added media)For Rainmeter there are enough rss feed reader. cu Taurec 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted May 3, 2016 Share Posted May 3, 2016 (edited) One of the issues I have come across is how to rewrite the RegExp to read the XML returned from the API. Once that is sorted I would suspect that the sky is the limit as far as what each rainmeter widget could post on the screen. Each user will have create their own API key in the server, the. Use that key when editing the rainmeter skin. It is a little more advanced, but the settings file can have a written walk through to help the editing process. Edited May 3, 2016 by chef Link to comment Share on other sites More sharing options...
chef 3746 Posted May 4, 2016 Share Posted May 4, 2016 (edited) @@Taurec Great News! I have finally been able to pull information from the emby API and display it in rainmeter!! Woohoo! But, I just have to figure out how to make the rainmeter skin dynamic, so it lists all or none of the users and the information attached. This is great! Edited May 4, 2016 by chef Link to comment Share on other sites More sharing options...
Taurec 60 Posted May 4, 2016 Author Share Posted May 4, 2016 @ Chef thats really great news :-) At Rainmter it is possiblle to change the skin (more or less all variablefor the skin) depend on compare values e.g. ( [Mea_Port] Measure=String String=#Port# IfMatch=1241 IfMatchAction=[!SetOption meterBtn01 MeterStyle styleBtnOn] IfNotMatchAction=[!SetOption meterBtn01 MeterStyle styleBtnOff] IfMatch2=1242 IfMatchAction2=[!SetOption meterBtn02 MeterStyle styleBtnOn] IfNotMatchAction2=[!SetOption meterBtn02 MeterStyle styleBtnOff] DynamicVariables=1 Mea_Port = my Name of my function (in this case measure Port of a tcpip connection) Measure String = means a string as source String= source to check IfMatch = compare value IfMatchAction = action if compare condition true IfNotMatchAction = action if compare condition false for further information: the forum of Rainmeter are a good place to find some solution :-) If you want i can try to help you. cu Taurec P.S. can you show what information and witch format are available from the api? Link to comment Share on other sites More sharing options...
chef 3746 Posted May 4, 2016 Share Posted May 4, 2016 Yes! I will post the current skin and the http calls to the API. Once you see them, I think you'll see how easy it actually is. I am having problems getting more then one user to post in the meter. Link to comment Share on other sites More sharing options...
chef 3746 Posted May 4, 2016 Share Posted May 4, 2016 (edited) Okay @@Taurec In a couple of minutes I will post the meter skin so you can see it. I think it sounds more complicated then it is, but I am not even sure what kind of code I am writing with this rainmeter skin... Lol! Edited May 4, 2016 by chef Link to comment Share on other sites More sharing options...
Taurec 60 Posted May 5, 2016 Author Share Posted May 5, 2016 (edited) @@chef don't worry. "The slow horse reaches the mill." I look forward to the API cu Taurec P.S. is this the right board board now or is it not better to move to the "Plug-ins and Themes Edited May 5, 2016 by Taurec Link to comment Share on other sites More sharing options...
chef 3746 Posted May 5, 2016 Share Posted May 5, 2016 Okay here it is, unfinished.. Problems I am having with the WebParser plugin, is this: I don';t know how to dynamically create RegExp to look a head and see if there is another Session in progress. If I write the skiin to show more then one Session and there is only 1 user in session the whole thing breaks (I figure it is because the RegExp is trying to find something that doesn't exist and an error is thrown). [Rainmeter] Update=1000 DynamicWindowSize=1 [Variables] fontName=Trebuchet MS textSize=10 LineHeight=18 colorBar=235,170,0,255 colorText=255,255,255,205 Header="Emby Sessions" ServerIP=192.168.0.3 ServerPort=8096 API_Key=13e536afd3124b24aa28794d6512d9c9 ; ---------------------------------- ; MEASURES return some kind of value ; ---------------------------------- [SessionsDto-Read] Measure=Plugin Plugin=Plugins\WebParser.dll URL=http://#ServerIP#:#ServerPort#/Sessions?api_key=#API_Key#&format=xml.xml RegExp="(?siU)<ArrayOfSessionInfoDto>(.*)</ArrayOfSessionInfoDto>" UpdateRate=27 ;this causes the xml to get updated, Debug=2 ;---------------------------------- [SessionsDto] Measure=Plugin Plugin=Plugins\WebParser.dll URL=file://#CURRENTPATH#WebParserDump.txt RegExp=(?siU)<Client>(.*)</Client>.*<UserName>(.*)</UserName> UpdateRate=30 DynamicVariables=1 [SessionsDtoUser1] Measure=Plugin Plugin=Plugins\WebParser.dll URL=[SessionsDto] UpdateRate=30 StringIndex=1 DynamicVariables=1 [SessionsDtoDevice1] Measure=Plugin Plugin=Plugins\WebParser.dll URL=[SessionsDto] UpdateRate=30 StringIndex=2 DynamicVariables=1 [SessionsDtoUser2] Measure=Plugin Plugin=Plugins\WebParser.dll URL=[SessionsDto] UpdateRate=30 StringIndex=3 DynamicVariables=1 Debug=2 [SessionsDtoDevice2] Measure=Plugin Plugin=Plugins\WebParser.dll URL=[SessionsDto] UpdateRate=30 StringIndex=4 DynamicVariables=1 Debug=2 ; ---------------------------------- ; METERS display images, text, bars, etc. ; ---------------------------------- [meterBackgroundBar] Meter=Bitmap MeasureName=SessionsDto SolidColor=0,0,0,128 X=0 Y=0 H=35 W=243 [meterBackground] Meter=Bitmap MeasureName=SessionsDto SolidColor=0,0,0,128 X=0 Y=0 H=300 W=243 [ListName] Meter=String AntiAlias=1 FontColor=255,255,255 X=72 Y=10 Text=#Header# [SessionList] Meter=String FontColor=225,225,225,255 FontFace=#fontName# FontSize=10 AntiAlias=1 MeasureName=SessionsDtoUser1 MeasureName2=SessionsDtoDevice1 MeasureName3=SessionsDtoUser2 MeasureName4=SessionsDtoDevice2 H=18 Y=45 X=10 DynamicVariables=1 Text="%1: %2 #CRLF#%3: %4" Maybe you know how to write the expressions properly? You'll have to create an API_Key for the Skin and also write in the ServerIP and ServerPort Information. To create an API Key I found it easiest to Click on the "API" button at the bottom of the Dashboard page (this enters the Swagger UI), there you will find the API key in a text box at the top of the page. Link to comment Share on other sites More sharing options...
speechles 1920 Posted May 5, 2016 Share Posted May 5, 2016 (edited) RegExp="(?siU)<ArrayOfSessionInfoDto>(.*)</ArrayOfSessionInfoDto>" .. should be... RegExp="(?=siU)<ArrayOfSessionInfoDto>(.*)</ArrayOfSessionInfoDto>" Do you want positive (?=) or negative (?!) look-ahead with the siU<Array... ? Do you need (?i) case insensitive context in your regex? Also your capture is greedy with just (.*) when (.*?) (non-greedy quantifier) is better. I know regular expressions well. What exactly is the html you are scraping and what do you need scraped from it? I can give you a regex does that. Edited May 5, 2016 by speechles Link to comment Share on other sites More sharing options...
chef 3746 Posted May 5, 2016 Share Posted May 5, 2016 (edited) Excellent @@speechles In the code where it locates "Client" then UserName" it needs to locate all instances of those tags and retrieve the (.*) Once that is figured out, we can gather the Now Playing info and make another call to the API to get the folder art for what the user is playing and present it in rainmeter under the username. It will be cool we can also skin it with emby colours and put it in the rainmeter catalog Edited May 5, 2016 by chef Link to comment Share on other sites More sharing options...
speechles 1920 Posted May 5, 2016 Share Posted May 5, 2016 (edited) (?siU)<Client>(.*?)</Client>.*?<UserName>(.*?)</UserName>(?(?=.*?<Client>)(.*?)</Client>.*?<UserName>(.*?)</UserName>)(?(?=.*?<Client>)(.*?)</Client>.*?<UserName>(.*?)</UserName>)(?(?=.*?<Client>)(.*?)</Client>.*?<UserName>(.*?)</UserName>)) This will allow to capture from 1-4 client/username combos. The problem is regular expressions are clumsy this way. Rainmeter is crippled by its dependence on regex. If you could use a foreach, or had ability to use regsubs would make it easier. Since you cant foreach or use regsub, you have to know the maximum number of client/usernames possible and have captures for them all. Then add: (?(?=.*?<Client>)(.*?)</Client>.*?<UserName>(.*?)</UserName>)) for each client/username you have beyond 1. The first (? ... ) makes it qualify as a group, not a capture. The second (?= ... ) is the positive look-ahead if found allow the captures (.*?). This is unfortunately how you have to accomplish it with the limited ability rainmeter offers. Edited May 5, 2016 by speechles Link to comment Share on other sites More sharing options...
chef 3746 Posted May 6, 2016 Share Posted May 6, 2016 (edited) Yes! That was the first thing I realized with regex, no foreach. I though look a head might be like that... I think I have a plan to get rainmeter to show a good emby skin. I am going to write something in c# that will fix the issues. Edit: I wrote a console app which creates the proper regex string and saves it a text document. The document can now be read by rainmeter an the text be put in a measure. From there we add the measure to the regex in the webparser measure and it should work. Edited May 6, 2016 by chef Link to comment Share on other sites More sharing options...
speechles 1920 Posted May 6, 2016 Share Posted May 6, 2016 (edited) You pre-parse the data before you make a regular expression that can parse the data again? Yeah, thats the easiest way to do it and keep moving forward. Construct the regex after you know the amount of fields are in the data. Then let rainmeter do its thing. Edited May 6, 2016 by speechles 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted May 6, 2016 Share Posted May 6, 2016 Lol! There has to be an easier way... Link to comment Share on other sites More sharing options...
chef 3746 Posted May 7, 2016 Share Posted May 7, 2016 (edited) Okay @@Taurec Here you go. Still not finished, but I created an exe that grabs the session info and then rainmeter reads the information from a text file. Inorder to use this properly, unzip the packaged file. Put the entire folder into your "Skins" folder for rainmeter. Then open the "LuaTextFile.ini" and add your login credentials for Emby. Save the ini Run the Session Grabber.EXE, and refresh the skin. If you want to kill the Session Grabber.exe you'll have to do it in task manager. It is called "emby.exe" there. It isn;t great but it works! DOWNLOAD: https://www.dropbox.com/s/ngofd5bd4rcfb96/LuaTextFile.rar?dl=0 Edited May 7, 2016 by chef Link to comment Share on other sites More sharing options...
Taurec 60 Posted May 7, 2016 Author Share Posted May 7, 2016 Hello @@chef sound is good but it doesn't work for me. When i start the "Session Grabber.exe" i get after 3-5 second a windows alarm "Emby doesn't work... searching for solutions....." I thing the reason is: My Emby Server is not running on the Windows Computer with Rainmeter. My Emby Server is runnign on a QNAp TVS-871T at the local Network. This is (one of..) the reason why i like to see who is online and is watching... Is there a possibility to start the Session Grabber.exe with parameters (e.g. Session Grabber.exe -A 192.168.1.1 -P 8096) cu Taurec Link to comment Share on other sites More sharing options...
chef 3746 Posted May 7, 2016 Share Posted May 7, 2016 (edited) Yep, I will revise the session grabber in C#. I wrote it quickly in Vb.net, so it won't run in a non windows computer. I will fix it tonight And yes I will add parameters for session grabber. I will also allow rainmeter to start the exe, so it will be easier Edited May 7, 2016 by chef 1 Link to comment Share on other sites More sharing options...
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