Jump to content

Playback Reporting migrating


fahad92
Go to solution Solved by fahad92,

Recommended Posts

 

Hi ,

I just moved my data to new server, all ursers profiles are already restored and everything is OK except for the plugin "Playback Reporting" All records are showing but the uesers are defined as "unknown". They are not linked to my current users profiles which is just a backup from the previous server.

I tried to restore the plugin multiple times and also did the manual restore with it but nothing helped to link the uesers in the new server to their records.

I tried the query method but it always thru this error " table playbackActivity has 12 columns but 11 values were supplied.

 

Any help is really appreciated as I have 2 years of records.

Link to comment
Share on other sites

TeamB

@Luke

5 hours ago, fahad92 said:

I just moved my data to new server, all ursers profiles are already restored and everything is OK except for the plugin "Playback Reporting" All records are showing but the uesers are defined as "unknown". They are not linked to my current users profiles which is just a backup from the previous server.

@Luke when you restore users using the backup do they keep the same userId?

5 hours ago, fahad92 said:

I tried to restore the plugin multiple times and also did the manual restore with it but nothing helped to link the uesers in the new server to their records.

how did you restore the plugin? just the steps you took will help.

5 hours ago, fahad92 said:

I tried the query method but it always thru this error " table playbackActivity has 12 columns but 11 values were supplied.

what is the query method?

One thing you can try is just (then the servers are shutodwn) copy the playback reporting DB files across.
If the users have the same IDs then it should work fine.

Link to comment
Share on other sites

2 minutes ago, TeamB said:

@Luke

@Luke when you restore users using the backup do they keep the same userId?

Currently, no. It essentially just creates a new user. However, what user info do you display and is this intended to capture historical data including deleted users?

if yes, then I would probably suggest capturing the user name to guard against this situation.

Alternatively you could base your storage on the user guid rather than the internal database id, given that the guid will never change.

Link to comment
Share on other sites

TeamB
12 minutes ago, Luke said:

Currently, no. It essentially just creates a new user. However, what user info do you display and is this intended to capture historical data including deleted users?

if yes, then I would probably suggest capturing the user name to guard against this situation.

it was designed to support user name changes so I store the user id and look up the user name dynamically when needed.

12 minutes ago, Luke said:

Alternatively you could base your storage on the user guid rather than the internal database id, given that the guid will never change.

I use

session.UserId

what is this ID? is it DB id or user guid?
How is it that the guid never changes? Is it based of the user name or something?

Edited by TeamB
Link to comment
Share on other sites

15 minutes ago, TeamB said:

@Luke

@Luke when you restore users using the backup do they keep the same userId?

how did you restore the plugin? just the steps you took will help.

what is the query method?

One thing you can try is just (then the servers are shutodwn) copy the playback reporting DB files across.
If the users have the same IDs then it should work fine.

 

@TeamBsorry for not been clear, I did restore the plugin using the build in method in the plugin itself when I saw the uesers are unknown I did try to copy DB files.

From my understanding so far it's all because the ueser ID are no longer matching.

Is there anything I can do in this case.

 

Thank for your reply.

 

 

Link to comment
Share on other sites

TeamB
3 minutes ago, fahad92 said:

From my understanding so far it's all because the ueser ID are no longer matching.

its looking that way.

4 minutes ago, fahad92 said:

Is there anything I can do in this case.

probably. if you have imported all the data and it is there but the uers ID are different you can run update queries to update the old Userid to the new Userid, HOWEVER, this requires you to run some queries in the query tab of the plugin OR in a Sqlite DB editing tool.
The idea is you find the new UserId and do and update to the data to update all the old rows with that id to the new id, this would have to be done for each user in your system Old Id->New Id

The tricky part is you need to know who the old ids are, identifying them is not easy if you have a lot of them.

 

Link to comment
Share on other sites

21 minutes ago, TeamB said:

it was designed to support user name changes so I store the user id and look up the user name dynamically when needed.

I use

session.UserId

what is this ID? is it DB id or user guid?
How is it that the guid never changes? Is it based of the user name or something?

It's not based on the name. It just gets created once and then stays attached to the user forever.

the database id's can't work like that because they are auto-incremented which means they can't be imported from one database to another.

All of the server's internal operations are based on the numeric id's because it's faster to work with, but there are certain exceptional cases where you may want to get the full user object so that you can use the guid instead. historical data is probably one such case.

Truthfully though, you may want to leave things alone and just wait for the 4.8 release. The backup process is going to be changed based on that and it's going to be a complete restore so this might become a moot point.

Link to comment
Share on other sites

TeamB
2 hours ago, Luke said:

It's not based on the name. It just gets created once and then stays attached to the user forever.

the database id's can't work like that because they are auto-incremented which means they can't be imported from one database to another.

All of the server's internal operations are based on the numeric id's because it's faster to work with, but there are certain exceptional cases where you may want to get the full user object so that you can use the guid instead. historical data is probably one such case.

Truthfully though, you may want to leave things alone and just wait for the 4.8 release. The backup process is going to be changed based on that and it's going to be a complete restore so this might become a moot point.

But what is "session.UserId" its not an int it looks a bit like a guid without with dashes.

Also why cant I highlight text in the Web Client interface?

Link to comment
Share on other sites

1 minute ago, TeamB said:

But what is "session.UserId" its not an int it looks a bit like a guid without with dashes.

Also why cant I highlight text in the Web Client interface?

Sorry, my mistake. yes that is the guid without dashes.

Link to comment
Share on other sites

TeamB
37 minutes ago, Luke said:

Sorry, my mistake. yes that is the guid without dashes.

ok so User Guid is Kept in an Emby backup/Restore action?
If so then just copying the playback reporting DB from the old server should actually just work.

9 hours ago, fahad92 said:

I tried the query method but it always thru this error " table playbackActivity has 12 columns but 11 values were supplied.

this is a bug in the restore code, I forgot to add the new transcode reason fields when restoring. I can fix that.
But if you just copy the original playback_reporting DB file to the new server then you should not need to import (restore) the old data as it will already be there.

Edited by TeamB
Link to comment
Share on other sites

9 hours ago, TeamB said:

ok so User Guid is Kept in an Emby backup/Restore action?
If so then just copying the playback reporting DB from the old server should actually just work.

this is a bug in the restore code, I forgot to add the new transcode reason fields when restoring. I can fix that.
But if you just copy the original playback_reporting DB file to the new server then you should not need to import (restore) the old data as it will already be there.

 

I just did try to copy the plugin DB file but still same issue.

Would your recommend having a second try with new  backup file from my old emby then try the to copy the DB file for the plugin (without doing restore in the plugin setting)

 

Link to comment
Share on other sites

TeamB
21 minutes ago, fahad92 said:

 

I just did try to copy the plugin DB file but still same issue.

Would your recommend having a second try with new  backup file from my old emby then try the to copy the DB file for the plugin (without doing restore in the plugin setting)

 

 

if the user guids are the same then it should work.

where are you seeing the unknown users?

@Lukeyou said with a restore the user guid should be kept correct?

if you run the default query in the query tab does it fill in the user name?

Link to comment
Share on other sites

5 minutes ago, TeamB said:

if the user guids are the same then it should work.

where are you seeing the unknown users?

@Lukeyou said with a restore the user guid should be kept correct?

if you run the default query in the query tab does it fill in the user name?

 

Here is a screenshot, it showing like this anywhere in the plugin records. regarding the query I don't know how to use it to be honest.

Once @Lukaconfirm the ueser guid should carry over with a restore I will do the process again to see if it's solve the issue.

@TeamBI'm really sorry if this is too much for you, if you feel you are not in the mood for any of this please leave it as you already did a great job on the plugin.

 

 

Screenshot_20231202_153325_Samsung Internet.png

Link to comment
Share on other sites

TeamB
9 hours ago, fahad92 said:

I'm really sorry if this is too much for you, if you feel you are not in the mood for any of this please leave it as you already did a great job on the plugin.

I am happy to try to help work out what is going on.

If @Lukecan confirm the User Guid should be kept in a restore and it is not for some reason then you will need to work out why that is.

I dont think there is much I can do but it would be good to kow what is heppeneing in your situation for other users in your situation.

Link to comment
Share on other sites

 

Hi @TeamBI figured I have nothing to lose so instead of using the plugin to restore my emby backup in the new server I just did copy all Emby config folder and drop it in the new server and pointed my media libraries to the correct new locations and everything is good so far. 

So, using the plugin ( Backup & Restore ) is not sufficient to migrate the users to your plugin (at least in my case).

Edited by fahad92
  • Thanks 1
Link to comment
Share on other sites

That's correct. I took a look at this and the import process does in fact create a brand new user. This is because it has to handle the situation of the user already being there.

Anyway the 4.8 backup process will be changed to just take the entire database so this issue won't even exist anymore.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

TeamB
1 hour ago, Luke said:

That's correct. I took a look at this and the import process does in fact create a brand new user. This is because it has to handle the situation of the user already being there.

Anyway the 4.8 backup process will be changed to just take the entire database so this issue won't even exist anymore.

thanks for confirm luke.

On 12/6/2023 at 7:22 AM, fahad92 said:

So, using the plugin ( Backup & Restore ) is not sufficient to migrate the users to your plugin (at least in my case).

yep looks like it.

there are ways arround this but they require you to know what the old user Guids were and most people are not going to know this.
if you do know you can just take the most recent backup from PlaybackReporting and do a find replace on the users Guids then import the backup data into PlaybackReporting. Hit the clean up button on the settings page and you should be back up and running.
but as I said not many admins will know the old users Guids

  • Thanks 1
Link to comment
Share on other sites

  • Solution
1 minute ago, TeamB said:

thanks for confirm luke.

yep looks like it.

there are ways arround this but they require you to know what the old user Guids were and most people are not going to know this.
if you do know you can just take the most recent backup from PlaybackReporting and do a find replace on the users Guids then import the backup data into PlaybackReporting. Hit the clean up button on the settings page and you should be back up and running.
but as I said not many admins will know the old users Guids

 

Hi @TeamBMy issue is solved by taking a copy of all the files in ( Config/Emby ) and transfer it to the new server. All my data for plackback reporting plugin are showing and linked to the users.

I believe this is the manual method to migrate to new server.

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