Closed onacvooe closed 5 years ago
Here is a link that should get you going:
https://stackoverflow.com/questions/25491090/how-to-use-python-to-execute-a-curl-command
Here is a link that should get you going:
https://stackoverflow.com/questions/25491090/how-to-use-python-to-execute-a-curl-command
I have tried different options mentioned with searching on google but I can't get anything to work. Sometimes sopare doesn't start at all with a message saying a syntax error or something. Other times it starts fine and executes all given commands but my lights don't respond and I don't get a error message. Any help would be great.
Thanks for all your work and help.
My current configuration is doesn't generate any errors but as you can see I put in your original message "Tschakka! Got my two words...now do some awesome stuff" at the end, so I know it runs the other command as well.
I tried executing ./sopare -v -l
for verbose output, which doesn't help, and also normal ./sopare -l
And it outputs the following:
lappie@lappie01:~/sopare$ ./sopare.py -l sopare 1.5.0 ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave Cannot lock down 82280346 byte memory area (Cannot allocate memory) [u'lampen'] Tschakka! Got my two words...now do some awesome stuff
When running with the verbose in it, I get the following output:
`lappie@lappie01:~/sopare$ ./sopare.py -l -v sopare 1.5.0 ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave Cannot lock down 82280346 byte memory area (Cannot allocate memory) INFO:sopare.analyze:checking for plugins... DEBUG:sopare.analyze:loading and initialzing plugins/print DEBUG:sopare.analyze:loading and initialzing plugins/lampen01 INFO:sopare.worker:worker queue runner started DEBUG:sopare.audio_factory:#### Default input device info ##### DEBUG:sopare.audio_factory:defaultSampleRate: 44100.0 DEBUG:sopare.audio_factory:defaultLowOutputLatency: 0.0087074829932 DEBUG:sopare.audio_factory:defaultLowInputLatency: 0.0087074829932 DEBUG:sopare.audio_factory:maxInputChannels: 32 DEBUG:sopare.audio_factory:structVersion: 2 DEBUG:sopare.audio_factory:hostApi: 0 DEBUG:sopare.audio_factory:index: 4 DEBUG:sopare.audio_factory:defaultHighOutputLatency: 0.0348299319728 DEBUG:sopare.audio_factory:maxOutputChannels: 32 DEBUG:sopare.audio_factory:name: default DEBUG:sopare.audio_factory:defaultHighInputLatency: 0.0348299319728 INFO:sopare.buffering:buffering queue runner DEBUG:sopare.recorder:SAMPLE_RATE: 48000 DEBUG:sopare.recorder:CHUNK: 512 INFO:sopare.recorder:start endless recording INFO:sopare.processing:starting append mode DEBUG:sopare.filter:New window! DEBUG:sopare.worker:characteristic = 0 {'dfm': 256784, 'peaks': [0, 1, 2, 3, 4, 5, 6, 7, 8, 31, 32], 'df': 21, 'volume': 488, 'fc': 208.3, 'norm': [0.24748985259337808, 0.19697923196415063, 0.17613148
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.06052299471687352], 'token_peaks': [18020, 59187, 149084, 176322, 198786, 206417]} DEBUG:sopare.worker:meta = [{'adapting': 206417, 'token_peaks': [18020, 59187, 149084, 176322, 198786, 206417], 'pos': 6, 'volume': 488, 'token': 'token', 'silence': 0}] DEBUG:sopare.worker:characteristic = 1 {'dfm': 1080438, 'peaks': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 37, 39, 40, 41, 42], 'df': 37, 'volume': 1468, 'fc': 185.4, 'norm': [0.18862625101780392, 0.16651922341725578, 0.18209453292238723, 0.20219862790041623, 0.19165117417294977,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.05042740354542106, 0.06486819269188564, 0.053484397538042544], 'token_peaks': [218664, 263590, 322222, 463373, 697530, 590549]} DEBUG:sopare.worker:meta = [{'adapting': 590549, 'token_peaks': [218664, 263590, 322222, 463373, 697530, 590549], 'pos': 12, 'volume': 1468, 'token': 'token', 'silence': 0}] DEBUG:sopare.worker:characteristic = 2 {'dfm': 1336807, 'peaks': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 37, 38, 39, 40, 41], 'df': 38, 'volume': 639, 'fc': 205.6, 'norm': [0.18419380846494518, 0.1541841647025054, 0.19131611625405495, 0.20266483341287808, 0.18899637205132147,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.07964203724066227, 0.06843676819066119, 0.07589014211555282, 0.05920830241633842, 0.05369450300744336, 0.05894261875232369, 0.052368810603330436], 'token_peaks': [682449, 712910, 581495, 530845, 297026, 258813]} DEBUG:sopare.worker:meta = [{'adapting': 258813, 'token_peaks': [682449, 712910, 581495, 530845, 297026, 258813], 'pos': 18, 'volume': 639, 'token': 'token', 'silence': 0}] DEBUG:sopare.worker:characteristic = 3 {'dfm': 125066, 'peaks': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 27, 41], 'df': 25, 'volume': 271, 'fc': 205.2, 'norm': [0.17719482163526487, 0.16943697186227125, 0.16524615616689897, 0.16819665659339972, 0.14704891173808068, 0.16237724936352846,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.05855445108328623, 0.06576568136339754, 0.05935504535502074, 0.05656116049371686, 0.06277894858830546, 0.06309620694653208], 'token_peaks': [287068, 186861, 199308, 137319, 113162, 124920]} DEBUG:sopare.worker:meta = [{'adapting': 124920, 'token_peaks': [287068, 186861, 199308, 137319, 113162, 124920], 'pos': 24, 'volume': 271, 'token': 'token', 'silence': 3}] DEBUG:sopare.worker:characteristic = 4 {'dfm': 378059, 'peaks': [0, 1, 2, 3, 4, 5, 6, 8], 'df': 32, 'volume': 977, 'fc': 197.5, 'norm': [0.1531105318877866, 0.14708024560636948, 0.16810067633547227, 0.14123896330526972, 0.14287343968811164, 0.13803642298467456,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.074167415929872, 0.07393865645028277, 0.07180089128346273, 0.06989268118130225, 0.07050360528351741, 0.0710751700608871], 'token_peaks': [103655, 72668, 53135, 92482, 231227, 402682]} DEBUG:sopare.worker:meta = [{'adapting': 402682, 'token_peaks': [103655, 72668, 53135, 92482, 231227, 402682], 'pos': 30, 'volume': 977, 'token': 'token', 'silence': 0}] DEBUG:sopare.worker:characteristic = 5 {'dfm': 677189, 'peaks': [0, 1, 2, 3, 4, 5], 'df': 30, 'volume': 519, 'fc': 185.6, 'norm': [0.15504729178760135, 0.14665161443067207, 0.1675580663803426, 0.144095466123701, 0.134476367804888, 0.14080107353350949, 0.12428887354500465,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.07040643555204101, 0.08053777349677273, 0.08986466256740193, 0.082758928503711, 0.07432985101796223], 'token_peaks': [483081, 411364, 238381, 287563, 270260, 214840]} DEBUG:sopare.worker:meta = [{'adapting': 214840, 'token_peaks': [483081, 411364, 238381, 287563, 270260, 214840], 'pos': 36, 'volume': 519, 'token': 'token', 'silence': 0}] DEBUG:sopare.worker:characteristic = 6 {'dfm': 296776, 'peaks': [0, 1, 2, 3, 4, 5, 9, 10], 'df': 22, 'volume': 268, 'fc': 199.0, 'norm': [0.18768642521687587, 0.15649532345780737, 0.1651693709933227, 0.14757270920727344, 0.1391391278719846, 0.13447248824646513, 0.07710111875537978, 0.05243003398897019, 0.07309095909052303, 0.06742103209034224,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.06524997217014662, 0.05887860488815589], 'token_peaks': [222362, 233588, 229979, 167161, 166221, 117834]} DEBUG:sopare.worker:meta = [{'adapting': 117834, 'token_peaks': [222362, 233588, 229979, 167161, 166221, 117834], 'pos': 42, 'volume': 268, 'token': 'token', 'silence': 2}] DEBUG:sopare.worker:characteristic = 7 {'dfm': 40125, 'peaks': [0, 1, 2, 3, 10], 'df': 22, 'volume': 44, 'fc': 232.3, 'norm': [0.16953587471032258, 0.13746520429458997, 0.14974414163154315, 0.1361278802586854, 0.12910152096627134, 0.12116836662217692, 0.11770717543498357,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.06834563151365737, 0.07698832194613343, 0.07828924287043722, 0.08273865184249776, 0.0743201898777455, 0.07127887039588117, 0.0709955998575492, 0.06790861111298417, 0.07756279586128496], 'token_peaks': [64258, 32316, 22492, 17251, 15444, 18849]} DEBUG:sopare.worker:meta = [{'adapting': 18849, 'token_peaks': [64258, 32316, 22492, 17251, 15444, 18849], 'pos': 48, 'volume': 44, 'token': 'token', 'silence': 8}] DEBUG:sopare.worker:characteristic = 8 {'dfm': 16365, 'peaks': [], 'df': 26, 'volume': 52, 'fc': 374.8, 'norm': [0.10724686364744433, 0.11209448794290243, 0.09403441582043093, 0.08529447811776145, 0.08470855175093563, 0.08571309246006878, 0.08267017673922515,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.08308091448175572, 0.08042656840151947, 0.0804766569949194, 0.07979771309263982, 0.07799684607050393], 'token_peaks': [13506, 11398, 27010, 30073, 23789, 21850]} DEBUG:sopare.worker:meta = [{'adapting': 21850, 'token_peaks': [13506, 11398, 27010, 30073, 23789, 21850], 'pos': 54, 'volume': 52, 'token': 'token', 'silence': 14}] DEBUG:sopare.worker:characteristic = 9 {'dfm': 15886, 'peaks': [], 'df': 25, 'volume': 48, 'fc': 377.8, 'norm': [0.11567431474939266, 0.10803047033116361, 0.10904790317044633, 0.10437572121002534, 0.09076571938995953, 0.08722556615946205, 0.09929310104403985,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.08246631326578183, 0.08125210458854731, 0.08547008185077701, 0.0757131291297179, 0.07817586088638735], 'token_peaks': [17052, 14727, 18242, 17973, 19359, 19245]} DEBUG:sopare.worker:meta = [{'adapting': 19245, 'token_peaks': [17052, 14727, 18242, 17973, 19359, 19245], 'pos': 60, 'volume': 48, 'token': 'start analysis', 'silence': 20, 'peaks': [18020, 59187, 149084, 176322, 198786, 206417, 218664, 263590, 322222, 463373, 697530, 590549, 682449,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
13506, 11398, 27010, 30073, 23789, 21850, 17052, 14727, 18242, 17973, 19359, 19245]}, {'adapting': 19245, 'token_peaks': [17052, 14727, 18242, 17973, 19359, 19245], 'pos': 60, 'volume': 48, 'token': 'token', 'silence': 20}] DEBUG:sopare.analyze:removing aan from potential start position 0 bc MARGINAL_VALUE > 0.67920795362 DEBUG:sopare.analyze:removing aan from potential start position 1 bc MARGINAL_VALUE > 0.64134449087 DEBUG:sopare.analyze:removing aan from potential start position 3 bc MARGINAL_VALUE > 0.617133660364 DEBUG:sopare.analyze:removing aan from potential start position 4 bc MARGINAL_VALUE > 0.452715304762 DEBUG:sopare.analyze:removing aan from potential start position 5 bc MARGINAL_VALUE > 0.274205229431 DEBUG:sopare.analyze:removing aan from potential start position 6 bc MARGINAL_VALUE > 0.187766265727 DEBUG:sopare.analyze:removing aan from potential start position 7 bc MARGINAL_VALUE > 0 DEBUG:sopare.analyze:removing aan from potential start position 8 bc MARGINAL_VALUE > 0 DEBUG:sopare.analyze:removing aan from potential start position 9 bc MARGINAL_VALUE > 0 DEBUG:sopare.analyze:removing lampen from potential start position 1 bc MARGINAL_VALUE > 0.605786291153 DEBUG:sopare.analyze:removing lampen from potential start position 2 bc MARGINAL_VALUE > 0.489040708936 DEBUG:sopare.analyze:removing lampen from potential start position 3 bc MARGINAL_VALUE > 0.401867960019 DEBUG:sopare.analyze:removing lampen from potential start position 4 bc MARGINAL_VALUE > 0.337199427062 DEBUG:sopare.analyze:removing lampen from potential start position 5 bc MARGINAL_VALUE > 0.267729979772 DEBUG:sopare.analyze:removing lampen from potential start position 6 bc MARGINAL_VALUE > 0.19493081166 DEBUG:sopare.analyze:removing lampen from potential start position 7 bc MARGINAL_VALUE > 0 DEBUG:sopare.analyze:removing lampen from potential start position 8 bc MARGINAL_VALUE > 0 DEBUG:sopare.analyze:removing lampen from potential start position 9 bc MARGINAL_VALUE > 0 DEBUG:sopare.analyze:****
[({'dfm': 256784, 'peaks': [0, 1, 2, 3, 4, 5, 6, 7, 8, 31, 32], 'df': 21, 'volume': 488, 'fc': 208.3, 'norm': [0.24748985259337808, 0.19697923196415063, 0.1761314842524187, 0.16564330582681053,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.0741963166580081, 0.07039107061372614, 0.07910064049255912, 0.0696974644386571, 0.06998556686247472, 0.06677339912875475, 0.05290257870246406, 0.06052299471687352], 'token_peaks': [18020, 59187, 149084, 176322, 198786, 206417]}, [{'adapting': 206417, 'token_peaks': [18020, 59187, 149084, 176322, 198786, 206417], 'pos': 6, 'volume': 488, 'token': 'token', 'silence': 0}]), ({'dfm': 1080438, 'peaks': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 37, 39, 40, 41, 42], 'df': 37, 'volume': 1468, 'fc': 185.4, 'norm': [0.18862625101780392, 0.16651922341725578, 0.18209453292238723, 0.20219862790041623, 0.19165117417294977, 0.1818776859413073,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.07834124543618894, 0.06764796404513987, 0.06456564987773519, 0.05042740354542106, 0.06486819269188564, 0.053484397538042544], 'token_peaks': [218664, 263590, 322222, 463373, 697530, 590549]}, [{'adapting': 590549, 'token_peaks': [218664, 263590, 322222, 463373, 697530, 590549], 'pos': 12, 'volume': 1468, 'token': 'token', 'silence': 0}]), ({'dfm': 1336807, 'peaks': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 37, 38, 39, 40, 41], 'df': 38, 'volume': 639, 'fc': 205.6, 'norm': [0.18419380846494518, 0.1541841647025054, 0.19131611625405495, 0.20266483341287808, 0.18899637205132147, 0.1992940840242556, 0.16170959225444595, 0.16652135773303914,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.08040759675072447, 0.07964203724066227, 0.06843676819066119, 0.07589014211555282, 0.05920830241633842, 0.05369450300744336, 0.05894261875232369, 0.052368810603330436], 'token_peaks': [682449, 712910, 581495, 530845, 297026, 258813]}, [{'adapting': 258813, 'token_peaks': [682449, 712910, 581495, 530845, 297026, 258813], 'pos': 18, 'volume': 639, 'token': 'token', 'silence': 0}]), ({'dfm': 125066, 'peaks': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 27, 41], 'df': 25, 'volume': 271, 'fc': 205.2, 'norm': [0.17719482163526487, 0.16943697186227125, 0.16524615616689897, 0.16819665659339972, 0.14704891173808068, 0.16237724936352846, 0.1543171379139365,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.06576568136339754, 0.05935504535502074, 0.05656116049371686, 0.06277894858830546, 0.06309620694653208], 'token_peaks': [287068, 186861, 199308, 137319, 113162, 124920]}, [{'adapting': 124920, 'token_peaks': [287068, 186861, 199308, 137319, 113162, 124920], 'pos': 24, 'volume': 271, 'token': 'token', 'silence': 3}]), ({'dfm': 378059, 'peaks': [0, 1, 2, 3, 4, 5, 6, 8], 'df': 32, 'volume': 977, 'fc': 197.5, 'norm': [0.1531105318877866, 0.14708024560636948, 0.16810067633547227, 0.14123896330526972, 0.14287343968811164, 0.13803642298467456,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.07105712025320161, 0.07044337808828786, 0.07643005284760983, 0.07422165984803303, 0.074167415929872, 0.07393865645028277, 0.07180089128346273, 0.06989268118130225, 0.07050360528351741, 0.0710751700608871], 'token_peaks': [103655, 72668, 53135, 92482, 231227, 402682]}, [{'adapting': 402682, 'token_peaks': [103655, 72668, 53135, 92482, 231227, 402682], 'pos': 30, 'volume': 977, 'token': 'token', 'silence': 0}]), ({'dfm': 677189, 'peaks': [0, 1, 2, 3, 4, 5], 'df': 30, 'volume': 519, 'fc': 185.6, 'norm': [0.15504729178760135, 0.14665161443067207, 0.1675580663803426, 0.144095466123701, 0.134476367804888, 0.14080107353350949, 0.12428887354500465, 0.1269487652855652, 0.10113089181844263, 0.12013525985786018,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.07593202106217005, 0.07040643555204101, 0.08053777349677273, 0.08986466256740193, 0.082758928503711, 0.07432985101796223], 'token_peaks': [483081, 411364, 238381, 287563, 270260, 214840]}, [{'adapting': 214840, 'token_peaks': [483081, 411364, 238381, 287563, 270260, 214840], 'pos': 36, 'volume': 519, 'token': 'token', 'silence': 0}]), ({'dfm': 296776, 'peaks': [0, 1, 2, 3, 4, 5, 9, 10], 'df': 22, 'volume': 268, 'fc': 199.0, 'norm': [0.18768642521687587, 0.15649532345780737, 0.1651693709933227, 0.14757270920727344, 0.1391391278719846, 0.13447248824646513,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.07710111875537978, 0.05243003398897019, 0.07309095909052303, 0.06742103209034224, 0.06524997217014662, 0.05887860488815589], 'token_peaks': [222362, 233588, 229979, 167161, 166221, 117834]}, [{'adapting': 117834, 'token_peaks': [222362, 233588, 229979, 167161, 166221, 117834], 'pos': 42, 'volume': 268, 'token': 'token', 'silence': 2}]), ({'dfm': 40125, 'peaks': [0, 1, 2, 3, 10], 'df': 22, 'volume': 44, 'fc': 232.3, 'norm': [0.16953587471032258, 0.13746520429458997, 0.14974414163154315, 0.1361278802586854, 0.12910152096627134, 0.12116836662217692,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.08273865184249776, 0.0743201898777455, 0.07127887039588117, 0.0709955998575492, 0.06790861111298417, 0.07756279586128496], 'token_peaks': [64258, 32316, 22492, 17251, 15444, 18849]}, [{'adapting': 18849, 'token_peaks': [64258, 32316, 22492, 17251, 15444, 18849], 'pos': 48, 'volume': 44, 'token': 'token', 'silence': 8}]), ({'dfm': 16365, 'peaks': [], 'df': 26, 'volume': 52, 'fc': 374.8, 'norm': [0.10724686364744433, 0.11209448794290243, 0.09403441582043093, 0.08529447811776145, 0.08470855175093563, 0.08571309246006878, 0.08267017673922515,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.08308091448175572, 0.08042656840151947, 0.0804766569949194, 0.07979771309263982, 0.07799684607050393], 'token_peaks': [13506, 11398, 27010, 30073, 23789, 21850]}, [{'adapting': 21850, 'token_peaks': [13506, 11398, 27010, 30073, 23789, 21850], 'pos': 54, 'volume': 52, 'token': 'token', 'silence': 14}]), ({'dfm': 15886, 'peaks': [], 'df': 25, 'volume': 48, 'fc': 377.8, 'norm': [0.11567431474939266, 0.10803047033116361, 0.10904790317044633, 0.10437572121002534, 0.09076571938995953, 0.08722556615946205, 0.09929310104403985, 0.0974636344748016,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.0826695805164135, 0.07984965184209274, 0.07023680777566502, 0.08246631326578183, 0.08125210458854731, 0.08547008185077701, 0.0757131291297179, 0.07817586088638735], 'token_peaks': [17052, 14727, 18242, 17973, 19359, 19245]}, [{'adapting': 19245, 'token_peaks': [17052, 14727, 18242, 17973, 19359, 19245], 'pos': 60, 'volume': 48, 'token': 'start analysis', 'silence': 20, 'peaks': [18020, 59187, 149084, 176322, 198786, 206417, 218664, 263590, 322222, 463373, 697530, 590549, 682449, 712910, 581495, 530845, 297026, 258813, 287068, 186861, 199308,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
17251, 15444, 18849, 13506, 11398, 27010, 30073, 23789, 21850, 17052, 14727, 18242, 17973, 19359, 19245]}, {'adapting': 19245, 'token_peaks': [17052, 14727, 18242, 17973, 19359, 19245], 'pos': 60, 'volume': 48, 'token': 'token', 'silence': 20}])]
{u'aan': [[0.7851426832191696, 0.8448606332487484, 0.8169072833434489, 0.6011781129446855, 0.7282910879625174, 0.34468532681858033, 0.3699266428509515, 0.4639563877558011,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
[0.45300787389029856, 0.2875909854461674, 0.34784884166438584], [0.3043293446583236, 0.2806837387094481], [0.29817229414842866]]}
framing_match: [[[0.91585805042642643, 0.9222858165640345, 0.6624128432860632, 2, 8, u'aan'], [0.93559810991562764, 0.9922626665762881, 0.7068814686296334, 2, 8, u'aan'], [0.8855863964644759, 1.0653449805266093, 0.6001659144492182, 2, 8, u'aan']], [[0.96077220529361629, 0.7965224280419378, 0.6089694744177692, 0, 10, u'lampen'], [0.96406994777723509, 0.7913354585273779, 0.5720193218376568, 0, 10, u'lampen'], [0.9266803703918729, 0.8935758040385684, 0.7202684687090045, 0, 10, u'lampen']]]
sorted_best_match: [[0.96406994777723509, 0.7913354585273779, 0.5720193218376568, 0, 10, u'lampen'], [0.96077220529361629, 0.7965224280419378, 0.6089694744177692, 0, 10, u'lampen'], [0.91585805042642643, 0.9222858165640345, 0.6624128432860632, 2, 8, u'aan'], [0.8855863964644759, 1.0653449805266093, 0.6001659144492182, 2, 8, u'aan']]
match_results: [u'lampen', u'lampen', u'lampen', u'lampen', u'lampen', u'lampen', u'lampen', u'lampen', u'lampen', u'lampen']
[u'lampen'] Tschakka! Got my two words...now do some awesome stuff INFO:sopare.processing:stop append mode because of silence INFO:sopare.buffering:stop buffering DEBUG:sopare.worker:characteristic = 0 {'dfm': 7648, 'peaks': [1, 2, 3, 4, 5, 7], 'df': 36, 'volume': 0, 'fc': 183.4, 'norm': [0.11774434726189205, 0.15434745135066458, 0.16816839827022176, 0.17350093663669866, 0.14618738294625594, 0.13467547752262637, 0.11735448671184658,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.08635693329399861, 0.08707555505627554, 0.09642622374704964, 0.08758294494736861, 0.0800310549151561], 'token_peaks': []} DEBUG:sopare.worker:meta = [{'adapting': 0, 'peaks': [10907, 8136, 8171], 'pos': 3, 'volume': 0, 'token': 'start analysis', 'silence': 131}] DEBUG:sopare.analyze:removing aan from potential start position 0 bc MARGINAL_VALUE > 0 DEBUG:sopare.analyze:removing lampen from potential start position 0 bc MARGINAL_VALUE > 0 DEBUG:sopare.analyze:****
[({'dfm': 7648, 'peaks': [1, 2, 3, 4, 5, 7], 'df': 36, 'volume': 0, 'fc': 183.4, 'norm': [0.11774434726189205, 0.15434745135066458, 0.16816839827022176, 0.17350093663669866, 0.14618738294625594,
[[## -= CUT OUT A LOT OF NUMBERS FOR CLARITY =- ##]]
0.08728865309239563, 0.08920844339605598, 0.08635693329399861, 0.08707555505627554, 0.09642622374704964, 0.08758294494736861, 0.0800310549151561], 'token_peaks': []}, [{'adapting': 0, 'peaks': [10907, 8136, 8171], 'pos': 3, 'volume': 0, 'token': 'start analysis', 'silence': 131}])]
{u'aan': [[0.2732126859123079]], u'lampen': [[0.2986424257165124]]}
framing_match: []
sorted_best_match: []
match_results: ['']
Results contain too many empty tokens. 1 / 1 Eliminating results`
When putting the Curl command in my terminal it works just fine.
Maybe I'm missing something?
oh and yes, my init.py is this:
`#!/usr/bin/env python
""" Copyright (C) 2015 - 2017 Martin Kauss (yo@bishoph.org)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """
import subprocess
def run(readable_results, data, rawbuf): if ('lampen' in readable_results): command = ("curl --header 'Content-Type: text/plain' --request POST --data 'ON' http://00.000.000.000:0000/rest/items/wcd001_schakelaar")
print ('Tschakka! Got my two words...now do some awesome stuff')`
Thanks for looking at this.
I can help in terms of SOPARE but not in terms of "my custom plugin curl command is not working and I don't know why". I suggest that you get SOPARE going without custom code. By going I mean it should run well until you get reproducible results. After you reached this goal start step two and throw in your custom plugin code and debug until the plugin code works. It seems to me that you have two loose ends.
It may help if you write a short Python program that runs standalone to test the execution of the curl command and the communication at both ends.
Verbose mode is fine for debugging SOPARE but not to find errors in custom plugins BTW ;)
I can help in terms of SOPARE but not in terms of "my custom plugin curl command is not working and I don't know why". I suggest that you get SOPARE going without custom code. By going I mean it should run well until you get reproducible results. After you reached this goal start step two and throw in your custom plugin code and debug until the plugin code works. It seems to me that you have two loose ends.
It may help if you write a short Python program that runs standalone to test the execution of the curl command and the communication at both ends.
Verbose mode is fine for debugging SOPARE but not to find errors in custom plugins BTW ;)
I know, SOPARE runs fine, without the custom plugin. I'm really not that good in understanding Python tho. I'll see what I can do with writing a Python program. But I'm more the visual kind of guy ;-)
Thanks anyway for your help! I'll post my sollution here, if I find any...
After a lot of trial and error, the following code works (for me) and I would like to share it here in case someone needs it:
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (C) 2015 - 2017 Martin Kauss (yo@bishoph.org) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ import subprocess # Default plugin for output of analysis def run(readable_results, data, rawbuf): if ('lampen' in readable_results): subprocess.call("curl -H 'Content-Type: text/plain' -X POST -d 'OFF' http://IPADRESS:PORT/rest/items/wcd001_schakelaar", shell=True)`
Hi,
Is it possible to execute commands from the python script? As an example:
Or any other shell action for that matter