aboutsummaryrefslogtreecommitdiff
path: root/news
blob: 67692401ed3238820568e9556d0e008a06fb2a24 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
#
# Wrapper for news application.
#

# Parameters
BASENAME="`basename $0`"
#APP="newsbeuter"
APP="newsboat"
OPML="$HOME/.custom/newsboat/opml.conf"

# Check config folder
if [ ! -e "$HOME/.custom/$APP" ]; then
  mkdir -p $HOME/.custom/$APP
fi

# Check data folder
if [ ! -e "$HOME/.local/share/$APP" ]; then
  mkdir -p $HOME/.local/share/$APP
fi

# Compile a list of OPMLs from the feeds repository, if available
if [ -d "$HOME/apps/dotfiles/modules/feeds" ]; then
  echo -n "opml-url " > $OPML
  find $HOME/apps/dotfiles/modules/feeds -name '*.opml' | while read item; do
    name="`basename $item .opml`"
    base="`dirname $item | sed -e 's/^\.//'`"

    # Skip the sample
    if [ "$name" = "sample" ]; then
      continue
    fi

    echo -n ' "' >> $OPML
    echo -n file://$item >> $OPML
    echo -n '"' >> $OPML
  done
  echo "" >> $OPML
fi

# Ensure a minimal config
if [ ! -e "$HOME/.custom/$APP/config" ]; then
  touch $HOME/.custom/$APP/config

  if [ -e "$OPML" ]; then
    echo "# Include some default OPML files"  > $HOME/.custom/$APP/config
    echo "include \"opml.conf\""             >> $HOME/.custom/$APP/config
  fi
fi

# Dispatch
# Put Tor config directly in $APP configuration
#TORSOCKS_DEBUG=-1 torify $APP
$APP