-
Notifications
You must be signed in to change notification settings - Fork 0
/
2download2
30 lines (26 loc) · 875 Bytes
/
2download2
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
#!/bin/bash
if [ -z $TO_DOWNLOAD_FILE ]; then
#TO_DOWNLOAD_FILE=$(cat ~/.downloadfolder) 2> /dev/null
. ~/.downloadfolder
fi
if [ $? -eq 1 ]; then
TO_DOWNLOAD_FILE="$HOME/Movies/.2download"
fi
if [ $# -gt 0 ]; then
FOLDER=$(dirname "$1/dummy")
echo "export TO_DOWNLOAD_FILE=$FOLDER/.2download" > ~/.downloadfolder
echo "$FOLDER/.2download" > ~/.downloadfile
. ~/.downloadfolder
TO_DOWNLOAD_FILE_VALUE=$(cat ~/.downloadfile)
echo "\$# > 0 -> TO_DOWNLOAD_FILE_VALUE=$TO_DOWNLOAD_FILE_VALUE"
fi
touch $TO_DOWNLOAD_FILE
#eport TO_DOWNLOAD_FILE
. ~/.downloadfolder
CLIPBOARD=$(pbpaste)
if [ -n "$(ytExists $CLIPBOARD)" ] || [ -n "$(grep $CLIPBOARD $TO_DOWNLOAD_FILE)" ];then
echo "Either already added to $TO_DOWNLOAD_FILE or existing in this folder" > /dev/stderr
exit 257
fi
echo $CLIPBOARD >> $TO_DOWNLOAD_FILE
echo "...added"