GetnfoFile() does'nt always find the .nfo file when playing movies from rar archives
#1
Hi,

In cases when the file structure is as following the GetnfoFile() can't find a matching nfo-file:


c:\moviename.2007.dvdr.dts-rlgroup\moviename-rlgroup.rar
c:\moviename.2007.dvdr.dts-rlgroup\........(inside rars)moviename-rlgorup.iso
c:\moviename.2007.dvdr.dts-rlgroup\moviename.2007.dvdr.dts-rlgroup.nfo

the group has in this case put the foldername in the nfo-file instead of the name of the iso-file. If the nfo was named moviename-rlgroup.nfo the GetnfoFile() will find it. The problem is, from what I can figure out from looking at the code, that the if-procedure that checks if there is an unique nfo file in the same directory does not take in consideration that the movie file is in a rar-archive.
If the iso is unrared, the .nfo can have whatever name it wants. As long as it is unique.

Fixing this would maybe solve a lot of problems users are having with scraping movies. Since all scene-releases (I've encountered) have a .nfo file with the imdb link in it. But the naming conventions of it isn't always the best. Sure you can simply rename it to have the same name as the iso-file, but that takes away some of the simplicity of telling your server to download a torrent and then without anymore fiddling have it in your xbmc database

The code is in VideoInfoScanner.cpp and starts at line 990 and streches to 1083 if someone wants to have a look at it.

mvh/regards
T. Watz
#2
Yeah. It doesnt find them because you have them in the wrong place from what Xbmc is expecting. This all revolves around how Xbmc treats an archive as a folder, and it's not treated any differently than a true folder. This causes some user confusion. When it needs to look for a auxiliary file based off the actual media file's name -- nfo files, and external subtitles come to mind -- Xbmc looks in the folder where the media file resides. In this case, the folder is the actual archive file. Feel free to post a patch to have Xbmc also check in the location where the archive file is located.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
#3
hmm, sorry I'm not that adept on coding. I mearly understand the basics and read the comments in the code.

please enlighten me...

my understanding of the GetnfoFile is this...(psuedo code basic++)



Code:
getnfofile(getsome input data)

if (!item->m_bIsFolder) <- do not understand that condition{
[INDENT]if(selected item is a rar){
[INDENT]remove the archive name in the path;
redo getnfofile with new path to look in;[/INDENT]
}
if(do some checks if we can find a nfo file)
[INDENT]return the file[/INDENT]
if(do some checks if we can find a nfo file)
[INDENT]return the file[/INDENT]
if(do some checks if we can find a nfo file)
[INDENT]return the file[/INDENT][/INDENT]
} <- here ends the first if

if (item->m_bIsFolder || (bGrabAny && nfoFile.IsEmpty())) <-don't exactly understand this one either
{
this one looks for a unique nfo-file and returns is and it works, but
not when the selected movie is in a rar
}

if this is what the code is supposed to do I don't see why it shouldn't work. The first one checks if the selected file is in a rar and removes some pieces of the virtual path and then it runs again(?). And in the second run it shouldn't find any matching files and then proceed to the "find unique nfofile" procedure.

please let me know if this is all jibberish Rolleyes
#4
Big Grin 
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 kraqh3d, I tested it and it seems to work.Shocked

mvh/regards T. Watz
#5
I presume you only want this to occur if you are in a rar or zip - has this check been made?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
#6
hmm got me there... will have to add that...damn, no edit... make me look stupid...Wink

seriously the only thing I can come up with is to copy the (israrcheckingcode) that is a couple of lines up in the code.
#7
I think the best thing to do is write some comments as to what GetNfoFile() is doing and what it should be doing. The code will then take care of itself.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
#8
do you think adding this:
&& CUtil::IsInRAR(item->m_strPath)

to the new if() would do it?
#9
jmarshall Wrote:I think the best thing to do is write some comments as to what GetNfoFile() is doing and what it should be doing. The code will then take care of itself.

well that's what I thought I was doin in the first place when I started this thread, but after kraqh3d's response I felt like he wasn't up for it.
#10
This needs to be a special check which is only done if and only if the item is in an archive. It should behave as normal first, which is to look in the folder where the media file is. In the case of an archived file, this is within the archive. Then if nothing is found there, try the folder where the archive, itself, is located. It could also try with "bGrabAny" to pick up any nfo file it finds, regardless of name.

Please don't take this the wrong way, but I really had no interest in changing this behaviour. As far as I'm concerned it's not a problem. But, I gave you the info about why it works as it does so that you could look into and change it if you felt so inclined to do so.

And I won't have time to play with your code until the weekend but it just looking it over, I think the only missing thing is to do the "IsInRAR()" and "IsInZIP()" test.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
#11
kraqh3d Wrote:This needs to be a special check which is only done if and only if the item is in an archive. It should behave as normal first, which is to look in the folder where the media file is. In the case of an archived file, this is within the archive. Then if nothing is found there, try the folder where the archive, itself, is located. It could also try with "bGrabAny" to pick up any nfo file it finds, regardless of name.
ok, I totally agree with you that it this should be a special check, thats why I put it on the bottom. the "bGrabAny"... I have no idea what it does, and where...

kraqh3d Wrote:Please don't take this the wrong way, but I really had no interest in changing this behaviour. As far as I'm concerned it's not a problem. But, I gave you the info about why it works as it does so that you could look into and change it if you felt so inclined to do so.
no problem, I didn't take it the wrong way. however, I do feel that this is a problem as no scene-releases pack thier nfo-file in their rar-archives.

kraqh3d Wrote:And I won't have time to play with your code until the weekend but it just looking it over, I think the only missing thing is to do the "IsInRAR()" and "IsInZIP()" test.
Thats okey, it works for me for now and maybe someone else have the time. the "IsInRAR()" I understand and I think the extra "&& CUtil::IsInRAR(item->m_strPath)" could do it, but the IsInZIP() seems a bit superfluous.

mvh/regards Watz
#12
Quote:however, I do feel that this is a problem as no scene-releases pack thier nfo-file in their rar-archives.
XBMC should not conform to the rules of piracy.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
#13
kraqh3d Wrote:XBMC should not conform to the rules of piracy.

seriously?...nah, no point to discuss...
#14
hey, kraqh3d.
Had any time looking into this bug and solution
#15
no i haven't yet but there are some other routines which would need similar changes so that there is uniformity. what comes to mind is thumbnail and fanart matching routines. im sure there's some more.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Logout Mark Read Team Forum Stats Members Help
GetnfoFile() does'nt always find the .nfo file when playing movies from rar archives0