Upload files to ''
This commit is contained in:
parent
90309b7991
commit
d7abdb22c4
5 changed files with 79 additions and 1 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 Maxwell Drake
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,2 +1,6 @@
|
|||
# rssgen
|
||||
# rss-generator
|
||||
Easy to use bash scripts that generate neat RSS feeds for you. Open source.
|
||||
|
||||
## Dependencies
|
||||
A basic GNU/Linux system.
|
||||
BASH.
|
||||
|
|
20
gen-boilerplate.sh
Normal file
20
gen-boilerplate.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
read -p "Enter filename [feed.xml]: " fname
|
||||
fname=${fname:-"feed.xml"}
|
||||
|
||||
bptemplate=$(cat "template.xml.dontchange")
|
||||
|
||||
read -p "Enter channel title: " rsschanneltitle
|
||||
read -p "Enter the main url for your site: " rssmainpage
|
||||
read -p "Enter channel description: " rsschanneldescription
|
||||
read -p "Enter channel language [en-us]: " rsschannellang
|
||||
rsschannellang=${rsschannellang:-"en-us"}
|
||||
|
||||
bpfinal=$(echo "${bptemplate/rss-channel-lang/$rsschannellang}")
|
||||
bpfinal=$(echo "${bpfinal/rss-channel-title/$rsschanneltitle}")
|
||||
bpfinal=$(echo "${bpfinal/rss-channel-description/$rsschanneldescription}")
|
||||
bpfinal=$(echo "${bpfinal/rss-mainpage/$rssmainpage}")
|
||||
|
||||
echo $bpfinal > $fname
|
||||
|
||||
echo Done generating boilerplate, now making first post...
|
||||
./post.sh $fname
|
6
post-template.xml.dontchange
Normal file
6
post-template.xml.dontchange
Normal file
|
@ -0,0 +1,6 @@
|
|||
<item>
|
||||
<title>post-title</title>
|
||||
<author>post-author</author>
|
||||
<description>post-content</description>
|
||||
<pubDate>post-date</pubDate>
|
||||
</item></channel>
|
27
post.sh
Normal file
27
post.sh
Normal file
|
@ -0,0 +1,27 @@
|
|||
posttemplate=$(cat "post-template.xml.dontchange")
|
||||
fname=$1
|
||||
read -p "Enter post title: " rssposttitle
|
||||
read -p "Enter post author email: " rsspostauthor
|
||||
read -p "Press ENTER to use nano to enter post contents..."
|
||||
randomfn="/tmp/post-content-$RANDOM"
|
||||
nano $randomfn
|
||||
rsspostcontent=$(cat $randomfn)
|
||||
|
||||
echo A1
|
||||
rsspostdate=$(date -R)
|
||||
echo A2
|
||||
postfinal=$(echo "${posttemplate/post-title/$rssposttitle}")
|
||||
echo A3
|
||||
postfinal=$(echo "${postfinal/post-author/$rsspostauthor}")
|
||||
echo A4
|
||||
postfinal=$(echo "${postfinal/post-content/$rsspostcontent}")
|
||||
echo A5
|
||||
postfinal=$(echo "${postfinal/post-date/$rsspostdate}")
|
||||
|
||||
oldcontent=$(cat $fname)
|
||||
echo "${oldcontent/'</channel>'/$postfinal}" > $fname
|
||||
|
||||
echo Done.
|
||||
echo Note that to use this post script in the future, you must specify a filename
|
||||
echo Example:
|
||||
echo "./post.sh $1"
|
Loading…
Reference in a new issue