Skip to content


Subversion checkout URL

You can clone with
Download ZIP


change DVD/VIDEO_TS/VIDEO_TS.IFO folder handling to mimic DVD.iso #1735

wants to merge 5 commits into from

4 participants


This change makes a folder movie/DVD/VIDEO_TS/VIDEO_TS.IFO act as if it were movie/DVD.iso.
the commits are

1) when scraping the movie name is either DVD or movie depending on "movies in folders" option
2)nfos are first searched in movie/DVD/VIDEO_TS/ and DVD for historical compatability then
movie.nfo and then DVD.nfo
3)saving tbns (possibly not needed) and nfos as DVD.nfo
4) saving/loading the new artwork in the movie folder as well as the .actor directory
5) rename GetLocalMetadataPath to GetOpticalFolderPath for clarity.

This change makes it much more consistent from a user point of view and allows movies with multiple DVDs. I'm sure there must be some way (without making them iso's), but I don't know how.

While there is little reason today to not have iso (historically there was the windows file size limit), I and quite a few other people still have large volumes of DVD folders

dragonflight added some commits
@dragonflight dragonflight when scanning with "movies in folders" DVD folders take their parents…
… name

 if the option "movies in folders" is enabled movie name is "movie"
 otherwise "DVD"
@dragonflight dragonflight look for nfo's for DVD Folders in the following order (mimicing an iso)
    1) moviename/dvdname/VIDEO_TS/VIDEO_TS.nfo
    2) moviename/dvdname/VIDEO_TS.nfo
    			as today
    3) moviename/movie.nfo
    			if folders match movie title enabled
    4) moviename/dvdname.nfo
@dragonflight dragonflight save DVD.tbn and DVD.nfo DVD Folder where folder is
@dragonflight dragonflight Save/read Art for DVD folders as if DVD/VIDEO_TS/VIDEO_TS.IFO was DVD…
@dragonflight dragonflight rename GetLocalMetadataPath to GetOpticalFolderPath to better reflect…
… use

This is a whole heap of non-obvious code for the 12 movies in existence that require two or more VIDEO_TS folders. Particularly when you can convert losslessly to ISO, mkv etc.


It is not just multi disc movies (of which I have several - maybe not all 12) it is also all the movies that come as 2 disc sets and of those I have > 1000.
I could convert them all to iso, but AFAIK any other format and you lose the menus and in many cases some of the "extras"


Extra disks can be handled as:


as you typically don't want those scraped anyway, right?


for the multi-disc movies, why don't you just create ISO files like movie.disc1.iso, movie.disc2.iso, etc. And scrape these as multi-part ISO? That functionality works great for me. I have several box-sets too. You can select which part to play, resume points can exist for each part etc.

EDIT: creating ISOs from files is easy (e.g. ImgBurn) and does not lose any menus.


I don't know why DVD folders are the poor cousin in the XBMC world

With this comment I will have spent more time and thought on this discussion than I did on the code!

Anyway a few somewhat nonsensical observations

I take some exception to "whole heap of non-obvious code", it is neither a whole heap nor particularly opaque especially if you look at each commit individually

A DVD file structure does not begin with VIDEO_TS folder there are numerous examples of DVDs that have extra folders

I have a large (>4000) episodes of the format tvshow/NNN episodename.titNN -> DVD/VIDEO_TS/VIDEO...s as I have proposed for everyone in another pull request. Without some change all the thumbs for the episodes tramp on each other and even worse all the episode nfo's go to DVD/VIDEO_TS/VIDEO_TS.nfo

It seems intuitively (of course intuition is personal) wrong that if you have "movies in folders" option that you can use movie.nfo except if you have DVD/BR folder.

While it is not entirely unreasonable (I say it is, but...) to say only use iso's there are several reasons to chose BR folders over BR isos at the moment (menu with list of files and the ability to select individual titles/playlists)

Personally I have a file structure with over 3000 DVDs and while it is not unreasonable to covert them all to ISO it is a pain and god forbid I should screw up the script. Others are no quite so lucky to have a file server that can compute

As for extras yes I do want them scraped but no-one else would, at least until XBMC undersands them

And FINALLY the way it is is just plain wrong ! :)

PS. Unfortunately much of this same code needs to be looked at regardless, as as nfos and actor thumbs all get stuffed in the VIDEO_TS folder which is really really wrong.
Luckily it's "simple and straightforward code" for me to keep rebasing :)


The DVD structure does begin with a VIDEO_TS folder. There is no real reason that I can see to have anything else. You can use movie.nfo just fine with VIDEO_TS folders - you put it in the movie folder (after all nothing at all other than the DVD structure should be in the VIDEO_TS folder).





I don't see where an additional folder needed, except if you happen to require two or more VIDEO_TS folders for a single item - the only real case here is for extras, thus I suggest a separate subfolder (this would make sense for non-DVD movies as well).

Lastly, at no time did I say you MUST use ISOs. I simply said that for the small number of 2-disk movies that exist, it's not unreasonable to do so in that case.


Here is an 'ls' of one of my DVDs (its unusual but not particularly rare)

AUDIO_TS Autorun.inf autorun.mcl common install.exe iti.png iti_st1.png JACKET_P start.osx start.pct VIDEO_TS win Xtras

I hate being wrong. Yes movie.nfo does work. I had to add a special case for it, in my stuff, when you click refresh in the movie information dialog (or so I thought I will have to retest that!), so I thought it wouldn't work now

I did realize I didn't have to convert all my movie titles, I was talking about the problems with tv show ones.

For me personally, I have other suff in my movie folder - checksums, independent metadata files, sometimes source info...

I just remembered another problem, but again there are a small number (10-20) of DVDs that have multiple movies per DVD - I have a structure like my tv show episodes with multiple symlinks to a single DVD and again the nfo and artwork will trample on each other (so I have 15-25 movies that have to be isos :) )


So what if there's other folders - you can have as much stuff as you like in the movie folder, alongside the VIDEO_TS/VIDEO_TS.IFO. movie.nfo, folder.jpg, fanart.jpg etc. can all be found there.

For episodes there's multiple ways to handle it (s01e01e02e03e04 is a common one) but there's no difference here between ISOs and VIDEO_TS folders either.

Basically: I don't understand why you need yet another folder between the movie folder and the VIDEO_TS folder. Are you wanting the subfolder just so that all the crap that's actually from the physical disk is separate from what you need for metadata about the DVD?


to answer 1 and three yes I am worried about separating the disk and the other crap. One day some of the other crap is going to stomp on the physical disk crap and I'll never know until way too late and I consider it pollution of the disk as much as sticking nfos into VIDEO_TS

the difference between s01e01e02e03e04 and my scheme is that I can mix seasons (rare) and specials which are sometimes scrape-able as s00e..

@jmarshallnz PS. I hope your not fuming at all this


Not at all, however others may be, as hundreds of people are receiving each mail...

Perhaps we should discuss on the forums until some agreement on how to proceed is reached?


one day in 3030 when cows fly and squirrels rule the world a conflict might occur. everybody will then be glad they listened to some random dude with unusual habits those mere 1000 years ago. the 1000 years of confusion, inconsistencies and support nightmares will all have been worth it.

it will be a tuesday.


@cptspiff Loved the morning smile!
Consistency and removing support nightmares is what I'm all about, after 25 years in the hi-tech industry (only 25 'cause I retired at 48) I appreciate removing support nightmares.

If you have a dvd.iso, or a stub file or a DVD jukebox (yes I used to have one of those - made it about 8 years ago), the scanner library treats each DVD as a single item and they can be placed in an extra folder if you use ("place movies in folders"), but for some reason DVD folders are different (inconsistant I would say :) ).
I don't know about windows (haven't seriously used windows since win2k) but in linux if I click on a dvd.iso I get the contents of what would appear to be a DVD Folder.

The true inconsistency is that XMBC understands lots of different ways of storing media but but not folders. A video_ts.ifo has no useful meaning if the accompanying vob files are not there.

These changes were to simplify matters (make them consistent) and say that in all (and yes a little more work is needed to say all) cases a DVD folder and a corresponding DVD iso were treated the same (including not polluting the structure with stuff)

At jmarshallnz's suggestion here ( is the forum topic I started about this stuff before I issued the PR


Closing since the diff contains commented out code there don't seem to be a good understanding of what it is we want to accomplish here (or mainly how).

