From ff215dccbae348845727503a906dd485e7f3485e Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Tue, 9 May 2023 20:47:31 -0700 Subject: [PATCH 01/15] don't cycle playlist if on "street fighter and capcom fighters" or "street fighter" --- RetroFE/Source/Graphics/Page.cpp | 14 ++++----- RetroFE/Source/RetroFE.cpp | 52 ++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/RetroFE/Source/Graphics/Page.cpp b/RetroFE/Source/Graphics/Page.cpp index 4c9da3998..5941a9945 100644 --- a/RetroFE/Source/Graphics/Page.cpp +++ b/RetroFE/Source/Graphics/Page.cpp @@ -1513,13 +1513,13 @@ void Page::togglePlaylist() { if (!selectedItem_) return; -if(playlist_->first != "favorites") - { - if (selectedItem_->isFavorite) - removePlaylist(); - else - addPlaylist(); - } + if (playlist_->first != "favorites") + { + if (selectedItem_->isFavorite) + removePlaylist(); + else + addPlaylist(); + } } diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index 599edec81..d04e3af2a 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -1596,24 +1596,33 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page ) else if ( input_.keystate(UserInput::KeyCodeCyclePlaylist) || input_.keystate(UserInput::KeyCodeNextCyclePlaylist) ) { - attract_.reset( ); - std::string cycleString; - config_.getProperty( "cyclePlaylist", cycleString ); - std::vector cycleVector; - Utils::listToVector( cycleString, cycleVector, ',' ); - page->nextCyclePlaylist( cycleVector ); - state = RETROFE_PLAYLIST_REQUEST; + if (currentPage_->getPlaylistName() != "street fighter and capcom fighters" && + currentPage_->getPlaylistName() != "street fighter") + { + attract_.reset(); + std::string cycleString; + config_.getProperty("cyclePlaylist", cycleString); + std::vector cycleVector; + Utils::listToVector(cycleString, cycleVector, ','); + page->nextCyclePlaylist(cycleVector); + state = RETROFE_PLAYLIST_REQUEST; + + } } else if ( input_.keystate(UserInput::KeyCodePrevCyclePlaylist) ) { - attract_.reset( ); - std::string cycleString; - config_.getProperty( "cyclePlaylist", cycleString ); - std::vector cycleVector; - Utils::listToVector( cycleString, cycleVector, ',' ); - page->prevCyclePlaylist( cycleVector ); - state = RETROFE_PLAYLIST_REQUEST; + if (currentPage_->getPlaylistName() != "street fighter and capcom fighters" && + currentPage_->getPlaylistName() != "street fighter") + { + attract_.reset(); + std::string cycleString; + config_.getProperty("cyclePlaylist", cycleString); + std::vector cycleVector; + Utils::listToVector(cycleString, cycleVector, ','); + page->prevCyclePlaylist(cycleVector); + state = RETROFE_PLAYLIST_REQUEST; + } } else if ( input_.keystate(UserInput::KeyCodeRemovePlaylist) ) @@ -1632,15 +1641,12 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page ) else if ( input_.keystate(UserInput::KeyCodeTogglePlaylist) ) { - if (currentPage_->getPlaylistName() == "favorites" ) -{ -} -else -{ - attract_.reset( ); - page->togglePlaylist( ); - state = RETROFE_PLAYLIST_REQUEST; -} + if (currentPage_->getPlaylistName() != "favorites" ) + { + attract_.reset( ); + page->togglePlaylist( ); + state = RETROFE_PLAYLIST_REQUEST; + } } else if ( input_.keystate(UserInput::KeyCodeSkipForward) ) From 5b28300f2a244aca041129b1ff32d63a210d9af0 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Mon, 15 May 2023 14:57:34 -0700 Subject: [PATCH 02/15] intial - not working - saving last played and favorites to a new `favorites`` collection so all collections will write there and you can style it differently to support all collection types --- RetroFE/Source/Collection/CollectionInfo.cpp | 23 +++++++++++++------ RetroFE/Source/Collection/CollectionInfo.h | 4 +++- .../Collection/CollectionInfoBuilder.cpp | 16 +++++++++---- RetroFE/Source/RetroFE.cpp | 2 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/RetroFE/Source/Collection/CollectionInfo.cpp b/RetroFE/Source/Collection/CollectionInfo.cpp index cd8915c09..6929af87c 100644 --- a/RetroFE/Source/Collection/CollectionInfo.cpp +++ b/RetroFE/Source/Collection/CollectionInfo.cpp @@ -34,12 +34,15 @@ #include #endif -CollectionInfo::CollectionInfo(std::string name, - std::string listPath, - std::string extensions, - std::string metadataType, - std::string metadataPath) - : name(name) +CollectionInfo::CollectionInfo( + Configuration& c, + std::string name, + std::string listPath, + std::string extensions, + std::string metadataType, + std::string metadataPath) + : conf_(c) + , name(name) , listpath(listPath) , saveRequest(false) , metadataType(metadataType) @@ -47,7 +50,7 @@ CollectionInfo::CollectionInfo(std::string name, , subsSplit(false) , hasSubs(false) , metadataPath_(metadataPath) - , extensions_(extensions) + , extensions_(extensions) { } @@ -79,6 +82,12 @@ bool CollectionInfo::Save() bool retval = true; if(saveRequest) { + bool globalFavLast = false; + conf_.getProperty("globalFavLast", globalFavLast); + if (globalFavLast) { + name = "favorites"; + } + std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); std::string file = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists/favorites.txt"); Logger::write(Logger::ZONE_INFO, "Collection", "Saving " + file); diff --git a/RetroFE/Source/Collection/CollectionInfo.h b/RetroFE/Source/Collection/CollectionInfo.h index ffe1046c8..758027da4 100644 --- a/RetroFE/Source/Collection/CollectionInfo.h +++ b/RetroFE/Source/Collection/CollectionInfo.h @@ -20,11 +20,12 @@ #include class Item; +class Configuration; class CollectionInfo { public: - CollectionInfo(std::string name, std::string listPath, std::string extensions, std::string metadataType, std::string metadataPath); + CollectionInfo(Configuration& c, std::string name, std::string listPath, std::string extensions, std::string metadataType, std::string metadataPath); virtual ~CollectionInfo(); std::string settingsPath() const; bool Save(); @@ -48,6 +49,7 @@ class CollectionInfo bool subsSplit; bool hasSubs; private: + Configuration& conf_; std::string metadataPath_; std::string extensions_; static bool itemIsLess(Item *lhs, Item *rhs); diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index c7f93ff96..5ebb5008b 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -184,7 +184,7 @@ CollectionInfo *CollectionInfoBuilder::buildCollection(std::string name, std::st Logger::write(Logger::ZONE_NOTICE, "Collections", ss.str()); } - CollectionInfo *collection = new CollectionInfo(name, listItemsPath, extensions, metadataType, metadataPath); + CollectionInfo *collection = new CollectionInfo(conf_, name, listItemsPath, extensions, metadataType, metadataPath); (void)conf_.getProperty("collections." + collection->name + ".launcher", collection->launcher); @@ -530,11 +530,17 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info) void CollectionInfoBuilder::updateLastPlayedPlaylist(CollectionInfo *info, Item *item, int size) { - std::string path = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists"); + std::string name = info->name; + bool globalFavLast = false; + conf_.getProperty("globalFavLast", globalFavLast); + if (globalFavLast) { + name = "favorites"; + } + std::string path = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); Logger::write(Logger::ZONE_INFO, "RetroFE", "Updating lastplayed playlist"); std::vector lastplayedList; - std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists", "lastplayed.txt"); + std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists", "lastplayed.txt"); ImportBasicList(info, playlistFile, lastplayedList); if (info->playlists["lastplayed"] == NULL) @@ -577,8 +583,8 @@ void CollectionInfoBuilder::updateLastPlayedPlaylist(CollectionInfo *info, Item } // Write new lastplayed playlist - std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists"); - std::string file = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists/lastplayed.txt"); + std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); + std::string file = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists/lastplayed.txt"); Logger::write(Logger::ZONE_INFO, "Collection", "Saving " + file); std::ofstream filestream; diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index b25866e34..f9b08c460 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -1995,7 +1995,7 @@ CollectionInfo *RetroFE::getMenuCollection( std::string collectionName ) std::string menuFile = Utils::combinePath( menuPath, collectionName + ".txt" ); std::vector menuVector; CollectionInfoBuilder cib( config_, *metadb_ ); - CollectionInfo *collection = new CollectionInfo( collectionName, menuPath, "", "", "" ); + CollectionInfo *collection = new CollectionInfo(config_, collectionName, menuPath, "", "", "" ); cib.ImportBasicList( collection, menuFile, menuVector ); for ( std::vector::iterator it = menuVector.begin( ); it != menuVector.end( ); ++it) { From 08146b42de38ae4a2e87d7f0b3ff3a2c6aebbb08 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Mon, 15 May 2023 16:30:12 -0700 Subject: [PATCH 03/15] working --- RetroFE/Source/Collection/CollectionInfo.cpp | 12 ++++++------ .../Source/Collection/CollectionInfoBuilder.cpp | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/RetroFE/Source/Collection/CollectionInfo.cpp b/RetroFE/Source/Collection/CollectionInfo.cpp index 6929af87c..f00681b77 100644 --- a/RetroFE/Source/Collection/CollectionInfo.cpp +++ b/RetroFE/Source/Collection/CollectionInfo.cpp @@ -82,14 +82,14 @@ bool CollectionInfo::Save() bool retval = true; if(saveRequest) { + std::string playlistCollectionName = name; bool globalFavLast = false; - conf_.getProperty("globalFavLast", globalFavLast); + (void)conf_.getProperty("globalFavLast", globalFavLast); if (globalFavLast) { - name = "favorites"; + playlistCollectionName = "Favorites"; } - - std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); - std::string file = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists/favorites.txt"); + std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists"); + std::string file = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists", "favorites.txt"); Logger::write(Logger::ZONE_INFO, "Collection", "Saving " + file); std::ofstream filestream; @@ -130,7 +130,7 @@ bool CollectionInfo::Save() std::vector *saveitems = playlists["favorites"]; for(std::vector::iterator it = saveitems->begin(); it != saveitems->end(); it++) { - if ((*it)->collectionInfo->name == name) + if ((*it)->collectionInfo->name == (*it)->name) { filestream << (*it)->name << std::endl; } diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index 5ebb5008b..39f4bc7ca 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -530,17 +530,17 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info) void CollectionInfoBuilder::updateLastPlayedPlaylist(CollectionInfo *info, Item *item, int size) { - std::string name = info->name; + std::string playlistCollectionName = info->name; bool globalFavLast = false; - conf_.getProperty("globalFavLast", globalFavLast); + (void)conf_.getProperty("globalFavLast", globalFavLast); if (globalFavLast) { - name = "favorites"; + playlistCollectionName = "Favorites"; } - std::string path = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); + std::string path = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists"); Logger::write(Logger::ZONE_INFO, "RetroFE", "Updating lastplayed playlist"); std::vector lastplayedList; - std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists", "lastplayed.txt"); + std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists", "lastplayed.txt"); ImportBasicList(info, playlistFile, lastplayedList); if (info->playlists["lastplayed"] == NULL) @@ -583,8 +583,8 @@ void CollectionInfoBuilder::updateLastPlayedPlaylist(CollectionInfo *info, Item } // Write new lastplayed playlist - std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); - std::string file = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists/lastplayed.txt"); + std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists"); + std::string file = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists", "lastplayed.txt"); Logger::write(Logger::ZONE_INFO, "Collection", "Saving " + file); std::ofstream filestream; @@ -625,7 +625,7 @@ void CollectionInfoBuilder::updateLastPlayedPlaylist(CollectionInfo *info, Item std::vector *saveitems = info->playlists["lastplayed"]; for(std::vector::iterator it = saveitems->begin(); it != saveitems->end(); it++) { - if ((*it)->collectionInfo->name == info->name) + if ((*it)->collectionInfo->name == playlistCollectionName) { filestream << (*it)->name << std::endl; } From b3e94f3e9889dd709c70ca3f79ee7dd7e35d5988 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Tue, 16 May 2023 20:36:58 -0700 Subject: [PATCH 04/15] playlist gets saved and loads, favorites loads and saves but overwrites still --- .../Collection/CollectionInfoBuilder.cpp | 139 ++++++++++-------- .../Source/Collection/CollectionInfoBuilder.h | 1 + 2 files changed, 78 insertions(+), 62 deletions(-) diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index 39f4bc7ca..7bd0caebf 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -411,40 +411,89 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info) { info->playlists["all"] = &info->items; } - - DIR *dp; - struct dirent *dirp; + std::map playlistItems; std::string path = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists"); - dp = opendir(path.c_str()); + loadPlaylistItems(info, playlistItems, path); + + bool globalFavLast = false; + (void)conf_.getProperty("globalFavLast", globalFavLast); + if (globalFavLast) { + std::string path = Utils::combinePath(Configuration::absolutePath, "collections", "Favorites", "playlists"); + loadPlaylistItems(info, playlistItems, path); + } + + if (!playlistItems.size()) { + return; + } + // if cyclePlaylist then order playlist menu items by that + std::string cycleString; + conf_.getProperty("cyclePlaylist", cycleString); + std::vector cycleVector; + Utils::listToVector(cycleString, cycleVector, ','); + if (cycleVector.size()) + { + // add in order according to cycle list + for (std::vector::iterator itP = cycleVector.begin(); itP != cycleVector.end(); itP++) + { + if (playlistItems[*itP]) { + info->playlistItems.push_back(playlistItems[*itP]); + } + } + } + else { + // convert lookup playlist map to vector + for (std::map::iterator itP = playlistItems.begin(); itP != playlistItems.end(); itP++) + { + info->playlistItems.push_back(itP->second); + } + } - if(dp == NULL) + if(info->playlists["favorites"] == NULL) { info->playlists["favorites"] = new std::vector(); + } + + if(info->playlists["lastplayed"] == NULL) + { + info->playlists["lastplayed"] = new std::vector(); + } + + return; +} + +void CollectionInfoBuilder::loadPlaylistItems(CollectionInfo* info, std::map playlistItems, std::string path) +{ + DIR* dp; + struct dirent* dirp; + dp = opendir(path.c_str()); + + if (dp == NULL) + { + info->playlists["favorites"] = new std::vector(); return; } - std::map playlistItems; - while((dirp = readdir(dp)) != NULL) + while ((dirp = readdir(dp)) != NULL) { std::string file = dirp->d_name; size_t position = file.find_last_of("."); - std::string basename = (std::string::npos == position)? file : file.substr(0, position); + std::string basename = (std::string::npos == position) ? file : file.substr(0, position); std::string comparator = ".txt"; int start = file.length() - comparator.length(); - if(start >= 0) + if (start >= 0) { - if(file.compare(start, comparator.length(), comparator) == 0) + if (file.compare(start, comparator.length(), comparator) == 0) { Logger::write(Logger::ZONE_INFO, "RetroFE", "Loading playlist: " + basename); - std::map playlistFilter; + std::map playlistFilter; std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists", file); ImportBasicList(info, playlistFile, playlistFilter); - info->playlists[basename] = new std::vector(); + info->playlists[basename] = new std::vector(); Item* playlistItem = new Item(); playlistItem->name = basename; @@ -455,76 +504,42 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info) playlistItems[basename] = playlistItem; // add the playlist list - for(std::map::iterator it = playlistFilter.begin(); it != playlistFilter.end(); it++) + for (std::map::iterator it = playlistFilter.begin(); it != playlistFilter.end(); it++) { std::string collectionName = info->name; - std::string itemName = it->first; + std::string itemName = it->first; if (itemName.at(0) == '_') // name consists of _: { - 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); - } + 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); + } } - for(std::vector::iterator it = info->items.begin(); it != info->items.end(); it++) + for (std::vector::iterator it = info->items.begin(); it != info->items.end(); it++) { - if ( ((*it)->name == itemName || itemName == "*") && (*it)->collectionInfo->name == collectionName ) + if (((*it)->name == itemName || itemName == "*") && (*it)->collectionInfo->name == collectionName) { info->playlists[basename]->push_back((*it)); - if ( basename == "favorites" ) + if (basename == "favorites") (*it)->isFavorite = true; } } } - while ( playlistFilter.size( ) > 0 ) + while (playlistFilter.size() > 0) { - std::map::iterator it = playlistFilter.begin(); + std::map::iterator it = playlistFilter.begin(); delete it->second; - playlistFilter.erase( it->first ); + playlistFilter.erase(it->first); } } } } - // if cyclePlaylist then order playlist menu items by that - std::string cycleString; - conf_.getProperty("cyclePlaylist", cycleString); - std::vector cycleVector; - Utils::listToVector(cycleString, cycleVector, ','); - if (cycleVector.size()) - { - // add in order according to cycle list - for (std::vector::iterator itP = cycleVector.begin(); itP != cycleVector.end(); itP++) - { - if (playlistItems[*itP]) { - info->playlistItems.push_back(playlistItems[*itP]); - } - } - } - else { - // convert lookup playlist map to vector - for (std::map::iterator itP = playlistItems.begin(); itP != playlistItems.end(); itP++) - { - info->playlistItems.push_back(itP->second); - } - } - if (dp) closedir(dp); - - if(info->playlists["favorites"] == NULL) - { - info->playlists["favorites"] = new std::vector(); - } - - if(info->playlists["lastplayed"] == NULL) - { - info->playlists["lastplayed"] = new std::vector(); - } - - return; + closedir(dp); } diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.h b/RetroFE/Source/Collection/CollectionInfoBuilder.h index ca9fce5a2..5bda6ea4e 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.h +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.h @@ -32,6 +32,7 @@ class CollectionInfoBuilder CollectionInfo *buildCollection(std::string collectionName); CollectionInfo *buildCollection(std::string collectionName, std::string mergedCollectionName); void addPlaylists(CollectionInfo *info); + void loadPlaylistItems(CollectionInfo* info, std::map playlistItems, std::string path); void updateLastPlayedPlaylist(CollectionInfo *info, Item *item, int size); void injectMetadata(CollectionInfo *info); static bool createCollectionDirectory(std::string collectionName); From e6541f36a15271a0b72df71509a3cf6a5b381f54 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Mon, 15 May 2023 14:57:34 -0700 Subject: [PATCH 05/15] intial - not working - saving last played and favorites to a new `favorites`` collection so all collections will write there and you can style it differently to support all collection types --- RetroFE/Source/Collection/CollectionInfo.cpp | 23 +++++++++++++------ RetroFE/Source/Collection/CollectionInfo.h | 4 +++- .../Collection/CollectionInfoBuilder.cpp | 16 +++++++++---- RetroFE/Source/RetroFE.cpp | 2 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/RetroFE/Source/Collection/CollectionInfo.cpp b/RetroFE/Source/Collection/CollectionInfo.cpp index cd8915c09..6929af87c 100644 --- a/RetroFE/Source/Collection/CollectionInfo.cpp +++ b/RetroFE/Source/Collection/CollectionInfo.cpp @@ -34,12 +34,15 @@ #include #endif -CollectionInfo::CollectionInfo(std::string name, - std::string listPath, - std::string extensions, - std::string metadataType, - std::string metadataPath) - : name(name) +CollectionInfo::CollectionInfo( + Configuration& c, + std::string name, + std::string listPath, + std::string extensions, + std::string metadataType, + std::string metadataPath) + : conf_(c) + , name(name) , listpath(listPath) , saveRequest(false) , metadataType(metadataType) @@ -47,7 +50,7 @@ CollectionInfo::CollectionInfo(std::string name, , subsSplit(false) , hasSubs(false) , metadataPath_(metadataPath) - , extensions_(extensions) + , extensions_(extensions) { } @@ -79,6 +82,12 @@ bool CollectionInfo::Save() bool retval = true; if(saveRequest) { + bool globalFavLast = false; + conf_.getProperty("globalFavLast", globalFavLast); + if (globalFavLast) { + name = "favorites"; + } + std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); std::string file = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists/favorites.txt"); Logger::write(Logger::ZONE_INFO, "Collection", "Saving " + file); diff --git a/RetroFE/Source/Collection/CollectionInfo.h b/RetroFE/Source/Collection/CollectionInfo.h index ffe1046c8..758027da4 100644 --- a/RetroFE/Source/Collection/CollectionInfo.h +++ b/RetroFE/Source/Collection/CollectionInfo.h @@ -20,11 +20,12 @@ #include class Item; +class Configuration; class CollectionInfo { public: - CollectionInfo(std::string name, std::string listPath, std::string extensions, std::string metadataType, std::string metadataPath); + CollectionInfo(Configuration& c, std::string name, std::string listPath, std::string extensions, std::string metadataType, std::string metadataPath); virtual ~CollectionInfo(); std::string settingsPath() const; bool Save(); @@ -48,6 +49,7 @@ class CollectionInfo bool subsSplit; bool hasSubs; private: + Configuration& conf_; std::string metadataPath_; std::string extensions_; static bool itemIsLess(Item *lhs, Item *rhs); diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index c7f93ff96..5ebb5008b 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -184,7 +184,7 @@ CollectionInfo *CollectionInfoBuilder::buildCollection(std::string name, std::st Logger::write(Logger::ZONE_NOTICE, "Collections", ss.str()); } - CollectionInfo *collection = new CollectionInfo(name, listItemsPath, extensions, metadataType, metadataPath); + CollectionInfo *collection = new CollectionInfo(conf_, name, listItemsPath, extensions, metadataType, metadataPath); (void)conf_.getProperty("collections." + collection->name + ".launcher", collection->launcher); @@ -530,11 +530,17 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info) void CollectionInfoBuilder::updateLastPlayedPlaylist(CollectionInfo *info, Item *item, int size) { - std::string path = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists"); + std::string name = info->name; + bool globalFavLast = false; + conf_.getProperty("globalFavLast", globalFavLast); + if (globalFavLast) { + name = "favorites"; + } + std::string path = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); Logger::write(Logger::ZONE_INFO, "RetroFE", "Updating lastplayed playlist"); std::vector lastplayedList; - std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists", "lastplayed.txt"); + std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists", "lastplayed.txt"); ImportBasicList(info, playlistFile, lastplayedList); if (info->playlists["lastplayed"] == NULL) @@ -577,8 +583,8 @@ void CollectionInfoBuilder::updateLastPlayedPlaylist(CollectionInfo *info, Item } // Write new lastplayed playlist - std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists"); - std::string file = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists/lastplayed.txt"); + std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); + std::string file = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists/lastplayed.txt"); Logger::write(Logger::ZONE_INFO, "Collection", "Saving " + file); std::ofstream filestream; diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index fa3c0a834..aa8199da8 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -2003,7 +2003,7 @@ CollectionInfo *RetroFE::getMenuCollection( std::string collectionName ) std::string menuFile = Utils::combinePath( menuPath, collectionName + ".txt" ); std::vector menuVector; CollectionInfoBuilder cib( config_, *metadb_ ); - CollectionInfo *collection = new CollectionInfo( collectionName, menuPath, "", "", "" ); + CollectionInfo *collection = new CollectionInfo(config_, collectionName, menuPath, "", "", "" ); cib.ImportBasicList( collection, menuFile, menuVector ); for ( std::vector::iterator it = menuVector.begin( ); it != menuVector.end( ); ++it) { From 87d8b6ff7ca7d1fc1f203323f2d11f857f92c403 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Mon, 15 May 2023 16:30:12 -0700 Subject: [PATCH 06/15] working --- RetroFE/Source/Collection/CollectionInfo.cpp | 12 ++++++------ .../Source/Collection/CollectionInfoBuilder.cpp | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/RetroFE/Source/Collection/CollectionInfo.cpp b/RetroFE/Source/Collection/CollectionInfo.cpp index 6929af87c..f00681b77 100644 --- a/RetroFE/Source/Collection/CollectionInfo.cpp +++ b/RetroFE/Source/Collection/CollectionInfo.cpp @@ -82,14 +82,14 @@ bool CollectionInfo::Save() bool retval = true; if(saveRequest) { + std::string playlistCollectionName = name; bool globalFavLast = false; - conf_.getProperty("globalFavLast", globalFavLast); + (void)conf_.getProperty("globalFavLast", globalFavLast); if (globalFavLast) { - name = "favorites"; + playlistCollectionName = "Favorites"; } - - std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); - std::string file = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists/favorites.txt"); + std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists"); + std::string file = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists", "favorites.txt"); Logger::write(Logger::ZONE_INFO, "Collection", "Saving " + file); std::ofstream filestream; @@ -130,7 +130,7 @@ bool CollectionInfo::Save() std::vector *saveitems = playlists["favorites"]; for(std::vector::iterator it = saveitems->begin(); it != saveitems->end(); it++) { - if ((*it)->collectionInfo->name == name) + if ((*it)->collectionInfo->name == (*it)->name) { filestream << (*it)->name << std::endl; } diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index 5ebb5008b..39f4bc7ca 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -530,17 +530,17 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info) void CollectionInfoBuilder::updateLastPlayedPlaylist(CollectionInfo *info, Item *item, int size) { - std::string name = info->name; + std::string playlistCollectionName = info->name; bool globalFavLast = false; - conf_.getProperty("globalFavLast", globalFavLast); + (void)conf_.getProperty("globalFavLast", globalFavLast); if (globalFavLast) { - name = "favorites"; + playlistCollectionName = "Favorites"; } - std::string path = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); + std::string path = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists"); Logger::write(Logger::ZONE_INFO, "RetroFE", "Updating lastplayed playlist"); std::vector lastplayedList; - std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists", "lastplayed.txt"); + std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists", "lastplayed.txt"); ImportBasicList(info, playlistFile, lastplayedList); if (info->playlists["lastplayed"] == NULL) @@ -583,8 +583,8 @@ void CollectionInfoBuilder::updateLastPlayedPlaylist(CollectionInfo *info, Item } // Write new lastplayed playlist - std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists"); - std::string file = Utils::combinePath(Configuration::absolutePath, "collections", name, "playlists/lastplayed.txt"); + std::string dir = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists"); + std::string file = Utils::combinePath(Configuration::absolutePath, "collections", playlistCollectionName, "playlists", "lastplayed.txt"); Logger::write(Logger::ZONE_INFO, "Collection", "Saving " + file); std::ofstream filestream; @@ -625,7 +625,7 @@ void CollectionInfoBuilder::updateLastPlayedPlaylist(CollectionInfo *info, Item std::vector *saveitems = info->playlists["lastplayed"]; for(std::vector::iterator it = saveitems->begin(); it != saveitems->end(); it++) { - if ((*it)->collectionInfo->name == info->name) + if ((*it)->collectionInfo->name == playlistCollectionName) { filestream << (*it)->name << std::endl; } From 29511f5136ca41721634bbc5a06960494f7482fa Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Tue, 16 May 2023 20:36:58 -0700 Subject: [PATCH 07/15] playlist gets saved and loads, favorites loads and saves but overwrites still --- .../Collection/CollectionInfoBuilder.cpp | 139 ++++++++++-------- .../Source/Collection/CollectionInfoBuilder.h | 1 + 2 files changed, 78 insertions(+), 62 deletions(-) diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index 39f4bc7ca..7bd0caebf 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -411,40 +411,89 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info) { info->playlists["all"] = &info->items; } - - DIR *dp; - struct dirent *dirp; + std::map playlistItems; std::string path = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists"); - dp = opendir(path.c_str()); + loadPlaylistItems(info, playlistItems, path); + + bool globalFavLast = false; + (void)conf_.getProperty("globalFavLast", globalFavLast); + if (globalFavLast) { + std::string path = Utils::combinePath(Configuration::absolutePath, "collections", "Favorites", "playlists"); + loadPlaylistItems(info, playlistItems, path); + } + + if (!playlistItems.size()) { + return; + } + // if cyclePlaylist then order playlist menu items by that + std::string cycleString; + conf_.getProperty("cyclePlaylist", cycleString); + std::vector cycleVector; + Utils::listToVector(cycleString, cycleVector, ','); + if (cycleVector.size()) + { + // add in order according to cycle list + for (std::vector::iterator itP = cycleVector.begin(); itP != cycleVector.end(); itP++) + { + if (playlistItems[*itP]) { + info->playlistItems.push_back(playlistItems[*itP]); + } + } + } + else { + // convert lookup playlist map to vector + for (std::map::iterator itP = playlistItems.begin(); itP != playlistItems.end(); itP++) + { + info->playlistItems.push_back(itP->second); + } + } - if(dp == NULL) + if(info->playlists["favorites"] == NULL) { info->playlists["favorites"] = new std::vector(); + } + + if(info->playlists["lastplayed"] == NULL) + { + info->playlists["lastplayed"] = new std::vector(); + } + + return; +} + +void CollectionInfoBuilder::loadPlaylistItems(CollectionInfo* info, std::map playlistItems, std::string path) +{ + DIR* dp; + struct dirent* dirp; + dp = opendir(path.c_str()); + + if (dp == NULL) + { + info->playlists["favorites"] = new std::vector(); return; } - std::map playlistItems; - while((dirp = readdir(dp)) != NULL) + while ((dirp = readdir(dp)) != NULL) { std::string file = dirp->d_name; size_t position = file.find_last_of("."); - std::string basename = (std::string::npos == position)? file : file.substr(0, position); + std::string basename = (std::string::npos == position) ? file : file.substr(0, position); std::string comparator = ".txt"; int start = file.length() - comparator.length(); - if(start >= 0) + if (start >= 0) { - if(file.compare(start, comparator.length(), comparator) == 0) + if (file.compare(start, comparator.length(), comparator) == 0) { Logger::write(Logger::ZONE_INFO, "RetroFE", "Loading playlist: " + basename); - std::map playlistFilter; + std::map playlistFilter; std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists", file); ImportBasicList(info, playlistFile, playlistFilter); - info->playlists[basename] = new std::vector(); + info->playlists[basename] = new std::vector(); Item* playlistItem = new Item(); playlistItem->name = basename; @@ -455,76 +504,42 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info) playlistItems[basename] = playlistItem; // add the playlist list - for(std::map::iterator it = playlistFilter.begin(); it != playlistFilter.end(); it++) + for (std::map::iterator it = playlistFilter.begin(); it != playlistFilter.end(); it++) { std::string collectionName = info->name; - std::string itemName = it->first; + std::string itemName = it->first; if (itemName.at(0) == '_') // name consists of _: { - 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); - } + 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); + } } - for(std::vector::iterator it = info->items.begin(); it != info->items.end(); it++) + for (std::vector::iterator it = info->items.begin(); it != info->items.end(); it++) { - if ( ((*it)->name == itemName || itemName == "*") && (*it)->collectionInfo->name == collectionName ) + if (((*it)->name == itemName || itemName == "*") && (*it)->collectionInfo->name == collectionName) { info->playlists[basename]->push_back((*it)); - if ( basename == "favorites" ) + if (basename == "favorites") (*it)->isFavorite = true; } } } - while ( playlistFilter.size( ) > 0 ) + while (playlistFilter.size() > 0) { - std::map::iterator it = playlistFilter.begin(); + std::map::iterator it = playlistFilter.begin(); delete it->second; - playlistFilter.erase( it->first ); + playlistFilter.erase(it->first); } } } } - // if cyclePlaylist then order playlist menu items by that - std::string cycleString; - conf_.getProperty("cyclePlaylist", cycleString); - std::vector cycleVector; - Utils::listToVector(cycleString, cycleVector, ','); - if (cycleVector.size()) - { - // add in order according to cycle list - for (std::vector::iterator itP = cycleVector.begin(); itP != cycleVector.end(); itP++) - { - if (playlistItems[*itP]) { - info->playlistItems.push_back(playlistItems[*itP]); - } - } - } - else { - // convert lookup playlist map to vector - for (std::map::iterator itP = playlistItems.begin(); itP != playlistItems.end(); itP++) - { - info->playlistItems.push_back(itP->second); - } - } - if (dp) closedir(dp); - - if(info->playlists["favorites"] == NULL) - { - info->playlists["favorites"] = new std::vector(); - } - - if(info->playlists["lastplayed"] == NULL) - { - info->playlists["lastplayed"] = new std::vector(); - } - - return; + closedir(dp); } diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.h b/RetroFE/Source/Collection/CollectionInfoBuilder.h index ca9fce5a2..5bda6ea4e 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.h +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.h @@ -32,6 +32,7 @@ class CollectionInfoBuilder CollectionInfo *buildCollection(std::string collectionName); CollectionInfo *buildCollection(std::string collectionName, std::string mergedCollectionName); void addPlaylists(CollectionInfo *info); + void loadPlaylistItems(CollectionInfo* info, std::map playlistItems, std::string path); void updateLastPlayedPlaylist(CollectionInfo *info, Item *item, int size); void injectMetadata(CollectionInfo *info); static bool createCollectionDirectory(std::string collectionName); From 13eb7a962892e7aa8e1777335c9528e911a28602 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Fri, 19 May 2023 08:45:07 -0700 Subject: [PATCH 08/15] ignore --- .gitignore | 2 +- RetroFE/Source/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ba90e2fbc..5b2ba046e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ Configuration/Configuration/obj/** Artifacts/** BP Files/Page.cpp BP Files/RetroFE.cpp -/.vs/RetroFE-MF-Dev/v17 +/.vs diff --git a/RetroFE/Source/CMakeLists.txt b/RetroFE/Source/CMakeLists.txt index 2bf4f3c6b..185e5bba7 100644 --- a/RetroFE/Source/CMakeLists.txt +++ b/RetroFE/Source/CMakeLists.txt @@ -29,7 +29,7 @@ endif() set(ZLIB_ROOT "${RETROFE_THIRD_PARTY_DIR}/zlib128-dll") - set(GSTREAMER_ROOT "C:/gstreamer/1.0/msvc_x86" CACHE STRING "location of where your gstreamer include and lib folders reside") + set(GSTREAMER_ROOT "D:/gstreamer/1.0/msvc_x86" CACHE STRING "location of where your gstreamer include and lib folders reside") set(GLIB2_ROOT "${GSTREAMER_ROOT}") if(MSVC) @@ -227,4 +227,4 @@ else() set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -ggdb") set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") -endif() +endif() \ No newline at end of file From 10846d439afc44732a7f6711265cc5cbc9da0f80 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Fri, 19 May 2023 20:11:08 -0700 Subject: [PATCH 09/15] fixed favorites from loading and added setting to filter out logs log=ERROR,INFO --- .../Source/Collection/CollectionInfoBuilder.cpp | 12 ++++++++++-- RetroFE/Source/Main.cpp | 8 ++++---- RetroFE/Source/Utility/Log.cpp | 14 +++++++++++++- RetroFE/Source/Utility/Log.h | 4 +++- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index 7bd0caebf..0684e7e1a 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -418,6 +418,12 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info) bool globalFavLast = false; (void)conf_.getProperty("globalFavLast", globalFavLast); if (globalFavLast) { + // don't use collection's playlist + if (!info->playlists["favorites"]) { + info->playlists["favorites"] = new std::vector(); + } else { + info->playlists["favorites"]->clear(); + } std::string path = Utils::combinePath(Configuration::absolutePath, "collections", "Favorites", "playlists"); loadPlaylistItems(info, playlistItems, path); } @@ -476,7 +482,9 @@ void CollectionInfoBuilder::loadPlaylistItems(CollectionInfo* info, std::mapd_name; - + if (file == "." || file == "..") { + continue; + } size_t position = file.find_last_of("."); std::string basename = (std::string::npos == position) ? file : file.substr(0, position); @@ -490,7 +498,7 @@ void CollectionInfoBuilder::loadPlaylistItems(CollectionInfo* info, std::map playlistFilter; - std::string playlistFile = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists", file); + std::string playlistFile = Utils::combinePath(path, file); ImportBasicList(info, playlistFile, playlistFilter); info->playlists[basename] = new std::vector(); diff --git a/RetroFE/Source/Main.cpp b/RetroFE/Source/Main.cpp index a51120aa6..dd90e24d4 100644 --- a/RetroFE/Source/Main.cpp +++ b/RetroFE/Source/Main.cpp @@ -29,7 +29,7 @@ #include static bool ImportConfiguration(Configuration *c); -static bool StartLogging(); +static bool StartLogging(Configuration *c); int main(int argc, char **argv) { @@ -71,7 +71,7 @@ int main(int argc, char **argv) Configuration config; - if(!StartLogging()) + if(!StartLogging(&config)) { return -1; } @@ -219,11 +219,11 @@ bool ImportConfiguration(Configuration *c) return true; } -bool StartLogging() +bool StartLogging(Configuration* config) { std::string logFile = Utils::combinePath(Configuration::absolutePath, "log.txt"); - if(!Logger::initialize(logFile)) + if(!Logger::initialize(logFile, config)) { // Can't write to logs give a heads up... fprintf(stderr, "Could not open log: %s for writing!\nRetroFE will now exit...\n", logFile.c_str()); diff --git a/RetroFE/Source/Utility/Log.cpp b/RetroFE/Source/Utility/Log.cpp index 497e3f55c..1ca807fd4 100644 --- a/RetroFE/Source/Utility/Log.cpp +++ b/RetroFE/Source/Utility/Log.cpp @@ -18,17 +18,20 @@ #include #include #include +#include "../Database/Configuration.h" std::ofstream Logger::writeFileStream_; std::streambuf *Logger::cerrStream_ = NULL; std::streambuf *Logger::coutStream_ = NULL; +Configuration* Logger::config_ = NULL; -bool Logger::initialize(std::string file) +bool Logger::initialize(std::string file, Configuration* config) { writeFileStream_.open(file.c_str()); cerrStream_ = std::cerr.rdbuf(writeFileStream_.rdbuf()); coutStream_ = std::cout.rdbuf(writeFileStream_.rdbuf()); + config_ = config; return writeFileStream_.is_open(); } @@ -68,6 +71,15 @@ void Logger::write(Zone zone, std::string component, std::string message) zoneStr = "ERROR"; break; } + + // if levels defined and zone not in list then don't log + if (config_) { + std::string level = ""; + config_->getProperty("log", level); + if (level != "" && level.find(zoneStr) == std::string::npos) { + return; + } + } std::time_t rawtime = std::time(NULL); struct tm* timeinfo = std::localtime(&rawtime); diff --git a/RetroFE/Source/Utility/Log.h b/RetroFE/Source/Utility/Log.h index 98bf1ca0e..7ef1341e3 100644 --- a/RetroFE/Source/Utility/Log.h +++ b/RetroFE/Source/Utility/Log.h @@ -20,6 +20,7 @@ #include #include #include +#include "../Database/Configuration.h" class Logger { @@ -33,7 +34,7 @@ class Logger ZONE_ERROR }; - static bool initialize(std::string file); + static bool initialize(std::string file, Configuration* config); static void write(Zone zone, std::string component, std::string message); static void deInitialize(); private: @@ -41,4 +42,5 @@ class Logger static std::streambuf *cerrStream_; static std::streambuf *coutStream_; static std::ofstream writeFileStream_; + static Configuration *config_; }; From 2398c5d583820d6ddfffdbc1d06ca143fbb59a1c Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Fri, 19 May 2023 20:15:06 -0700 Subject: [PATCH 10/15] fix --- RetroFE/Source/Collection/CollectionInfoBuilder.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index dba224e2f..f6ebb569c 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -472,7 +472,19 @@ void CollectionInfoBuilder::loadPlaylistItems(CollectionInfo* info, std::mapplaylists["favorites"] = new std::vector(); + return; + } + while ((dirp = readdir(dp)) != NULL) + { + std::string file = dirp->d_name; + if (file == "." || file == "..") { + continue; + } size_t position = file.find_last_of("."); std::string basename = (std::string::npos == position) ? file : file.substr(0, position); From 90a06b9c276e8750cf824be92a17032f82fdadd8 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Fri, 19 May 2023 20:21:32 -0700 Subject: [PATCH 11/15] revert --- RetroFE/Source/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RetroFE/Source/CMakeLists.txt b/RetroFE/Source/CMakeLists.txt index 185e5bba7..1efcf1b7a 100644 --- a/RetroFE/Source/CMakeLists.txt +++ b/RetroFE/Source/CMakeLists.txt @@ -29,7 +29,7 @@ endif() set(ZLIB_ROOT "${RETROFE_THIRD_PARTY_DIR}/zlib128-dll") - set(GSTREAMER_ROOT "D:/gstreamer/1.0/msvc_x86" CACHE STRING "location of where your gstreamer include and lib folders reside") + set(GSTREAMER_ROOT "C:/gstreamer/1.0/msvc_x86" CACHE STRING "location of where your gstreamer include and lib folders reside") set(GLIB2_ROOT "${GSTREAMER_ROOT}") if(MSVC) From 8ffacff9bf423d0f57e397d75fe522619a3ca9b6 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Fri, 19 May 2023 20:22:29 -0700 Subject: [PATCH 12/15] revert --- RetroFE/Source/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RetroFE/Source/CMakeLists.txt b/RetroFE/Source/CMakeLists.txt index 1efcf1b7a..2bf4f3c6b 100644 --- a/RetroFE/Source/CMakeLists.txt +++ b/RetroFE/Source/CMakeLists.txt @@ -227,4 +227,4 @@ else() set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -ggdb") set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") -endif() \ No newline at end of file +endif() From ba05d767b7b321aa4ff932568852229418ae96b4 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Fri, 19 May 2023 21:06:10 -0700 Subject: [PATCH 13/15] ability to turn off logs=0 --- RetroFE/Source/Main.cpp | 25 +++++++++++++------------ RetroFE/Source/Utility/Log.cpp | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/RetroFE/Source/Main.cpp b/RetroFE/Source/Main.cpp index dd90e24d4..009f025f8 100644 --- a/RetroFE/Source/Main.cpp +++ b/RetroFE/Source/Main.cpp @@ -135,6 +135,19 @@ bool ImportConfiguration(Configuration *c) return false; } + // log version + Logger::write(Logger::ZONE_INFO, "RetroFE", "Version " + Version::getString() + " starting"); + +#ifdef WIN32 + Logger::write(Logger::ZONE_INFO, "RetroFE", "OS: Windows"); +#elif __APPLE__ + Logger::write(Logger::ZONE_INFO, "RetroFE", "OS: Mac"); +#else + Logger::write(Logger::ZONE_INFO, "RetroFE", "OS: Linux"); +#endif + + Logger::write(Logger::ZONE_INFO, "RetroFE", "Absolute path: " + Configuration::absolutePath); + dp = opendir(launchersPath.c_str()); if(dp == NULL) @@ -231,17 +244,5 @@ bool StartLogging(Configuration* config) return false; } - Logger::write(Logger::ZONE_INFO, "RetroFE", "Version " + Version::getString() + " starting"); - -#ifdef WIN32 - Logger::write(Logger::ZONE_INFO, "RetroFE", "OS: Windows"); -#elif __APPLE__ - Logger::write(Logger::ZONE_INFO, "RetroFE", "OS: Mac"); -#else - Logger::write(Logger::ZONE_INFO, "RetroFE", "OS: Linux"); -#endif - - Logger::write(Logger::ZONE_INFO, "RetroFE", "Absolute path: " + Configuration::absolutePath); - return true; } diff --git a/RetroFE/Source/Utility/Log.cpp b/RetroFE/Source/Utility/Log.cpp index 1ca807fd4..d0114fcaa 100644 --- a/RetroFE/Source/Utility/Log.cpp +++ b/RetroFE/Source/Utility/Log.cpp @@ -74,7 +74,7 @@ void Logger::write(Zone zone, std::string component, std::string message) // if levels defined and zone not in list then don't log if (config_) { - std::string level = ""; + std::string level = "0";// default to not show logs config_->getProperty("log", level); if (level != "" && level.find(zoneStr) == std::string::npos) { return; From bd98476d466292ba2080bf3409071dbbd01b3bd8 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Sat, 20 May 2023 20:08:34 -0700 Subject: [PATCH 14/15] fix merge conflict --- RetroFE/Source/CMakeLists.txt | 5 +++-- RetroFE/Source/Collection/CollectionInfoBuilder.cpp | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/RetroFE/Source/CMakeLists.txt b/RetroFE/Source/CMakeLists.txt index 2bf4f3c6b..b61f4fde0 100644 --- a/RetroFE/Source/CMakeLists.txt +++ b/RetroFE/Source/CMakeLists.txt @@ -29,7 +29,7 @@ endif() set(ZLIB_ROOT "${RETROFE_THIRD_PARTY_DIR}/zlib128-dll") - set(GSTREAMER_ROOT "C:/gstreamer/1.0/msvc_x86" CACHE STRING "location of where your gstreamer include and lib folders reside") + set(GSTREAMER_ROOT "D:/gstreamer/1.0/msvc_x86" CACHE STRING "location of where your gstreamer include and lib folders reside") set(GLIB2_ROOT "${GSTREAMER_ROOT}") if(MSVC) @@ -211,7 +211,8 @@ if(MINGW) endif() add_definitions(-DRETROFE_VERSION_MAJOR=${VERSION_MAJOR}) -add_definitions(-DRETROFE_VERSION_MINOR=${VERSION_MINOR}) +add_definitions(-D +=${VERSION_MINOR}) add_definitions(-DRETROFE_VERSION_BUILD=${VERSION_BUILD}) if(MSVC) diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index f6a90fd2e..88a58eead 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -414,8 +414,7 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info) info->playlists["all"] = &info->items; } - DIR *dp; - struct dirent *dirp; + std::map playlistItems; std::string path = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists"); loadPlaylistItems(info, playlistItems, path); From 5667aa21d2718062213ac07b9a6d2cc7e05993a7 Mon Sep 17 00:00:00 2001 From: Tobias Contreras Date: Sat, 20 May 2023 20:34:32 -0700 Subject: [PATCH 15/15] revert --- RetroFE/Source/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/RetroFE/Source/CMakeLists.txt b/RetroFE/Source/CMakeLists.txt index b61f4fde0..2bf4f3c6b 100644 --- a/RetroFE/Source/CMakeLists.txt +++ b/RetroFE/Source/CMakeLists.txt @@ -29,7 +29,7 @@ endif() set(ZLIB_ROOT "${RETROFE_THIRD_PARTY_DIR}/zlib128-dll") - set(GSTREAMER_ROOT "D:/gstreamer/1.0/msvc_x86" CACHE STRING "location of where your gstreamer include and lib folders reside") + set(GSTREAMER_ROOT "C:/gstreamer/1.0/msvc_x86" CACHE STRING "location of where your gstreamer include and lib folders reside") set(GLIB2_ROOT "${GSTREAMER_ROOT}") if(MSVC) @@ -211,8 +211,7 @@ if(MINGW) endif() add_definitions(-DRETROFE_VERSION_MAJOR=${VERSION_MAJOR}) -add_definitions(-D -=${VERSION_MINOR}) +add_definitions(-DRETROFE_VERSION_MINOR=${VERSION_MINOR}) add_definitions(-DRETROFE_VERSION_BUILD=${VERSION_BUILD}) if(MSVC)