mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-04-08 20:23:05 +02:00
Merge with playlists
This commit is contained in:
@@ -46,6 +46,18 @@ CollectionInfo::~CollectionInfo()
|
||||
}
|
||||
|
||||
|
||||
Playlists_T::iterator pit = playlists.begin();
|
||||
|
||||
while(pit != playlists.end())
|
||||
{
|
||||
if(pit->second != &items)
|
||||
{
|
||||
delete pit->second;
|
||||
}
|
||||
playlists.erase(pit);
|
||||
pit = playlists.begin();
|
||||
}
|
||||
|
||||
std::vector<Item *>::iterator it = items.begin();
|
||||
while(it != items.end())
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
class Item;
|
||||
|
||||
@@ -35,6 +36,10 @@ public:
|
||||
std::string metadataType;
|
||||
std::string launcher;
|
||||
std::vector<Item *> items;
|
||||
|
||||
typedef std::map<std::string, std::vector <Item *> *> Playlists_T;
|
||||
Playlists_T playlists;
|
||||
|
||||
bool menusort;
|
||||
private:
|
||||
std::vector<CollectionInfo *> subcollections_;
|
||||
|
||||
@@ -231,8 +231,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;
|
||||
@@ -258,6 +260,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);
|
||||
}
|
||||
|
||||
@@ -265,6 +268,8 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
||||
std::vector<std::string>::iterator extensionsIt;
|
||||
|
||||
info->extensionList(extensions);
|
||||
info->playlists["all"] = &info->items;
|
||||
info->playlists["favorites"] = new std::vector<Item *>();
|
||||
|
||||
|
||||
dp = opendir(path.c_str());
|
||||
@@ -286,6 +291,11 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
||||
}
|
||||
}
|
||||
}
|
||||
// add the favorites list
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user