mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-06-06 19:06:48 +02:00
Added support for exclude_all.txt; a filter for the automatically generated all playlists.
This commit is contained in:
@@ -185,17 +185,19 @@ bool CollectionInfo::itemIsLess(Item *lhs, Item *rhs)
|
|||||||
|
|
||||||
void CollectionInfo::sortItems()
|
void CollectionInfo::sortItems()
|
||||||
{
|
{
|
||||||
for(Playlists_T::iterator it = playlists.begin(); it != playlists.end(); it++)
|
std::sort( items.begin(), items.end(), itemIsLess );
|
||||||
{
|
// for(Playlists_T::iterator it = playlists.begin(); it != playlists.end(); it++)
|
||||||
std::sort(it->second->begin(), it->second->end(), itemIsLess);
|
// {
|
||||||
}
|
// std::sort(it->second->begin(), it->second->end(), itemIsLess);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CollectionInfo::sortPlaylists()
|
void CollectionInfo::sortPlaylists()
|
||||||
{
|
{
|
||||||
|
|
||||||
std::vector<Item *> *allItems = playlists["all"];
|
// std::vector<Item *> *allItems = playlists["all"];
|
||||||
|
std::vector<Item *> *allItems = &items;
|
||||||
std::vector<Item *> toSortItems;
|
std::vector<Item *> toSortItems;
|
||||||
|
|
||||||
for ( Playlists_T::iterator itP = playlists.begin( ); itP != playlists.end( ); itP++ )
|
for ( Playlists_T::iterator itP = playlists.begin( ); itP != playlists.end( ); itP++ )
|
||||||
|
|||||||
@@ -280,8 +280,10 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
|||||||
std::vector<Item *> includeFilterUnsorted;
|
std::vector<Item *> includeFilterUnsorted;
|
||||||
std::map<std::string, Item *> includeFilter;
|
std::map<std::string, Item *> includeFilter;
|
||||||
std::map<std::string, Item *> excludeFilter;
|
std::map<std::string, Item *> excludeFilter;
|
||||||
std::string includeFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "include.txt");
|
std::map<std::string, Item *> excludeAllFilter;
|
||||||
std::string excludeFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "exclude.txt");
|
std::string includeFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "include.txt");
|
||||||
|
std::string excludeFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "exclude.txt");
|
||||||
|
std::string excludeAllFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "exclude_all.txt");
|
||||||
|
|
||||||
std::string launcher;
|
std::string launcher;
|
||||||
bool showMissing = false;
|
bool showMissing = false;
|
||||||
@@ -313,6 +315,7 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
|||||||
ImportBasicList(info, includeFile, includeFilter);
|
ImportBasicList(info, includeFile, includeFilter);
|
||||||
ImportBasicList(info, excludeFile, excludeFilter);
|
ImportBasicList(info, excludeFile, excludeFilter);
|
||||||
}
|
}
|
||||||
|
ImportBasicList(info, excludeAllFile, excludeAllFilter);
|
||||||
|
|
||||||
if (showMissing)
|
if (showMissing)
|
||||||
{
|
{
|
||||||
@@ -363,7 +366,46 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
|||||||
excludeFilter.erase(it);
|
excludeFilter.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
info->playlists["all"] = &info->items;
|
if ( excludeAllFilter.size() > 0)
|
||||||
|
{
|
||||||
|
info->playlists["all"] = new std::vector<Item *>();
|
||||||
|
for(std::vector<Item *>::iterator it = info->items.begin(); it != info->items.end(); it++)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
for(std::map<std::string, Item *>::iterator itex = excludeAllFilter.begin(); itex != excludeAllFilter.end(); itex++)
|
||||||
|
{
|
||||||
|
std::string collectionName = info->name;
|
||||||
|
std::string itemName = itex->first;
|
||||||
|
if (itemName.at(0) == '_') // name consists of _<collectionName>:<itemName>
|
||||||
|
{
|
||||||
|
itemName.erase(0, 1); // Remove _
|
||||||
|
size_t position = itemName.find(":");
|
||||||
|
if (position != std::string::npos )
|
||||||
|
{
|
||||||
|
collectionName = itemName.substr(0, position);
|
||||||
|
itemName = itemName.erase(0, position+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( (*it)->name == itemName && (*it)->collectionInfo->name == collectionName)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( !found )
|
||||||
|
{
|
||||||
|
info->playlists["all"]->push_back((*it));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(excludeAllFilter.size() > 0)
|
||||||
|
{
|
||||||
|
std::map<std::string, Item *>::iterator it = excludeAllFilter.begin();
|
||||||
|
excludeAllFilter.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info->playlists["all"] = &info->items;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ bool MenuParser::buildTextMenu(CollectionInfo *collection, bool sort)
|
|||||||
std::string path = Utils::combinePath(Configuration::absolutePath, "collections", collection->name, "menu");
|
std::string path = Utils::combinePath(Configuration::absolutePath, "collections", collection->name, "menu");
|
||||||
dp = opendir(path.c_str());
|
dp = opendir(path.c_str());
|
||||||
|
|
||||||
while((dirp = readdir(dp)) != NULL)
|
while(dp && (dirp = readdir(dp)) != NULL)
|
||||||
{
|
{
|
||||||
std::string file = dirp->d_name;
|
std::string file = dirp->d_name;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
std::string retrofe_version_major = "0";
|
std::string retrofe_version_major = "0";
|
||||||
std::string retrofe_version_minor = "8";
|
std::string retrofe_version_minor = "8";
|
||||||
std::string retrofe_version_build = "20";
|
std::string retrofe_version_build = "21";
|
||||||
|
|
||||||
|
|
||||||
std::string Version::getString( )
|
std::string Version::getString( )
|
||||||
|
|||||||
Reference in New Issue
Block a user