[Techtalk] anyone know of a simple text viewer?

Miriam English mim at miriam-english.org
Mon Jul 22 22:21:31 UTC 2019


Thanks Little Girl.

Multitail looks like a very useful tool for keeping watch on multiple 
logfiles at once. I'm glad you brought it to my notice. As you note 
though, it doesn't solve my current problem.

Paperbox looks like a database kind of solution, though I'm not sure. It 
appears to have gone commercial, which might be why free downloads are 
difficult to find. I watched the video and got the impression it is 
mostly suited to organising and linking to online documents, though I'm 
not sure. I'll look further into it.

Like you, I do most of my writing in Geany (I format it as HTML later 
with a simple script I wrote, then epub with Calibre). I didn't know you 
could open all the text files in a directory with Geany using a 
wildcard. Nice tip. Thank you. There is even a key combination for 
jumping between open tabs (I didn't know this -- just found it online).  
CTRL-PageUp for previous tab and CTRL-PageDown for next tab, which makes 
it really quick and easy to jump backward and forward between files. Nice.

I've been thinking of making a simple script to quickly and easily look 
at and edit the text information embedded in many files (jpg, png, mp3, 
mp4, avi, and epub).  Some time back I wrote a small script 
(mp3-set-tags) for mp3 files only. It uses exiftool to read the data, 
gtkdialog to display and edit the data, and idv3v2 to write it back. (It 
also needs sed version 4.2.2 or greater for -z option  though it can 
work with earlier versions -- uncomment line 143 and comment line 145 
for older versions of sed.) I've attached "mp3-set-tags" to this email 
if anybody is interested.

Thinking on this further... I could probably write a simple script to 
let me quickly flip through text files using gtkdialog....

The collection managers GCstar and Tellico look interesting. I got the 
source for GCstar, but wasn't able to "make" its dependencies. I haven't 
looked at Tellico yet.

Thanks for the leads and info.

Best wishes,

     - Miriam


Little Girl wrote:
> Hey there,
>
> Miriam English wrote:
>
>> Optimal would be something that works in a similar way to image
>> viewers which let me see one file after another by pressing the
>> spacebar (or backspace to view the previous file), though the actual
>> key(s) used don't need to be those. The next and previous commands
>> ":n" and ":p" are a bit cumbersome compared with being able to
>> quickly and repeatedly hit the spacebar to jump through files. I
>> have many thousands of small text files that I collect in many
>> subdirectories under my "ideas" directory. When I'm writing I often
>> go through them looking for useful material. It is a slow,
>> repetitive, and clumsy process. I just wanted something to make it
>> easier.
> Neither of my suggestions are ideal, but maybe they'll do for the
> moment:
>
> You might want to try multitail. It's a command-line program to
> monitor multiple files at once. It's a bit awkward in that you have
> to use Ctrl commands to work parts of it, but it allows you to browse
> a bunch of files at once and, at any time, single one out to scroll
> through it in its entirety.
>
> Another possibility is PaperBox, which is an open-source document
> viewer for GNU/Linux. It's listed on the
> https://www.gnome-look.org/p/1129217/ page, but the download link
> isn't working. You can click the Files tab to get at some archives,
> though, but I didn't try downloading them.
>
> There's a video about PaperBox on the
> https://www.youtube.com/watch?v=6pDbreBzcrs page, showing its basic
> use. Last, but not least, if the downloads above don't work, a search
> for "gnome paperbox" in Google will turn it up in some more
> locations. For the record, it's not in the Ubuntu MATE 16.04
> repositories.
>
>> There are many other situations that would be helped by this too. I
>> try to keep text descriptions of all videos, photos, diagrams,
>> talks, ebooks on my computer.
> I also keep a lot of text files on my computer and am often looking
> through them. I usually grep them to find what I'm specifically
> looking for and follow that by opening them in a text editor if I
> want to have a deeper look at the surrounding text. I get the
> impression you're looking for something a bit different, though, where
> you can just randomly browse through the contents of files for
> inspiration rather than doing a targeted search. Grep won't help with
> that and text editors are a bit cumbersome.
>
> That said, my preference is for using Geany to read text files when
> I want to browse. After all, I inevitably find something I want to
> change in a text file I've written or archived, and it's handy to
> already be in a program that can do that.
>
> My preferred method for opening a bunch of files in the current
> directory in Geany, each in a separate tab, is:
>
> geany *.txt
>
> That can also be done this way, which will also open them all at
> once, each in its own tab, in Geany:
>
> for f in *.txt; do geany "$f"; done;
>
> You can probably use either or both of those commands with
> pretty much any tabbed editor and, of course, be more specific than
> *.txt when wanting to browse certain directories.
>
>> Linux would be greatly improved with a simple method of attaching
>> text descriptions to all those things. I know jpeg and png images,
>> and mp3 audio, and some video formats, and epub ebooks can have
>> descriptive text embedded in the files themselves, but reading those
>> descriptions is a major pain, and editing them is even more so.
>> Searching them is very inefficient.
> It's probably scriptable to get at that kind of embedded information,
> but you'd have to find out how to access each individual kind of
> information and tailor the script to do it. It would be nice to have
> a universal program that could do it with some check boxes for
> choosing the desired file types.
>
>> My description text files are also useful because they let me easily
>> search for information. I keep many terabytes of data on my computer
>> and this helps me tame the information monster and stop it getting
>> out of control.
> One last thing I thought I'd mention is collection managers (like
> GCstar or Tellico, for example). I'm not sure how well any of them
> would work for what you're trying to do, but it's worth a look
> through all of the possibilities to see if you can find one that might
> just import all your text files and make them viewable.
>

