news speaker

Share and discuss your flows and ideas with other users.

Moderator: Martin

Post Reply
thomas
Posts: 3
Joined: 15 Apr 2018 15:30

news speaker

Post by thomas » 16 Apr 2018 21:05

This will speak the news.

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<data version="1.34.0">
<condition type="expression">
<useDefaultName>true</useDefaultName>
<name>Expression: article['headlines-only']=='1'</name>
<expression>article['headlines-only']=='1'</expression>
</condition>
<condition type="expression">
<useDefaultName>true</useDefaultName>
<name>Expression: article['sourceLanguage']=='de'</name>
<expression>article['sourceLanguage']=='de'</expression>
</condition>
<condition type="expression">
<useDefaultName>false</useDefaultName>
<name>for web results news</name>
<expression>if (article['id']==4)
{ return false; }
article['id']=(article['id'] + 1);
article['title'] = resultJson['articles'][{article['id']}]['title'];
article['description'] = resultJson['articles'][{article['id']}]['description'];
return true;
</expression>
</condition>
<condition type="expression">
<useDefaultName>false</useDefaultName>
<name>for web source</name>
<expression>article['source']=(article['source'] + 1);
if (article['source']==length(newsSources))
{ return false; }
words=split(newsSources["{article['source']}"], ' ');
article['sourceName']=words[0];
article['sourceSort']=words[1];
article['sourceLanguage']=words[2];
return true;
</expression>
</condition>
<condition type="expression">
<useDefaultName>false</useDefaultName>
<name>Is Announcer on?</name>
<expression>global_say_announce == true</expression>
</condition>
<action type="notification_status_bar">
<useDefaultName>true</useDefaultName>
<name>Benachrichtigung in Statusbar: Tagesnachrichten Globus</name>
<notificationIconType>BUILTIN</notificationIconType>
<notificationIcon>GLOBE</notificationIcon>
<customNotificationIcon></customNotificationIcon>
<title>Tagesnachrichten</title>
<message>Die Tagesnachrichten werden verlesen</message>
<sound>false</sound>
<vibrate>false</vibrate>
<flashLED>false</flashLED>
<flashLEDColor>#ff00ff00</flashLEDColor>
<flashLEDOn>500</flashLEDOn>
<flashLEDOff>500</flashLEDOff>
<flagLocalOnly>false</flagLocalOnly>
<accentColorEnabled>true</accentColorEnabled>
<accentColor>#ff00f7ff</accentColor>
<flagOngoing>true</flagOngoing>
<flagNoClear>false</flagNoClear>
<notificationIDEnabled>false</notificationIDEnabled>
<notificationID>1</notificationID>
<category>MESSAGE</category>
<priority>MAX</priority>
<visibility>PUBLIC</visibility>
<messageBigEnabled>true</messageBigEnabled>
<messageBig>Die Tagesnachrichten werden verlesen</messageBig>
<showProgressbar>false</showProgressbar>
<progressbarIndeterminate>false</progressbarIndeterminate>
<progressbarValue>0</progressbarValue>
<progressbarMaximum>100</progressbarMaximum>
<largeIconEnabled>true</largeIconEnabled>
<largeIcon>file:///storage/emulated/0/IconCache/Newsrepublic.png</largeIcon>
<group></group>
<isGroupSummary>false</isGroupSummary>
<actionRef text="Abbrechen" icon="REMOVE" remove="true">Flows stoppen: say announce news</actionRef>
</action>
<action type="http_request">
<useDefaultName>false</useDefaultName>
<name>Fetch news</name>
<url>https://newsapi.org/v1/articles?source={article['sourceName']}&sortBy={article['sourceSort']}&apiKey={global__app_news['gnews_api']}</url>
<verifyCertificates>true</verifyCertificates>
<basicAuthentication>false</basicAuthentication>
<username></username>
<clientCert>false</clientCert>
<clientCertPath></clientCertPath>
<httpMethod>GET</httpMethod>
<httpContentType>X_WWW_FORM_URLENCODED</httpContentType>
<contentType>text/plain</contentType>
<generalTextData></generalTextData>
<formFieldList>Lastname=XYZ,Firstname=ABC</formFieldList>
<uploadFieldName>upload_field</uploadFieldName>
<uploadFilePath></uploadFilePath>
<timeout>60000</timeout>
<setCustomHTTPHeaders>false</setCustomHTTPHeaders>
<customHTTPHeaders></customHTTPHeaders>
<storeInVariable>true</storeInVariable>
<variable>response</variable>
<path>/storage/emulated/0/Download/testnews.json</path>
<followRedirects>true</followRedirects>
</action>
<action type="stop_flows">
<useDefaultName>true</useDefaultName>
<name>Flows stoppen: say announce news</name>
<includeFlowNamePatternList>say announce news</includeFlowNamePatternList>
<excludeFlowNamePatternList></excludeFlowNamePatternList>
</action>
<action type="message_dialog">
<useDefaultName>true</useDefaultName>
<name>Meldungsdialog: xyz {newsSources[2]}</name>
<title>xyz</title>
<message>{newsSources[2]}</message>
<buttonLabel></buttonLabel>
<timeoutEnabled>false</timeoutEnabled>
<timeout>60000</timeout>
</action>
<action type="sound">
<useDefaultName>false</useDefaultName>
<name>pling</name>
<soundSourceType>FILE</soundSourceType>
<alarmName>Lautlos</alarmName>
<path>/storage/emulated/0/Ringtones/hangouts_message.ogg</path>
<audioStreamType>MUSIC</audioStreamType>
<startPosition></startPosition>
<showStopSoundNotification>false</showStopSoundNotification>
<waitForSoundToFinish>false</waitForSoundToFinish>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="sound">
<useDefaultName>false</useDefaultName>
<name>plong</name>
<soundSourceType>FILE</soundSourceType>
<alarmName>Lautlos</alarmName>
<path>/storage/emulated/0/Ringtones/hangouts_incoming_call.ogg</path>
<audioStreamType>MUSIC</audioStreamType>
<startPosition></startPosition>
<showStopSoundNotification>false</showStopSoundNotification>
<waitForSoundToFinish>false</waitForSoundToFinish>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="sound">
<useDefaultName>false</useDefaultName>
<name>plong w1</name>
<soundSourceType>FILE</soundSourceType>
<alarmName>Lautlos</alarmName>
<path>/storage/emulated/0/Ringtones/hangouts_incoming_call.ogg</path>
<audioStreamType>MUSIC</audioStreamType>
<startPosition></startPosition>
<showStopSoundNotification>false</showStopSoundNotification>
<waitForSoundToFinish>true</waitForSoundToFinish>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="script">
<useDefaultName>false</useDefaultName>
<name>prep web articles</name>
<script>article['id']=-1;</script>
</action>
<action type="script">
<useDefaultName>false</useDefaultName>
<name>prep web sources sources</name>
<script>//newsSources=newList('google-news top en','der-tagesspiegel latest de', 'bild top de', 'die-zeit latest de', 'spiegel-online top de' );
newsSources = newList('focus top de', 'der-tagesspiegel latest de', 'bild top de', 'die-zeit latest de', 'spiegel-online top de', 'handelsblatt latest de', 'wirtschafts-woche latest de');
article = newMap();
log(resultJson);
article['source'] = -1;
article['headlines-only'] = 1;
words=newList();
return true;
</script>
</action>
<action type="script">
<useDefaultName>false</useDefaultName>
<name>prep webResult news 1</name>
<script>resultJson = fromJSON(response);
//article = newMap();
log(resultJson);
//article['id']=0;
return true;
</script>
</action>
<action type="script">
<useDefaultName>true</useDefaultName>
<name>Script: response = global__app_news['articles']["{article['sourceName']}"];</name>
<script>response = global__app_news['articles']["{article['sourceName']}"];</script>
</action>
<action type="speech_output">
<useDefaultName>false</useDefaultName>
<name>Sprachausgabe:
{article['description']} de</name>
<audioStreamType>MUSIC</audioStreamType>
<text>{article['description']}</text>
<locale>de_DE</locale>
<usePitch>true</usePitch>
<pitch>1.0</pitch>
<useSpeechRate>true</useSpeechRate>
<speechRate>1.0</speechRate>
<embeddedSynthesis>false</embeddedSynthesis>
<networkSynthesis>false</networkSynthesis>
<showStopSpeechNotification>false</showStopSpeechNotification>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="speech_output">
<useDefaultName>false</useDefaultName>
<name>Sprachausgabe:
{article['description']} en</name>
<audioStreamType>MUSIC</audioStreamType>
<text>{article['description']}</text>
<locale>en_US</locale>
<usePitch>true</usePitch>
<pitch>1.0</pitch>
<useSpeechRate>true</useSpeechRate>
<speechRate>0.75</speechRate>
<embeddedSynthesis>false</embeddedSynthesis>
<networkSynthesis>false</networkSynthesis>
<showStopSpeechNotification>false</showStopSpeechNotification>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="speech_output">
<useDefaultName>false</useDefaultName>
<name>Sprachausgabe:
{article['title']} de</name>
<audioStreamType>MUSIC</audioStreamType>
<text>{article['title']}</text>
<locale>de_DE</locale>
<usePitch>true</usePitch>
<pitch>1.0</pitch>
<useSpeechRate>true</useSpeechRate>
<speechRate>1.0</speechRate>
<embeddedSynthesis>false</embeddedSynthesis>
<networkSynthesis>false</networkSynthesis>
<showStopSpeechNotification>false</showStopSpeechNotification>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="speech_output">
<useDefaultName>false</useDefaultName>
<name>Sprachausgabe:
{article['title']} en</name>
<audioStreamType>MUSIC</audioStreamType>
<text>{article['title']}</text>
<locale>en_US</locale>
<usePitch>true</usePitch>
<pitch>1.0</pitch>
<useSpeechRate>true</useSpeechRate>
<speechRate>0.75</speechRate>
<embeddedSynthesis>false</embeddedSynthesis>
<networkSynthesis>false</networkSynthesis>
<showStopSpeechNotification>false</showStopSpeechNotification>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="speech_output">
<useDefaultName>true</useDefaultName>
<name>Sprachausgabe: Artikel {article['id']}</name>
<audioStreamType>MUSIC</audioStreamType>
<text>Artikel {article['id']}</text>
<locale>de_DE</locale>
<usePitch>true</usePitch>
<pitch>1.0</pitch>
<useSpeechRate>true</useSpeechRate>
<speechRate>1.0</speechRate>
<embeddedSynthesis>false</embeddedSynthesis>
<networkSynthesis>false</networkSynthesis>
<showStopSpeechNotification>false</showStopSpeechNotification>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="speech_output">
<useDefaultName>true</useDefaultName>
<name>Sprachausgabe: Ende der Tagesnachrichten.</name>
<audioStreamType>MUSIC</audioStreamType>
<text>Ende der Tagesnachrichten.</text>
<locale>de_DE</locale>
<usePitch>true</usePitch>
<pitch>1.0</pitch>
<useSpeechRate>true</useSpeechRate>
<speechRate>1.0</speechRate>
<embeddedSynthesis>false</embeddedSynthesis>
<networkSynthesis>false</networkSynthesis>
<showStopSpeechNotification>false</showStopSpeechNotification>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="speech_output">
<useDefaultName>true</useDefaultName>
<name>Sprachausgabe: Neue Tagesnachrichten:</name>
<audioStreamType>MUSIC</audioStreamType>
<text>Neue Tagesnachrichten:</text>
<locale>de_DE</locale>
<usePitch>true</usePitch>
<pitch>1.0</pitch>
<useSpeechRate>true</useSpeechRate>
<speechRate>1.0</speechRate>
<embeddedSynthesis>false</embeddedSynthesis>
<networkSynthesis>false</networkSynthesis>
<showStopSpeechNotification>false</showStopSpeechNotification>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="speech_output">
<useDefaultName>true</useDefaultName>
<name>Sprachausgabe: {article['sourceName']}</name>
<audioStreamType>MUSIC</audioStreamType>
<text>{article['sourceName']}</text>
<locale>de_DE</locale>
<usePitch>true</usePitch>
<pitch>1.0</pitch>
<useSpeechRate>true</useSpeechRate>
<speechRate>1.0</speechRate>
<embeddedSynthesis>false</embeddedSynthesis>
<networkSynthesis>false</networkSynthesis>
<showStopSpeechNotification>false</showStopSpeechNotification>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<action type="speech_output">
<useDefaultName>true</useDefaultName>
<name>Sprachausgabe: {article['sourceName']} und {article['sourceSort']} und {words[0]} </name>
<audioStreamType>MUSIC</audioStreamType>
<text>{article['sourceName']} und {article['sourceSort']} und {words[0]} </text>
<locale>de_DE</locale>
<usePitch>true</usePitch>
<pitch>1.0</pitch>
<useSpeechRate>true</useSpeechRate>
<speechRate>1.0</speechRate>
<embeddedSynthesis>false</embeddedSynthesis>
<networkSynthesis>false</networkSynthesis>
<showStopSpeechNotification>false</showStopSpeechNotification>
<requestAudioFocus>false</requestAudioFocus>
<audioFocusType>TRANSIENT</audioFocusType>
</action>
<flow type="flow">
<name>say announce news</name>
<group>Announce</group>
<enabled>true</enabled>
<executionPolicy>SKIP</executionPolicy>
<emergencyStopCount>600</emergencyStopCount>
<triggercontainer id="t1" x="-665.0" y="-612.5" />
<actioncontainer id="t2" x="-665.0" y="682.5">pling</actioncontainer>
<actioncontainer id="t3" x="-665.0" y="857.5">plong w1</actioncontainer>
<actioncontainer id="t4" x="-910.0" y="332.5">Sprachausgabe: {article['sourceName']} und {article['sourceSort']} und {words[0]} </actioncontainer>
<conditioncontainer id="t5" x="35.0" y="332.5">Expression: article['sourceLanguage']=='de'</conditioncontainer>
<actioncontainer id="t6" x="35.0" y="542.5">Sprachausgabe:
{article['title']} de</actioncontainer>
<actioncontainer id="t7" x="560.0" y="612.5">Sprachausgabe: Artikel {article['id']}</actioncontainer>
<conditioncontainer id="t8" x="35.0" y="752.5">Expression: article['headlines-only']=='1'</conditioncontainer>
<actioncontainer id="t9" x="35.0" y="927.5">Sprachausgabe:
{article['description']} de</actioncontainer>
<actioncontainer id="t10" x="175.0" y="1452.5">pling</actioncontainer>
<conditioncontainer id="t11" x="315.0" y="752.5">Expression: article['headlines-only']=='1'</conditioncontainer>
<actioncontainer id="t12" x="315.0" y="927.5">Sprachausgabe:
{article['description']} en</actioncontainer>
<actioncontainer id="t13" x="315.0" y="542.5">Sprachausgabe:
{article['title']} en</actioncontainer>
<actioncontainer id="t14" x="-455.0" y="1242.5">Meldungsdialog: xyz {newsSources[2]}</actioncontainer>
<conditioncontainer id="t15" x="35.0" y="-122.5">for web results news</conditioncontainer>
<actioncontainer id="t16" x="-245.0" y="472.5">Sprachausgabe: {article['sourceName']}</actioncontainer>
<actioncontainer id="t17" x="350.0" y="17.5">pling</actioncontainer>
<actioncontainer id="t18" x="595.0" y="17.5">pling</actioncontainer>
<actioncontainer id="t19" x="-245.0" y="192.5">prep webResult news 1</actioncontainer>
<actioncontainer id="t20" x="-245.0" y="-262.5">Fetch news</actioncontainer>
<actioncontainer id="t21" x="-665.0" y="-52.5">prep web sources sources</actioncontainer>
<actioncontainer id="t22" x="-665.0" y="122.5">prep web articles</actioncontainer>
<conditioncontainer id="t23" x="-665.0" y="297.5">for web source</conditioncontainer>
<actioncontainer id="t24" x="-665.0" y="507.5">Sprachausgabe: Ende der Tagesnachrichten.</actioncontainer>
<conditioncontainer id="t25" x="-665.0" y="-472.5">Is Announcer on?</conditioncontainer>
<actioncontainer id="t26" x="-455.0" y="-262.5">plong</actioncontainer>
<actioncontainer id="t27" x="-455.0" y="192.5">Script: response = global__app_news['articles']["{article['sourceName']}"];</actioncontainer>
<actioncontainer id="t28" x="-945.0" y="-157.5">Benachrichtigung in Statusbar: Tagesnachrichten Globus</actioncontainer>
<actioncontainer id="t29" x="-665.0" y="1032.5">pling</actioncontainer>
<actioncontainer id="t30" x="-665.0" y="-262.5">Sprachausgabe: Neue Tagesnachrichten:</actioncontainer>
<connection from="t1" to="t25" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t2" to="t3" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t3" to="t29" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t5" to="t6" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t5" to="t13" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t6" to="t8" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t8" to="t9" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t8" to="t10" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t8" to="t15" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t9" to="t10" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t11" to="t12" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t11" to="t10" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t11" to="t15" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t12" to="t10" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t13" to="t11" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t15" to="t22" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t15" to="t17" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t15" to="t5" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t16" to="t15" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t17" to="t18" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t19" to="t16" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t21" to="t22" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t22" to="t23" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t23" to="t24" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t23" to="t27" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t24" to="t2" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t25" to="t30" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t27" to="t19" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t30" to="t26" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t30" to="t21" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t30" to="t28" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
</flow>
</data>

Post Reply