Preserve viewstates after library deletion and re-creation

Hi,

I have a pretty specific question: a long time ago, I set up my TV library with the TMDb agent. I’ve been wanting to switch to the TVDB agent for a long time now. As I understand it, the only chance to switch is to delete the library and re-create it with the new agent. Unfortunately, this would mean losing all of my viewstates (and even worse: that of my friends, too). After looking at the database, this doesn’t seem impossible to fix though.

As I see it, there are two tables that are linked to the viewstate of an item: metadata_item_settings and metadata_item_views. So question 1: What’s the purpose for 2 distinct tables and which table is used for the display of the viewstates in the Plex apps?

Adjusting the guid column of metadata_item_settings (e.g. changing the TMDb-IDs to TVDB-IDs) seems to be enough to set that table up for the re-created library. In metadata_item_views however, there are a few columns that I’m not comfortable with, namely the title and grandparent_title columns (I will be switching the library language to English, so those fields might not match the titles of the re-created library) and especially the thumb_url column. So question 2: What is the purpose of those three columns? Would it be possible to leave them unchanged after re-creation of the library?

I would really appreciate an answer, even if it’s just a good guess.

I don’t think you need to delete your entire library and re-create it just to use a new agent. I believe you just need to drag The TVDB to the top of your Agents, make sure it’s checked. I have both TVDB & TMDB checked (TMDB 2nd). Then go back to your TV library and Refresh All Metadata. Will probably take quite a while depending on the size of your library (mine takes a few hours). Sorry if I’m oversimplifying your question, I hope this helps! :slight_smile:

Changing the agent is just half of the story, that could be done by just changing the order inside the TMDb agent, you’re right (even though I don’t know if you could get episodes that are already added to update with the Refresh All feature).
What I’m more concerned about is changing the library language to English, which definitely only affects newly added content. There is no way to force old content to be updated. So thanks for the tip, but still looking for a solution here :confused:

Yes. Once you change your library language to English, only newly added content will be affected when you Scan Library Files. But when I Refresh All Metadata for a library it will add trailers, plot info, subtitles, directors, etc. for ALL content even old. Wouldn’t TVDB just switch from pulling info in your language to English for everything?

Unfortunately, that’s not the case, no.

Source: Editing Libraries
Note: While you can change the language for a Library, you cannot retroactively update the language used for existing items. The new language will only apply to newly-added content.

Damn. Your right. That’s too bad. It seems you will actually have to delete and recreate your library when changing the Primary Language. My apologies. The only way that I can think of to keep your view states is by using the Trakt.tv plugin from the Unsupported AppStore. After installation you will need to setup a Trakt account and Authenticate it with your Plex account then Push your Plex watched status. Then after recreating your library you could Pull your watched status from Trakt. Please look into that. It may be an option. :slight_smile:

I’m actually using the Trakt plugin already, it’s great, but would only be a solution if I was the only one using the server. Unfortunately, I have many users that rely on their viewstates and I don’t want to tell everybody to set up a Trakt account just for that. Thanks for your tips, but I guess I’m still looking for an answer :confused:

There must be somebody of the Plex team who can tell me the purpose of the two distinct viewstate tables…

Ahh. I see. I don’t think there is a way around preserving all of your users view states without Trakt accounts. If your users already have their own Plex accounts there is a guide in the top post of this thread that you could follow if your are willing to create Trakt accounts for them.
(I’m not certain how many user you have though.)

Please see:

If that doesn’t help I hope you can get in touch with Plex staff to answer your questions about the two distinct view state tables.

Phew, that seems like a lot of work…

I just found this article about preserving viewstates across different installs. There they only back up metadata_item_settings, so I guess that’s the table I need and therefore I only need to change the guid column from TMDb to TVDB. I would still like to know what the metadata_item_views table is for, though.

@ryan. said:
Ahh. I see. I don’t think there is a way around preserving all of your users view states without Trakt accounts.
That is actually wrong, if you don’t plan on changing the agent. The viewstate tables are not linked to any specific library entries, they refer to the ID of the movie/show on the agent website, so even if you delete a library and create a new one, the viewstates are preserved. The problem only arises when you change the agent and therefore, the IDs of the viewstate table don’t match the IDs in your newly created library anymore.

I would still like to know what that second table is for and if it has any influence on my database if I only change the metadata_item_views table.

Btw I really love Plex, it’s a great piece of software, but the support by the Plex team here on the forums is, by all means, catastrophic! Not only with topics like this, but also with bug reports that just stay unanswered. I don’t even bother to report anymore, because I won’t receive an answer anyway.

Why don’t you create a new TV Library with the settings you want, when I have done this in the past it has retained the view states from the original library.
If it does work you can then delete the original library.
eg. I have a “TV Shows” library and a “TV Shows Ended” library, when I move media between the two the view states are retained.

@ryan. said:
Ahh. I see. I don’t think there is a way around preserving all of your users view states without Trakt accounts.
That is actually wrong, if you don’t plan on changing the agent. The viewstate tables are not linked to any specific library entries, they refer to the ID of the movie/show on the agent website, so even if you delete a library and create a new one, the viewstates are preserved. The problem only arises when you change the agent and therefore, the IDs of the viewstate table don’t match the IDs in your newly created library anymore.

I have actually tried this and it confirms what I wrote in the post above. If you don’t change the agent, viewstates are preserved. If you do change it, they are lost.