-- 
The only person that you should try to be better than is the person you were yesterday.
  -- Ain Eineziz

-------------- next part --------------
#! /bin/sh

## mp3-set-tags
## by Miriam English
## 2011-07-17, 2014-08-06
##
## A GUI to write some of the more important ID3v2 tags to mp3 files
## updated later to let it store and display single newlines
##
## depends: exiftool, gtkdialog, id3v2, libid3-3.8.so.3 (for id3v2)
##          sed (version 4.2.2 or greater for -z option)
#
# todo:
#	- count length of lines in comment to widen the text area
#

fname=`basename "$1"`
#Tags for \"$1\" "
#Title:        "
ttitle="`exiftool -S -s -Title \"$1\"`"
#Person:       "
tartist="`exiftool -S -s -Artist \"$1\"`"
#old filename: "
tfilename="`exiftool -S -s -Subtitle \"$1\"`"
#Show:         "
talbum="`exiftool -S -s -Album \"$1\"`"
#Date:         "
tdate="`exiftool -S -s -Year \"$1\"`"
#Genre:        "
tgenre="`exiftool -S -s -Genre \"$1\"`"

#Comment:      "
#tcomment="`exiftool -S -s -Comment \"$1\"`"

exiftool -S -s -Comment "$1" | sed 's/\\n/\n/g' >/tmp/comment.txt
tcomment="`cat /tmp/comment.txt`"

##debugging
#cat /tmp/comment.txt
#exit

export MAIN_DIALOG="
<window title=\"mp3-set-tags\" icon-name=\"stock_insert-sound-plugin\">
	<vbox>
		<hbox>
			<frame File:>
				<text>
					<label>\"$fname\"</label>
				</text>
			</frame>
		</hbox>
		<hbox>
			<text>
				<label>Title:</label>
			</text>
			<entry>
				<default>\"$ttitle\"</default>
				<variable>ENTRY1</variable>
			</entry>
		</hbox>
		<hbox>
			<text>
				<label>Person:</label>
			</text>
			<entry>
				<default>\"$tartist\"</default>
				<variable>ENTRY2</variable>
			</entry>
		</hbox>
		<hbox>
			<text>
				<label>old filename:</label>
			</text>
			<entry>
				<default>\"$tfilename\"</default>
				<variable>ENTRY3</variable>
			</entry>
		</hbox>
		<hbox>
			<text>
				<label>Show or album:</label>
			</text>
			<entry>
				<default>\"$talbum\"</default>
				<variable>ENTRY4</variable>
			</entry>
		</hbox>
		<hbox>
			<text>
				<label>Date:</label>
			</text>
			<entry>
				<default>\"$tdate\"</default>
				<variable>ENTRY5</variable>
			</entry>
		</hbox>
		<hbox>
			<text>
				<label>Genre:</label>
			</text>
			<entry>
				<default>\"$tgenre\"</default>
				<variable>ENTRY6</variable>
			</entry>
		</hbox>
		<hbox>
			<frame Comments:>
				<text>
					<label>\"Double quotes converted to 2xsingle quotes.
Colon (:) is converted to dash (-).\"</label>
				</text>
			</frame>
		</hbox>
		<edit>
			<width>400</width><height>150</height>
			<default>\"$tcomment\"</default>
			<variable>ENTRY7</variable>
		</edit>
		<hbox>
			<button>
				<label>Don't Alter</label>
			</button>
			<button>
				<label>Write</label>
			</button>
		</hbox>
	</vbox>
</window>
"


I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog --program MAIN_DIALOG); do
	eval $STATEMENTS
done
IFS=$I

SEP=$'\x01'

if [ "$EXIT" = "Write" ]; then

	# earlier hack using old sed - had to translate newlines first
	#echo "$ENTRY7" | tr "\\n" "$SEP" | sed "s/$SEP$SEP/\\\\n\\\\n/g; s/ $SEP/ /g; s/$SEP / /g; s/$SEP/ /g" >/tmp/comment.txt

	echo "$ENTRY7" | sed -z 's/\n/\\n/g ; s/:/ -/g' | sed "s/\"/''/g" >/tmp/comment.txt

	## debugging
	#echo "$ENTRY7"
	#cat /tmp/comment.txt
	#exit


	# id3v2 parameters are:
	#	-t	title of track
	#	-a	person/artist/group
	#	--TIT3	old filename or Subtitle/Description
	#	-A	album
	#	-y	year
	#	-g	genre
	#	-c	comment
	id3v2 -t "$ENTRY1" -a "$ENTRY2" --TIT3 "$ENTRY3" -A "$ENTRY4" -y "$ENTRY5" -g "$ENTRY6" -c "`cat /tmp/comment.txt`" "$1"

fi


More information about the Techtalk mailing list