luser 37 Posted December 22, 2024 Posted December 22, 2024 Refreshing metadata (search for missing) ignores locks on metadata fields and replaces them anyway... The makes locking metadata fields useless. Steps to reproduce: 1. Set "CommunityRating" for an item 2. Lock the "CommunityRating" field (LockedFields = 'CommunityRating') 3. Refresh metadata (select search for missing) 4. Despite being locked, "CommunityRating" is replaced with the TMDb rating...
Luke 42078 Posted December 22, 2024 Posted December 22, 2024 Hi there, let's look at a specific example: How to Report a Problem Thanks !
Happy2Play 9780 Posted December 22, 2024 Posted December 22, 2024 @luserSorry I don't entirely follow Edited from 5.9 to 9.5 and locked. Refreshed metadata search for missing or Replace All had no change. So this can come back to what is your library settings? Is there a NFO file with media? As it sounds like you have a nfo file but do not have Emby writing nfo files so nfo data overwrites database data. But that is just a guess without all the information. 1
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 You might be on to something with the NFO files. There are NFO files and Emby maintains them. It looks like edits to SQLite and NFO files might be "conflicting" with each other. Despite locking the "CommunityRating" field (LockedFields = 'CommunityRating') in SQLite, I noticed some of my items don't display the lock in the UI. I'll have to take a closer look now, thanks for the insight.
Happy2Play 9780 Posted December 22, 2024 Posted December 22, 2024 1 minute ago, luser said: You might be on to something with the NFO files. There are NFO files and Emby maintains them. It looks like edits to SQLite and NFO files might be "conflicting" with each other. Despite locking the "CommunityRating" field (LockedFields = 'CommunityRating') in SQLite, I noticed some of my items don't display the lock in the UI. I'll have to take a closer look now, thanks for the insight. Have you verified Library setting to write nfo per library? If enabled have you verified editing in Emby is actually written to nfo or maybe getting permissions errors?
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 (edited) Yes, Yes. Emby maintains the NFO files. There are no permission issues. As a sanity check, I verified changes made in the UI are reflected in the NFO file. For anyone else who stumbles along this thread... "Community rating" is "rating" in the NFO file. - Community rating (in the web UI) - CommunityRating (in SQLite) - rating (in the NFO file) Edited December 22, 2024 by luser
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 In summary... There doesn't appear to be an issue with Emby updating locked fields. It was a misunderstanding of the situation on my part. It looks like I need to rethink the way I'm setting CommunityRating. I'm not 100% sure what's going on yet, but the NFO file and edits to SQLite seem to be "conflicting" with each other. I need to investigate further to find out. Thanks for the insight @Happy2Play: ) 1
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 I think this might be a timing issue (an issue with my method). Scenario Inspecting an item... In SQLite, the "CommunityRating" is a locked field. In the UI, "Community rating" is a locked field (lock is displayed beside field) However, in the NFO file, `<lockedfields>` doesn't exist. If I disable the lock in the UI, save, re-enable the lock in the UI, and save; the NFO file is updated: ``` <lockedfields>CommunityRating</lockedfields> ``` I don't think I'm giving Emby enough time to write changes to the NFO file. Question My method still needs to change, but I'm curious if anyone knows... Assuming the values are different, which takes precedence; fields in SQLite or NFO?
Happy2Play 9780 Posted December 22, 2024 Posted December 22, 2024 7 minutes ago, luser said: Assuming the values are different, which takes precedence; fields in SQLite or NFO? Since I will assume you have NFO reader enabled it will always take precedence. So, when NFO is reread it will/can change database info.
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 (edited) To be clear, the NFO reader and writer are enabled for the library and there are no permission issues. As a sanity check, I verified changes made in the UI are reflected in the NFO file. - Metadata Readers - [X] Nfo - Metadata Savers - [X] Nfo ------------------------------------------------------------------------------------------------------------------------------------------------------ > So, when NFO is reread it will/can change database info. The opposite is happening. Scenario The NFO file, the SQLite DB, and the UI all show the same rating for an item. - In the UI, an item contains a "Community rating" of 7.5 (the field is unlocked) - The corresponding NFO file for this item contains `<rating>7.5</rating>` - In SQLite, the item's CommunityRating = 7.5 An edit is made to the NFO file. After scanning, Emby changes the value in the NFO file value back to what is containing in SQLite. 1. The NFO file is edited manually (by me); `<rating>7.5</rating>` is changed to `<rating>8.5</rating>` 2. The "Scan media library" scheduled task is executed and completes successfully. 3. The NFO file is automatically edited by Emby; `<rating>8.5</rating>` is changed back to `<rating>7.5</rating>` Edited December 22, 2024 by luser
Happy2Play 9780 Posted December 22, 2024 Posted December 22, 2024 There are issues with your said method if locked fields are at play as the db will supersede nfo in this circumstance. As you cannot manually edit nfo folder with locked statuses you have to update via Emby UI or API only. As all locked fields will push db data back to nfo file.
Happy2Play 9780 Posted December 22, 2024 Posted December 22, 2024 So my example I had to remove CommunityRating Field lock, then I can manipulate the field in NFO files and it will be read and change db.
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 Gotcha. You appear to be correct. The UI doesn't show a lock next to "Community rating". The NFO file does not contain "<lockedfields>". However... In SQLite, LockedFields = 'CommunityRating' for this item. So... Emby is just not displaying the value of this field correctly.
Happy2Play 9780 Posted December 22, 2024 Posted December 22, 2024 4 minutes ago, luser said: Gotcha. You appear to be correct. The UI doesn't show a lock next to "Community rating". The NFO file does not contain "<lockedfields>". However... In SQLite, LockedFields = 'CommunityRating' for this item. So... Emby is just not displaying the value of this field correctly. If the UI and DB do not match I am guessing you will have lots of issues. @Lukeshould this even be possible?
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 I think the "issue" is that I'm really not "supposed to" edit the DB. Somehow I'm confusing Emby by doing so. Either I need to find out what that confusion is, or come up with a different method that doesn't involve editing the DB. I'll have to investigate further. Discussing it helped though.
Happy2Play 9780 Posted December 22, 2024 Posted December 22, 2024 (edited) 2 minutes ago, luser said: Either I need to find out what that confusion is, or come up with a different method that doesn't involve editing the DB. I'll have to investigate further. Discussing it helped though. I will guess you potentially need to look aa api edits. But it really comes back to what exactly you are doing. Edited December 22, 2024 by Happy2Play
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 For sure. Thanks I definitely need to change my method. I didn't realize it was possible via API. I'll look into that.
Luke 42078 Posted December 22, 2024 Posted December 22, 2024 If you didn’t have nfo files then editing the database directly would probably be ok. But since you have them, if you edit one but not the other it means you’re going to have two pieces of data that are out of sync, which could result in any number of unknown quirks. 1
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 Thanks. I disabled the NFO reader and tested again. Refresh metadata (search for missing) still replaces item's existing CommunityRating. I tried to pad the CommunityRating value with zeros so it matches the TMDb "format", but the results are the same. Question @Luke, What is considered "missing" metadata? I'd expect "missing" to mean the SQL value was NULL, but through my testing this doesn't seem to be the case.
Luke 42078 Posted December 22, 2024 Posted December 22, 2024 Did you do this with the server shut down?
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 (edited) 2 minutes ago, Luke said: Did you do this with the server shut down? Yes. Clean shutdown. Actually, beforehand, I enable the "Vacuum the database on the next Emby Server startup" option, restart, wait a bit, then shutdown. Edited December 22, 2024 by luser
Luke 42078 Posted December 22, 2024 Posted December 22, 2024 OK then what I would suggest is to do everything with the UI and verify that it functions as expected. Once you have that, then it's a matter of finding the database differences between what the server does vs what you are doing. 1
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 (edited) Okay, thanks. I'll perform a test. In the meantime, are you able to explain what is considered "missing metadata"? I'd expect "missing" to mean the SQL value was NULL, but through my testing this doesn't seem to be the case. Edited December 22, 2024 by luser
luser 37 Posted December 22, 2024 Author Posted December 22, 2024 (edited) > I tried to pad the CommunityRating value with zeros so it matches the TMDb "format", but the results are the same. Actually it looks like this test didn't work. Setting a value of 8.50000000000000 actually sets/saves 8.5. I assume this is a SQL datatype "feature". I can test again by setting 8.50000000000001. --------------------------------------------------------------------------------------------------------- Setting the Community rating in the UI (9.1) and restarting results in a DB value of 9.10000038146973. I'm starting the think "missing" means null -- OR not the expected format. Testing... Edited December 22, 2024 by luser
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now