NanoNote: selecting of PDF file for viewing

There is one problem with the NanoNote: the PDF viewer (nupdf), the video player (mplayer) and several other programs have no easy tool for browsing and opening of files.

It is not a problem for most current user because the file to be opened can always be specified from the command line. But non-geek usually want to have something more “user friendly”.

So I have started to search a simple file browser (yes, there is at leat the Midnight Commander but it is too powerfull for such task). T Jlime has a very nice file picker ( a SDL-based fileselector). I have spent some time when attempting to make it work under the OpenWRT but without success, yet (it might be my fault).

The I have started to make a simple script which utilises the dialog program for actual file picking. It’s not that cool, it’s even somewhat ugly but it works (well, at least it works for me).

Simple list of files for NanoNote

I have had to make two files. The first one is the actual script (/usr/bin/pick-pdf):

#! /bin/bash

export CMD=nupdf
export EXT=pdf

export i=0

echo " "
echo "Searching for *.$EXT files. It may take a while..."
echo " "

rm -f /tmp/fsel.tmp 2>/dev/null
touch /tmp/fsel.tmp
for aa in `find . -name "*.$EXT" -print` ;do i=`expr $i + 1` ; echo $i $aa >>/tmp/fsel.tmp ;done
export B=`cat /tmp/fsel.tmp`
export A=`dialog --menu "Select a File" 0 50 20 $B --stdout`

if test $A > 0
export C=`grep "^$A" /tmp/fsel.tmp`
export D=`echo $C | cut -d' ' -f2 -`
echo "No file selected!"

And the second one is a starter for the Gmenu2x (/usr/share/gmenu2x/sections/applications/pickpdf):


And that is all. There are many things to improve, of course. But it is also possible to modify the script for other programs and file types.

NanoNote: selecting of PDF file for viewing

2 thoughts on “NanoNote: selecting of PDF file for viewing

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s