def __get_stat_line(self): if self.__filtered_dupes is None: mark_count = self.mark_count marked_size = self.__marked_size total_count = self.__total_count total_size = self.__total_size else: mark_count = len([ dupe for dupe in self.__filtered_dupes if self.is_marked(dupe) ]) marked_size = sum(dupe.size for dupe in self.__filtered_dupes if self.is_marked(dupe)) total_count = len([ dupe for dupe in self.__filtered_dupes if self.is_markable(dupe) ]) total_size = sum(dupe.size for dupe in self.__filtered_dupes if self.is_markable(dupe)) if self.mark_inverted: marked_size = self.__total_size - marked_size result = tr("%d / %d (%s / %s) duplicates marked.") % ( mark_count, total_count, format_size(marked_size, 2), format_size(total_size, 2), ) if self.__filters: result += tr(" filter: %s") % ' --> '.join(self.__filters) return result
def __GetStatsLine(self): if self.allconflicts: return "%s (%d conflicts), %s, %s" % ( pluralize(self.get_stat('filecount'), 'song'), len(self.allconflicts), format_time_decimal(self.get_stat('duration')), format_size(self.get_stat('size'), 2)) else: return "%s, %s, %s" % ( pluralize(self.get_stat('filecount'), 'song'), format_time_decimal(self.get_stat('duration')), format_size(self.get_stat('size'), 2))
def get_display_info(self, group, delta): size = self.size mtime = self.mtime dimensions = self.dimensions m = group.get_match_of(self) if m: percentage = m.percentage dupe_count = 0 if delta: r = group.ref size -= r.size mtime -= r.mtime dimensions = get_delta_dimensions(dimensions, r.dimensions) else: percentage = group.percentage dupe_count = len(group.dupes) dupe_folder_path = getattr(self, "display_folder_path", self.folder_path) return { "name": self.name, "folder_path": str(dupe_folder_path), "size": format_size(size, 0, 1, False), "extension": self.extension, "dimensions": format_dimensions(dimensions), "exif_timestamp": self.exif_timestamp, "mtime": format_timestamp(mtime, delta and m), "percentage": format_perc(percentage), "dupe_count": format_dupe_count(dupe_count), }
def get_display_info(self, group, delta): size = self.size mtime = self.mtime dimensions = self.dimensions m = group.get_match_of(self) if m: percentage = m.percentage dupe_count = 0 if delta: r = group.ref size -= r.size mtime -= r.mtime dimensions = get_delta_dimensions(dimensions, r.dimensions) else: percentage = group.percentage dupe_count = len(group.dupes) dupe_folder_path = getattr(self, 'display_folder_path', self.folder_path) return { 'name': self.name, 'folder_path': str(dupe_folder_path), 'size': format_size(size, 0, 1, False), 'extension': self.extension, 'dimensions': format_dimensions(dimensions), 'exif_timestamp': self.exif_timestamp, 'mtime': format_timestamp(mtime, delta and m), 'percentage': format_perc(percentage), 'dupe_count': format_dupe_count(dupe_count), }
def GetLocationData(self, location): return [ location.name, location.get_stat('filecount'), format_size(location.get_stat('size'), 2, 3, False), location.is_removable, location.is_available, str(location.physical_path) ]
def _getData(self): song = self.ref return [ song.name, song.original.parent_volume.name, 0, format_size(song.size, 2, 2, False), format_time(song.duration, with_hours=False), ]
def GetLocationData(self, location): return [ location.name, location.get_stat('filecount'), format_size(location.get_stat('size'),2,3,False), location.is_removable, location.is_available, str(location.physical_path) ]
def GetSelectionInfo(self, item): def output_stats(info, item): info.append(('Size', format_size(item.get_stat('size'), 2))) info.append(('Time', format_time(item.get_stat('duration'), with_hours=False))) info.append(('Extensions', ','.join(item.get_stat('extension', [])))) info.append(('# Artists', len(item.get_stat('artist', [])))) info.append(('# Albums', len(item.get_stat('album', [])))) info.append(('# Genres', len(item.get_stat('genre', [])))) stats = item.get_stat('year', []) years = [tryint(s) for s in stats if s] if not years: years = [0] minyear = min(years) maxyear = max(years) info.append(('Years', "%d - %d" % (minyear, maxyear))) new_info = [] if isinstance(item, list) and (len(item) == 1): item = item[0] if isinstance(item, list): if item: new_item = StatsList() #remove all items with their parent in the list new_item += [ child for child in item if child.parent not in item ] new_info.append(('Selection', "%d selected" % len(item))) filecount = new_item.get_stat('filecount') if filecount is None: filecount = 0 filecount += len( [child for child in new_item if not child.is_container]) new_info.append(('Songs', filecount)) output_stats(new_info, new_item) elif item.is_container: new_info.append(('Path', str(item.path[1:]))) new_info.append(('Songs', item.get_stat('filecount'))) output_stats(new_info, item) else: new_info.append(('Filename', item.name)) new_info.append(('Directory', str(item.parent.path[1:]))) new_info.append(('Title', item.title)) new_info.append(('Artist', item.artist)) new_info.append(('Album', item.album)) new_info.append(('Genre', item.genre)) new_info.append(('Year', item.year)) new_info.append(('Track', "%02d" % item.track)) new_info.append(('Size', format_size(item.size, 2))) new_info.append( ('Time', format_time(item.duration, with_hours=False))) new_info.append(('Bitrate', item.bitrate)) new_info.append(('Comment', item.comment)) return new_info
def _getData(self): folder = self.ref parent_volumes = dedupe(song.original.parent_volume for song in folder.iterallfiles()) return [ folder.name, ','.join(l.name for l in parent_volumes), folder.get_stat('filecount'), format_size(folder.get_stat('size'), 2, 2, False), format_time(folder.get_stat('duration')), ]
def get_display_info(self, group, delta): size = self.size m = group.get_match_of(self) if m and delta: r = group.ref size -= r.size return { 'name': self.name, 'folder_path': str(self.folder_path), 'size': format_size(size, 0, 1, False), 'extension': self.extension if hasattr(self, 'extension') else '---', }
def get_display_info(self, group, delta): size = self.size m = group.get_match_of(self) if m and delta: r = group.ref size -= r.size return { "name": self.name, "folder_path": str(self.folder_path), "size": format_size(size, 0, 1, False), "extension": self.extension if hasattr(self, "extension") else "---", }
def GetNodeData(self, node): if node.is_container: img_name = 'folder_conflict_16' if node.allconflicts else 'folder_16' parent_volumes = dedupe(song.original.parent_volume for song in node.iterallfiles()) return [ node.name, ','.join(l.name for l in parent_volumes), node.get_stat('filecount'), format_size(node.get_stat('size'),2,2,False), format_time(node.get_stat('duration')), img_name, ] else: img_name = 'song_conflict_16' if is_conflicted(node.name) else 'song_16' return [ node.name, node.original.parent_volume.name, 0, format_size(node.size,2,2,False), format_time(node.duration, with_hours=False), img_name, ]
def __get_stat_line(self): if self.__filtered_dupes is None: mark_count = self.mark_count marked_size = self.__marked_size total_count = self.__total_count total_size = self.__total_size else: mark_count = len([dupe for dupe in self.__filtered_dupes if self.is_marked(dupe)]) marked_size = sum(dupe.size for dupe in self.__filtered_dupes if self.is_marked(dupe)) total_count = len([dupe for dupe in self.__filtered_dupes if self.is_markable(dupe)]) total_size = sum(dupe.size for dupe in self.__filtered_dupes if self.is_markable(dupe)) if self.mark_inverted: marked_size = self.__total_size - marked_size result = tr("%d / %d (%s / %s) duplicates marked.") % ( mark_count, total_count, format_size(marked_size, 2), format_size(total_size, 2), ) if self.__filters: result += tr(" filter: %s") % ' --> '.join(self.__filters) return result
def output_stats(info, item): info.append(('Size',format_size(item.get_stat('size'),2))) info.append(('Time',format_time(item.get_stat('duration'), with_hours=False))) info.append(('Extensions',','.join(item.get_stat('extension',[])))) info.append(('# Artists',len(item.get_stat('artist',[])))) info.append(('# Albums',len(item.get_stat('album',[])))) info.append(('# Genres',len(item.get_stat('genre',[])))) stats = item.get_stat('year',[]) years = [tryint(s) for s in stats if s] if not years: years = [0] minyear = min(years) maxyear = max(years) info.append(('Years',"%d - %d" % (minyear,maxyear)))
def GetSelectionInfo(self, item): def output_stats(info, item): info.append(('Size',format_size(item.get_stat('size'),2))) info.append(('Time',format_time(item.get_stat('duration'), with_hours=False))) info.append(('Extensions',','.join(item.get_stat('extension',[])))) info.append(('# Artists',len(item.get_stat('artist',[])))) info.append(('# Albums',len(item.get_stat('album',[])))) info.append(('# Genres',len(item.get_stat('genre',[])))) stats = item.get_stat('year',[]) years = [tryint(s) for s in stats if s] if not years: years = [0] minyear = min(years) maxyear = max(years) info.append(('Years',"%d - %d" % (minyear,maxyear))) new_info = [] if isinstance(item,list) and (len(item) == 1): item = item[0] if isinstance(item,list): if item: new_item = StatsList() #remove all items with their parent in the list new_item += [child for child in item if child.parent not in item] new_info.append(('Selection',"%d selected" % len(item))) filecount = new_item.get_stat('filecount') if filecount is None: filecount = 0 filecount += len([child for child in new_item if not child.is_container]) new_info.append(('Songs',filecount)) output_stats(new_info,new_item) elif item.is_container: new_info.append(('Path',str(item.path[1:]))) new_info.append(('Songs',item.get_stat('filecount'))) output_stats(new_info,item) else: new_info.append(('Filename',item.name)) new_info.append(('Directory',str(item.parent.path[1:]))) new_info.append(('Title',item.title)) new_info.append(('Artist',item.artist)) new_info.append(('Album',item.album)) new_info.append(('Genre',item.genre)) new_info.append(('Year',item.year)) new_info.append(('Track',"%02d" % item.track)) new_info.append(('Size',format_size(item.size,2))) new_info.append(('Time',format_time(item.duration, with_hours=False))) new_info.append(('Bitrate',item.bitrate)) new_info.append(('Comment',item.comment)) return new_info
def GetNodeData(self, node): if node.is_container: img_name = 'folder_conflict_16' if node.allconflicts else 'folder_16' parent_volumes = dedupe(song.original.parent_volume for song in node.iterallfiles()) return [ node.name, ','.join(l.name for l in parent_volumes), node.get_stat('filecount'), format_size(node.get_stat('size'), 2, 2, False), format_time(node.get_stat('duration')), img_name, ] else: img_name = 'song_conflict_16' if is_conflicted( node.name) else 'song_16' return [ node.name, node.original.parent_volume.name, 0, format_size(node.size, 2, 2, False), format_time(node.duration, with_hours=False), img_name, ]
def output_stats(info, item): info.append(('Size', format_size(item.get_stat('size'), 2))) info.append(('Time', format_time(item.get_stat('duration'), with_hours=False))) info.append(('Extensions', ','.join(item.get_stat('extension', [])))) info.append(('# Artists', len(item.get_stat('artist', [])))) info.append(('# Albums', len(item.get_stat('album', [])))) info.append(('# Genres', len(item.get_stat('genre', [])))) stats = item.get_stat('year', []) years = [tryint(s) for s in stats if s] if not years: years = [0] minyear = min(years) maxyear = max(years) info.append(('Years', "%d - %d" % (minyear, maxyear)))
def get_display_info(self, group, delta): size = self.size duration = self.duration bitrate = self.bitrate samplerate = self.samplerate mtime = self.mtime m = group.get_match_of(self) if m: percentage = m.percentage dupe_count = 0 if delta: r = group.ref size -= r.size duration -= r.duration bitrate -= r.bitrate samplerate -= r.samplerate mtime -= r.mtime else: percentage = group.percentage dupe_count = len(group.dupes) dupe_folder_path = getattr(self, 'display_folder_path', self.folder_path) return { 'name': self.name, 'folder_path': str(dupe_folder_path), 'size': format_size(size, 2, 2, False), 'duration': format_time(duration, with_hours=False), 'bitrate': str(bitrate), 'samplerate': str(samplerate), 'extension': self.extension, 'mtime': format_timestamp(mtime, delta and m), 'title': self.title, 'artist': self.artist, 'album': self.album, 'genre': self.genre, 'year': self.year, 'track': str(self.track), 'comment': self.comment, 'percentage': format_perc(percentage), 'words': format_words(self.words) if hasattr(self, 'words') else '', 'dupe_count': format_dupe_count(dupe_count), }
def get_display_info(self, group, delta): size = self.size duration = self.duration bitrate = self.bitrate samplerate = self.samplerate mtime = self.mtime m = group.get_match_of(self) if m: percentage = m.percentage dupe_count = 0 if delta: r = group.ref size -= r.size duration -= r.duration bitrate -= r.bitrate samplerate -= r.samplerate mtime -= r.mtime else: percentage = group.percentage dupe_count = len(group.dupes) dupe_folder_path = getattr(self, "display_folder_path", self.folder_path) return { "name": self.name, "folder_path": str(dupe_folder_path), "size": format_size(size, 2, 2, False), "duration": format_time(duration, with_hours=False), "bitrate": str(bitrate), "samplerate": str(samplerate), "extension": self.extension, "mtime": format_timestamp(mtime, delta and m), "title": self.title, "artist": self.artist, "album": self.album, "genre": self.genre, "year": self.year, "track": str(self.track), "comment": self.comment, "percentage": format_perc(percentage), "words": format_words(self.words) if hasattr(self, "words") else "", "dupe_count": format_dupe_count(dupe_count), }
def get_display_info(self, group, delta): size = self.size duration = self.duration bitrate = self.bitrate samplerate = self.samplerate mtime = self.mtime m = group.get_match_of(self) if m: percentage = m.percentage dupe_count = 0 if delta: r = group.ref size -= r.size duration -= r.duration bitrate -= r.bitrate samplerate -= r.samplerate mtime -= r.mtime else: percentage = group.percentage dupe_count = len(group.dupes) dupe_folder_path = getattr(self, 'display_folder_path', self.folder_path) return { 'name': self.name, 'folder_path': str(dupe_folder_path), 'size': format_size(size, 2, 2, False), 'duration': format_time(duration, with_hours=False), 'bitrate': str(bitrate), 'samplerate': str(samplerate), 'extension': self.extension, 'mtime': format_timestamp(mtime,delta and m), 'title': self.title, 'artist': self.artist, 'album': self.album, 'genre': self.genre, 'year': self.year, 'track': str(self.track), 'comment': self.comment, 'percentage': format_perc(percentage), 'words': format_words(self.words) if hasattr(self, 'words') else '', 'dupe_count': format_dupe_count(dupe_count), }
def data(self, index, role): if not index.isValid(): return None location = self.app.collection[index.row()] if role == Qt.DisplayRole: column = index.column() if column == 0: return location.name elif column == 1: return location.get_stat('filecount') elif column == 2: return format_size(location.get_stat('size'), 2, 3, False) elif role == Qt.ForegroundRole: if location.is_removable: return QBrush(Qt.blue) elif not location.is_available: return QBrush(Qt.red) elif role == Qt.CheckStateRole: if index.column() == 0: return Qt.Checked if location in self.app.board.locations else Qt.Unchecked return None
def get_display_info(dupe, group, delta): size = dupe.size mtime = dupe.mtime m = group.get_match_of(dupe) if m: percentage = m.percentage dupe_count = 0 if delta: r = group.ref size -= r.size mtime -= r.mtime else: percentage = group.percentage dupe_count = len(group.dupes) return { "name": dupe.name, "folder_path": str(dupe.folder_path), "size": format_size(size, 0, 1, False), "extension": dupe.extension, "mtime": format_timestamp(mtime, delta and m), "percentage": format_perc(percentage), "words": format_words(dupe.words) if hasattr(dupe, "words") else "", "dupe_count": format_dupe_count(dupe_count), }
def get_display_info(dupe, group, delta): size = dupe.size mtime = dupe.mtime m = group.get_match_of(dupe) if m: percentage = m.percentage dupe_count = 0 if delta: r = group.ref size -= r.size mtime -= r.mtime else: percentage = group.percentage dupe_count = len(group.dupes) return { 'name': dupe.name, 'folder_path': str(dupe.folder_path), 'size': format_size(size, 0, 1, False), 'extension': dupe.extension, 'mtime': format_timestamp(mtime, delta and m), 'percentage': format_perc(percentage), 'words': format_words(dupe.words) if hasattr(dupe, 'words') else '', 'dupe_count': format_dupe_count(dupe_count), }