diff --git a/common/http_lib/http_lib_connection.cpp b/common/http_lib/http_lib_connection.cpp index 86651e7cd6..0f8aad00b3 100644 --- a/common/http_lib/http_lib_connection.cpp +++ b/common/http_lib/http_lib_connection.cpp @@ -255,6 +255,27 @@ bool HTTP_LIB_CONNECTION::SelectOne( const std::string& aPartID, HTTP_LIB_PART& // Add field to fields list aFetchedPart.fields.push_back( std::make_pair( key, std::make_tuple( value, visible ) ) ); } + + if( response.contains( "description" ) ) + aFetchedPart.desc = response.at( "description" ); + + if( response.contains( "keywords" ) ) + aFetchedPart.keywords = response.at( "keywords" ); + + if( response.contains( "footprint_filters" ) ) + { + nlohmann::json filters_json = response.at( "footprint_filters" ); + + if( filters_json.is_array() ) + { + for( const auto& val : filters_json ) + aFetchedPart.fp_filters.push_back( val ); + } + else + { + aFetchedPart.fp_filters.push_back( filters_json ); + } + } } catch( const std::exception& e ) { diff --git a/eeschema/sch_io/http_lib/sch_io_http_lib.cpp b/eeschema/sch_io/http_lib/sch_io_http_lib.cpp index 3ff081c832..2ba114c1da 100644 --- a/eeschema/sch_io/http_lib/sch_io_http_lib.cpp +++ b/eeschema/sch_io/http_lib/sch_io_http_lib.cpp @@ -370,14 +370,12 @@ LIB_SYMBOL* SCH_IO_HTTP_LIB::loadSymbolFromPart( const wxString& aSymbolName, else if( !symbolId.IsValid() ) { wxLogTrace( traceHTTPLib, wxT( "loadSymbolFromPart: source symbol id '%s' is invalid, " - "will create empty symbol" ), - symbolIdStr ); + "will create empty symbol" ), symbolIdStr ); } else { wxLogTrace( traceHTTPLib, wxT( "loadSymbolFromPart: source symbol '%s' not found, " - "will create empty symbol" ), - symbolIdStr ); + "will create empty symbol" ), symbolIdStr ); } } @@ -464,6 +462,16 @@ LIB_SYMBOL* SCH_IO_HTTP_LIB::loadSymbolFromPart( const wxString& aSymbolName, } } + symbol->SetDescription( aPart.desc ); + symbol->SetKeyWords( aPart.keywords ); + + wxArrayString filters; + + for( const std::string& filter : aPart.fp_filters ) + filters.push_back( filter ); + + symbol->SetFPFilters( filters ); + return symbol; } diff --git a/include/http_lib/http_lib_settings.h b/include/http_lib/http_lib_settings.h index 0b5a98a44c..e67f0ba92d 100644 --- a/include/http_lib/http_lib_settings.h +++ b/include/http_lib/http_lib_settings.h @@ -54,7 +54,11 @@ struct HTTP_LIB_PART std::time_t lastCached = 0; - std::vector>> fields; ///< additional generic fields + std::string desc; + std::string keywords; + std::vector fp_filters; + + std::vector>> fields; };