Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1969 from Montellese/set_grouping_fix

GroupUtils: fix URL options when grouping movies into sets
  • Loading branch information...
commit 31843b4682e684a4dd3c4d70e6692b3b011ebd36 2 parents b8a867f + a5bb217
@davilla davilla authored
View
22 xbmc/utils/GroupUtils.cpp
@@ -25,6 +25,7 @@
#include "FileItem.h"
#include "utils/StringUtils.h"
#include "utils/Variant.h"
+#include "video/VideoDbUrl.h"
#include "video/VideoInfoTag.h"
#include "utils/URIUtils.h"
#include "filesystem/MultiPathDirectory.h"
@@ -33,7 +34,7 @@ using namespace std;
typedef map<int, set<CFileItemPtr> > SetMap;
-bool GroupUtils::Group(GroupBy groupBy, const CFileItemList &items, CFileItemList &groupedItems, GroupAttribute groupAttributes /* = GroupAttributeNone */)
+bool GroupUtils::Group(GroupBy groupBy, const std::string &baseDir, const CFileItemList &items, CFileItemList &groupedItems, GroupAttribute groupAttributes /* = GroupAttributeNone */)
{
if (items.Size() <= 0 || groupBy == GroupByNone)
return false;
@@ -58,6 +59,10 @@ bool GroupUtils::Group(GroupBy groupBy, const CFileItemList &items, CFileItemLis
if ((groupBy & GroupBySet) && setMap.size() > 0)
{
+ CVideoDbUrl itemsUrl;
+ if (!itemsUrl.FromString(baseDir))
+ return false;
+
for (SetMap::const_iterator set = setMap.begin(); set != setMap.end(); set++)
{
// only one item in the set, so just re-add it
@@ -70,7 +75,16 @@ bool GroupUtils::Group(GroupBy groupBy, const CFileItemList &items, CFileItemLis
CFileItemPtr pItem(new CFileItem((*set->second.begin())->GetVideoInfoTag()->m_strSet));
pItem->GetVideoInfoTag()->m_iDbId = set->first;
pItem->GetVideoInfoTag()->m_type = "set";
- pItem->SetPath(StringUtils::Format("videodb://1/7/%ld/", set->first));
+
+ std::string basePath = StringUtils::Format("videodb://1/7/%ld/", set->first);
+ CVideoDbUrl videoUrl;
+ if (!videoUrl.FromString(basePath))
+ pItem->SetPath(basePath);
+ else
+ {
+ videoUrl.AddOptions(itemsUrl.GetOptionsString());
+ pItem->SetPath(videoUrl.ToString());
+ }
pItem->m_bIsFolder = true;
CVideoInfoTag* setInfo = pItem->GetVideoInfoTag();
@@ -132,9 +146,9 @@ bool GroupUtils::Group(GroupBy groupBy, const CFileItemList &items, CFileItemLis
return true;
}
-bool GroupUtils::GroupAndSort(GroupBy groupBy, const CFileItemList &items, const SortDescription &sortDescription, CFileItemList &groupedItems, GroupAttribute groupAttributes /* = GroupAttributeNone */)
+bool GroupUtils::GroupAndSort(GroupBy groupBy, const std::string &baseDir, const CFileItemList &items, const SortDescription &sortDescription, CFileItemList &groupedItems, GroupAttribute groupAttributes /* = GroupAttributeNone */)
{
- if (!Group(groupBy, items, groupedItems, groupAttributes))
+ if (!Group(groupBy, baseDir, items, groupedItems, groupAttributes))
return false;
groupedItems.Sort(sortDescription);
View
4 xbmc/utils/GroupUtils.h
@@ -37,6 +37,6 @@ typedef enum {
class GroupUtils
{
public:
- static bool Group(GroupBy groupBy, const CFileItemList &items, CFileItemList &groupedItems, GroupAttribute groupAttributes = GroupAttributeNone);
- static bool GroupAndSort(GroupBy groupBy, const CFileItemList &items, const SortDescription &sortDescription, CFileItemList &groupedItems, GroupAttribute groupAttributes = GroupAttributeNone);
+ static bool Group(GroupBy groupBy, const std::string &baseDir, const CFileItemList &items, CFileItemList &groupedItems, GroupAttribute groupAttributes = GroupAttributeNone);
+ static bool GroupAndSort(GroupBy groupBy, const std::string &baseDir, const CFileItemList &items, const SortDescription &sortDescription, CFileItemList &groupedItems, GroupAttribute groupAttributes = GroupAttributeNone);
};
View
2  xbmc/video/VideoDatabase.cpp
@@ -4954,7 +4954,7 @@ bool CVideoDatabase::GetSetsByWhere(const CStdString& strBaseDir, const Filter &
return false;
CFileItemList sets;
- if (!GroupUtils::Group(GroupBySet, items, sets))
+ if (!GroupUtils::Group(GroupBySet, strBaseDir, items, sets))
return false;
items.ClearItems();
View
2  xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -1884,7 +1884,7 @@ void CGUIWindowVideoBase::GetGroupedItems(CFileItemList &items)
g_guiSettings.GetBool("videolibrary.groupmoviesets"))
{
CFileItemList groupedItems;
- if (GroupUtils::Group(GroupBySet, items, groupedItems, GroupAttributeIgnoreSingleItems))
+ if (GroupUtils::Group(GroupBySet, m_strFilterPath, items, groupedItems, GroupAttributeIgnoreSingleItems))
{
items.ClearItems();
items.Append(groupedItems);
Please sign in to comment.
Something went wrong with that request. Please try again.