From f7e4897de899599f484d3910476bf6cd63356a34 Mon Sep 17 00:00:00 2001 From: randomuser Date: Sun, 20 Dec 2020 11:50:47 -0600 Subject: [PATCH] add more functions to yt --- yt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/yt b/yt index 2256739..9e57483 100755 --- a/yt +++ b/yt @@ -1,11 +1,11 @@ #!/bin/sh -DATFILE="~/.config/youtube" +DATFILE="~/.config/youtube/dat" CACHEDIR="~/.config/youtube/cache" tmp1=$(mktemp) tmp2=$(mktemp) -mkdir -p $DATFILE +touch $DATFILE mkdir -p $CACHEDIR sync () { @@ -24,10 +24,22 @@ display () { done cat $tmp1 $tmp2 | pr -2t -s" | " } +add () { # $1: name of channel id + printf "%s\n" $1 >> $DATFILE +} +del () { # $1: line number of channel id + sed -i "${1}d" $DATFILE +} case $1 in *"sync"*) sync ;; + *"add"*) + [ $# -eq 2 ] && add $2 + ;; + *"del"*) + [ $# -eq 2 ] && del $2 + ;; *) display ;;