aboutsummaryrefslogtreecommitdiff
path: root/compile
blob: e707ec9439bbbac5e2d21a4d40609558de9b5db4 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env sh
#
# Compile an OPML including all other OPML files.
#

# Parameters
BASENAME="`basename $0`"
DIRNAME="`dirname $0`"
OUT="$DIRNAME/all.opml"
BASE_URL="https://git.fluxo.info/feeds/plain/"

# Header
cat <<-EOF > $OUT
<?xml version="1.0"?>
<opml version="2.0">
  <head>
    <title>All Feeds</title>
  </head>
  <body>
EOF

# Contend
find $DIRNAME -name '*.opml' | while read item; do
  name="`basename $item .opml`"
  base="`dirname $item | sed -e 's/^\.//'`"

  # Avoid recursion
  if [ "$name" = "all" ]; then
    continue
  fi

  #echo "    <outline type=\"include\" url=\"${item}\" title=\"${base}/${name}\"/>" >> $OUT
  #echo "    <outline type=\"include\" url=\"${item}\"/>" >> $OUT
  echo "    <outline type=\"link\" url=\"${BASE_URL}${base}${name}.opml\" text=\"${base}/${name}\"/>" >> $OUT
done

# Footer
cat <<-EOF >> $OUT
  </body>
</opml>
EOF