#! /usr/bin/env python
#
# A obpipemenu script for viewing a dir
# with a few options
#
import sys
import os
###
# Global Variables
###
VIDPRG = "vlc" #Program to open files
PYPIPE = str(os.path.abspath(__file__)) + " "
def recent_file_list(src):
files = []
os.chdir(src)
# Get a list of tuples of filenames and their times modified.
for fn in os.listdir(src):
mtime = os.path.getmtime(os.path.abspath(fn))
timename = mtime, fn
files.append(timename)
# Sort the list by times, newest first
recenttuples = sorted(files, reverse=True)
# Get the names only, ina new list
recents = [ t[1] for t in recenttuples ]
return recents
def printing(recents):
for f in recents:
if os.path.isdir(os.path.abspath(f)):
print_dir(f,PYPIPE)
else:
print_file(f,VIDPRG)
def print_file(fn,prg):
print '