示例#1
0
 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),
     ]
示例#2
0
 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),
     ]
示例#3
0
文件: app.py 项目: hsoft/musicguru
    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
示例#4
0
 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')),
     ]
示例#5
0
 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')),
     ]
示例#6
0
 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,
         ]
示例#7
0
文件: app.py 项目: hsoft/musicguru
 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)))
示例#8
0
文件: app.py 项目: hsoft/musicguru
 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
示例#9
0
 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,
         ]
示例#10
0
文件: app.py 项目: hsoft/musicguru
 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)))
示例#11
0
文件: fs.py 项目: zoodis/dupeguru
 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),
     }
示例#12
0
 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),
     }
示例#13
0
文件: fs.py 项目: Beyond82/dupeguru
 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),
     }