mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-04-03 10:47:23 +02:00
playlist support - crashes
This commit is contained in:
@@ -37,11 +37,17 @@ CollectionInfo::~CollectionInfo()
|
||||
{
|
||||
// remove items from the subcollections so their destructors do not
|
||||
// delete the items since the parent collection will delete them.
|
||||
std::vector<CollectionInfo *>::iterator subit;
|
||||
for (subit != subcollections_.begin(); subit != subcollections_.end(); subit++)
|
||||
std::vector<CollectionInfo *>::iterator subit = subcollections_.begin();
|
||||
while (subit != subcollections_.end())
|
||||
{
|
||||
CollectionInfo *info = *subit;
|
||||
info->items.clear();
|
||||
subcollections_.erase(subit);
|
||||
|
||||
if(info != this)
|
||||
{
|
||||
delete info;
|
||||
}
|
||||
subit = subcollections_.begin();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
class Item;
|
||||
|
||||
@@ -36,6 +37,9 @@ public:
|
||||
std::string launcher;
|
||||
std::vector<Item *> items;
|
||||
|
||||
typedef std::map<std::string, std::vector <Item *> > Playlists_T;
|
||||
Playlists_T playlists;
|
||||
|
||||
private:
|
||||
std::vector<CollectionInfo *> subcollections_;
|
||||
std::string metadataPath_;
|
||||
|
||||
@@ -242,8 +242,10 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
||||
struct dirent *dirp;
|
||||
std::string path = info->listpath;
|
||||
std::map<std::string, Item *> includeFilter;
|
||||
std::map<std::string, Item *> favoritesFilter;
|
||||
std::map<std::string, Item *> excludeFilter;
|
||||
std::string includeFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "include.txt");
|
||||
std::string favoritesFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "favorites.txt");
|
||||
std::string excludeFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "exclude.txt");
|
||||
|
||||
std::string launcher;
|
||||
@@ -269,6 +271,7 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
||||
{
|
||||
Logger::write(Logger::ZONE_INFO, "CollectionInfoBuilder", "Checking for \"" + includeFile + "\"");
|
||||
ImportBasicList(info, includeFile, includeFilter);
|
||||
ImportBasicList(info, favoritesFile, favoritesFilter);
|
||||
ImportBasicList(info, excludeFile, excludeFilter);
|
||||
}
|
||||
|
||||
@@ -297,6 +300,10 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
||||
}
|
||||
}
|
||||
}
|
||||
for(std::map<std::string, Item *>::iterator it = favoritesFilter.begin(); it != favoritesFilter.end(); it++)
|
||||
{
|
||||
info->playlists["favorites"].push_back(it->second);
|
||||
}
|
||||
|
||||
while((dirp = readdir(dp)) != NULL)
|
||||
{
|
||||
@@ -327,6 +334,7 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
||||
i->collectionInfo = info;
|
||||
|
||||
info->items.push_back(i);
|
||||
info->playlists["include"].push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user