Made modifications to overhaul ptrack. Beginning the initial work on ptrack, going to do some tests and make more scripts to finish it.
This commit is contained in:
parent
fbc1f6a71e
commit
487814605c
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
#Attempts to echo the last sorted match to an existing FIFO and creates a new FIFO using tmpfifo if there's no match.
|
||||
|
||||
if [ -z $USAGE_LOCK ] ; then
|
||||
NAME="$(filename $0)"
|
||||
USAGE="Usage: $NAME [string to grep | path to FIFO]"
|
||||
if usage "$1" "$USAGE" ; then exit ; fi
|
||||
export USAGE_LOCK=1
|
||||
fi
|
||||
|
||||
FIFO=$(ls /tmp/fifo/ | grep "$1" | tail -n 1)
|
||||
if [ -p "/tmp/fifo/$FIFO" ] ; then echo "/tmp/fifo/$FIFO" ; elif [ -p "$1" ] ; then echo "$1" ; else tmpfifo "$1" ; fi
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
# Sends stdin to a FIFO created with the tmpfifo command. Echoes the FIFO it's using to stdout so you can remove the file after it completes its job.
|
||||
|
||||
#!/bin/sh
|
||||
if [ -z $USAGE_LOCK ] ; then
|
||||
NAME="$(filename $0)"
|
||||
USAGE="Usage: <command> | $NAME [file to send to | temporary fifo ID]"
|
||||
if usage "$1" "$USAGE" ; then exit ; fi
|
||||
export USAGE_LOCK=1
|
||||
fi
|
||||
|
||||
FIFO="$(tmpfifo $1)"
|
||||
echo "$FIFO"
|
||||
|
||||
INPUT=1
|
||||
until [ "$INPUT" == "" ] ; do
|
||||
read INPUT
|
||||
if [ "$INPUT" != "" ] ; then echo $INPUT >> "$FIFO" ; fi
|
||||
done
|
|
@ -7,26 +7,9 @@
|
|||
# grep grep
|
||||
# sed sed
|
||||
|
||||
if [ -z $USAGE_LOCK ] ; then
|
||||
NAME="$(filename $0)"
|
||||
USAGE="Usage: $NAME"
|
||||
if usage "$1" "$USAGE" ; then exit ; fi
|
||||
export USAGE_LOCK=1
|
||||
fi
|
||||
FIFO="$(tail -qf .local/share/poezio/logs/* | pipetofifo $(attfifo poezio))"
|
||||
|
||||
IFS='
|
||||
'
|
||||
if [ "$LNOTIFY_ICON" = "" ] ; then LNOTIFY_ICON="/usr/share/icons/ouro/attention.png" ; fi
|
||||
|
||||
FILES="$(find .local/share/poezio/logs/ -type f,p,l,s,b,c | sort)"
|
||||
for file in $FILES ; do
|
||||
NICK="$(grep 'You \(.*\) joined the room' "$file" 2>/dev/null | tail -n 1 - | sed -e 's/.*You (//' -e 's/) joined the room//')"
|
||||
if [ "$NICK" = "" ] ; then
|
||||
NICK="$(grep 'default_nick' "$HOME/.config/poezio/poezio.cfg" | sed -e '/^#/d' -e 's/.*=[ ]//' | tail -n 1)"
|
||||
fi
|
||||
FILENAME="$(echo $file | sed 's/.*\///')"
|
||||
ICON="$(echo $HOME/.cache/poezio/avatars/$FILENAME/$(ls -tr $HOME/.cache/poezio/avatars/$FILENAME 2>/dev/null | tail -n 1))"
|
||||
if [ ! -f "$ICON" ] ; then ICON="$LNOTIFY_ICON" ; fi
|
||||
|
||||
echo "-i $ICON" | track "$file" sed -e "/^[^M][^A-Z]/d" -e "/^MR [0-9]*T[0-9]*:[0-9]*:[0-9]*Z [0-9]* <$NICK>/d" -e "s/^[A-Z]* [0-9]*T[0-9]*:[0-9]*:[0-9]*Z [0-9]*//" &
|
||||
done
|
||||
# I need to read from this file and do a few specific things.
|
||||
# I need a script to automatically fetch avatar locations based on a JID, if available.
|
||||
# I need a script to search in logs for JID-to-temporary-username associations.
|
||||
# Let's test notify-send.
|
||||
|
|
|
@ -17,12 +17,16 @@ else
|
|||
if [ "$1" = "" ] ; then
|
||||
NAME="fifo"
|
||||
else
|
||||
NAME="$1"
|
||||
NAME="$(filename $1)"
|
||||
fi
|
||||
NUMBER=1
|
||||
while [ -e "$FIFODIR/$NAME-$NUMBER" ] ; do
|
||||
NUMBER=$(($NUMBER+1))
|
||||
done
|
||||
mkfifo "$FIFODIR/$NAME-$NUMBER"
|
||||
echo "$FIFODIR/$NAME-$NUMBER"
|
||||
if [ -p "$NAME" ] ; then
|
||||
echo "$NAME"
|
||||
else
|
||||
while [ -e "$FIFODIR/$NAME-$NUMBER" ] ; do
|
||||
NUMBER=$(($NUMBER+1))
|
||||
done
|
||||
mkfifo "$FIFODIR/$NAME-$NUMBER"
|
||||
echo "$FIFODIR/$NAME-$NUMBER"
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue