コード例 #1
0
ファイル: thumbnails.py プロジェクト: angelsanz/beets
    def make_cover_thumbnail(self, album, size, target_dir):
        """Make a thumbnail of given size for `album` and put it in
        `target_dir`.
        """
        target = os.path.join(target_dir, self.thumbnail_file_name(album.path))

        if os.path.exists(target) and os.stat(target).st_mtime > os.stat(album.artpath).st_mtime:
            if self.config["force"]:
                self._log.debug(u"found a suitable {1}x{1} thumbnail for {0}, " u"forcing regeneration", album, size)
            else:
                self._log.debug(u"{1}x{1} thumbnail for {0} exists and is " u"recent enough", album, size)
                return False
        resized = ArtResizer.shared.resize(size, album.artpath, util.syspath(target))
        self.add_tags(album, util.syspath(resized))
        shutil.move(resized, target)
        return True
コード例 #2
0
    def make_cover_thumbnail(self, album, size, target_dir):
        """Make a thumbnail of given size for `album` and put it in
        `target_dir`.
        """
        target = os.path.join(target_dir, self.thumbnail_file_name(album.path))

        if os.path.exists(target) and \
           os.stat(target).st_mtime > os.stat(album.artpath).st_mtime:
            if self.config['force']:
                self._log.debug(u"found a suitable {1}x{1} thumbnail for {0}, "
                                u"forcing regeneration", album, size)
            else:
                self._log.debug(u"{1}x{1} thumbnail for {0} exists and is "
                                u"recent enough", album, size)
                return False
        resized = ArtResizer.shared.resize(size, album.artpath,
                                           util.syspath(target))
        self.add_tags(album, util.syspath(resized))
        shutil.move(resized, target)
        return True