mirror of
https://codeberg.org/tenacityteam/tenacity
synced 2025-10-11 11:12:46 +02:00
Scripts in Piped-Work
- New docimages script for the tracks. - Added new option in screenshots to capture ruler as well as track. - Typo fix (focussed)
This commit is contained in:
committed by
Paul Licameli
parent
1f605ccfc8
commit
24e8bbc623
71
scripts/piped-work/pipe_test.py
Normal file
71
scripts/piped-work/pipe_test.py
Normal file
@@ -0,0 +1,71 @@
|
||||
# pipe-test.py
|
||||
# Tests the audacity pipe. Sends 3 commands.
|
||||
# Keep pipe-test.py short!!
|
||||
# You can make more complicated longer tests to test other functionality
|
||||
# or to generate screenshots etc in other scripts.
|
||||
|
||||
# Make sure Audacity is running first and that mod-script-pipe is enabled
|
||||
# before running this script.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
if( sys.platform == 'win32' ):
|
||||
print( "pipe-test.py, running on windows" )
|
||||
toname = '\\\\.\\pipe\\ToSrvPipe'
|
||||
fromname = '\\\\.\\pipe\\FromSrvPipe'
|
||||
EOL = '\r\n\0'
|
||||
else:
|
||||
print( "pipe-test.py, running on linux or mac" )
|
||||
toname = '/tmp/audacity_script_pipe.to.' + str(os.getuid())
|
||||
fromname = '/tmp/audacity_script_pipe.from.' + str(os.getuid())
|
||||
EOL = '\n'
|
||||
|
||||
print( "Write to \"" + toname +"\"" )
|
||||
if not os.path.exists( toname ) :
|
||||
print( " ..does not exist. Ensure Audacity is running with mod-script-pipe." )
|
||||
sys.exit();
|
||||
|
||||
print( "Read from \"" + fromname +"\"")
|
||||
if not os.path.exists( fromname ) :
|
||||
print( " ..does not exist. Ensure Audacity is running with mod-script-pipe." )
|
||||
sys.exit();
|
||||
|
||||
print( "-- Both pipes exist. Good." )
|
||||
|
||||
tofile = open( toname, 'wt+' )
|
||||
print( "-- File to write to has been opened" )
|
||||
fromfile = open( fromname, 'rt')
|
||||
print( "-- File to read from has now been opened too\r\n" )
|
||||
|
||||
|
||||
def sendCommand( command ) :
|
||||
print( "Send: >>> "+command )
|
||||
tofile.write( command + EOL )
|
||||
tofile.flush()
|
||||
|
||||
def getResponse() :
|
||||
result = ''
|
||||
line = ''
|
||||
while line != '\n' :
|
||||
result += line
|
||||
line = fromfile.readline()
|
||||
#print(" I read line:["+line+"]")
|
||||
return result
|
||||
|
||||
def doCommand( command ) :
|
||||
sendCommand( command )
|
||||
response = getResponse()
|
||||
print( "Rcvd: <<< " + response )
|
||||
return response
|
||||
|
||||
def do( command ) :
|
||||
doCommand( command )
|
||||
|
||||
def quickTest() :
|
||||
do( 'Help: Command=Help' )
|
||||
do( 'Help: Command="SetTrackInfo"' )
|
||||
do( 'SetPreference: Name=GUI/Theme Value=light Reload=false' )
|
||||
|
||||
quickTest()
|
Reference in New Issue
Block a user