[PATCH] getnfofil() didn't find nfofile if named other then name of file inside rar
#1
please see thread for problem that it solves:
http://forum.xbmc.org/showthread.php?tid=34514


Ok, I spent the night reading through the puny little pieces of code and came up with this:

since the item supplied never m_bisFolder (in my case) it never checks if there are any lonely nfo-files in the directory. so... I used my mad copy/paste coding skills and created this:

Code:
Index: xbmc/VideoInfoScanner.cpp
===================================================================
--- xbmc/VideoInfoScanner.cpp    (revision 13902)
+++ xbmc/VideoInfoScanner.cpp    (working copy)
@@ -1036,7 +1036,7 @@
         }
       }

-      if (nfoFile.IsEmpty()) // final attempt - strip off any cd1 folders
+      if (nfoFile.IsEmpty()) // almost final attempt - strip off any cd1 folders
       {
         CStdString strPath;
         CUtil::GetDirectory(item->m_strPath,strPath);
@@ -1049,6 +1049,33 @@
           return GetnfoFile(&item2,bGrabAny);
         }
       }
+      if (nfoFile.IsEmpty()) //this is final attempt - check if there are any lonely .nfo files in the directory where file resides in
+      {
+      CFileItemList items;
+        CDirectory dir;
+        CStdString strPath = item->m_strPath;
+        if (!item->m_bIsFolder)
+          CUtil::GetDirectory(item->m_strPath,strPath);
+        if (dir.GetDirectory(strPath, items, ".nfo") && items.Size())
+        {
+          int numNFO = -1;
+          for (int i = 0; i < items.Size(); i++)
+          {
+            if (items[i]->IsNFO())
+            {
+              if (numNFO == -1)
+                numNFO = i;
+              else
+              {
+                numNFO = -1;
+                break;
+              }
+            }
+          }
+          if (numNFO > -1)
+            return items[numNFO]->m_strPath;
+        }
+      }
     }
     if (item->m_bIsFolder || (bGrabAny && nfoFile.IsEmpty()))
     {

Please have a look at this, I tested it and it seems to work.Shocked

mvh/regards T. Watz
Reply

Logout Mark Read Team Forum Stats Members Help
[PATCH] getnfofil() didn't find nfofile if named other then name of file inside rar0