Jump to content

If you move tv/movies files into the final EMBY folder it will be ignored by the EMBY real time monitoring!!!


Recommended Posts

Posted

If you move tv/movies files, into the final EMBY folder, it will be ignored by the EMBY real time monitoring!!!
EMBY watcher on Linux only watch for created files.

Problem in Emby: "MOVED_TO" Events Ignored

Many media managers (including older Emby builds or certain configurations) only respond to CREATE events — not MOVED_TO.

So if the file arrives like this:

mv tempfile.mkv Foundation.S03E03.1080p.mkv

Then Emby’s real-time watcher might not treat it as a new file, depending on:

  • When it happens

  • Whether metadata lookup fails silently

  • Internal debounce or file locking bugs

There are many tools like sab, sonarr and at least 20 more tools that depend on moving the temp file to final location. 

Real Fix Option: Cron + API Refresh Script

If Emby is unreliable in catching MOVED_TO, consider running a 2-minute cron:

*/2 * * * * curl -X POST http://localhost:8096/Library/Refresh --header "X-Emby-Token: YOUR_TOKEN"

Replace YOUR_TOKEN with your Emby access token (from browser network panel during manual scan).

 

Emby reacts correctly only to a CREATE + CLOSE_WRITE event or if the first time series is added and the folder is brand new, that could trigger EMBY real time monitoring just because of the folder\subfolder creation, but if series or season folder is existed and the new episode is moved upon creation to EMBY folder, its 100% confirmed that it will be ignored!

There are eventually post scripts for tools to touch file upon finalizing the move which will CREATE + CLOSE_WRITE event to complete the trigger for EMBY real time monitoring.

 

The real solution is that EMBY monitor for "MOVED_TO"

 

 

Posted

Hi, that’s interesting. Thanks for the info. We’ll take a look at it, although the issue is likely in the dotnet runtime’s filesystemwatcher. That is what we’re using, which itself is built on top of inotify.

Posted (edited)
Quote

Emby Real-Time Monitoring Issue - Technical Diagnosis
Summary
This document summarizes the real-time monitoring issue experienced in Emby on a Linux-based system when using
the FileSystemWatcher backed by inotify. The user reported that while real-time detection of new media files works for
some libraries, it does not work consistently in the "TV" library.
Key points:
- Manual scanning works.
- Real-time monitoring fails silently on new episodes added by SABnzbd.
- Other libraries work fine.
Root Cause
The issue is not with Linux inotify or file permissions, but rather with the .NET FileSystemWatcher itself, which Emby
uses internally.
.NET FileSystemWatcher has a well-known limitation: it often fails to emit events for MOVED_TO operations, especially
when whole folders are moved at once - which is exactly what SABnzbd does after unpacking content.
What Was Confirmed
- inotifywait confirmed Linux inotify detects MOVED_TO.
- Emby logs show the folder is being watched.
- Files placed using `mv` do not appear in Emby.
- A simple `touch` of the file after the move causes Emby to recognize it immediately.
Workaround (Recommended)
Add a SABnzbd post-processing script to "touch" the final video file after it is moved:
#!/bin/bash
DEST="$1"
STATUS="$3"
if [[ "$STATUS" == "0" ]]; then
FILE=$(find "$DEST" -type f -iname "*.mkv" -printf "%T@ %p\n" | sort -n | tail -1 | cut -d' ' -f2-)
[ -f "$FILE" ] && touch "$FILE"
fi
- This ensures that Emby sees a proper CLOSE_WRITE event, which it does detect correctly.Emby Real-Time Monitoring Issue - Technical Diagnosis
Final Notes
This issue stems from .NET internals and not from Emby directly. The Emby creator has acknowledged this and noted
that it is likely in the .NET runtime.
Users are advised to use simple workarounds until a runtime-level improvement is made upstream.
Important Correction
Important Correction:
If a newly downloaded TV series or full season is not already present in the Emby library, SABnzbd will create the new
series folder and subfolders. In this case, the creation of those folders often triggers the FileSystemWatcher correctly,
and Emby detects the new content in most cases.
However, if the TV series already exists in the Emby library and only a new episode is added into an existing folder, then
SAB typically performs a move operation (MOVED_TO), which is not reliably detected by .NET's FileSystemWatcher. As
a result, Emby ignores the new episode unless a workaround (like touch) is applied.
This distinction is crucial when diagnosing inconsistent real-time behavior depending on the library structure.

I made pdf file for easy submission on github if needed also similar bug was on dotnet github maybe they broke it by fixing some other bug.

https://github.com/dotnet/runtime/pull/50787

 

Above I made script for sabnzbd users

emby_monitoring_issue_summary_corrected.pdf

Edited by loop11
Q-Droid
Posted

Nope. My files are moved and they are all detected.

