Jump to content

New Plugin - Devices Database Cleaner


chef

Recommended Posts

Happy2Play

I think a specific example is needed but with a "Device count threshold to flag as an issue" of 1, you will always have this issues as I have a Roku listed that was last used over a year ago.

  • Agree 1
Link to comment
Share on other sites

19 minutes ago, Happy2Play said:

I think a specific example is needed but with a "Device count threshold to flag as an issue" of 1, you will always have this issues as I have a Roku listed that was last used over a year ago.

I'd have to look and see what in the world I wrote... 

In your example, that Roku device should be removed because it hasn't been accessed, right? Even if the threshold is 1?

Edited by chef
Link to comment
Share on other sites

Happy2Play
Just now, chef said:

I'd have to look and see what in the world I wrote... 

In your example, that Roku device should be removed because it hasn't been accessed, right?

Correct removing devices that have not been accessed in x amount of time would cover it, but would have to re-read topic why that route was not taken.

  • Thanks 1
Link to comment
Share on other sites

  • 5 months later...
Happy2Play
20 hours ago, RaptorCentauri said:

Is there a working link for this plugin? The download link on the first post is non-functional.

 

Updated link in first topic.

Link to comment
Share on other sites

  • 1 month later...
chef
1 hour ago, bakes82 said:

Is this on github anywhere?

I think so.

I'll check. If it isnt, I'll put it there. 

Link to comment
Share on other sites

chef
1 hour ago, bakes82 said:

See keeping stuff top secret huh.

I actually forgot to put that repo in there 😆

It's an older plugin, it works but dont laugh at my early code. 

It might be just the worst. 😄

Link to comment
Share on other sites

Happy2Play
1 minute ago, chef said:

I actually forgot to put that repo in there 😆

It's an older plugin, it works but dont laugh at my early code. 

It might be just the worst. 😄

All that matters is it works. 😁

  • Agree 1
Link to comment
Share on other sites

  • 1 month later...
vaise

Hi @chef

If you feel like taking a break from the work on the auto organize, can I propose a mod to this devices list to show devices not connected in the last XX weeks (configurable), and allow those to be deleted.  I have run your plugin (coffee on the way), but I still have 194 devices......

Link to comment
Share on other sites

chef
2 hours ago, vaise said:

Hi @chef

If you feel like taking a break from the work on the auto organize, can I propose a mod to this devices list to show devices not connected in the last XX weeks (configurable), and allow those to be deleted.  I have run your plugin (coffee on the way), but I still have 194 devices......

I would have to figure device activity.

I know that we can find out when the last time a user was on, but I don't know if there is data on the device activity specifically.

Let me take a look at the API and see what is there.

If that data is available then we can absolutely do that. I think it is a great idea!

 

Link to comment
Share on other sites

Happy2Play
7 minutes ago, chef said:

I would have to figure device activity.

I know that we can find out when the last time a user was on, but I don't know if there is data on the device activity specifically.

Let me take a look at the API and see what is there.

If that data is available then we can absolutely do that. I think it is a great idea!

 

Looks like maybe "DateLastActivity"

    {
      "Name": "My Desktop",
      "Id": "863aca3b-5db9-4b7f-a4c3-2d282603fa91",
      "LastUserName": "Media",
      "AppName": "Emby Web",
      "AppVersion": "4.7.0.25",
      "LastUserId": "5a53fdc26e094dfeb5b768xxxxxxxxxx",
      "DateLastActivity": "2022-02-25T01:28:12.0000000Z",
      "IconUrl": "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chrome.png"
    }

 

  • Thanks 1
Link to comment
Share on other sites

chef

Yeah, I remember now. ...The C# libraries don't have a 'Remove Device' method.

But, that's okay. It just means we have to wrap our own client with that method in it.

Might take a little longer then planned. 

 

Link to comment
Share on other sites

chef

Interesting, I had originally wanted to create a scheduled task that would handle removing devices after a set amount of time of inactivity.

But, that has proven to be a more difficult to handle on the backend  then I thought.

Note: At some point I really should figure out the code for extension methods that call missing emby API calls. It would probably be useful. 

 

What I can do is list devices that are considered "expired", in the UI.

Then the UI ApiClient can send the command to remove them.

I will post the dll with that ability here this evening.

 

 

Link to comment
Share on other sites

chef

@vaise I have finished this. Sorry it took so long.

I added the ability to show last activity dates, and the client devices should be targeted for removal.

I'll post the dll below. 👍

  • Like 1
Link to comment
Share on other sites

chef

This a bit more difficult.

Because we are grouping devices in order to calculate the unwanted abundance of them I had to handle expired devices like this:

expiredDevice.thumb.png.02ffdcdeec85a8bf05f5f2bbd7bfac33.png

 

Where the devices are still grouped, however each group will allow the user to remove expired devices that have reregistered themselves under new ID's, and have exceeded the limit/threshold of days existing on the server.

In the image above "Amber's IPhone" apparently reregistered itself under a new ID at some point back in 2021, and it still exists in the device list.

I can now remove that entry, and get it cleaned up.

One more moment to test the device removal, and I'll post the DLL.

Link to comment
Share on other sites

vaise

Hi @chef

This was a great help, but as I  had so many to do initially, it was a pain to have to scroll to the end and delete, then it jumps back to the top, and repeat over and over and over.

Wont be as big as issue once I complete this process and manage it monthly however.

A view enhancement could not group them like that maybe.

Or a button to delete all expired devices

 

Edited by vaise
  • Like 1
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...