* morituri/common/common.py:

Add shrinkPath to write shorter path names.
	* morituri/test/test_common_common.py (added):
	  Add test.
	* morituri/program/cdparanoia.py:
	  Catch ENAMETOOLONG and shrink path.
	* morituri/common/program.py:
	  Update track result's filename if it was shrunk.
	* morituri/rip/cd.py:
	  set the possibly shrunk path on the result.
This commit is contained in:
Thomas Vander Stichele
2011-09-18 15:19:45 +00:00
parent 4fdfb7f58c
commit 2c27b73d09
6 changed files with 78 additions and 4 deletions

View File

@@ -21,6 +21,7 @@
# along with morituri. If not, see <http://www.gnu.org/licenses/>.
import os
import errno
import re
import stat
import shutil
@@ -478,6 +479,10 @@ class ReadVerifyTrackTask(log.Loggable, task.MultiSeparateTask):
try:
self.debug('Moving to final path %r', self.path)
shutil.move(self._tmppath, self.path)
except IOError, e:
if e.errno == errno.ENAMETOOLONG:
self.path = common.shrinkPath(self.path)
shutil.move(self._tmppath, self.path)
except Exception, e:
self.debug('Exception while moving to final path %r: %r',
self.path, log.getExceptionMessage(e))