diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3cce93a490ca398e635e41792b02bba6c8833134..5c1481d655f2f01397a3da6e098bfbf999be42ce 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,19 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="BookmarkManager"> - <bookmark url="file://$PROJECT_DIR$/guru.py" line="82" mnemonic="8" /> + <bookmark url="file://$PROJECT_DIR$/guru.py" line="86" mnemonic="8" /> </component> <component name="ChangeListManager"> <list default="true" id="c58ca86a-4167-4474-accb-41439a535514" name="Default" comment=""> + <change beforePath="" afterPath="$PROJECT_DIR$/modules/communication/redis/redisadapter.py" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change beforePath="$PROJECT_DIR$/aura.py" afterPath="$PROJECT_DIR$/aura.py" /> <change beforePath="$PROJECT_DIR$/guru.py" afterPath="$PROJECT_DIR$/guru.py" /> - <change beforePath="$PROJECT_DIR$/libraries/base/calendar.py" afterPath="$PROJECT_DIR$/libraries/base/calendar.py" /> - <change beforePath="$PROJECT_DIR$/libraries/database/broadcasts.py" afterPath="$PROJECT_DIR$/libraries/database/broadcasts.py" /> - <change beforePath="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapCommunicator.py" afterPath="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapCommunicator.py" /> + <change beforePath="$PROJECT_DIR$/libraries/reporting/messenger.py" afterPath="$PROJECT_DIR$/libraries/reporting/messenger.py" /> + <change beforePath="$PROJECT_DIR$/libraries/reporting/statestore.py" afterPath="$PROJECT_DIR$/libraries/reporting/statestore.py" /> + <change beforePath="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapClient.py" afterPath="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapClient.py" /> <change beforePath="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapInitThread.py" afterPath="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapInitThread.py" /> - <change beforePath="$PROJECT_DIR$/modules/communication/zmq/zmqadapter.py" afterPath="$PROJECT_DIR$/modules/communication/zmq/zmqadapter.py" /> <change beforePath="$PROJECT_DIR$/modules/controller/controller.py" afterPath="$PROJECT_DIR$/modules/controller/controller.py" /> + <change beforePath="$PROJECT_DIR$/modules/liquidsoap/fallback.liq" afterPath="$PROJECT_DIR$/modules/liquidsoap/fallback.liq" /> <change beforePath="$PROJECT_DIR$/modules/liquidsoap/simplestmixer.log" afterPath="$PROJECT_DIR$/modules/liquidsoap/simplestmixer.log" /> <change beforePath="$PROJECT_DIR$/modules/scheduling/scheduler.py" afterPath="$PROJECT_DIR$/modules/scheduling/scheduler.py" /> <change beforePath="$PROJECT_DIR$/modules/tools/padavan.py" afterPath="$PROJECT_DIR$/modules/tools/padavan.py" /> @@ -27,43 +28,53 @@ </component> <component name="FileEditorManager"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> - <file leaf-file-name="guru.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/guru.py"> + <file leaf-file-name="padavan.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/modules/tools/padavan.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="232"> + <caret line="86" column="45" lean-forward="false" selection-start-line="86" selection-start-column="45" selection-end-line="86" selection-end-column="45" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="redisadapter.py" pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/modules/communication/redis/redisadapter.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1411"> - <caret line="83" column="0" lean-forward="false" selection-start-line="83" selection-start-column="0" selection-end-line="83" selection-end-column="0" /> + <state relative-caret-position="-425"> + <caret line="68" column="17" lean-forward="false" selection-start-line="68" selection-start-column="17" selection-end-line="68" selection-end-column="17" /> <folding> - <element signature="e#34#45#0" expanded="true" /> + <element signature="e#0#16#0" expanded="true" /> </folding> </state> </provider> </entry> </file> - <file leaf-file-name="broadcasts.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/libraries/database/broadcasts.py"> + <file leaf-file-name="LiquidSoapClient.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapClient.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="-661"> - <caret line="139" column="24" lean-forward="false" selection-start-line="139" selection-start-column="24" selection-end-line="139" selection-end-column="24" /> + <state relative-caret-position="317"> + <caret line="136" column="56" lean-forward="false" selection-start-line="136" selection-start-column="56" selection-end-line="136" selection-end-column="56" /> <folding /> </state> </provider> </entry> </file> - <file leaf-file-name="calendar.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/libraries/base/calendar.py"> + <file leaf-file-name="simplestmixer.liq" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/modules/liquidsoap/simplestmixer.liq"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="722"> - <caret line="207" column="45" lean-forward="false" selection-start-line="207" selection-start-column="45" selection-end-line="207" selection-end-column="45" /> + <state relative-caret-position="884"> + <caret line="52" column="26" lean-forward="false" selection-start-line="52" selection-start-column="26" selection-end-line="52" selection-end-column="26" /> <folding /> </state> </provider> </entry> </file> - <file leaf-file-name="LiquidSoapClient.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapClient.py"> + <file leaf-file-name="fallback.liq" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/modules/liquidsoap/fallback.liq"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="249"> - <caret line="132" column="56" lean-forward="false" selection-start-line="132" selection-start-column="56" selection-end-line="132" selection-end-column="56" /> + <state relative-caret-position="239"> + <caret line="79" column="35" lean-forward="false" selection-start-line="79" selection-start-column="35" selection-end-line="79" selection-end-column="35" /> <folding /> </state> </provider> @@ -72,28 +83,28 @@ <file leaf-file-name="LiquidSoapCommunicator.py" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapCommunicator.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="-2454"> - <caret line="135" column="30" lean-forward="false" selection-start-line="135" selection-start-column="29" selection-end-line="135" selection-end-column="30" /> + <state relative-caret-position="238"> + <caret line="39" column="26" lean-forward="false" selection-start-line="39" selection-start-column="26" selection-end-line="39" selection-end-column="26" /> <folding /> </state> </provider> </entry> </file> - <file leaf-file-name="scheduler.py" pinned="false" current-in-tab="true"> - <entry file="file://$PROJECT_DIR$/modules/scheduling/scheduler.py"> + <file leaf-file-name="LiquidSoapInitThread.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapInitThread.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="266"> - <caret line="180" column="17" lean-forward="false" selection-start-line="180" selection-start-column="17" selection-end-line="180" selection-end-column="17" /> + <state relative-caret-position="317"> + <caret line="30" column="12" lean-forward="false" selection-start-line="30" selection-start-column="12" selection-end-line="30" selection-end-column="12" /> <folding /> </state> </provider> </entry> </file> - <file leaf-file-name="padavan.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/modules/tools/padavan.py"> + <file leaf-file-name="scheduler.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/modules/scheduling/scheduler.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="121"> - <caret line="78" column="0" lean-forward="false" selection-start-line="78" selection-start-column="0" selection-end-line="78" selection-end-column="0" /> + <state relative-caret-position="147"> + <caret line="175" column="13" lean-forward="false" selection-start-line="175" selection-start-column="8" selection-end-line="175" selection-end-column="13" /> <folding /> </state> </provider> @@ -102,9 +113,11 @@ <file leaf-file-name="messenger.py" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/libraries/reporting/messenger.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1081"> - <caret line="255" column="98" lean-forward="false" selection-start-line="255" selection-start-column="98" selection-end-line="255" selection-end-column="98" /> - <folding /> + <state relative-caret-position="102"> + <caret line="15" column="0" lean-forward="false" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" /> + <folding> + <element signature="e#24#35#0" expanded="true" /> + </folding> </state> </provider> </entry> @@ -112,19 +125,11 @@ <file leaf-file-name="controller.py" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/modules/controller/controller.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="309"> - <caret line="57" column="52" lean-forward="false" selection-start-line="57" selection-start-column="52" selection-end-line="57" selection-end-column="52" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="aura.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/aura.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="392"> - <caret line="32" column="35" lean-forward="false" selection-start-line="32" selection-start-column="35" selection-end-line="32" selection-end-column="35" /> - <folding /> + <state relative-caret-position="266"> + <caret line="124" column="94" lean-forward="false" selection-start-line="124" selection-start-column="94" selection-end-line="124" selection-end-column="94" /> + <folding> + <element signature="e#43#56#0" expanded="true" /> + </folding> </state> </provider> </entry> @@ -140,19 +145,6 @@ </component> <component name="FindInProjectRecents"> <findStrings> - <find>json</find> - <find>self.jsonstr</find> - <find>programme</find> - <find>fetch_new_programme</find> - <find>ppr</find> - <find>acs</find> - <find>get_act</find> - <find>stori</find> - <find>st</find> - <find>client wa</find> - <find>self.schedule_e</find> - <find>get_calendar</find> - <find>get_calen</find> <find>fetched_schedule_data</find> <find>get_act_programme_as_json</find> <find>cannot</find> @@ -169,7 +161,20 @@ <find>LiquidSoapClient</find> <find>closed</find> <find>LiquidSoapCom</find> + <find>RedisS</find> + <find>player_startup</find> + <find>type</find> + <find>pub</find> + <find>startup</find> + <find>liqu</find> + <find>fet</find> + <find>config</find> + <find>pop</find> + <find>reped</find> + <find>i am</find> <find>print</find> + <find>reload_pro</find> + <find>ZMQ</find> </findStrings> <replaceStrings> <replace>"</replace> @@ -184,7 +189,6 @@ <component name="IdeDocumentHistory"> <option name="CHANGED_PATHS"> <list> - <option value="$PROJECT_DIR$/modules/communication/scheduling/scheduler.py" /> <option value="$PROJECT_DIR$/libraries/base/schedulerconfig.py" /> <option value="$PROJECT_DIR$/modules/communication/scheduling/Scheduler.py" /> <option value="$PROJECT_DIR$/modules/scheduling/Scheduler.py" /> @@ -210,31 +214,32 @@ <option value="$PROJECT_DIR$/configuration/aura.ini" /> <option value="$PROJECT_DIR$/configuration/scheduler.xml" /> <option value="$PROJECT_DIR$/libraries/exceptions/auraexceptions" /> - <option value="$PROJECT_DIR$/libraries/reporting/statestore.py" /> <option value="$PROJECT_DIR$/libraries/database/database.py" /> <option value="$PROJECT_DIR$/libraries/exceptions/auraexceptions.py" /> <option value="$PROJECT_DIR$/modules/communication/liquidsoap/InitThread.py" /> - <option value="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapClient.py" /> - <option value="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapInitThread.py" /> <option value="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapPlayerClient.py" /> <option value="$PROJECT_DIR$/modules/liquidsoap/serversettings.liq" /> <option value="$PROJECT_DIR$/modules/liquidsoap/helpers/nextfrompool.py" /> <option value="$PROJECT_DIR$/modules/liquidsoap/helpers/nextfromfallback.py" /> <option value="$PROJECT_DIR$/modules/liquidsoap/helpers/message.py" /> <option value="$PROJECT_DIR$/modules/liquidsoap/settings.liq" /> - <option value="$PROJECT_DIR$/modules/liquidsoap/fallback.liq" /> - <option value="$PROJECT_DIR$/libraries/reporting/messenger.py" /> <option value="$PROJECT_DIR$/modules/liquidsoap/serverfunctions.liq" /> <option value="$PROJECT_DIR$/modules/liquidsoap/simplestmixer.liq" /> - <option value="$PROJECT_DIR$/modules/tools/padavan.py" /> <option value="$PROJECT_DIR$/modules/communication/zmq/zmqadapter.py" /> - <option value="$PROJECT_DIR$/guru.py" /> - <option value="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapCommunicator.py" /> <option value="$PROJECT_DIR$/libraries/base/calendar.py" /> <option value="$PROJECT_DIR$/libraries/database/broadcasts.py" /> - <option value="$PROJECT_DIR$/modules/controller/controller.py" /> + <option value="$PROJECT_DIR$/guru.py" /> + <option value="$PROJECT_DIR$/libraries/reporting/statestore.py" /> + <option value="$PROJECT_DIR$/libraries/reporting/messenger.py" /> <option value="$PROJECT_DIR$/aura.py" /> + <option value="$PROJECT_DIR$/modules/communication/redis/redisadapter.py" /> + <option value="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapInitThread.py" /> + <option value="$PROJECT_DIR$/modules/liquidsoap/fallback.liq" /> + <option value="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapClient.py" /> + <option value="$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapCommunicator.py" /> <option value="$PROJECT_DIR$/modules/scheduling/scheduler.py" /> + <option value="$PROJECT_DIR$/modules/controller/controller.py" /> + <option value="$PROJECT_DIR$/modules/tools/padavan.py" /> </list> </option> </component> @@ -322,6 +327,12 @@ <item name="libraries" type="462c0819:PsiDirectoryNode" /> <item name="reporting" type="462c0819:PsiDirectoryNode" /> </path> + <path> + <item name="aura" type="b2602c69:ProjectViewProjectNode" /> + <item name="aura" type="462c0819:PsiDirectoryNode" /> + <item name="libraries" type="462c0819:PsiDirectoryNode" /> + <item name="security" type="462c0819:PsiDirectoryNode" /> + </path> <path> <item name="aura" type="b2602c69:ProjectViewProjectNode" /> <item name="aura" type="462c0819:PsiDirectoryNode" /> @@ -338,7 +349,14 @@ <item name="aura" type="462c0819:PsiDirectoryNode" /> <item name="modules" type="462c0819:PsiDirectoryNode" /> <item name="communication" type="462c0819:PsiDirectoryNode" /> - <item name="liquidsoap" type="462c0819:PsiDirectoryNode" /> + <item name="redis" type="462c0819:PsiDirectoryNode" /> + </path> + <path> + <item name="aura" type="b2602c69:ProjectViewProjectNode" /> + <item name="aura" type="462c0819:PsiDirectoryNode" /> + <item name="modules" type="462c0819:PsiDirectoryNode" /> + <item name="communication" type="462c0819:PsiDirectoryNode" /> + <item name="zmq" type="462c0819:PsiDirectoryNode" /> </path> <path> <item name="aura" type="b2602c69:ProjectViewProjectNode" /> @@ -369,8 +387,8 @@ <select /> </subPane> </pane> - <pane id="Scope" /> <pane id="Scratches" /> + <pane id="Scope" /> </panes> </component> <component name="PropertiesComponent"> @@ -505,18 +523,19 @@ </component> <component name="ToolWindowManager"> <frame x="645" y="31" width="1926" height="1052" extended-state="6" /> + <editor active="true" /> <layout> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.16692996" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.46312365" sideWeight="0.5018431" order="13" side_tool="true" content_ui="tabs" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.43275487" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> - <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.43275487" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32936078" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" /> + <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.43275487" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" /> - <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.46312365" sideWeight="0.49815693" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> + <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.46312365" sideWeight="0.49815693" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Debug Logs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" /> @@ -570,20 +589,6 @@ <watches-manager /> </component> <component name="editorHistoryManager"> - <entry file="file://$PROJECT_DIR$/libraries/base/schedulerconfig.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="119"> - <caret line="11" column="32" lean-forward="true" selection-start-line="11" selection-start-column="32" selection-end-line="11" selection-end-column="32" /> - </state> - </provider> - </entry> - <entry file="file:///usr/local/lib/python3.5/dist-packages/flask_sqlalchemy/__init__.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="422"> - <caret line="1021" column="11" lean-forward="true" selection-start-line="1021" selection-start-column="11" selection-end-line="1021" selection-end-column="11" /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/modules/communication/zmq/zmqworker.py" /> <entry file="file://$PROJECT_DIR$/modules/scheduling/programme.py" /> <entry file="file://$PROJECT_DIR$/modules/liquidsoap/library.liq"> @@ -708,13 +713,6 @@ </provider> </entry> <entry file="file://$PROJECT_DIR$/modules/liquidsoap/helpers/D" /> - <entry file="file://$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapInitThread.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="51"> - <caret line="6" column="45" lean-forward="false" selection-start-line="6" selection-start-column="45" selection-end-line="6" selection-end-column="45" /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/modules/liquidsoap/__init__.py"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="17"> @@ -758,13 +756,6 @@ </provider> </entry> <entry file="file://$PROJECT_DIR$/modules/liquidsoap/helpers/nextfromfallback.py" /> - <entry file="file://$PROJECT_DIR$/libraries/reporting/statestore.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="272"> - <caret line="16" column="30" lean-forward="false" selection-start-line="16" selection-start-column="30" selection-end-line="16" selection-end-column="30" /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/modules/liquidsoap/readini.liq"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="272"> @@ -783,15 +774,6 @@ <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="323"> <caret line="19" column="0" lean-forward="false" selection-start-line="19" selection-start-column="0" selection-end-line="19" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/modules/liquidsoap/fallback.liq"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="2023"> - <caret line="119" column="100" lean-forward="false" selection-start-line="119" selection-start-column="100" selection-end-line="119" selection-end-column="100" /> - <folding /> </state> </provider> </entry> @@ -799,7 +781,6 @@ <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="0"> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> - <folding /> </state> </provider> </entry> @@ -815,107 +796,156 @@ <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="85"> <caret line="5" column="1" lean-forward="false" selection-start-line="5" selection-start-column="1" selection-end-line="5" selection-end-column="1" /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/libraries/base/calendar.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="3366"> + <caret line="207" column="45" lean-forward="false" selection-start-line="207" selection-start-column="45" selection-end-line="207" selection-end-column="45" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/modules/liquidsoap/simplestmixer.liq"> + <entry file="file://$PROJECT_DIR$/libraries/database/broadcasts.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1105"> - <caret line="65" column="0" lean-forward="false" selection-start-line="65" selection-start-column="0" selection-end-line="65" selection-end-column="0" /> + <state relative-caret-position="2278"> + <caret line="139" column="24" lean-forward="false" selection-start-line="139" selection-start-column="24" selection-end-line="139" selection-end-column="24" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/modules/communication/zmq/zmqadapter.py"> + <entry file="file://$PROJECT_DIR$/libraries/reporting/statestore.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-932"> + <caret line="16" column="23" lean-forward="false" selection-start-line="16" selection-start-column="23" selection-end-line="16" selection-end-column="23" /> + <folding> + <element signature="e#25#37#0" expanded="false" /> + </folding> + </state> + </provider> + </entry> + <entry file="file:///usr/local/lib/python3.5/dist-packages/redis/client.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="408"> - <caret line="121" column="53" lean-forward="false" selection-start-line="121" selection-start-column="53" selection-end-line="121" selection-end-column="53" /> + <state relative-caret-position="62"> + <caret line="2214" column="8" lean-forward="false" selection-start-line="2214" selection-start-column="8" selection-end-line="2214" selection-end-column="8" /> <folding /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/guru.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1411"> - <caret line="83" column="0" lean-forward="false" selection-start-line="83" selection-start-column="0" selection-end-line="83" selection-end-column="0" /> + <state relative-caret-position="477"> + <caret line="48" column="103" lean-forward="false" selection-start-line="48" selection-start-column="103" selection-end-line="48" selection-end-column="103" /> <folding> - <element signature="e#34#45#0" expanded="true" /> + <element signature="e#34#45#0" expanded="false" /> </folding> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/libraries/base/calendar.py"> + <entry file="file://$PROJECT_DIR$/modules/communication/zmq/zmqadapter.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="722"> - <caret line="207" column="45" lean-forward="false" selection-start-line="207" selection-start-column="45" selection-end-line="207" selection-end-column="45" /> + <state relative-caret-position="-150"> + <caret line="255" column="8" lean-forward="false" selection-start-line="255" selection-start-column="8" selection-end-line="255" selection-end-column="8" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/libraries/reporting/messenger.py"> + <entry file="file://$PROJECT_DIR$/aura.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1081"> - <caret line="255" column="98" lean-forward="false" selection-start-line="255" selection-start-column="98" selection-end-line="255" selection-end-column="98" /> - <folding /> + <state relative-caret-position="359"> + <caret line="29" column="45" lean-forward="false" selection-start-line="29" selection-start-column="45" selection-end-line="29" selection-end-column="45" /> + <folding> + <element signature="e#0#13#0" expanded="false" /> + </folding> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/libraries/database/broadcasts.py"> + <entry file="file://$PROJECT_DIR$/libraries/reporting/messenger.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="-661"> - <caret line="139" column="24" lean-forward="false" selection-start-line="139" selection-start-column="24" selection-end-line="139" selection-end-column="24" /> - <folding /> + <state relative-caret-position="102"> + <caret line="15" column="0" lean-forward="false" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" /> + <folding> + <element signature="e#24#35#0" expanded="true" /> + </folding> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/modules/tools/padavan.py"> + <entry file="file://$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapInitThread.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="121"> - <caret line="78" column="0" lean-forward="false" selection-start-line="78" selection-start-column="0" selection-end-line="78" selection-end-column="0" /> + <state relative-caret-position="317"> + <caret line="30" column="12" lean-forward="false" selection-start-line="30" selection-start-column="12" selection-end-line="30" selection-end-column="12" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapClient.py"> + <entry file="file://$PROJECT_DIR$/modules/liquidsoap/simplestmixer.liq"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="249"> - <caret line="132" column="56" lean-forward="false" selection-start-line="132" selection-start-column="56" selection-end-line="132" selection-end-column="56" /> + <state relative-caret-position="884"> + <caret line="52" column="26" lean-forward="false" selection-start-line="52" selection-start-column="26" selection-end-line="52" selection-end-column="26" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/modules/controller/controller.py"> + <entry file="file://$PROJECT_DIR$/modules/liquidsoap/fallback.liq"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="309"> - <caret line="57" column="52" lean-forward="false" selection-start-line="57" selection-start-column="52" selection-end-line="57" selection-end-column="52" /> + <state relative-caret-position="239"> + <caret line="79" column="35" lean-forward="false" selection-start-line="79" selection-start-column="35" selection-end-line="79" selection-end-column="35" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/aura.py"> + <entry file="file://$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapClient.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="392"> - <caret line="32" column="35" lean-forward="false" selection-start-line="32" selection-start-column="35" selection-end-line="32" selection-end-column="35" /> + <state relative-caret-position="317"> + <caret line="136" column="56" lean-forward="false" selection-start-line="136" selection-start-column="56" selection-end-line="136" selection-end-column="56" /> <folding /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/modules/communication/liquidsoap/LiquidSoapCommunicator.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="-2454"> - <caret line="135" column="30" lean-forward="false" selection-start-line="135" selection-start-column="29" selection-end-line="135" selection-end-column="30" /> + <state relative-caret-position="238"> + <caret line="39" column="26" lean-forward="false" selection-start-line="39" selection-start-column="26" selection-end-line="39" selection-end-column="26" /> <folding /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/modules/scheduling/scheduler.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="147"> + <caret line="175" column="13" lean-forward="false" selection-start-line="175" selection-start-column="8" selection-end-line="175" selection-end-column="13" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/modules/controller/controller.py"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="266"> - <caret line="180" column="17" lean-forward="false" selection-start-line="180" selection-start-column="17" selection-end-line="180" selection-end-column="17" /> + <caret line="124" column="94" lean-forward="false" selection-start-line="124" selection-start-column="94" selection-end-line="124" selection-end-column="94" /> + <folding> + <element signature="e#43#56#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/modules/tools/padavan.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="232"> + <caret line="86" column="45" lean-forward="false" selection-start-line="86" selection-start-column="45" selection-end-line="86" selection-end-column="45" /> <folding /> </state> </provider> </entry> + <entry file="file://$PROJECT_DIR$/modules/communication/redis/redisadapter.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-425"> + <caret line="68" column="17" lean-forward="false" selection-start-line="68" selection-start-column="17" selection-end-line="68" selection-end-column="17" /> + <folding> + <element signature="e#0#16#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> </component> </project> \ No newline at end of file diff --git a/aura.py b/aura.py index a3ebc714d5f398562536b3009cca6fa7017b5ade..ef5e2b4bbd870cd7660110420a1ebea77024598f 100644 --- a/aura.py +++ b/aura.py @@ -3,9 +3,10 @@ import sys import threading from libraries.base.config import ConfigReader -from libraries.reporting.messenger import RedisMessenger +#from libraries.reporting.messenger import RedisListener from modules.controller.controller import AuraController -from modules.communication.zmq.zmqadapter import ServerZMQAdapter +#from modules.communication.zmq.zmqadapter import ServerZMQAdapter +from modules.communication.redis.redisadapter import ServerRedisAdapter class Aura(): @@ -18,13 +19,15 @@ class Aura(): self.config = ConfigReader() self.config.loadConfig() - messenger = RedisMessenger() - messenger.set_channel("aura") - server = object self.controller = AuraController(self.config, debug=False) - self.server = ServerZMQAdapter(self.controller, self.config, debug=True) + #self.server = ServerZMQAdapter(self.controller, self.config, debug=True) + #self.redislistener = + + self.messenger = ServerRedisAdapter() + self.messenger.set_controller(self.controller) + self.messenger.set_config(self.config) def receive_signal(signum, stack): print("received signal") @@ -34,7 +37,7 @@ class Aura(): def join_comm(self): # start listener thread - self.server.join_comm() + self.messenger.start() # # ## ## ## ## ## # # # # ENTRY FUNCTION # # diff --git a/guru.py b/guru.py index da6b95b77fb072be0bbbde03398994f11f5b05fc..7255c5ca1847385311b846384087dea9c416add9 100755 --- a/guru.py +++ b/guru.py @@ -46,9 +46,13 @@ class Guru: parser.add_argument("-vm", "--volume", action="store", dest="set_volume", default=0, metavar=("MIXERNUM","VOLUME"), nargs=2, help="Set volume of a mixer source", type=int) - parser.add_argument("-as", "--add-source", action="store", dest="add_source", default="", + parser.add_argument("-as", "--add-source", action="store", dest="add_source", default=False, help="Add new source to LiquidSoap mixer [Experimental]") + # redis comm. test + parser.add_argument("-rm", "--redis-message", action="store", dest="redis_message", default=False, metavar=("CHANNEL", "MESSAGE"), nargs=2, + help="Send a redis message to the Listeners") + # calls from liquidsoap parser.add_argument("-gnft", "--get-next-for-fallback-file", action="store", dest="type", default=False, help="For which type you wanna have a next audio file?") diff --git a/libraries/reporting/messenger.py b/libraries/reporting/messenger.py index f3fd3e40910cd7a5d081fa91b631af7551ef8935..55166832811cb5632a1d01d3ff755f96d8702204 100644 --- a/libraries/reporting/messenger.py +++ b/libraries/reporting/messenger.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- -import datetime import time +import redis import logging +import datetime +import threading from libraries.reporting.statestore import RedisStateStore from libraries.reporting.mail import AuraMailer @@ -10,17 +12,19 @@ from libraries.reporting.mail import AuraMailer Meldungen an den StateStore schicken """ class RedisMessenger(): + rstore = None + def __init__(self): - """ - Constructor - """ - self.channel = 'main' - self.section = '' - self.rstore = RedisStateStore() - self.errnr = '00' - self.components = {'controller':'01', 'scheduling':'02', 'playd':'03', 'recorder':'04', 'helpers':'09'} - self.fromMail = '' - self.adminMails = '' + """ + Constructor + """ + self.channel = 'main' + self.section = '' + self.rstore = RedisStateStore() + self.errnr = '00' + self.components = {'controller':'01', 'scheduling':'02', 'playd':'03', 'recorder':'04', 'helpers':'09'} + self.fromMail = '' + self.adminMails = '' # ------------------------------------------------------------------------------------------ # def set_channel(self, channel): @@ -260,3 +264,4 @@ class RedisMessenger(): next = b'' return next.decode('utf-8') + diff --git a/libraries/reporting/statestore.py b/libraries/reporting/statestore.py index fdd3adb9d0065d73b3c8480dae0d52347f559c9c..1bb4a3c46ae5fff248e4507242646a1ab5b1953b 100644 --- a/libraries/reporting/statestore.py +++ b/libraries/reporting/statestore.py @@ -6,7 +6,7 @@ import datetime import json import re import uuid - +import threading class RedisStateStore(object): @@ -296,3 +296,14 @@ class RedisStateStore(object): pass return entries + + # ------------------------------------------------------------------------------------------ # + def publish(self, channel, message): + #pb = self.db.pub + subscriber_count = self.db.execute_command('PUBSUB', 'NUMSUB', channel) + + if subscriber_count[1] == 0: + raise Exception("No subscriber! Is Aura daemon running?") + + self.db.publish(channel, message) + diff --git a/modules/communication/liquidsoap/LiquidSoapClient.py b/modules/communication/liquidsoap/LiquidSoapClient.py index 9085b08d243144a240dc7c95982e5e9aa48b00de..aca3edc88f0302f0bdb43c1fa7d66df8a21cfae9 100644 --- a/modules/communication/liquidsoap/LiquidSoapClient.py +++ b/modules/communication/liquidsoap/LiquidSoapClient.py @@ -87,7 +87,7 @@ class LiquidSoapClient(): # self.client.setblocking(0) data = ''; - self.client.settimeout(2) + self.client.settimeout(3) # recv something # while True: @@ -114,7 +114,11 @@ class LiquidSoapClient(): ret = ret.splitlines() try: +# print("pop from empty list?") +# print(ret) ret.pop() # pop 'END' out +# print(ret) +# print("yes") self.message = str.join('\n', ret) # self.message = str(b'\n'.join(ret)) except Exception as e: diff --git a/modules/communication/liquidsoap/LiquidSoapInitThread.py b/modules/communication/liquidsoap/LiquidSoapInitThread.py index 573cfd64baee02c940647592d63ab63fedbeada7..6f1136f537e1182e6918c9fb40b1ead235cb7e9c 100644 --- a/modules/communication/liquidsoap/LiquidSoapInitThread.py +++ b/modules/communication/liquidsoap/LiquidSoapInitThread.py @@ -14,10 +14,10 @@ class LiquidSoapInitThread(threading.Thread): self.socket = socket self.liquidsoapcommunicator = liquidsoapcommunicator - def run(self, ): + def run(self): try: # sleep needed, because the socket is created to slow by liquidsoap - time.sleep(1) + time.sleep(10) self.liquidsoapcommunicator.enable_transaction() self.liquidsoapcommunicator.open_conn(self.socket) self.liquidsoapcommunicator.__send_lqc_command__(self.socket, "mixer", "volume", "0", "0") diff --git a/modules/communication/redis/redisadapter.py b/modules/communication/redis/redisadapter.py new file mode 100644 index 0000000000000000000000000000000000000000..9686b9771912fbbde77a2eb852709b37698922b3 --- /dev/null +++ b/modules/communication/redis/redisadapter.py @@ -0,0 +1,196 @@ +import threading +import time +import sys +import redis +import random +import string +import simplejson +import traceback + +from datetime import datetime + +from threading import Event +from libraries.security.whitelist import AuraWhitelist +from libraries.security.user import AuraUser +from modules.scheduling.scheduler import AuraScheduler +from libraries.reporting.statestore import RedisStateStore +from libraries.reporting.messenger import RedisMessenger + + +class ServerRedisAdapter(threading.Thread, RedisMessenger): + debug = False + pubsub = None + config = None + redisdb = None + channel = "" + auracontroller = None + + def __init__(self, debug=False): + threading.Thread.__init__(self) + RedisMessenger.__init__(self) + + self.debug = debug + + # init + threading.Thread.__init__ (self) + self.shutdown_event = Event() + + self.channel = 'aura' + self.section = '' + self.rstore = RedisStateStore() + self.errnr = '00' + self.components = {'controller':'01', 'scheduling':'02', 'playd':'03', 'recorder':'04', 'helpers':'09'} + self.fromMail = '' + self.adminMails = '' + + def set_controller(self, auracontroller): + self.auracontroller = auracontroller + + def set_config(self, config): + self.config = config + + # ------------------------------------------------------------------------------------------ # + def run(self): + self.redisdb = redis.Redis() + self.pubsub = self.redisdb.pubsub() + self.pubsub.subscribe(self.channel) + + print("waiting for REDIS message") + for item in self.pubsub.listen(): + if item["type"] == "subscribe": + continue + + item["channel"] = item["channel"].decode("utf-8") + if isinstance(item["data"], bytes): + item["data"] = item["data"].decode("utf-8") + + if item['data'] == "KILL": + break + else: + print(item) + self.work(item) + + print("waiting for REDIS message") + + self.pubsub.unsubscribe() + print(self, "unsubscribed from "+self.channel+" and finished") + + def listen_for_one_message(self, channel): + self.redisdb = redis.Redis() + self.pubsub = self.redisdb.pubsub() + self.pubsub.subscribe(channel) + + for item in self.pubsub.listen(): + if item["type"] == "subscribe": + continue + + item["channel"] = item["channel"].decode("utf-8") + if isinstance(item["data"], bytes): + item["data"] = item["data"].decode("utf-8") + + self.pubsub.unsubscribe() + break + + return item["data"] + + def work(self, item): + if item["data"] == "fetch_new_programme": + self.auracontroller.fetch_new_programme() + + elif item["data"] == "liquid_startup": + self.auracontroller.liquid_startup() + + elif item["data"] == "get_act_programme": + self.auracontroller.get_act_programme() + + else: + raise Exception("Cannot understand command: "+item["data"]) + + # ------------------------------------------------------------------------------------------ # + def join_comm(self): + try: + while self.is_alive(): + print(str(datetime.now())+" joining") + self.join() + print("join out") + + # if cnt % 30 == 0: + # print(datetime.datetime.now().isoformat()) + # server.printLastMessages() + # cnt = 0 + # cnt = cnt + 1 + + except (KeyboardInterrupt, SystemExit): + # Dem Server den Shutdown event setzen + # server.shutdown_event.set() + # Der Server wartet auf Eingabe + # Daher einen Client initiieren, der eine Nachricht schickt + self.halt() + sys.exit('Terminated') + + # ------------------------------------------------------------------------------------------ # + def halt(self): + """ + Stop the server + """ + if self.shutdown_event.is_set(): + return + try: + del self.auracontroller + except: + pass + self.shutdown_event.set() + result = 'failed' + try: + result = self.socket.unbind("tcp://"+self.ip+":"+self.port) + except: + pass + #self.socket.close() + + # ------------------------------------------------------------------------------------------ # + def send(self, message): + """ + Send a message to the client + :param message: string + """ + if not self.can_send: + print("sending a "+str(len(message))+" long message via ZMQ.") + self.socket.send(message.encode("utf-8")) + self.can_send = False + else: + print("cannot send message via ZMQ: "+str(message)) + + # ------------------------------------------------------------------------------------------ # + @staticmethod + def get_accounts(self): + """ + Get accounts from redis db + :return: llist - a list of accounts + """ + accounts = AuraUser().getLogins() + db = redis.Redis() + + internaccount = db.get('internAccess') + if not internaccount: + user = ''.join(random.sample(string.ascii_lowercase,10)) + password = ''.join(random.sample(string.ascii_lowercase+string.ascii_uppercase+string.digits,22)) + db.set('internAccess', user + ':' + password) + intern = [user, password] + else: + intern = internaccount.split(':') + + accounts[intern[0]] = intern[1] + + return accounts + + +class ClientRedisAdapter(RedisMessenger): + debug = False + + def __init__(self, debug=True): + RedisMessenger.__init__(self) + self.debug = debug + + # ------------------------------------------------------------------------------------------ # + def publish(self, channel, message): + self.rstore.publish(channel, message) diff --git a/modules/controller/controller.py b/modules/controller/controller.py index fb2f006f81403fad93ecc4efa883214bb58b1290..587ce8520ee5a6570114866a9b7bd4fc86708c99 100644 --- a/modules/controller/controller.py +++ b/modules/controller/controller.py @@ -24,6 +24,7 @@ from libraries.database.broadcasts import ScheduleEntry #from modules.communication.liquidsoap.liquidcontroller import LiquidController from modules.communication.liquidsoap.LiquidSoapCommunicator import LiquidSoapCommunicator from modules.scheduling.scheduler import AuraScheduler +from modules.communication.redis.redisadapter import ClientRedisAdapter @@ -43,6 +44,7 @@ class AuraController(): config = None sender = None debug = False + redisclient = None # Constructor def __init__(self, config, debug): @@ -71,6 +73,8 @@ class AuraController(): self.scheduler = AuraScheduler(config, self.liquidsoapcommunicator, self.debug) self.config = config + self.redisclient = ClientRedisAdapter() + # ------------------------------------------------------------------------------------------ # def set_sender(self, sender): """ @@ -118,6 +122,7 @@ class AuraController(): if response == "fetching_finished": programme = acs.get_calendar_data() self.scheduler.reload_programme() + self.redisclient.publish("fetch_new_programme_reply", simplejson.dumps(programme)) return programme else: print("Got an unknown response from AuraCalendarService: "+response) @@ -125,36 +130,28 @@ class AuraController(): # ------------------------------------------------------------------------------------------ # def get_act_programme(self): + programme = None + try: programme = self.scheduler.get_act_programme() + except NoProgrammeLoadedException as e: print("WARNING: no programme in memory. i have to reload it!") # refetch the programme from pv and importer self.fetch_new_programme() # is the recursion here really needed, or an additional error source? - return self.get_act_programme() + programme = self.get_act_programme() + self.success("00") + self.redisclient.publish("get_act_programme_reply", programme[0]) + return programme + except Exception as e: traceback.print_exc() -# exc_type, exc_obj, exc_tb = sys.exc_info() -# fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] -# print(e.with_traceback(True)) # exc_type, fname, exc_tb.tb_lineno) self.fatal("01") else: -# entries = [] -# for p in programme: -# entries.append(p["playlist"]["entries"]) -# print(p) -# for p in programme["entries"]: -# print(p) - - #retstring = json.dumps([p._asdict() for p in programme], default=alchemyencoder) - #retstring = json.dumps([p._asdict() for p in programme["entries"]], default=alchemyencoder) - #retstring = json.dumps(programme["entries"], default=alchemyencoder) - #retstring = json.dumps([p["playlist"]["entries"] for p in programme], default=alchemyencoder) - #print("WANNA SEND") - #print(retstring) self.success("00") + self.redisclient.publish("get_act_programme_reply", programme[0]) return programme # ------------------------------------------------------------------------------------------ # diff --git a/modules/liquidsoap/fallback.liq b/modules/liquidsoap/fallback.liq index 59819064422409df0d35c2c1d40bff27088c1a47..477617210a80b70f80d8ba4c9d6cf7c9943c0cdc 100644 --- a/modules/liquidsoap/fallback.liq +++ b/modules/liquidsoap/fallback.liq @@ -76,7 +76,8 @@ def fallback_create(~skip=true, name, requestor) # Create the request.dynamic source # Set conservative to true to queue # several songs in advance - source = request.dynamic(conservative=true, length=400., id="pool_"^name, requestor, timeout=60.) + #source = request.dynamic(conservative=true, length=50., id="pool_"^name, requestor, timeout=60.) + source = request.dynamic(length=50., id="pool_"^name, requestor, timeout=60.) # Apply normalization using replaygain information source = amplify(1., override="replay_gain", source) diff --git a/modules/scheduling/scheduler.py b/modules/scheduling/scheduler.py index fcba0314a10dd16a19e1356dac0bb39381e306d1..b66808b70becd8336f82c63be3579d1fcd5176b2 100644 --- a/modules/scheduling/scheduler.py +++ b/modules/scheduling/scheduler.py @@ -60,6 +60,12 @@ def alchemyencoder(obj): return obj.isoformat() elif isinstance(obj, decimal.Decimal): return float(obj) + elif isinstance(obj, bool): + if obj: + return "True" + return "False" + else: + return obj """ Comba Scheduler Class @@ -116,7 +122,7 @@ class AuraScheduler(): self.schedule_events = ScheduleEntry.query.filter() - print(self.schedule_events) + #print(self.schedule_events) #errors_file = os.path.dirname(os.path.realpath(__file__)) + '/error/scheduler_error.js' json_data = open(self.auraconfig.get("install_dir") + "/errormessages/scheduler_error.js") diff --git a/modules/tools/padavan.py b/modules/tools/padavan.py index 8e6a2920a9bd9c6602b862291612b92c12b9051e..b6a678537f95535091a8606725dbaeaff3817157 100644 --- a/modules/tools/padavan.py +++ b/modules/tools/padavan.py @@ -7,6 +7,7 @@ class Padavan: lsc = None zmqclient = None + redisclient = None def __init__(self, args, config): self.args = args @@ -25,9 +26,12 @@ class Padavan: if self.args.print_act_prog: self.print_act_program() - if self.args.add_source != "": + if self.args.add_source: print("Guru still has to learn to add a source") + if self.args.redis_message: + self.redis_message(self.args.redis_message[0], self.args.redis_message[1]) + if self.args.select_mixer != -1: self.select_mixer(self.args.select_mixer) @@ -38,7 +42,7 @@ class Padavan: self.set_volume(self.args.set_volume[0], self.args.set_volume[1]) if self.args.init_player: - self.init_player() + self.liquid_startup() if self.args.type: self.print_next_fallback_file(self.args.type) @@ -63,33 +67,61 @@ class Padavan: # and init self.zmqclient = ClientZMQAdapter(self.config.get('zmqhostip'), self.config.get('zmqport'), debug=False) + def init_redis_communication(self, with_server=False): + from modules.communication.redis.redisadapter import ClientRedisAdapter + + self.redisclient = ClientRedisAdapter() + + if with_server: + from modules.communication.redis.redisadapter import ServerRedisAdapter + self.redisserver = ServerRedisAdapter() + def fetch_new_programme(self): - self.init_zmq_communication() + #self.init_zmq_communication() + #jsonreply = self.zmqclient.send("fetch_new_programme") + + self.init_redis_communication(True) + self.redisclient.publish("aura", "fetch_new_programme") - jsonreply = self.zmqclient.send("fetch_new_programme") - print(jsonreply) - reply = simplejson.loads(jsonreply) + stringreply = self.redisserver.listen_for_one_message("fetch_new_programme_reply") + reply = simplejson.loads(stringreply) + + #print(jsonreply) + #reply = simplejson.loads(jsonreply) for schedule in reply: print(schedule["show_name"] + " starts at " + schedule["schedule_start"] + ", ends at " + schedule[ "schedule_end"] + " and has " + str(len(schedule["playlist"]["entries"])) + " entries in the playlist") - def init_player(self): - self.init_zmq_communication() + def print_act_program(self): + #self.init_zmq_communication() - reply = self.zmqclient.send("player_startup") + #jsonreply = self.zmqclient.send("get_act_programme") + #reply = simplejson.loads(jsonreply) - print(reply) + self.init_redis_communication(True) - def print_act_program(self): - self.init_zmq_communication() + self.redisclient.publish("aura", "get_act_programme") + + reply = simplejson.loads(self.redisserver.listen_for_one_message("get_act_programme_reply")) - jsonreply = self.zmqclient.send("get_act_programme") - reply = simplejson.loads(jsonreply) for entry in reply: - print("schedule id #" + str(entry["schedule_id"]) + " and entrynumber #" + str( - entry["entry_num"]) + " starting @ " + entry["entry_start"] + " playing " + entry[ - "source"] + " and is going to stop @ " + entry["entry_end"]) + print("schedule id #" + str(entry["schedule_id"]) + " and entrynumber #" + str(entry["entry_num"]) + " starting @ " + entry["entry_start"] + " playing " + entry["source"] + " and is going to stop @ " + entry["entry_end"]) + + def liquid_startup(self): + self.init_redis_communication() + + self.redisclient.publish("aura", "liquid_startup") + #self.init_zmq_communication() + + #self.zmqclient.send("liquid_startup", False) + + def redis_message(self, channel, message): + from libraries.reporting.messenger import RedisMessenger + + r = RedisMessenger() + r.set_channel(channel) + r.publish(channel, message) def select_mixer(self, mixernumber, activate=True): self.init_liquidsoap_communication() @@ -122,13 +154,7 @@ class Padavan: for k, v in status.items(): print("source: " + k + "\t status: " + v) - def liquid_startup(self): - self.init_zmq_communication() - - self.zmqclient.send("liquid_startup", False) - def print_next_fallback_file(self, type): - from libraries.reporting.messenger import RedisMessenger redis = RedisMessenger()