Jump to content

Remove rows from MediaItems that no longer exist in a library?


Recommended Posts

jlficken
Posted

Is this possible?


I see lots of records that I no longer have the media for and I'm having issues with the Statistics plugin and I'm trying to narrow it down.

Posted

Hi, normally the server will clean this up for you automatically during library scans, but if you've had this database for a while, then there's always the chance you may have stuff dangling if there were defects in older versions of the server causing it.

Before you can delete from mediaitems you'll need to delete from other tables due to foreign keys. Just try to delete and you'll see what I mean in the error message. 

jlficken
Posted
Just now, Luke said:

Hi, normally the server will clean this up for you automatically during library scans, but if you've had this database for a while, then there's always the chance you may have stuff dangling if there were defects in older versions of the server causing it.

Before you can delete from mediaitems you'll need to delete from other tables due to foreign keys. Just try to delete and you'll see what I mean in the error message. 

 

Yeah I see the foreign key constraint errors when I tried to delete certain records.

 

In looking through the tables in Library.db it apperas that it doesn't actually keep track of what's been played, correct?  That appears to be in playback_reporting.db unless that's specifically for the plugin of the same name?

If the above is true could I just delete the Library.db file and have it be recreated?

Posted

That's in the userdatas table. playback_reporting is a from a plugin and not part of the emby server core.

Quote

If the above is true could I just delete the Library.db file and have it be recreated?

No, it's all together.

  • Thanks 1
jlficken
Posted
7 minutes ago, Luke said:

That's in the userdatas table. playback_reporting is a from a plugin and not part of the emby server core.

No, it's all together.

I wondered about that.

I gave it a go anyway and deleted Library.db, however, the Emby Statistics plugin task still fails so I just restored the backup of Library.db and will continue to see if I can figure out the issue.

 

Thanks for your help!

  • Thanks 1
jlficken
Posted

I have been able to confirm that deleting media from a share and performing a Library scan doesn't remove the item from MediaItems.

Any thoughts as to why that might be?

Posted
1 minute ago, jlficken said:

I have been able to confirm that deleting media from a share and performing a Library scan doesn't remove the item from MediaItems.

Any thoughts as to why that might be?

We'd have to look at a specific example:

Thanks.

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...