Opened 13 years ago

Closed 13 years ago

#2791 closed patch (fixed)

Duplicate filenames in database not removed by VideoManager

Reported by: arniemisfeldt@… Owned by: Anduin Withers
Priority: minor Milestone: unknown
Component: mythvideo Version: 0.20
Severity: low Keywords:
Cc: Ticket locked: no

Description (last modified by Nigel)

I don't know how the duplicate files ended up in the database, but the VideoManager? would not delete them from the database when they were removed from the file system.

VideoScanner::verifyFiles in mythvideo/mythvideo/videoscan.cpp would mark the file for removal the first time through the for loop. The second time through the for loop, the file would get removed from the 'removal list'.

This patch checks that the file is a real file and not one marked for removal.

--- videoscan.cpp-orig	2006-12-10 19:06:21.854341471 -0800
+++ videoscan.cpp	2006-12-10 19:06:32.522173552 -0800
@@ -136,8 +136,14 @@
         {
             if ((iter = m_VideoFiles.find(name)) != m_VideoFiles.end())
             {
-                // If it's both on disk and in the database we're done with it.
-                m_VideoFiles.remove(iter);
+                // In case there are duplicate files in the database, check if
+                // this is a real file and not one that was marked for
+                // removal.
+                if (*iter == kFileSystem)
+                {
+                    // If it's both on disk and in the database we're done with it.
+                    m_VideoFiles.remove(iter);
+                }
             }
             else
             {

Thanks, Arnie

Change History (2)

comment:1 Changed 13 years ago by Nigel

Description: modified (diff)

comment:2 Changed 13 years ago by Anduin Withers

Resolution: fixed
Status: newclosed

(In [13369]) Closes #2791

Fix duplicate metadata entry handling (something you should never normally see).

Thanks to arniemisfeldt for discovering this and supplying a patch.

Note: See TracTickets for help on using tickets.