@elupus elupus closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 5, 2012
  1. @dragonflight

    when scanning with "movies in folders" DVD folders take their parents…

    dragonflight authored
    … name
     if the option "movies in folders" is enabled movie name is "movie"
     otherwise "DVD"
  2. @dragonflight

    look for nfo's for DVD Folders in the following order (mimicing an iso)

    dragonflight authored
        1) moviename/dvdname/VIDEO_TS/VIDEO_TS.nfo
        2) moviename/dvdname/VIDEO_TS.nfo
        			as today
        3) moviename/movie.nfo
        			if folders match movie title enabled
        4) moviename/dvdname.nfo
  3. @dragonflight

    save DVD.tbn and DVD.nfo DVD Folder where folder is

    dragonflight authored
  4. @dragonflight
  5. @dragonflight
This page is out of date. Refresh to see the latest.
29 xbmc/FileItem.cpp
@@ -2457,7 +2457,7 @@ void CFileItemList::StackFolders()
item->m_bIsFolder = false;
- item->SetLabelPreformated(true);
+// item->SetLabelPreformated(true);
m_sortMethod = SORT_METHOD_NONE; /* sorting is now broken */
@@ -2800,6 +2800,14 @@ CStdString CFileItem::GetTBNFile() const
if (m_bIsFolder && !IsFileFolder())
+ CLog::Log(LOGDEBUG, "mike: GetTBNFile %s", strFile.c_str());
+ if (IsOpticalMediaFile())
+ {
+ strFile = URIUtils::GetParentPath(URIUtils::GetParentPath(strFile));
+ URIUtils::RemoveSlashAtEnd(strFile);
+ CLog::Log(LOGDEBUG, "mike: GetTBNFile DVD tbn file %s", strFile.c_str());
+ }
if (!strFile.IsEmpty())
if (m_bIsFolder && !IsFileFolder())
@@ -2873,11 +2881,11 @@ CStdString CFileItem::GetLocalArt(const std::string &artFile, bool useFolder) co
strFile = CMultiPathDirectory::GetFirstPath(m_strPath);
if (IsOpticalMediaFile())
- { // optical media files should be treated like folders
- useFolder = true;
- strFile = GetLocalMetadataPath();
+ { // optical media folders should be treated like a file
+// useFolder = true;
+ strFile = GetOpticalFolderPath();
- else if (useFolder)
+ if (useFolder)
strFile = URIUtils::GetDirectory(strFile);
if (strFile.empty()) // empty filepath -> nothing to find
@@ -2939,9 +2947,9 @@ CStdString CFileItem::GetBaseMoviePath(bool bUseFolderNames) const
strMovieName = CMultiPathDirectory::GetFirstPath(m_strPath);
if (IsOpticalMediaFile())
- return GetLocalMetadataPath();
+ strMovieName = GetOpticalFolderPath();
- if ((!m_bIsFolder || URIUtils::IsInArchive(m_strPath)) && bUseFolderNames)
+ if ((!m_bIsFolder || URIUtils::IsInArchive(m_strPath) || IsOpticalMediaFile()) && bUseFolderNames)
CStdString name2(strMovieName);
@@ -3011,7 +3019,7 @@ CStdString CFileItem::GetLocalFanart() const
if (IsOpticalMediaFile())
{ // grab from the optical media parent folder as well
CFileItemList moreItems;
- CDirectory::GetDirectory(GetLocalMetadataPath(), moreItems, g_settings.m_pictureExtensions, DIR_FLAG_NO_FILE_DIRS | DIR_FLAG_READ_CACHE | DIR_FLAG_NO_FILE_INFO);
+ CDirectory::GetDirectory(GetOpticalFolderPath(), moreItems, g_settings.m_pictureExtensions, DIR_FLAG_NO_FILE_DIRS | DIR_FLAG_READ_CACHE | DIR_FLAG_NO_FILE_INFO);
@@ -3039,8 +3047,8 @@ CStdString CFileItem::GetLocalFanart() const
return "";
-CStdString CFileItem::GetLocalMetadataPath() const
+// only called if IsOpticalMediaFile
+CStdString CFileItem::GetOpticalFolderPath() const
if (m_bIsFolder && !IsFileFolder())
return m_strPath;
@@ -3053,6 +3061,7 @@ CStdString CFileItem::GetLocalMetadataPath() const
{ // go back up another one
parent = URIUtils::GetParentPath(parent);
+ URIUtils::RemoveSlashAtEnd(parent);
return parent;
2  xbmc/FileItem.h
@@ -321,7 +321,7 @@ class CFileItem :
\sa URIUtils::GetParentPath
- CStdString GetLocalMetadataPath() const;
+ CStdString GetOpticalFolderPath() const;
// finds a matching local trailer file
CStdString FindTrailer() const;
13 xbmc/video/VideoDatabase.cpp
@@ -8238,11 +8238,6 @@ void CVideoDatabase::ExportToXML(const CStdString &path, bool singleFiles /* = f
CStdString nfoFile(URIUtils::ReplaceExtension(item.GetTBNFile(), ".nfo"));
- if (item.IsOpticalMediaFile())
- {
- nfoFile = URIUtils::GetParentFolderURI(nfoFile, true);
- }
if (overwrite || !CFile::Exists(nfoFile, false))
@@ -8619,7 +8614,13 @@ void CVideoDatabase::ExportActorThumbs(const CStdString &strDir, const CVideoInf
CStdString strPath(strDir);
if (singleFiles)
- strPath = URIUtils::AddFileToFolder(tag.m_strPath, ".actors");
+ strPath = tag.m_strPath;
+ CStdString dirName;
+ CUtil::GetDirectoryName(strPath, dirName);
+ if (dirName.Equals( "VIDEO_TS" ) || dirName.Equals( "BDMV" ) )
+ strPath = URIUtils::GetParentPath(URIUtils::GetParentPath(strPath));
+ CLog::Log(LOGDEBUG, "mike: export actor thumbs '%s' %s %s %s", strPath.c_str(), tag.m_strPath.c_str(), tag.m_basePath.c_str(), dirName.c_str());
+ strPath = URIUtils::AddFileToFolder(strPath, ".actors");
if (!CDirectory::Exists(strPath))
19 xbmc/video/VideoInfoScanner.cpp
@@ -1251,7 +1251,9 @@ namespace VIDEO
// parent folder to apply the thumb to and to search for local actor thumbs
CStdString parentDir = GetParentDir(*pItem);
- if (g_guiSettings.GetBool("videolibrary.actorthumbs"))
+ if (pItem->IsOpticalMediaFile())
+ parentDir = URIUtils::GetParentPath(pItem->GetOpticalFolderPath());
+ if (g_guiSettings.GetBool("videolibrary.actorthumbs"))
FetchActorThumbs(movieDetails.m_cast, actorArtPath.empty() ? parentDir : actorArtPath);
if (bApplyToDir)
ApplyThumbToFolder(parentDir, art["thumb"]);
@@ -1548,8 +1550,21 @@ namespace VIDEO
if (nfoFile.IsEmpty() && item->IsOpticalMediaFile())
- CFileItem parentDirectory(item->GetLocalMetadataPath(), true);
+ CFileItem parentDirectory(item->GetOpticalFolderPath(), true);
nfoFile = GetnfoFile(&parentDirectory, true);
+ if (nfoFile.IsEmpty())
+ {
+ if (bGrabAny)
+ nfoFile = URIUtils::AddFileToFolder(URIUtils::GetParentPath(parentDirectory.GetPath()), "movie.nfo");
+ if (!CFile::Exists(nfoFile) )
+ nfoFile.clear();
+ nfoFile = parentDirectory.GetPath();
+ URIUtils::RemoveSlashAtEnd(nfoFile);
+ nfoFile = URIUtils::ReplaceExtension(nfoFile, ".nfo");
+ if (!nfoFile.IsEmpty())
+ return nfoFile;
+ }
// folders (or stacked dvds) can take any nfo file if there's a unique one
2  xbmc/video/windows/GUIWindowVideoNav.cpp
@@ -436,7 +436,7 @@ void CGUIWindowVideoNav::LoadVideoInfo(CFileItemList &items)
CFileItemPtr pItem = items[i];
CFileItemPtr match;
if (!content.IsEmpty()) /* optical media will be stacked down, so it's path won't match the base path */
- match = dbItems.Get(pItem->IsOpticalMediaFile() ? pItem->GetLocalMetadataPath() : pItem->GetPath());
+ match = dbItems.Get(pItem->IsOpticalMediaFile() ? pItem->GetOpticalFolderPath() : pItem->GetPath());
if (match)
pItem->UpdateInfo(*match, replaceLabels);
Something went wrong with that request. Please try again.