What are you doing differently and what filesystem type are you using?

 

 

  • Thanks 1
Posted
2 hours ago, Q-Droid said:

Nope. My files are moved and they are all detected.

What are you doing differently and what filesystem type are you using?

 

 

Question is what are you doing different than others from Sonarr or Sabnzbd community who has this problem?

 

For example realtime monitor the path which is the TV folder of your EMBU output with time stamps

Quote

inotifywait -m -r /home/incoming/TV --format '%T %w %e %f' --timefmt '%Y-%m-%d %H:%M:%S'

Now in your case edit this line to exact path of your actual tv folder in emby, set terminal output to 20000 lines because it can be big.

Download tv episode of the series that you already have from the season you already have which means that tv series folder and season subfolder were already present without creation and upload the log file of the ouput, its confirmed with 8 emby/sab users.

  • Thanks 1
Q-Droid
Posted

@Luke and his team might have more accurate numbers but it's safe to say there are thousands, maybe tens of thousands of Emby servers running on Linux alongside the *arrs and other media and file management applications moving files with Emby RTM detecting the moves as expected.

It's known that network and FUSE filesystems don't support inotify so those can be excluded from the equation. The remaining kernel based filesystems function normally and Emby RTM detects the changes.

I don't need to experiment because I can see the activity on my system and in my logs. Series that are currently airing release their episodes incrementally, a new one or two weekly. I can see when the downloads complete, files are moved, then Emby detection and within two minutes the intake begins. Sometimes I don't get a full season and try a few episodes first, then get the rest later. Same behavior with Emby RTM.

 

 

  • Agree 1
Posted

I think you are probably both right. I wouldn’t doubt that with certain file systems or environments the moved to operation might be getting ignored.

Q-Droid
Posted

 

In case you're not convinced this was a simple manual file rename, in place move:

2025-07-26 11:36:13 /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/ MOVED_FROM The Zoo- San Diego - S02E06 - Baby Wallaby Debut - WEBDL-1080p.mp4
2025-07-26 11:36:13 /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/ MOVED_TO The Zoo- San Diego - S02E06 - Baby Wallaby Debut - test -  WEBDL-1080p.mp4

Emby server processing the change after a delay:

2025-07-26 11:37:43 /mnt2/Media/Video/DVR/Series/The Zoo San Diego/ OPEN,ISDIR Season 2
2025-07-26 11:37:43 /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/ OPEN,ISDIR
2025-07-26 11:37:43 /mnt2/Media/Video/DVR/Series/The Zoo San Diego/ ACCESS,ISDIR Season 2
2025-07-26 11:37:43 /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/ ACCESS,ISDIR
2025-07-26 11:37:43 /mnt2/Media/Video/DVR/Series/The Zoo San Diego/ ACCESS,ISDIR Season 2
2025-07-26 11:37:43 /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/ ACCESS,ISDIR
2025-07-26 11:37:43 /mnt2/Media/Video/DVR/Series/The Zoo San Diego/ CLOSE_NOWRITE,CLOSE,ISDIR Season 2
2025-07-26 11:37:43 /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/ CLOSE_NOWRITE,CLOSE,ISDIR


From the Emby log, it detects the change:

2025-07-26 11:36:13.057 Debug LibraryMonitor: Change detected to /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/The Zoo- San Diego - S02E06 - Baby Wallaby Debut - test -  WEBDL-1080p.mp4
2025-07-26 11:36:13.057 Debug LibraryMonitor: New file refresher created for /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/The Zoo- San Diego - S02E06 - Baby Wallaby Debut - test -  WEBDL-1080p.mp4

And then processes the "new" file after some delay:

2025-07-26 11:37:43.054 Debug LibraryMonitor: Timer stopped.
2025-07-26 11:37:43.063 Info LibraryMonitor: Season 2 (/mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2) will be refreshed.
2025-07-26 11:37:43.121 Debug BaseItem: Removed item 1079257 Episode /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/The Zoo- San Diego - S02E06 - Baby Wallaby Debut - WEBDL-1080p.mp4
2025-07-26 11:37:43.121 Info App: Removing item from database, Type: Episode, Name: Baby Wallaby Debut, Path: /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/The Zoo- San Diego - S02E06 - Baby Wallaby Debut - WEBDL-1080p.mp4, Id: 1079257
2025-07-26 11:37:43.126 Info App: Deleting path /var/lib/emby/metadata/library/bf/bf90f94b45950ab88af52a18688add96
2025-07-26 11:37:43.130 Debug App: Running FFProbeProvider for /mnt2/Media/Video/DVR/Series/The Zoo San Diego/Season 2/The Zoo- San Diego - S02E06 - Baby Wallaby Debut - test -  WEBDL-1080p.mp4

 

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