Issue with deleting episodes when shutting down (1 Viewer)

dabbith

Portal Member
June 7, 2007
17
13
Home Country
United States of America United States of America
Hello,

I noticed a slight problem with the way the file watcher works right now. My files are located on a network share. If I shut down or hibernate with MediaPortal running, I loose connection to the wireless network before MediaPortal closes. This prompts TVSeries to delete all my episodes (the watcher detects the files are missing).

I think if it checked to make sure the watched directory was still there before removing individual files that would avoid the problem. One possible patch is below, but it would check to see that the directory exists on each file add and remove. It might be better to only check when the WatcherChangeType is Deleted, or possibly somewhere else in the code.

Thanks,

Dan

Code:
Index: OnlineParse.cs
===================================================================
--- OnlineParse.cs	(revision 230)
+++ OnlineParse.cs	(working copy)
@@ -130,7 +130,11 @@
 
         void watcher_Changed(object sender, FileSystemEventArgs e)
         {
-            // a file has changed! created, not created, whatever. Just add it to our list. We only process this list once in a while
+          // a file has changed! created, not created, whatever. Just add it to our list. We only process this list once in a while
+          FileSystemWatcher watcher = sender as FileSystemWatcher;
+          if (Directory.Exists(watcher.Path))
+          {
+
             lock (m_modifiedFilesList)
             {
                 foreach (WatcherItem item in m_modifiedFilesList)
@@ -142,6 +146,7 @@
                 m_modifiedFilesList.Add(new WatcherItem(sender as FileSystemWatcher, e));
                 progressUpdateRequired = true; // signal the worker thread (not using events because we don't want to react immediatly but only every couple of seconds at the most
             }
+          }
         }
 
         void setUpWatches()
 

Users who are viewing this thread

Top Bottom