Compare commits

...

4 Commits

Author SHA1 Message Date
randomuser 11d85172f5 add trss manpage 2022-07-18 22:16:42 -05:00
randomuser b917fd2de9 remove simplestatus man page 2022-07-18 22:08:31 -05:00
randomuser 6ed0ede26d remove yt and add trss-yt-id 2022-07-18 22:07:17 -05:00
randomuser 62eec5e9ab todo add 2022-07-17 08:49:12 -05:00
6 changed files with 42 additions and 190 deletions

View File

@ -12,6 +12,7 @@ sh:
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f sh/paste $(DESTDIR)$(PREFIX)/bin
cp -f sh/trss $(DESTDIR)$(PREFIX)/bin
cp -f sh/trss-yt-id $(DESTDIR)$(PREFIX)/bin
cp -f sh/disp $(DESTDIR)$(PREFIX)/bin
cp -f sh/wallpaper $(DESTDIR)$(PREFIX)/bin
cp -f sh/yt $(DESTDIR)$(PREFIX)/bin

1
TODO
View File

@ -5,3 +5,4 @@ TODO LIST
- fix paste
- make the c programs less buggy and let them not suck as much
- add manpage for trss
- add option to *force* syncing

View File

@ -1,87 +0,0 @@
'\" t
.TH SIMPLESTATUS 1 simplestatus
.SH NAME
simplestatus \- simple, lightweight status bar content generator
.SH SYNOPSIS
.B simplestatus
.SH DESCRIPTION
simplestatus is a simple status bar content generator for statusbars which accept their input via standard input (such as lemonbar), or can be used in conjunction with other utilities to set their statusbars (e.g. dwm's statusbar). simplestatus is configured via a configuration file.
simplestatus works on the premise of each component in the statusbar being a module; in this case, simplestatus represents them in shell scripts residing in the configuration directory. When a module needs to be updated, the cooresponding shell script is executed and its stdout read as the output of the module. Modules can be updated via signals send to the process or via timers, all specified in the configuration file.
.SH CONFIGURATION
The configuration file resides in the configuration directory. The configuration file location is determined via checking the following places:
.IP
o $XDG_CONFIG_DIR/simplestatus/config
.IP
o $HOME/.config/simplestatus/config
.P
If after these two steps the configuration cannot be found, simplestatus exits.
Once the configuration file location is determined, the configuration file is read and parsed. There are three main directives in the configuration file:
.IP
o module
.IP
o order
.IP
o format
.SS module
This directive takes three arguments: the module name, the signal trigger number, and the timer trigger. For example
.IP
.B module power 7 30
.P
defines a module named ``power'', which is updated when signal 7 is recieved (SIGBUS) or every thirty seconds. ``power'' must be an executable placed in the configuration directory (e.g. the directory in which the configuration file resides) and must have the executable flag set for the current user. Note that entering the signals' symbolic name (SIGBUS) instead of the number (7) is not supported at this time.
.SS order
The ``order'' directive specifies in what order the modules will be placed in the format string, defined by the directive ``format''. For example,
.IP
.B order power time date wm
.P
specifies the order in which the modules will be inserted in the format string, starting with ``power'' and ending with ``wm''.
.SS format
``format'' specifies the format string that the output of the modules will be inserted into. Below is an example command:
.IP
.B format %{l}&%{c}&%{r}&
.SH CONFIGURATION EXAMPLE
Assume we have the following modules, who output the following values:
.TS
tab(@) allbox;
l|l .
MODULE@EVALUATED VALUE
foo@bar
ping@pong
a@b
.TE
.P
and this configuration:
.IP
module foo 7 30
module ping 10 30
module a 12 120
order foo ping a
format output of foo: &; output of ping: &; output of a: &
.P
we will get the output:
.IP
.B output of foo: bar; output of ping: pong; output of a: b
.P
Should you wish to make comments, prefix lines with ``#''. If you wish to make spaces between instructions, make an empty line.
.SH COMMON PITFALLS
.IP
o Don't assign SIGINT (2) to a module unless you want it to update when you ^C!
.SH PLANNED FEATURES
.IP
o If the configuration file is marked +x, execute and read contents from the script's stdout to be parsed.
o free(...) memory when finished.
o Add ability to export environment variables to scripts via configuration file.
o Add signal to force re-parsing of configuration file.
.SH KNOWN BUGS
o Lack of use of free(...), causing potential for memory leaks.
.SH SEE ALSO
.BR lemonbar (1),
.BR slstatus (1)
.SH AUTHOR
randomuser <randomuser at tilde dot club>

32
man/trss.1 Normal file
View File

@ -0,0 +1,32 @@
.TH TRSS 1 trss
.SH NAME
trss \- command oriented feed reader powered by sfeed
.SH SYNOPSIS
.B trss
.SH INTERFACE
.TP
.B ls
list all feed names in the 'feed home', or within a feed, list all items within
.TP
.B cd
focus another feed. in order to go back to the 'feed home', use 'cd' or 'cd ..'
.TP
.B sync
with no arguments and in the 'feed home', syncs all feeds. if in a specific feed, syncs that feed. a feed can be specified in an argument.
.TP
.B cat
open all feeds whose titles contain text as specified by an argument in 'lynx'
.SH trss-yt-id
this script is designed to allow one to obtain an rss feed for the uploads of a youtube channel. this command takes the homepage of the youtube channel in question as an argument and then returns the rss feed for that channel.
.SH BUGS
- 'set' is a stub
- when in a feed, you can't cd to another directly, you must go to to the 'feed home' and then cd
.SH DEPENDS
sfeed
.SH AUTHOR
randomuser <random user at tilde dot club>

8
sh/trss-yt-id Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
[ -z "$1" ] && exit 1
curl "${1}" -s | \
grep 'youtube/www\.youtube\.com/channel/.\{24\}' -o | \
awk -F'/' '{print "https://www.youtube.com/feeds/videos.xml?channel_id=" $NF}' | \
sed 1q

103
sh/yt
View File

@ -1,103 +0,0 @@
#!/bin/sh
[ -z "${YT_DATFILE}" ] && YT_DATFILE="${HOME}/.local/share/ytdat"
[ -z "${YT_CACHEDIR}" ] && YT_CACHEDIR="${HOME}/.local/share/ytcache"
[ -z "${YT_TORIFY}" ] && YT_TORIFY=""
ver=0.1
info () {
printf %s "\
yt - youtube tool
=> [s]ync - Sync RSS feeds
=> [a]dd [id] - Add a channel to the list
=> [d]el [id] - Remove a channel from the list
=> [h]elp - Show this help
=> [i]d [url] - Show internal channel id
=> [c]lear - Clear cache
List file: export YT_DATFILE=<your file here>
Cache directory: export YT_CACHEDIR=<your dir here>
Torify wrapper: export YT_TORIFY=<your torify here>
"
}
cache () {
touch ${YT_DATFILE}
mkdir -p ${YT_CACHEDIR}
}
err () {
printf "err: %s\n" ${1}
[ -z "${2}" ] && exit 1
exit ${2}
}
sync () {
cache
for i in $(cat $YT_DATFILE | tr '\n' ' '); do
${YT_TORIFY} curl -s \
https://www.youtube.com/feeds/videos.xml?channel_id=$i\
> ${YT_CACHEDIR}/$i
done
}
id () {
${YT_TORIFY} curl "${1}" -s | \
grep 'youtube/www\.youtube\.com/channel/.\{24\}' -o | \
awk -F'/' '{print $NF}' | \
sed 1q
}
display () {
cache
tmp1=$(mktemp)
tmp2=$(mktemp)
for i in $(ls $YT_CACHEDIR | tr '\n' ' '); do
grep \<media:title\> ${YT_CACHEDIR}/$i | cut -c 17- | \
rev | cut -c 15- | rev >> $tmp1
grep 'link rel' ${YT_CACHEDIR}/$i | grep 'watch' | \
cut -c31- | rev | cut -c4- | rev >> $tmp2
done
cat $tmp1 $tmp2 | pr -2t -s" | "
}
add () { # $1: name of channel id
cache
printf "%s\n" $1 >> ${YT_DATFILE}
}
del () { # $1: line number of channel id
cache
sed -i "${1}d" ${YT_DATFILE}
}
cclear () {
rm -r ${YT_CACHEDIR}
}
case $1 in
"s"*)
sync
exit 0
;;
"a"*)
[ $# -eq 2 ] && add $2 || \
err "two args required"
exit 0
;;
"d"*)
[ $# -eq 2 ] && del $2 || \
err "two args required"
exit 0
;;
"h"*)
info
exit 0
;;
"i"*)
[ $# -eq 2 ] && id $2 || \
err "two args required"
exit 0
;;
"c"*)
cclear
exit 0
;;
*)
display
exit 0
;;
esac
exit 0