Jump to content

Developing a standalone embystat server


reggi

Recommended Posts

Hey @@Macieksoft

 

Sorry for not replying sooner. What docker image are you running? Best thing to do is running the nightly builds for now because the beta version has some problems with docker still.

 

You can always create a share to /Logs so you can access the log files. In the new release you will also be able to access your user settings in a json file.

(at the moment the settings are still stored in the database located in the root folder)

Link to comment
Share on other sites

Macieksoft

Hey @@Macieksoft

 

Sorry for not replying sooner. What docker image are you running? Best thing to do is running the nightly builds for now because the beta version has some problems with docker still.

 

You can always create a share to /Logs so you can access the log files. In the new release you will also be able to access your user settings in a json file.

(at the moment the settings are still stored in the database located in the root folder)

I tried the beta linux version at first, but the logs just said "application shutting down", just tried the nightly version (just assigned a port too it, not sure if it needs a share or acess of some sort). The logs just said:

 

Sequence contains no elements

SYSTEM Server shutdown

 

Im not very knowledgeable in docker so my help is prob very limited. Im assuming im missing a point where I create a share to it but when I tired to give it an appdata folder is just failed. I couldn't manage to get any access to more detailed logs.

Link to comment
Share on other sites

Oke, I found the problem. I will need to update the database migrations but they are still on a side branch. 

 

I will try to make a new build this night and push the new version to docker.

 

If you want to mount the Logs folder use the following docker command: docker run -p <port>:5432 -v <path-on-host>:/app/Logs uping/embystat:nightly-linux

Link to comment
Share on other sites

Macieksoft

Oke, I found the problem. I will need to update the database migrations but they are still on a side branch. 

 

I will try to make a new build this night and push the new version to docker.

 

If you want to mount the Logs folder use the following docker command: docker run -p <port>:5432 -v <path-on-host>:/app/Logs uping/embystat:nightly-linux

Thanks! Got it up and running on unraid, doing the media sync now, ill report back if I run into any problems. 

Link to comment
Share on other sites

Hey guys,

 

So I got a new release ready for you (sorry for the long release interval)

Had some refactor work done as well as setting up the web socket connection to Emby, after some long night I can finally say that EmbyStat is receiving life event data from Emby. At this moment it is still limited to play events (start, stopped and paused) but it's a start.

 

Release noted:

* Live session data is stored
* Added user sync
* Added device sync
* Created new user page (displaying session data)
* Added option to enable Exception logging
* Updated to Angular 7
* Some refactoring
* Minor bug fixes 

 

Also you can find your settings in the Settings/usersettings.json file. If you are running docker you can easily create a share to it with "-v /path/on/host:/app/Settings"

And I installed some online exception logging on Rollbar, this means that I will receive a message every time your system get's an exception, this will make my life easier and will help me fix bugs faster. This option is not enabled by default! So feel free to go to the settings page and enable the option. You will have to restart the server after you hit the save button. If you want to know what data is logged feel free to send me a message! In short, I receive the exception details, release train and version number. I do not receive your log files, your settings files, IP address, ...

 

Feel free to test this version and let me know what you think about it.

 

Next release I will increase the Emby events and calculate some more statistics about the user usage and try to increase the server stability by refactoring and bug fixing.

  • Like 3
Link to comment
Share on other sites

