xbmc: add upstream patches

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2012-01-19 01:28:39 +01:00
parent b93f932d72
commit 7e474e7155
2 changed files with 159 additions and 0 deletions

View File

@ -0,0 +1,121 @@
From ac6a16ff11ba6087cba773938c34558a4bce4837 Mon Sep 17 00:00:00 2001
From: Jonathan Marshall <jmarshall@never.you.mind>
Date: Wed, 18 Jan 2012 11:48:17 +1300
Subject: [PATCH] Fix finding of local thumbs/fanart for VIDEO_TS/BDMV items
in the parent folder
---
xbmc/FileItem.cpp | 45 +++++++++++++++++++++++++++++++--------------
xbmc/FileItem.h | 14 ++++++++++++++
2 files changed, 45 insertions(+), 14 deletions(-)
diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp
index 8e2f1df..c21c0f4 100644
--- a/xbmc/FileItem.cpp
+++ b/xbmc/FileItem.cpp
@@ -2112,25 +2112,11 @@ void CFileItemList::StackFolders()
if (!dvdPath.IsEmpty())
{
// NOTE: should this be done for the CD# folders too?
- /* set the thumbnail based on folder */
- item->SetCachedVideoThumb();
- if (!item->HasThumbnail())
- item->SetUserVideoThumb();
-
item->m_bIsFolder = false;
item->SetPath(dvdPath);
item->SetLabel2("");
item->SetLabelPreformated(true);
m_sortMethod = SORT_METHOD_NONE; /* sorting is now broken */
-
- /* override the previously set thumb if video_ts.ifo has any */
- /* otherwise user can't set icon on the stacked file as that */
- /* will allways be set on the video_ts.ifo file */
- CStdString thumb(item->GetCachedVideoThumb());
- if(CFile::Exists(thumb))
- item->SetThumbnailImage(thumb);
- else
- item->SetUserVideoThumb();
}
}
}
@@ -2646,6 +2632,15 @@ CStdString CFileItem::GetUserVideoThumb() const
if (CFile::Exists(fileThumb))
return fileThumb;
+ if (IsOpticalMediaFile())
+ { // special case for optical media "folders" - check the parent folder (or parent of parent)
+ // TODO: A better way to handle this would be to treat stacked folders as folders rather than files.
+ CFileItem item(GetLocalMetadataPath(), true);
+ CStdString thumb(item.GetUserVideoThumb());
+ if (!thumb.IsEmpty())
+ return thumb;
+ }
+
// 2. - check movie.tbn, as long as it's not a folder
if (!m_bIsFolder)
{
@@ -2886,6 +2881,12 @@ CStdString CFileItem::GetLocalFanart() const
CFileItemList items;
CDirectory::GetDirectory(strDir, items, g_settings.m_pictureExtensions, false, false, DIR_CACHE_ALWAYS, false, true);
+ if (IsOpticalMediaFile())
+ { // grab from the optical media parent folder as well - see GetUserVideoThumb
+ CFileItemList moreItems;
+ CDirectory::GetDirectory(GetLocalMetadataPath(), moreItems, g_settings.m_pictureExtensions, false, false, DIR_CACHE_ALWAYS, false, true);
+ items.Append(moreItems);
+ }
CStdStringArray fanarts;
StringUtils::SplitString(g_advancedSettings.m_fanartImages, "|", fanarts);
@@ -2912,6 +2913,22 @@ CStdString CFileItem::GetLocalFanart() const
return "";
}
+CStdString CFileItem::GetLocalMetadataPath() const
+{
+ if (m_bIsFolder && !IsFileFolder())
+ return m_strPath;
+
+ CStdString parent(URIUtils::GetParentPath(m_strPath));
+ CStdString parentFolder(parent);
+ URIUtils::RemoveSlashAtEnd(parentFolder);
+ parentFolder = URIUtils::GetFileName(parentFolder);
+ if (parentFolder == "VIDEO_TS" || parentFolder == "BDMV")
+ { // go back up another one
+ parent = URIUtils::GetParentPath(parent);
+ }
+ return parent;
+}
+
CStdString CFileItem::GetCachedFanart() const
{
return CThumbnailCache::GetFanart(*this);
diff --git a/xbmc/FileItem.h b/xbmc/FileItem.h
index d621880..c5a748b 100644
--- a/xbmc/FileItem.h
+++ b/xbmc/FileItem.h
@@ -258,6 +258,20 @@ class CFileItem :
void SetUserVideoThumb();
void SetUserMusicThumb(bool alwaysCheckRemote = false);
+ /*! \brief Get the path where we expect local metadata to reside.
+ For a folder, this is just the existing path (eg tvshow folder)
+ For a file, this is the parent path, with exceptions made for VIDEO_TS and BDMV files
+
+ Three cases are handled:
+
+ /foo/bar/movie_name/file_name -> /foo/bar/movie_name/
+ /foo/bar/movie_name/VIDEO_TS/file_name -> /foo/bar/movie_name/
+ /foo/bar/movie_name/BDMV/file_name -> /foo/bar/movie_name/
+
+ \sa URIUtils::GetParentPath
+ */
+ CStdString GetLocalMetadataPath() const;
+
// finds a matching local trailer file
CStdString FindTrailer() const;
--
1.7.5.4

View File

@ -0,0 +1,38 @@
From fb3128b24683e3b700f10aa3f8e3c58eb0a2c41a Mon Sep 17 00:00:00 2001
From: Jonathan Marshall <jmarshall@never.you.mind>
Date: Thu, 19 Jan 2012 12:18:17 +1300
Subject: [PATCH] fix movie.nfo not being picked up in the movie folder of
bluray or dvd rips
---
xbmc/video/VideoInfoScanner.cpp | 13 +++----------
1 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp
index 4534aa1..5cf75a9 100644
--- a/xbmc/video/VideoInfoScanner.cpp
+++ b/xbmc/video/VideoInfoScanner.cpp
@@ -1445,17 +1445,10 @@
}
}
- if (!nfoFile.IsEmpty() && item->IsOpticalMediaFile())
+ if (nfoFile.IsEmpty() && item->IsOpticalMediaFile())
{
- CStdString parent(URIUtils::GetParentPath(item->GetPath()));
- CStdString parentFolder(parent);
- URIUtils::RemoveSlashAtEnd(parentFolder);
- if (parentFolder == "VIDEO_TS" || parentFolder == "BDMV")
- { // check for movie.nfo in the parent folder
- parent = URIUtils::GetParentPath(parent);
- CFileItem parentDirectory(parent, true);
- nfoFile = GetnfoFile(&parentDirectory, true);
- }
+ CFileItem parentDirectory(item->GetLocalMetadataPath(), true);
+ nfoFile = GetnfoFile(&parentDirectory, true);
}
}
// folders (or stacked dvds) can take any nfo file if there's a unique one
--
1.7.5.4