first working tool (with special sign bug)
This commit is contained in:
parent
ac62cf4935
commit
46a51314c7
@ -73,11 +73,11 @@ moviedir=""$(echo $moviedir | sed 's|/$||g')""
|
|||||||
## functions
|
## functions
|
||||||
function md5_in_add() {
|
function md5_in_add() {
|
||||||
cat $md5 | while read line; do #for each line in md5
|
cat $md5 | while read line; do #for each line in md5
|
||||||
md5=$(echo $line | cut -c -32)
|
local md5=$(echo $line | cut -c -32)
|
||||||
path=$(echo $line | cut -c 33- | sed 's/^\ //g')
|
local path=$(echo $line | cut -c 33- | sed 's/^\ //g')
|
||||||
relrevpath=$(echo $path | sed "s|^$moviedir||g" | sed 's|^/||g' | sed 's|/$||g' | rev)
|
local relrevpath=$(echo $path | sed "s|^$moviedir||g" | sed 's|^/||g' | sed 's|/$||g' | rev)
|
||||||
name=$(echo $relrevpath | cut -d '/' -f 1 | rev)
|
local name=$(echo $relrevpath | cut -d '/' -f 1 | rev)
|
||||||
folder=$(echo $relrevpath | cut -d '/' -f 2- | rev)
|
local folder=$(echo $relrevpath | cut -d '/' -f 2- | rev)
|
||||||
db_query "INSERT INTO File (MD5, Folder, Name, TTSync) VALUES ('$md5', '$folder', '$name', $TTSYNC_EXIST );" #-> handle in future: ";'()"
|
db_query "INSERT INTO File (MD5, Folder, Name, TTSync) VALUES ('$md5', '$folder', '$name', $TTSYNC_EXIST );" #-> handle in future: ";'()"
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -85,10 +85,28 @@ function md5_in_add() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function md5_rm() {
|
function md5_rm() {
|
||||||
|
cat $md5 | while read line; do #for each line in md5
|
||||||
|
local md5=$(echo $line | cut -c -32)
|
||||||
|
local path=$(echo $line | cut -c 33- | sed 's/^\ //g')
|
||||||
|
local relrevpath=$(echo $path | sed "s|^$moviedir||g" | sed 's|^/||g' | sed 's|/$||g' | rev)
|
||||||
|
local name=$(echo $relrevpath | cut -d '/' -f 1 | rev)
|
||||||
|
local folder=$(echo $relrevpath | cut -d '/' -f 2- | rev)
|
||||||
|
db_query "DELETE FROM File WHERE MD5='$md5' AND Folder='$folder' AND Name='$name';" #-> handle in future: ";'()"
|
||||||
|
done
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function md5_in_del() {
|
function md5_in_del() {
|
||||||
|
cat $md5 | while read line; do #for each line in md5
|
||||||
|
local md5=$(echo $line | cut -c -32)
|
||||||
|
local path=$(echo $line | cut -c 33- | sed 's/^\ //g')
|
||||||
|
local relrevpath=$(echo $path | sed "s|^$moviedir||g" | sed 's|^/||g' | sed 's|/$||g' | rev)
|
||||||
|
local name=$(echo $relrevpath | cut -d '/' -f 1 | rev)
|
||||||
|
local folder=$(echo $relrevpath | cut -d '/' -f 2- | rev)
|
||||||
|
db_query "UPDATE File SET TTSync=$TTSYNC_DEL WHERE MD5='$md5' AND Folder='$folder' AND Name='$name';" #-> handle in future: ";'()"
|
||||||
|
done
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user