From dea78021271bb61f720f63f9ba3829432328bd8f Mon Sep 17 00:00:00 2001 From: Jan Krcmar Date: Tue, 28 Sep 2010 15:31:47 +0200 Subject: [PATCH] new features filechooser ignores filenames with bad characters (ord > 128) tv script uses cvlc with ncurses interface --- bin/tv | 2 +- filechooser.py | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/bin/tv b/bin/tv index 93d679f..715b4e1 100755 --- a/bin/tv +++ b/bin/tv @@ -2,7 +2,7 @@ # mplayer parametres #prms="-stereo 1 -vf pp=lb -cache 2048" -prms="--video-filter=deinterlace --deinterlace-mode=blend -f" +prms="--extraintf ncurses --video-filter=deinterlace --deinterlace-mode=blend -f" conf="$HOME/bin/tv.conf" # shows all available channels diff --git a/filechooser.py b/filechooser.py index 17e15ea..0ce288b 100644 --- a/filechooser.py +++ b/filechooser.py @@ -6,7 +6,11 @@ import string class FileChooser(): def __init__(self): - self.allowed_prefix = [ '/mnt/data', '/home/ftp/serialy' ] + self.allowed_prefix = [ + '/mnt/data', + '/home/ftp/serialy', + '/mnt/kesunka/serialy', + ] self.cpath = self.allowed_prefix[0] def getAllowed(self): @@ -32,10 +36,17 @@ class FileChooser(): return False def getList(self): - out = os.listdir(self.cpath) - out.sort() + out = self.transformList(os.listdir(self.cpath)) return out + def transformList(self, list): + out = [] + list.sort() + for d in list: + if all(ord(c) < 128 for c in d): + out.append(d) + return out + if __name__ == "__main__": fc = FileChooser() -- 2.11.4.GIT