[mythtv-commits] Ticket #2791: Duplicate filenames in database not removed by VideoManager

MythTV mythtv at cvs.mythtv.org
Tue Dec 12 08:43:24 UTC 2006


#2791: Duplicate filenames in database not removed by VideoManager
---------------------------------------+------------------------------------
 Reporter:  arniemisfeldt at hotmail.com  |        Owner:  awithers
     Type:  patch                      |       Status:  new     
 Priority:  minor                      |    Milestone:  unknown 
Component:  mythvideo                  |      Version:  0.20    
 Severity:  low                        |   Resolution:          
---------------------------------------+------------------------------------
Old description:

> 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

New description:

 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

-- 
Ticket URL: <http://cvs.mythtv.org/trac/ticket/2791#comment:1>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list