pir8radio
2019-02-23 22:14:26 [INF] 1 scheduled job(s) enqueued.
2019-02-23 22:14:35 [INF] SMALLEMBYSYNC-JOB	Starting job
2019-02-23 22:14:35 [INF] EMBY-CLIENT	Sending GET: http://xxx.xxx.xxx.xxx:xxxx/emby/System/Info?format=json
2019-02-23 22:14:35 [INF] Received web socket message: UserUpdated
2019-02-23 22:14:35 [ERR] Error while running job
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> Microsoft.Data.Sqlite.SqliteException: SQLite Error 19: 'NOT NULL constraint failed: ServerInfo.LocalAddress'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(DbContext _, ValueTuple`2 parameters)
   at Microsoft.EntityFrameworkCore.Storage.Internal.NoopExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at EmbyStat.Repositories.EmbyRepository.AddOrUpdateServerInfo(ServerInfo entity) in D:\Yoda\work\aa794b64fcf59423\EmbyStat.Repositories\EmbyRepository.cs:line 88
   at EmbyStat.Services.EmbyService.GetAndProcessServerInfo(String embyAddress, String accessToken) in D:\Yoda\work\aa794b64fcf59423\EmbyStat.Services\EmbyService.cs:line 215
   at EmbyStat.Jobs.Jobs.Sync.SmallSyncJob.RunJob() in D:\Yoda\work\aa794b64fcf59423\EmbyStat.Jobs\Jobs\Sync\SmallSyncJob.cs:line 29
   at EmbyStat.Jobs.BaseJob.Execute() in D:\Yoda\work\aa794b64fcf59423\EmbyStat.Jobs\BaseJob.cs:line 44
2019-02-23 22:14:35 [ERR] SMALLEMBYSYNC-JOB	Job failed, check logs for more info.

Doesn't seem to handle not having a local server address.

Edited by pir8radio
Link to comment
Share on other sites

Thanks for the log. I didn't knew it was possible that you don't have a local address. Let me fix it in 31 quick.

 

I also noticed that I have some events that fails mapping, but I'm not using the events at the moment. So will fix that as well today.

  • Like 1
Link to comment
Share on other sites

pir8radio

Thanks for the log. I didn't knew it was possible that you don't have a local address. Let me fix it in 31 quick.

 

I also noticed that I have some events that fails mapping, but I'm not using the events at the moment. So will fix that as well today.

 

Yea if you bind the local address to 127.0.0.1  emby won't have a local address...   My emby server is directly attached to the internet backbone, there really is no local network.   So all I have is a WAN.   Thanks!!

  • Like 2
Link to comment
Share on other sites

Thanks for the info @@pir8radio, I never used Emby without local address that's why it never failed on my setup.

 

I pushed a new update (version 0.1.0-beta.32) that should fix your problem. Can you verify?

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
reggi

@@Kyouma

 

Thanks for the dropbox file, strange behavior indeed. Do you have access to some log files to see what happens as well?

You can try to mount the Logs folder of EmbyStat while you create the container with -v /path/on/the/host:/app/Logs

 

At the moment my dev machine is broken (CPU started to behave strange) so I will look at the problem when my new hardware arrives!

Link to comment
Share on other sites

Spaceboy

Hi, I've been trying to get this running in docker on a synology. it seems to crash on trying to sync with Emby and then crashes everytime it restarts within 30seconds or so. log is attached uping-embystat1.txt

Link to comment
Share on other sites

reggi

@@Kyouma

Can you send me a PM with more system specs? Specially the OS you are using and the app to generate the docker files. I'll see what I can do then.

 

@@Spaceboy

You are having the same problem as hbooo on GitHub => https://github.com/mregni/EmbyStat/issues/538

Problem is that the play event TvChannel can't be mapped at the moment. Will fix that in the new release

  • Like 1
Link to comment
Share on other sites

Spaceboy

@@Kyouma

Can you send me a PM with more system specs? Specially the OS you are using and the app to generate the docker files. I'll see what I can do then.

 

@@Spaceboy

You are having the same problem as hbooo on GitHub => https://github.com/mregni/EmbyStat/issues/538

Problem is that the play event TvChannel can't be mapped at the moment. Will fix that in the new release

no problem, i'll look out for the update

Link to comment
Share on other sites

  • 3 weeks later...
reggi

Hey guys,

 

I uploaded a new beta version (34) yesterday, feel free to test it.

It has been a while that I updated the beta version because finding time for the project is getting hard.

New version can be pulled from docker or downloaded here: https://github.com/mregni/EmbyStat/releases

 

 

Next step is to add graphs to display who is watching when (hours of the day, days of the week, ...).

If you have some other ideas you want in the app, feel free to contact me!

  • Like 1
Link to comment
Share on other sites

hshah

I installed this in Docker on my Synology NAS last night and noticed that dotnet is using a lot of the CPU.  I am hoping that this is the cause only whilst the media is being scanned, and that it will came down afterwards?

 

Also, not sure if this is down to running the betas but shouldn't the About screen (and at the bottom of the sidebar) state the actual version number? I see:

 

EmbyStat version: 0.0.0.0 
  • Like 1
Link to comment
Share on other sites

reggi

The version 0.0.0.0 is a build error. Some version string replacement went wrong in the appsettings file. Thanks for noticing! 

 

As for the CPU usage, this indeed will spike when doing the media sync but should come down when it is finished the media sync job.

For now, the media sync is also not incrementing. So, every run will sync ALL media. I haven't found a solution how to sync only media that has a creation date after the last sync date.

Link to comment
Share on other sites

PenkethBoy

Hi @@reggi

 

Just took the win64 version for a spin

 

Works fine, only 5% cpu load when doing the media scan on an i7

 

One thing i noticed is that as i use coverart the Movie and Show images are not wide enough

 

e.g

5ca46350a9ce5_Capture.jpg

 

maybe select them with the EnableImageEnhancers=False so you get the image untouched by coverart?

  • Like 1
Link to comment
Share on other sites

hshah

@@reggi, the log file path in nlog.config should have a / rather than a \

fileName="Logs/${shortdate}.log"

That would explain why I wasn't able to open the Logs section from the UI... until I fixed the path anyway  ;)

 

 

 

The version 0.0.0.0 is a build error. Some version string replacement went wrong in the appsettings file. Thanks for noticing! 

 

As for the CPU usage, this indeed will spike when doing the media sync but should come down when it is finished the media sync job.

For now, the media sync is also not incrementing. So, every run will sync ALL media. I haven't found a solution how to sync only media that has a creation date after the last sync date.

 

 

Cool, as long it isn't a constant thing, I am not too worried especially since it isn't affecting anything else on my NAS/network :)

Edited by hshah
  • Like 1
Link to comment
Share on other sites

Hi,


I modified my docker run to this :


docker run -d --name='embystat' --net='bridge' -e TZ="Europe/Paris" -e HOST_OS="Unraid" -p '5432:5432/tcp' -v '/mnt/user/appdata/embystat/Settings':'/app/Settings':'rw' 'uping/embystat:nightly-linux'


but DB doesn't seems to be created and I have to set up EmbyStat each time I update the docker image


Link to comment
Share on other sites

reggi

@@kesm

 

Probably it will be the same issue as @@hshah descripted, the nlog.config file has a wrong \ in it. Maybe that's why the container is failing to start on UNRAID.

I will update the config tonight and push version 35 to have a quick fix. 

 

If it's not fixed then you can try to mount the /app/Logs folder as well and then read the logs files.

Link to comment
Share on other sites

hshah

@@kesm / @@reggi - In the Docker UI for Synology I defined the entire /app folder to mount to a directory of my choosing.  Port 5432 is used by Synology somewhere so I also had to use the "--port 65432" arguement (I just added a 6 in front) to define an alternative port - using Docker's UI for that didn't seem to work and it always defaulted to 5432.

 

My sync is running at the moment and I can see a ~12mb data.db file in /app but whilst the timestamp is changing the size isn't for some reason. I had removed the original container, created a new one, and then put the data.db file back in.  When I started the sync it did say it was clearing the database but the ~12mb I mentioned is what it was before.

 

I will let you guys know when this has finished - it has taken 2 hours to do my films and probably another 2-3 hours to cover the episodes :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...