From 2af492960ead4f6b720e648af92b412fa7221b5c Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Sun, 23 Nov 2008 21:14:15 +0000 Subject: [PATCH] Added a "destination" property to favourites and programmes, which allows you to specify a subdirectory into which the converted programme will be put when it is converted. --- src/rtv_convert.py | 12 ++++++++++-- src/rtv_programmeinfo.py | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/rtv_convert.py b/src/rtv_convert.py index a9bb923..600f060 100644 --- a/src/rtv_convert.py +++ b/src/rtv_convert.py @@ -33,13 +33,21 @@ def _get_flv_file_path( rtvinfo, fallback_filename ): else: unsan_file = startTime + "_" + proginfo.channel - ret_dir = _sanitise_filename( proginfo.title, 40 ) + progname_dir = _sanitise_filename( proginfo.title, 40 ) + + if proginfo.destination: + ret_dir = os.path.join( + _sanitise_filename( proginfo.destination, 40 ), + progname_dir ) + else: + ret_dir = progname_dir + return ( ret_dir, os.path.join( ret_dir, _sanitise_filename( unsan_file, 40 ) ) ) def _delete_empty_dirs( config ): for ( dirpath, dirnames, filenames ) in os.walk( config.converted_progs_dir ): - if len( filenames ) == 0: + if len( filenames ) == 0 and len( dirnames ) == 0: empty_dir_name = os.path.join( config.converted_progs_dir, dirpath ) print "Removing empty directory '%s'" % empty_dir_name diff --git a/src/rtv_programmeinfo.py b/src/rtv_programmeinfo.py index 3730c14..373a2a5 100644 --- a/src/rtv_programmeinfo.py +++ b/src/rtv_programmeinfo.py @@ -16,6 +16,7 @@ class ProgrammeInfo( rtv_propertiesfile.PropertiesFile ): self.atJob = None self.deleteTime = None self.priority = None + self.destination = None def clashes_with( self, otherPi ): -- 2.11.4.GIT