-
Notifications
You must be signed in to change notification settings - Fork 0
/
lo
executable file
·50 lines (46 loc) · 1.17 KB
/
lo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# 2018-01-13
# Feeder to the slo queue (Lots of files Opener)
# Use as: lo <part of filename(s)>
# Adds to the beginning of the queue.
if ! pgrep -x "slo" > /dev/null
then
echo "I need the slo server running but it's apparently not."
fi
if [[ "$1" == "http://"* ]] || [[ "$1" == "https://"* ]] || [[ "$1" == "file://"* ]]
then
if [ -s $HOME/.slo/2p.txt ]
then
echo "$1
$(cat $HOME/.slo/2p.txt)" > $HOME/.slo/2p.txt
else
echo "$1" > $HOME/.slo/2p.txt
fi
sleep 0.3 #Don't interfere with slo processing a new list
else
for j in "$@"
do
for i in *$j*
do
#k=`date +%N`
#k=`date +%y%m%d_%H%M%S`_`strings /dev/urandom | tr -dc a-z-0-9 | tr -d - | head -c5` <-- mailcap under fish dies... :-(
k=`date +%y%m%d_%H%M%S_%N`
# Alpine is crazy
clfn=${i//\*/}
veg=${clfn##*.}
elej=${clfn%.*}
#gnome-terminal -e "bash -c 'echo "$clfn"; exec bash'"
clfnr="${elej}_${k}.${veg}"
pfn=${clfnr##*/}
cp "$clfn" $HOME/.slo/2p/"$pfn"
if [ -s $HOME/.slo/2p.txt ]
then
echo "$pfn
$(cat $HOME/.slo/2p.txt)" > $HOME/.slo/2p.txt
else
echo "$pfn" > $HOME/.slo/2p.txt
fi
sleep 0.3 #Don't interfere with slo processing a new list
done
done
fi