[Issue]: Importing watched status from NFO is not working #4849

Closed
opened 2026-02-07 01:12:40 +03:00 by OVERLORD · 13 comments
Owner

Originally created by @TwentyWasHere on GitHub (May 14, 2023).

Please describe your bug

When parsing NFO files Jellyfin does not process watched information from NFO files, all imported media show up as unwatched.

No NFO Saver activated on the source because I do not want Jellyfin to update the NFO itself, just read what is in there includung the watched status (the UI states it is for saving only, not for reading). A user has been set in the general NFO settings though.

Jellyfin Version

10.8.z

Environment

- OS: Debian 11
- Virtualization: Docker

Jellyfin logs

No response

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Originally created by @TwentyWasHere on GitHub (May 14, 2023). ### Please describe your bug When parsing NFO files Jellyfin does not process watched information from NFO files, all imported media show up as unwatched. No NFO Saver activated on the source because I do not want Jellyfin to update the NFO itself, just read what is in there includung the watched status (the UI states it is for saving only, not for reading). A user has been set in the general NFO settings though. ### Jellyfin Version 10.8.z ### Environment ```markdown - OS: Debian 11 - Virtualization: Docker ``` ### Jellyfin logs _No response_ ### FFmpeg logs _No response_ ### Please attach any browser or client logs here _No response_ ### Please attach any screenshots here _No response_ ### Code of Conduct - [X] I agree to follow this project's Code of Conduct
OVERLORD added the bugstale labels 2026-02-07 01:12:40 +03:00
Author
Owner

@TwentyWasHere commented on GitHub (May 14, 2023):

Did some playing around with a fresh container and just a few movies.

Jellyfin itself detects the watch state (I added some debug code to dump the information) but fails to update the UserData in SQLLite later on.:

[2023-05-14 17:00:42.969 +02:00] [ERR] [31] MediaBrowser.Providers.Movies.MovieMetadataService: Error in "Nfo"
Busy: SQLitePCL.pretty.SQLiteException: database is locked
   at SQLitePCL.pretty.SQLiteException.Throw(Int32 rc, Int32 extended, String msg)
   at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc)
   at SQLitePCL.pretty.StatementImpl.MoveNext()
   at Emby.Server.Implementations.Data.SqliteUserDataRepository.SaveUserData(IDatabaseConnection db, Int64 internalUserId, String key, UserItemData userData)
   at SQLitePCL.pretty.DatabaseConnection.<>c__DisplayClass20_0.<RunInTransaction>b__0(IDatabaseConnection db)
   at SQLitePCL.pretty.DatabaseConnection.RunInTransaction[T](IDatabaseConnection This, Func`2 f, TransactionMode mode)
   at SQLitePCL.pretty.DatabaseConnection.RunInTransaction(IDatabaseConnection This, Action`1 action, TransactionMode mode)
   at Emby.Server.Implementations.Data.SqliteUserDataRepository.PersistUserData(Int64 internalUserId, String key, UserItemData userData, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.UserDataManager.SaveUserData(User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken)
   at MediaBrowser.XbmcMetadata.Parsers.BaseNfoParser`1.FetchDataFromXmlNode(XmlReader reader, MetadataResult`1 itemResult)
   at MediaBrowser.XbmcMetadata.Parsers.MovieNfoParser.FetchDataFromXmlNode(XmlReader reader, MetadataResult`1 itemResult)
   at MediaBrowser.XbmcMetadata.Parsers.BaseNfoParser`1.Fetch(MetadataResult`1 item, String metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken)
   at MediaBrowser.XbmcMetadata.Parsers.BaseNfoParser`1.Fetch(MetadataResult`1 item, String metadataFile, CancellationToken cancellationToken)
   at MediaBrowser.XbmcMetadata.Providers.BaseVideoNfoProvider`1.Fetch(MetadataResult`1 result, String path, CancellationToken cancellationToken)
   at MediaBrowser.XbmcMetadata.Providers.BaseNfoProvider`1.GetMetadata(ItemInfo info, IDirectoryService directoryService, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RefreshWithProviders(MetadataResult`1 metadata, TIdType id, MetadataRefreshOptions options, ICollection`1 providers, ItemImageProvider imageService, CancellationToken cancellationToken)

The scanning of movies works fine and completes, but everytime "_userDataManager.SaveUserData(user, item, userData, UserDataSaveReason.Import, CancellationToken.None);" is called to update the user data for watched/lastplayed/playcount in "MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs" during scanning a Busy exception is thrown and therefore the watched status is never saved.

@TwentyWasHere commented on GitHub (May 14, 2023): Did some playing around with a fresh container and just a few movies. Jellyfin itself detects the watch state (I added some debug code to dump the information) but fails to update the UserData in SQLLite later on.: ``` [2023-05-14 17:00:42.969 +02:00] [ERR] [31] MediaBrowser.Providers.Movies.MovieMetadataService: Error in "Nfo" Busy: SQLitePCL.pretty.SQLiteException: database is locked at SQLitePCL.pretty.SQLiteException.Throw(Int32 rc, Int32 extended, String msg) at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc) at SQLitePCL.pretty.StatementImpl.MoveNext() at Emby.Server.Implementations.Data.SqliteUserDataRepository.SaveUserData(IDatabaseConnection db, Int64 internalUserId, String key, UserItemData userData) at SQLitePCL.pretty.DatabaseConnection.<>c__DisplayClass20_0.<RunInTransaction>b__0(IDatabaseConnection db) at SQLitePCL.pretty.DatabaseConnection.RunInTransaction[T](IDatabaseConnection This, Func`2 f, TransactionMode mode) at SQLitePCL.pretty.DatabaseConnection.RunInTransaction(IDatabaseConnection This, Action`1 action, TransactionMode mode) at Emby.Server.Implementations.Data.SqliteUserDataRepository.PersistUserData(Int64 internalUserId, String key, UserItemData userData, CancellationToken cancellationToken) at Emby.Server.Implementations.Library.UserDataManager.SaveUserData(User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken) at MediaBrowser.XbmcMetadata.Parsers.BaseNfoParser`1.FetchDataFromXmlNode(XmlReader reader, MetadataResult`1 itemResult) at MediaBrowser.XbmcMetadata.Parsers.MovieNfoParser.FetchDataFromXmlNode(XmlReader reader, MetadataResult`1 itemResult) at MediaBrowser.XbmcMetadata.Parsers.BaseNfoParser`1.Fetch(MetadataResult`1 item, String metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken) at MediaBrowser.XbmcMetadata.Parsers.BaseNfoParser`1.Fetch(MetadataResult`1 item, String metadataFile, CancellationToken cancellationToken) at MediaBrowser.XbmcMetadata.Providers.BaseVideoNfoProvider`1.Fetch(MetadataResult`1 result, String path, CancellationToken cancellationToken) at MediaBrowser.XbmcMetadata.Providers.BaseNfoProvider`1.GetMetadata(ItemInfo info, IDirectoryService directoryService, CancellationToken cancellationToken) at MediaBrowser.Providers.Manager.MetadataService`2.RefreshWithProviders(MetadataResult`1 metadata, TIdType id, MetadataRefreshOptions options, ICollection`1 providers, ItemImageProvider imageService, CancellationToken cancellationToken) ``` The scanning of movies works fine and completes, but everytime "_userDataManager.SaveUserData(user, item, userData, UserDataSaveReason.Import, CancellationToken.None);" is called to update the user data for watched/lastplayed/playcount in "MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs" during scanning a Busy exception is thrown and therefore the watched status is never saved.
Author
Owner

@Shadowghost commented on GitHub (May 14, 2023):

Can you please post the used NFO?

@Shadowghost commented on GitHub (May 14, 2023): Can you please post the used NFO?
Author
Owner

@TwentyWasHere commented on GitHub (May 14, 2023):

Attached is one example, where it fails on SaveUserData. Note sometimes one movie makes it through and the watched state is set (I tested with a set of 25 movies in a folder of which three were set to watched).

test_movie.nfo.zip

@TwentyWasHere commented on GitHub (May 14, 2023): Attached is one example, where it fails on SaveUserData. Note sometimes one movie makes it through and the watched state is set (I tested with a set of 25 movies in a folder of which three were set to watched). [test_movie.nfo.zip](https://github.com/jellyfin/jellyfin/files/11472286/test_movie.nfo.zip)
Author
Owner

@jellyfin-bot commented on GitHub (Sep 12, 2023):

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

@jellyfin-bot commented on GitHub (Sep 12, 2023): This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments. If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label. This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on [Matrix or Social Media](https://docs.jellyfin.org/general/getting-help.html).
Author
Owner

@rschuiling commented on GitHub (Oct 6, 2023):

I have the same issue, unfortunately this one was just closed. Do I need to raise a new issue or can this be looked at again?

@rschuiling commented on GitHub (Oct 6, 2023): I have the same issue, unfortunately this one was just closed. Do I need to raise a new issue or can this be looked at again?
Author
Owner

@jellyfin-bot commented on GitHub (Feb 4, 2024):

This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs.

If you have any questions you can use one of several ways to contact us.

@jellyfin-bot commented on GitHub (Feb 4, 2024): This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs. If you have any questions you can use one of several ways to [contact us](https://jellyfin.org/contact).
Author
Owner

@Zothoz commented on GitHub (Feb 17, 2024):

This topic is still open, nfo state "< watched >true</ watched >" is ignored when importing movies. (had to enter spaces between the brackets to show correctly as post).

@Zothoz commented on GitHub (Feb 17, 2024): This topic is still open, nfo state "< watched >true</ watched >" is ignored when importing movies. (had to enter spaces between the brackets to show correctly as post).
Author
Owner

@Morphy99 commented on GitHub (Feb 25, 2024):

I've just migrated from Emby and have the same problem. This is a deal breaker for me :(

@Morphy99 commented on GitHub (Feb 25, 2024): I've just migrated from Emby and have the same problem. This is a deal breaker for me :(
Author
Owner

@jellyfin-bot commented on GitHub (Jun 25, 2024):

This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs.

If you have any questions you can use one of several ways to contact us.

@jellyfin-bot commented on GitHub (Jun 25, 2024): This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs. If you have any questions you can use one of several ways to [contact us](https://jellyfin.org/contact).
Author
Owner

@jellyfin-bot commented on GitHub (Jul 16, 2024):

This issue was closed due to inactivity.

@jellyfin-bot commented on GitHub (Jul 16, 2024): This issue was closed due to inactivity.
Author
Owner

@brupec commented on GitHub (Aug 16, 2024):

Hello, issue is still present.

It had been fixed while ago already two times, but seems changed is removed each time ?

https://github.com/jellyfin/jellyfin/issues/8415

@brupec commented on GitHub (Aug 16, 2024): Hello, issue is still present. It had been fixed while ago already two times, but seems changed is removed each time ? https://github.com/jellyfin/jellyfin/issues/8415
Author
Owner

@brupec commented on GitHub (Aug 16, 2024):

OK actually it seems to work on some files, other not. so the problem may be different.

Here are two NFOs. I renamed them to NOK and OK, NOK appears as unseen when loaded in Jellyfin, OK appears as seen. I added .log to the filename.
NOK.nfo.log
OK.nfo.log

Both have the watched tag to true.

Edit: confirmed after importing my whole kodi database. I would say like half of the title watched status was not imported, even if present in nfo. I did it manually, but definately something to fix here in my opinion. Cheers

@brupec commented on GitHub (Aug 16, 2024): OK actually it seems to work on some files, other not. so the problem may be different. Here are two NFOs. I renamed them to NOK and OK, NOK appears as unseen when loaded in Jellyfin, OK appears as seen. I added .log to the filename. [NOK.nfo.log](https://github.com/user-attachments/files/16636250/NOK.nfo.log) [OK.nfo.log](https://github.com/user-attachments/files/16636251/OK.nfo.log) Both have the watched tag to true. Edit: confirmed after importing my whole kodi database. I would say like half of the title watched status was not imported, even if present in nfo. I did it manually, but definately something to fix here in my opinion. Cheers
Author
Owner

@vvdveen commented on GitHub (Nov 1, 2024):

I ran into this bug when migrating from Kodi to Jellyfin. Jellyfin writes UserData to the database immediately after reading a userdata field (e.g., playcount or lastplayed). But because kodi writes identifiers (e.g., IMDB id or TMDB id) to the .nfo AFTER userdata, Jellyfin does not know to what entry the userdata should be written. When I changed my .nfo to always have the uniqueid tags at the very beginning of the XML tree, Jellyfin would indeed start importing.

  • Ideally, we fix this by changing RefreshMetadata() such that it first completes parsing the entire XML and then saves all UserData at once.

I then ran into a related issue where no movie would be shown as watched. Jellyfin expects a "watched" tag in the .nfo that is not written by kodi. I fixed this by changing my .nfo to include a "watched" tag.

  • Ideally, we fix this by changing the parser such that it sets the watched status (called "played" in Jellyfin) to true if lastplayed was set or if playcount is greater than 0.

I then observed a third issue where some movies that did not have their watch status set, would still show up as "recently played". This seems to be caused by the caching mechanism for UserData. This uses a key that is the same for all videos. Jellyfin caches only one UserData item, makes changes to that, and writes it to disk. So any UserData field not updated by the .nfo would default to whatever Jellyfin saw when parsing an earlier .nfo. I fixed this by disabling the caching mechanism and recompile Jellyfin.

  • Ideally, we fix this by changing the caching mechanism to use the video's unique id (+ user id) as key instead.

Unfortunately, I find the code a bit convoluted. Fixing the above will take me time that I don't have :( Instead I wrote a script to update my .nfo files. Combined with a small patch that disables the caching of UserData, I think I can now import my kodi video library correctly. Because this is only a one-time event, it may work for others too: https://gist.github.com/vvdveen/e7de190e0d73423b109ac15f1e78e3b5

@vvdveen commented on GitHub (Nov 1, 2024): I ran into this bug when migrating from Kodi to Jellyfin. Jellyfin writes UserData to the database immediately after reading a userdata field (e.g., playcount or lastplayed). But because kodi writes identifiers (e.g., IMDB id or TMDB id) to the .nfo AFTER userdata, Jellyfin does not know to what entry the userdata should be written. When I changed my .nfo to always have the uniqueid tags at the very beginning of the XML tree, Jellyfin would indeed start importing. - Ideally, we fix this by changing RefreshMetadata() such that it first completes parsing the entire XML and then saves all UserData at once. I then ran into a related issue where no movie would be shown as watched. Jellyfin expects a "watched" tag in the .nfo that is not written by kodi. I fixed this by changing my .nfo to include a "watched" tag. - Ideally, we fix this by changing the parser such that it sets the watched status (called "played" in Jellyfin) to true if lastplayed was set or if playcount is greater than 0. I then observed a third issue where some movies that did not have their watch status set, would still show up as "recently played". This seems to be caused by the caching mechanism for UserData. This uses a key that is the same for all videos. Jellyfin caches only one UserData item, makes changes to that, and writes it to disk. So any UserData field not updated by the .nfo would default to whatever Jellyfin saw when parsing an earlier .nfo. I fixed this by disabling the caching mechanism and recompile Jellyfin. - Ideally, we fix this by changing the caching mechanism to use the video's unique id (+ user id) as key instead. Unfortunately, I find the code a bit convoluted. Fixing the above will take me time that I don't have :( Instead I wrote a script to update my .nfo files. Combined with a small patch that disables the caching of UserData, I think I can now import my kodi video library correctly. Because this is only a one-time event, it may work for others too: https://gist.github.com/vvdveen/e7de190e0d73423b109ac15f1e78e3b5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#4849