From 28be5c6bd3e33aa007a2fbfc8f53ef6bc875e98f Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Tue, 21 Oct 2014 15:34:10 -0400 Subject: [PATCH] CC-5929: Certain long filenames can result in the extension getting cut off --- .../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 de296e092..79c288124 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/filemover_analyzer.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/filemover_analyzer.py @@ -42,14 +42,16 @@ class FileMoverAnalyzer(Analyzer): # 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 + max_dir_len = 48 + max_file_len = 48 final_file_path = import_directory + orig_file_basename, orig_file_extension = os.path.splitext(original_filename) if metadata.has_key("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"][0:max_dir_len] - final_file_path += "/" + original_filename[0:max_file_len] + final_file_path += "/" + metadata["album_title"][0:max_dir_len] + # Note that orig_file_extension includes the "." already + final_file_path += "/" + orig_file_basename[0:max_file_len] + orig_file_extension #Ensure any redundant slashes are stripped final_file_path = os.path.normpath(final_file_path)