#!/bin/bash
# /usr/local/bin/mediascan
# http://crystalfaeries.net/posix/bin/mediascan
# celeste:crystalfaery 2016-04-12 15:56:01+00:00
# mediascan is spawned nightly from cron on each computer on our LAN,
# (from which, we may have cross-mounted via sshfs certain directory trees,
# (which we wish to have scanned locally rather than across the LAN),
# or upon which we may have CIFS-mounted NAS volumes),
# to generate within relevant directory trees
# a recent-within-1-day index of contained "media files",
# which collectively may then be used by other scripts
# to present to users a sorted collection of specific media types.
#
# NOTE: WE HAVE DONE SOMETHING SIMILAR BEFORE, AND HAVE LAYING AROUND
# PRESENTLY-UNUSED SCRIPTS TO CANNIBALIZE OR DISCARD AS OBSOLETE
#
# This WILL BE replacing on-demand scanning from existing scripts:
# newest (VIM newest text and scripts (e.g. todo list))
# oldest (VIM oldest text and scripts (orphaned / ignored))
# audition (edit smallest AUDACITY project)
# monitor (show largest AUDIO or VIDEO)
# pdfs (show largest ACROBAT READER documents, obsoleted
# now that we imported all .pdfs into calibre)
# prune_downloaded_images (largest .gif .pnm .PNG .JPG .svg ...etc.)
#
# Ideally we should automagically parse our local tree of mount points
# in order to determine which subtrees to scan versus which to ignore.
#
# Since we already have a habit of littering ".du.txt" files around,
# (generated with "dudir" script) those MAY BE what we wish to generate.
# The primary consideration is in parsing those, can we discern
# directory entries from file entries, for which purpose,
# we would like to see all listed directories ending with a "/" character.
# THEREFORE, before proceeding to code in this script
# REWRITE as necessary the dudir script to guarantee that result!
let return_code=0 # default to success
# DEBUGGING EXIT # THIS IS AS FAR AS WE HAVE DEBUGGED CODE in LIVE cron-driven script
exit $return_code # THIS SCRIPT IS LIVE IN OUR CRON FILES!
# DEBUGGING EXIT # THIS IS AS FAR AS WE HAVE DEBUGGED CODE in LIVE cron-driven script
syntax highlighted by Code2HTML, v. 0.9.1