@@ -1151,6 +1151,12 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
11511151 optionParseString (key , value , & instance -> config .publicIP .outputFormat );
11521152 else if (strcasecmp (key , "--public-ip-error" ) == 0 )
11531153 optionParseString (key , value , & instance -> config .publicIP .errorFormat );
1154+ else if (strcasecmp (key , "--weather-key" ) == 0 )
1155+ optionParseString (key , value , & instance -> config .weather .key );
1156+ else if (strcasecmp (key , "--weather-format" ) == 0 )
1157+ optionParseString (key , value , & instance -> config .weather .outputFormat );
1158+ else if (strcasecmp (key , "--weather-error" ) == 0 )
1159+ optionParseString (key , value , & instance -> config .weather .errorFormat );
11541160 else if (strcasecmp (key , "--player-key" ) == 0 )
11551161 optionParseString (key , value , & instance -> config .player .key );
11561162 else if (strcasecmp (key , "--player-format" ) == 0 )
@@ -1291,8 +1297,14 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
12911297 optionParseString (key , value , & instance -> config .osFile );
12921298 else if (strcasecmp (key , "--player-name" ) == 0 )
12931299 optionParseString (key , value , & instance -> config .playerName );
1300+ else if (strcasecmp (key , "--public-ip-url" ) == 0 )
1301+ optionParseString (key , value , & instance -> config .publicIpUrl );
12941302 else if (strcasecmp (key , "--public-ip-timeout" ) == 0 )
12951303 instance -> config .publicIpTimeout = optionParseUInt32 (key , value );
1304+ else if (strcasecmp (key , "--weather-output-format" ) == 0 )
1305+ optionParseString (key , value , & instance -> config .weatherOutputFormat );
1306+ else if (strcasecmp (key , "--weather-timeout" ) == 0 )
1307+ instance -> config .weatherTimeout = optionParseUInt32 (key , value );
12961308 else if (strcasecmp (key , "--gl" ) == 0 )
12971309 {
12981310 optionParseEnum (key , value , & instance -> config .glType ,
@@ -1428,6 +1440,8 @@ static void parseStructureCommand(FFinstance* instance, FFdata* data, const char
14281440 ffPrintLocalIp (instance );
14291441 else if (strcasecmp (line , "publicip" ) == 0 )
14301442 ffPrintPublicIp (instance );
1443+ else if (strcasecmp (line , "weather" ) == 0 )
1444+ ffPrintWeather (instance );
14311445 else if (strcasecmp (line , "player" ) == 0 )
14321446 ffPrintPlayer (instance );
14331447 else if (strcasecmp (line , "media" ) == 0 || strcasecmp (line , "song" ) == 0 )
@@ -1471,6 +1485,19 @@ int main(int argc, const char** argv)
14711485 if (data .structure .length == 0 )
14721486 ffStrbufAppendS (& data .structure , FASTFETCH_DATATEXT_STRUCTURE );
14731487
1488+ #define FF_CONTAINS_MODULE_NAME (moduleName )\
1489+ ffStrbufContainIgnCaseS(&data.structure, ":" #moduleName ":") ||\
1490+ ffStrbufStartsWithIgnCaseS(&data.structure, #moduleName ":") ||\
1491+ ffStrbufEndsWithIgnCaseS(&data.structure, ":" #moduleName)
1492+
1493+ if (FF_CONTAINS_MODULE_NAME (CPUUsage ))
1494+ ffPrepareCPUUsage ();
1495+ if (FF_CONTAINS_MODULE_NAME (PublicIp ))
1496+ ffPreparePublicIp (& instance );
1497+ if (FF_CONTAINS_MODULE_NAME (Weather ))
1498+ ffPrepareWeather (& instance );
1499+ #undef FF_CONTAINS_MODULE_NAME
1500+
14741501 ffStart (& instance );
14751502
14761503 //Parse the structure and call the modules
0 commit comments