Update of /cvsroot/freevo/freevo/src/tv
In directory sc8-pr-cvs1:/tmp/cvs-serv3519
Modified Files:
tv_util.py
Log Message:
Initial implementation of user configurable naming styles for recording
filenames. The 'mask' variable should move into config, but due to Dischi's
changes yesterday, I don't want to do it until he lets me know how things
like this should work?
(Namely, he suggested less variables in freevo_config, in which case I don't
know where they should go)
Index: tv_util.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/tv_util.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** tv_util.py 8 Sep 2003 19:44:44 -0000 1.7
--- tv_util.py 11 Sep 2003 13:58:06 -0000 1.8
***************
*** 7,10 ****
--- 7,19 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.8 2003/09/11 13:58:06 outlyer
+ # Initial implementation of user configurable naming styles for recording
+ # filenames. The 'mask' variable should move into config, but due to Dischi's
+ # changes yesterday, I don't want to do it until he lets me know how things
+ # like this should work?
+ #
+ # (Namely, he suggested less variables in freevo_config, in which case I don't
+ # know where they should go)
+ #
# Revision 1.7 2003/09/08 19:44:44 dischi
# exception handling, just in case...
***************
*** 54,57 ****
--- 63,83 ----
FALSE = 0
+ def progname2filename(progname):
+ '''Translate a program name to something that can be used as a filename.'''
+
+ # Letters that can be used in the filename
+ ok = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
+
+ s = ''
+ for letter in progname:
+ if letter in ok:
+ s += letter
+ else:
+ if s and s[-1] != '_':
+ s += '_'
+
+ return s
+
+
def getKey(prog=None):
***************
*** 75,80 ****
if not prog:
return 'ERROR: no prog'
! return '%s--%s' % (prog.title, time.strftime('%Y-%m-%d-%H%M',
time.localtime(prog.start)))
--- 101,113 ----
if not prog:
return 'ERROR: no prog'
+
+ mask = '%%m-%%d %%H:%%M %(progname)s - %(title)s'
+ filename_array = { 'progname': prog.title,
+ 'title' : prog.sub_title }
! filemask = mask % filename_array
! filemask = time.strftime(filemask, time.localtime(prog.start))
! filename = progname2filename(filemask)
! return filename
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog