From 4548123ad9dea8e89ba1cb507b75941f69cbb676 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Tue, 3 Jun 2014 11:41:45 -0400 Subject: [PATCH] CC-5861: Long file paths will cause analyzer error * Fixed it --- .../airtime_analyzer/filemover_analyzer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python_apps/airtime_analyzer/airtime_analyzer/filemover_analyzer.py b/python_apps/airtime_analyzer/airtime_analyzer/filemover_analyzer.py index b0d94ee79..de296e092 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/filemover_analyzer.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/filemover_analyzer.py @@ -41,13 +41,15 @@ class FileMoverAnalyzer(Analyzer): #Import the file over to it's final location. # TODO: Also, handle the case where the move fails and write some code # to possibly move the file to problem_files. - + + max_dir_len = 32 + max_file_len = 32 final_file_path = import_directory if metadata.has_key("artist_name"): - final_file_path += "/" + metadata["artist_name"] + final_file_path += "/" + metadata["artist_name"][0:max_dir_len] # truncating with array slicing if metadata.has_key("album_title"): - final_file_path += "/" + metadata["album_title"] - final_file_path += "/" + original_filename + final_file_path += "/" + metadata["album_title"][0:max_dir_len] + final_file_path += "/" + original_filename[0:max_file_len] #Ensure any redundant slashes are stripped final_file_path = os.path.normpath(final_file_path)