Skip to content

Instantly share code, notes, and snippets.

@explorigin
Created January 25, 2021 17:29
Show Gist options
  • Save explorigin/bdc4801f366c947dc452cbeefc73f17a to your computer and use it in GitHub Desktop.
Save explorigin/bdc4801f366c947dc452cbeefc73f17a to your computer and use it in GitHub Desktop.
Search Youtube
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="9|t#QO2zA=*4IWswdkeK">song_name</variable>
<variable id="2-q?U_#:3)N]Gp8T#.5n">song_data</variable>
<variable id="5OLs)=knY`zB7E;2)e1)">result</variable>
<variable id="_q8cHm$C0!{jYnL-7fVE">song_dict</variable>
<variable id=",fR2ZFq6oHdtdqkKlbAr">utterance_remainder</variable>
</variables>
<block type="adaptv2" id="xQ~9n8Mu[}wCgNCb%634" x="47" y="-200">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation>
<value name="PVALUE1">
<shadow type="multi_text" id="f0n8dcS#/78NbM_]9^NQ">
<field name="NAME"/>
</shadow>
<block type="multi_text" id="2~zTi6,}ngcNbzEoiN@L">
<field name="NAME">Search Youtube for</field>
</block>
</value>
<value name="PVALUE2">
<shadow type="multi_text" id="TKM%Gb|*fPO5VL9ygm*+">
<field name="NAME"/>
</shadow>
<block type="multi_text" id="D@]pzJnZ_=qx2K{o-_@W">
<field name="NAME">Play</field>
</block>
</value>
<statement name="CODE">
<block type="variables_set" id="[Y-wV!N^loauWe}nqm7j">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
<value name="VALUE">
<block type="variables_get" id="Jl%IFsgPJ,(*Uz-)a+Aj">
<field name="VAR" id=",fR2ZFq6oHdtdqkKlbAr">utterance_remainder</field>
</block>
</value>
<next>
<block type="variables_set" id="RV#?R=)xy|i7h`}OAf@V">
<field name="VAR" id="2-q?U_#:3)N]Gp8T#.5n">song_data</field>
<value name="VALUE">
<block type="procedures_callreturn" id="CZJ)r5!kLTE;!0x-%MK9">
<mutation name="Get saved song">
<arg name="song_name"/>
</mutation>
<value name="ARG0">
<block type="variables_get" id="*.|l5mkV^h*GyHQZ=kWY">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
</block>
</value>
</block>
</value>
<next>
<block type="controls_if_try" id="TD+E^gFIGu[8Dhusv8~n">
<mutation xmlns="http://www.w3.org/1999/xhtml" else="1"></mutation>
<value name="IF0">
<block type="logic_compare" id="46]4TsZD7HN{dt29GeUo">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id=")zF*=G/blk$@BMP:VPN!">
<field name="VAR" id="2-q?U_#:3)N]Gp8T#.5n">song_data</field>
</block>
</value>
<value name="B">
<block type="logic_null" id="ZjrYec!Do#9MqI*R_`8!"/>
</value>
</block>
</value>
<statement name="DO0">
<block type="speak" id="ai042e:4`gdxe65f-N*w">
<value name="MESSAGE">
<shadow type="text" id="i0FJfp|2|C7-l53GL^VP">
<field name="TEXT"/>
</shadow>
<block type="multi_text" id="G/S./jA5]K!cm^8rs0oV">
<field name="NAME">Searching youtube for</field>
<value name="NAME">
<block type="variables_get" id="#BD?m1#,Ipbtp!AB+k4%">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
</block>
</value>
</block>
</value>
</block>
</statement>
<statement name="ELSE">
<block type="speak_random" id="=-60]ON-O2Z+xK@RcL(C">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation>
<value name="MESSAGE1">
<shadow type="multi_text" id="[?#?67DUwPW;|INi)E:k">
<field name="NAME"/>
</shadow>
<block type="multi_text" id="Y)~B;+PIE`r7WYnmgmoT">
<field name="NAME">Oh, I remember this song!</field>
</block>
</value>
<value name="MESSAGE2">
<shadow type="multi_text" id=";~MvQ@g:_Ftf=~?};y{z">
<field name="NAME"/>
</shadow>
<block type="multi_text" id="r@8{M7_:d+D9OSvxV)(d">
<field name="NAME">Got it!</field>
</block>
</value>
</block>
</statement>
<next>
<block type="print_chat" id="jG]z#w~h8Gt5(3oE!O*b">
<value name="text">
<shadow type="text">
<field name="TEXT"/>
</shadow>
<block type="text" id="^:ZR7onVeA$/wnw5`O02">
<field name="TEXT">Done</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="variables_set" id="n!BRyfz$NgVV42^|5h|A" disabled="true" x="291" y="174">
<field name="VAR" id="5OLs)=knY`zB7E;2)e1)">result</field>
<value name="VALUE">
<block type="search_youtube" id="hB?7jVSmuMQ(FnH~:ed]">
<value name="NAME">
<shadow type="text" id="b_YD?i1WtbuzZT$U[W;_">
<field name="TEXT"/>
</shadow>
<block type="variables_get" id="UDd{p3?W;kX*tfuMis-:">
<field name="VAR" id=",fR2ZFq6oHdtdqkKlbAr">utterance_remainder</field>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="CKjbgiTJc5H:l.xQ*vi0">
<field name="VAR" id="5OLs)=knY`zB7E;2)e1)">result</field>
<value name="VALUE">
<block type="dict_get" id="-x5DA.tkJm+nSn.kc5|R">
<value name="ITEM">
<shadow type="text" id="O8SoUTGXH$dwS1@)-s#F">
<field name="TEXT"/>
</shadow>
<block type="text" id="|;U1HqFSN5P$1RjnF7O:">
<field name="TEXT">videos</field>
</block>
</value>
<value name="DICT">
<block type="variables_get" id="7crf[AvpLcE8W^K?04gt">
<field name="VAR" id="5OLs)=knY`zB7E;2)e1)">result</field>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="weLZ$rU;$5rclO|(6G:1">
<field name="VAR" id="2-q?U_#:3)N]Gp8T#.5n">song_data</field>
<value name="VALUE">
<block type="lists_getIndex" id="`LUQ5PmuX?q+ut~+pI/h">
<mutation statement="false" at="false"/>
<field name="MODE">GET</field>
<field name="WHERE">FIRST</field>
<value name="VALUE">
<block type="variables_get" id="pD+tP$Zq7|qu*wfl-nf-">
<field name="VAR" id="5OLs)=knY`zB7E;2)e1)">result</field>
</block>
</value>
</block>
</value>
<next>
<block type="procedures_callnoreturn" id="W@vSU{QmbY5q8ods,n1}">
<mutation name="Save song as">
<arg name="song_name"/>
<arg name="song_data"/>
</mutation>
<value name="ARG0">
<block type="variables_get" id="sK%nA7m-n,i93Iww_FgF">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
</block>
</value>
<value name="ARG1">
<block type="variables_get" id="aE5=evqRmiJCAS:OObo?">
<field name="VAR" id="2-q?U_#:3)N]Gp8T#.5n">song_data</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
<block type="variables_get" id="nVV6QBj7yNeb8pg8)u^s" disabled="true" x="664" y="314">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
</block>
<block type="on_keyphrase" id="x]?vF2h.~hfS!W%`Q3=t" x="41" y="409">
<value name="keyphrase">
<shadow type="text" id="JEp^j3hrE2?FDz1Tds+C">
<field name="TEXT"/>
</shadow>
<block type="text" id="Iuy)F=Q1-7C1[9jWZmBk">
<field name="TEXT">Forget this song</field>
</block>
</value>
<statement name="CODE">
<block type="print_chat" id="||juu*%GBa`CVo@Vir}-">
<value name="text">
<shadow type="text" id="hFaj47nY[OV0=F49ND^`">
<field name="TEXT"/>
</shadow>
<block type="variables_get" id="eP8sZsq`nkA;]o=xF5{a">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
</block>
</value>
<next>
<block type="controls_if_try" id="G%_)(KJZV!lnJ_Kd!H|Z">
<value name="IF0">
<block type="logic_compare" id="s`ov|FPz1iZzmbKmg_v0">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id="numz0gC1wZcQ6}yJC7%l">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
</block>
</value>
<value name="B">
<block type="multi_text" id="@s`X0K]4O-ge*_VV(]g$">
<field name="NAME"/>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="v,p*@3%7]{Qp5fUm6}L8">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
<value name="VALUE">
<block type="get_response" id="e2I1kOM!H63+r2RBBJth">
<value name="TEXT">
<shadow type="text">
<field name="TEXT"/>
</shadow>
<block type="text" id="zYO[@O5lFIkxZ8mX}07)">
<field name="TEXT">Which song again?</field>
</block>
</value>
</block>
</value>
</block>
</statement>
<next>
<block type="procedures_callnoreturn" id="gG-BMZtGize6o{E!!Af[">
<mutation name="Save song as">
<arg name="song_name"/>
<arg name="song_data"/>
</mutation>
<value name="ARG0">
<block type="variables_get" id="mv)9w?oK%(;qkd}3Qn09">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
</block>
</value>
<value name="ARG1">
<block type="logic_null" id="2bNb-u}UuKH^pj5T}=$1"/>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="logic_null" id="uRpX.6Y:r3vQarpgR^$." disabled="true" x="688" y="549"/>
<block type="adaptv2" id="ID5-ngj:%?d6k*!7D_B^" x="39" y="687">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
<value name="PVALUE1">
<shadow type="multi_text" id="4XP+V|~W5Ha8v}U*E2jc">
<field name="NAME"/>
</shadow>
<block type="multi_text" id="XVEbe_z-2OAJs0GlIryS">
<field name="NAME">Remember this song</field>
</block>
</value>
<statement name="CODE">
<block type="procedures_callnoreturn" id="bqjt:XRvZm6OGG%[Y7=:">
<mutation name="Save song as">
<arg name="song_name"/>
<arg name="song_data"/>
</mutation>
<value name="ARG0">
<block type="variables_get" id="XTb;;l*MF8#.@.R}B@p-">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
</block>
</value>
<value name="ARG1">
<block type="variables_get" id="LG:ekko(]He;i_)?qGg2">
<field name="VAR" id="2-q?U_#:3)N]Gp8T#.5n">song_data</field>
</block>
</value>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" id="DkMVzSFpmM/~u9_qHX2," x="34" y="855">
<mutation>
<arg name="song_name" varid="9|t#QO2zA=*4IWswdkeK"/>
<arg name="song_data" varid="2-q?U_#:3)N]Gp8T#.5n"/>
</mutation>
<field name="NAME">Save song as</field>
<comment pinned="false" h="80" w="160">Describe this function...</comment>
<statement name="STACK">
<block type="variables_set" id="gQ2XZ)!Q,niRZJeDH2s@">
<field name="VAR" id="_q8cHm$C0!{jYnL-7fVE">song_dict</field>
<value name="VALUE">
<block type="load_data" id="^yh?N0tuHv~,Vz5k-}0F">
<value name="NAME">
<shadow type="text" id="J-|GPRXf}SF)knt.O{eJ">
<field name="TEXT"/>
</shadow>
<block type="text" id="8gZ1c#Zus29CVd|d|iYN">
<field name="TEXT">songs</field>
</block>
</value>
</block>
</value>
<next>
<block type="set_key" id="K~UM%^mqk[=E*f=owN`m">
<value name="key">
<shadow type="text" id="Som%PKYLd8v?RHyatT;{">
<field name="TEXT"/>
</shadow>
<block type="variables_get" id="6kAUUo%dH%QG_{(einzL">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
</block>
</value>
<value name="dict">
<block type="variables_get" id="XIl/w7Ex|AfZ+8L_n#1;">
<field name="VAR" id="_q8cHm$C0!{jYnL-7fVE">song_dict</field>
</block>
</value>
<value name="val">
<shadow type="text" id="42TL_v4h#}v)UOr;HPb{">
<field name="TEXT"/>
</shadow>
<block type="variables_get" id="1*,E955w.:U^E1RaIEgx">
<field name="VAR" id="2-q?U_#:3)N]Gp8T#.5n">song_data</field>
</block>
</value>
<next>
<block type="save_data" id="cu:8FC4~,mbJXiR-Htng">
<value name="data">
<block type="variables_get" id="=}oOOFfa$Zc:0uJ3%~x,">
<field name="VAR" id="_q8cHm$C0!{jYnL-7fVE">song_dict</field>
</block>
</value>
<value name="NAME">
<shadow type="text">
<field name="TEXT"/>
</shadow>
<block type="text" id="jCxz/^_ED@VOXyF6}dp)">
<field name="TEXT">songs</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defreturn" id="bTyhB:),QMNuyLG1*1xu" x="54" y="1111">
<mutation>
<arg name="song_name" varid="9|t#QO2zA=*4IWswdkeK"/>
</mutation>
<field name="NAME">Get saved song</field>
<comment pinned="false" h="80" w="160">Describe this function...</comment>
<statement name="STACK">
<block type="variables_set" id="+u^y+}txzM/bUU1Bj=81">
<field name="VAR" id="_q8cHm$C0!{jYnL-7fVE">song_dict</field>
<value name="VALUE">
<block type="load_data" id="ek[gbK8;Ey6*`La@Lf~x">
<value name="NAME">
<shadow type="text" id="%|LkV`i[LNVwzDy,*Hg}">
<field name="TEXT"/>
</shadow>
<block type="text" id="/W}m6DUA9F1V0#lK=p{H">
<field name="TEXT">songs</field>
</block>
</value>
</block>
</value>
<next>
<block type="print_chat" id="/%S36H%MJ71!4Qbmh;xZ">
<value name="text">
<shadow type="text" id="U2W_-:Ft,;3}Lb2*[p{Q">
<field name="TEXT"/>
</shadow>
<block type="variables_get" id=".bbb+Hsk6b!EYSGGINzL">
<field name="VAR" id="_q8cHm$C0!{jYnL-7fVE">song_dict</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<value name="RETURN">
<block type="dict_get" id="|]b`l5_HgfZSse}%!#b)">
<value name="ITEM">
<shadow type="text" id=":PPclp,g?Ca7={pOyOo=">
<field name="TEXT"/>
</shadow>
<block type="variables_get" id="}ERk}eDGB%OSR@`gOqc,">
<field name="VAR" id="9|t#QO2zA=*4IWswdkeK">song_name</field>
</block>
</value>
<value name="DICT">
<block type="variables_get" id="a+Cb(0G}CgbOhw_R)ko%">
<field name="VAR" id="_q8cHm$C0!{jYnL-7fVE">song_dict</field>
</block>
</value>
</block>
</value>
</block>
</xml>
@explorigin
Copy link
Author

The idea here is to be able to search youtube for audio. Remember and prioritize previously played songs. It's still a WIP but it should work at some level. But currently doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment