Jump to content

Recommended Posts

Dibbes
Posted

Over time my database got highly polluted with double entries due to moving machines, media locations, addition of .strm files for localised metadata and various plugins. How do I clean this up automatically, now that I cannot start over without removing play-states when restoring from backup?

Examples of multiple entries:

image.thumb.png.c0f91012df8b0b56f69535230843ff62.png

image.thumb.png.266309fd3a574c5993ba5b65350cd325.png

image.png.9051fd4f4d5c306efb1525e92393ad40.png

rbjtech
Posted

Are the duplicates valid/working items ?

Dibbes
Posted (edited)
1 hour ago, rbjtech said:

Are the duplicates valid/working items ?

For movies, yes... these are the exact same files and when playing one, all are marked as watched.

Series is a little more complicated I just noticed now, I just found. When clicking on the duplicate series, I get the versions below. I can play each of them:

image.png.7fd045bb1621661a2947f555d9421586.png

EDIT: Some of these are not even on the same physical drive, LUN, device or even the same library... curiouser and curiouser

Edited by Dibbes
rbjtech
Posted

So first thing I would check is to 'split' the items - scroll down the details and you may see them joined.

Once 'split' then run a full scan plus metadata scan, then in database choose vacuum.  Then restart emby.

Dibbes
Posted (edited)

Yeah, that is something I thought of, but having to do that with 60k entries is not feasible...

Also, not every episode has the option:

image.png.5ef60e3cf3dedfaa181292b593db8404.png

Edited by Dibbes
Neminem
Posted

@DibbesHow is you naming scheme ? and folder order ?

Dibbes
Posted
4 minutes ago, jaycedk said:

@DibbesHow is you naming scheme ? and folder order ?

Believe me, the naming scheme is in order. Folder -> Series Name (year) -> Season# -> Filename (See screenshot above for filename examples)

image.png.9fb0aff3387a6ef763f083ba28bad741.png

Neminem
Posted

Ohh wow how did Emby FUBAR that.

I would try with series folder {Series TitleYear} [TvdbId={TvdbId}]

Something like this 

image.png.f73dac5d559898a083412136a060a829.png

Dibbes
Posted

why the square brackets?

Neminem
Posted

Not really sure, but it works for me 😂🤣 

And it was in the documentation 😁

TV Naming | Emby Documentation

Example:

The Vampire Diaries (2009) [tmdbid=18165]

Emby supports the following tags with the host website for lookup.

  • Haha 1
Dibbes
Posted (edited)

That will wreak havoc with any PowerShell script I'm running against that folder structure... lol

Edited by Dibbes
Neminem
Posted

Guess you could put " " around the path in powershell, like you do with spaces.

Dibbes
Posted

For just paths, that will work, but I use a lot of pattern matching in the scripts. Guess what PowerShell uses for that?

Anyway, getting off topic...

rbjtech
Posted (edited)

' "include the quotes" ' - single quote will allow you to include the quotes in PS .. ;)

Anyway yes back to the issue ...

2 hours ago, Dibbes said:

For movies, yes... these are the exact same files and when playing one, all are marked as watched.

Series is a little more complicated I just noticed now, I just found. When clicking on the duplicate series, I get the versions below. I can play each of them:

image.png.7fd045bb1621661a2947f555d9421586.png

EDIT: Some of these are not even on the same physical drive, LUN, device or even the same library... curiouser and curiouser

Oh wow - so emby thinks these are all versions of Hawaii five-0 S10E21 ?

Sounds like the db is very corrupt ... :(

Does the backup/restore not let you restore the UserData table on a fresh library.db ?

I throught that's exactly what this did below - ie from a backup (made on your corrupt db), you can just restore the user playstates.

It's done by provider id - so it doesn't matter if it's a brand new db - the 'match' will still happen.  

Take a copy of all the db files (with emby shutdown) before even attempting this.

It's probably quick than trying to individually 'ungroup' all these items - plus who knows what other corruption exists down the line - fresh db is always the way to go imo.

image.png.da86ffb6c370ca03385c254a007e5627.png

 

Edited by rbjtech
Dibbes
Posted
2 hours ago, rbjtech said:

' "include the quotes" ' - single quote will allow you to include the quotes in PS .. ;)

*grin* I think you pretty much know my scripts... 😉

2 hours ago, rbjtech said:

Oh wow - so emby thinks these are all versions of Hawaii five-0 S10E21 ?

Sounds like the db is very corrupt ... :(

Yes... *sigh*

2 hours ago, rbjtech said:

Does the backup/restore not let you restore the UserData table on a fresh library.db ?

I've been reluctant to try this, tbh... Just setting up a new DB, scanning everything, etc., takes about 3 weeks... This purely due to the amount of MediaItems... I had hoped there was a quicker way

 

Ever since yesterday @pünktchen's plugin stopped populating the guide as well, out of the blue... 

rbjtech
Posted
14 hours ago, Dibbes said:

I've been reluctant to try this, tbh... Just setting up a new DB, scanning everything, etc., takes about 3 weeks... This purely due to the amount of MediaItems... I had hoped there was a quicker way

You don't necessarily have to wipe the old and start fresh - just setup another instance of emby, running on a different port - but pointing to the same same libraries.   Let that scan the items in the background and when it's finished, then import the play state from the corrupt db - then move that over as the new instance.

If you unlink all the items in the current db, then its possible that would suffice, but I would be concerned about what else is corrupt - there is no way of knowing unfortunately.

  • Thanks 1
Dibbes
Posted
On 5/21/2024 at 10:59 AM, rbjtech said:

You don't necessarily have to wipe the old and start fresh - just setup another instance of emby, running on a different port - but pointing to the same same libraries.   Let that scan the items in the background and when it's finished, then import the play state from the corrupt db - then move that over as the new instance.

If you unlink all the items in the current db, then its possible that would suffice, but I would be concerned about what else is corrupt - there is no way of knowing unfortunately.

Yeah, that's something I'll try and see... Thanks all!

  • Thanks 1

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