mirror of
				https://github.com/arsenetar/dupeguru.git
				synced 2025-09-11 17:58:17 +00:00 
			
		
		
		
	[#41 state:fixed] Added error handling + logging for GetDisplayInfo()
--HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40110
This commit is contained in:
		
							parent
							
								
									44ecae2657
								
							
						
					
					
						commit
						e5015d85b9
					
				| @ -87,6 +87,15 @@ class DupeGuru(RegistrableApplication): | |||||||
|         for file in j.iter_with_progress(files, 'Reading metadata %d/%d'): |         for file in j.iter_with_progress(files, 'Reading metadata %d/%d'): | ||||||
|             file._read_all_info(sections=[IT_ATTRS, IT_EXTRA]) |             file._read_all_info(sections=[IT_ATTRS, IT_EXTRA]) | ||||||
|      |      | ||||||
|  |     def _get_display_info(self, dupe, group, delta=False): | ||||||
|  |         if (dupe is None) or (group is None): | ||||||
|  |             return ['---'] * len(self.data.COLUMNS) | ||||||
|  |         try: | ||||||
|  |             return self.data.GetDisplayInfo(dupe, group, delta) | ||||||
|  |         except Exception as e: | ||||||
|  |             logging.warning(u'Exception on GetDisplayInfo for %s: %s', unicode(dupe.path), unicode(e)) | ||||||
|  |             return ['---'] * len(self.data.COLUMNS) | ||||||
|  |      | ||||||
|     def _get_file(self, str_path): |     def _get_file(self, str_path): | ||||||
|         p = Path(str_path) |         p = Path(str_path) | ||||||
|         for d in self.directories: |         for d in self.directories: | ||||||
| @ -185,7 +194,7 @@ class DupeGuru(RegistrableApplication): | |||||||
|         rows = [] |         rows = [] | ||||||
|         for group in self.results.groups: |         for group in self.results.groups: | ||||||
|             for dupe in group: |             for dupe in group: | ||||||
|                 data = self.data.GetDisplayInfo(dupe, group) |                 data = self._get_display_info(dupe, group) | ||||||
|                 row = [data[colid] for colid in column_ids] |                 row = [data[colid] for colid in column_ids] | ||||||
|                 row.insert(0, dupe is not group.ref) |                 row.insert(0, dupe is not group.ref) | ||||||
|                 rows.append(row) |                 rows.append(row) | ||||||
|  | |||||||
| @ -100,9 +100,9 @@ class DupeGuru(app.DupeGuru): | |||||||
|         return self.GetDirectory(node_path[1:],d) |         return self.GetDirectory(node_path[1:],d) | ||||||
|      |      | ||||||
|     def RefreshDetailsTable(self,dupe,group): |     def RefreshDetailsTable(self,dupe,group): | ||||||
|         l1 = self.data.GetDisplayInfo(dupe,group,False) |         l1 = self._get_display_info(dupe, group, False) | ||||||
|         if group is not None: |         if group is not None: | ||||||
|             l2 = self.data.GetDisplayInfo(group.ref,group,False) |             l2 = self._get_display_info(group.ref, group, False) | ||||||
|         else: |         else: | ||||||
|             l2 = l1 #To have a list of empty '---' values |             l2 = l1 #To have a list of empty '---' values | ||||||
|         names = [c['display'] for c in self.data.COLUMNS] |         names = [c['display'] for c in self.data.COLUMNS] | ||||||
| @ -265,7 +265,7 @@ class DupeGuru(app.DupeGuru): | |||||||
|             else: |             else: | ||||||
|                 d = self.results.dupes[node_path[0]] |                 d = self.results.dupes[node_path[0]] | ||||||
|                 g = self.results.get_group_of_duplicate(d) |                 g = self.results.get_group_of_duplicate(d) | ||||||
|             result = self.data.GetDisplayInfo(d, g, self.display_delta_values) |             result = self._get_display_info(d, g, self.display_delta_values) | ||||||
|             return result |             return result | ||||||
|         elif tag == 1: #Directories |         elif tag == 1: #Directories | ||||||
|             try: |             try: | ||||||
|  | |||||||
| @ -53,9 +53,7 @@ COLUMNS = [ | |||||||
|     {'attr':'dupe_count','display':'Dupe Count'}, |     {'attr':'dupe_count','display':'Dupe Count'}, | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| def GetDisplayInfo(dupe, group, delta=False): | def GetDisplayInfo(dupe, group, delta): | ||||||
|     if (dupe is None) or (group is None): |  | ||||||
|         return ['---'] * len(COLUMNS) |  | ||||||
|     size = dupe.size |     size = dupe.size | ||||||
|     ctime = dupe.ctime |     ctime = dupe.ctime | ||||||
|     mtime = dupe.mtime |     mtime = dupe.mtime | ||||||
|  | |||||||
| @ -33,9 +33,7 @@ COLUMNS = [ | |||||||
|     {'attr':'dupe_count','display':'Dupe Count'}, |     {'attr':'dupe_count','display':'Dupe Count'}, | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| def GetDisplayInfo(dupe, group, delta=False): | def GetDisplayInfo(dupe, group, delta): | ||||||
|     if (dupe is None) or (group is None): |  | ||||||
|         return ['---'] * len(COLUMNS) |  | ||||||
|     size = dupe.size |     size = dupe.size | ||||||
|     duration = dupe.duration |     duration = dupe.duration | ||||||
|     bitrate = dupe.bitrate |     bitrate = dupe.bitrate | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user