示例#1
0
    def move(self, dest, copy=False):
        """Moves or copies the item's file, updating the path value if
        the move succeeds.
        """
        if copy:
            util.copy(self.path, dest)
        else:
            util.move(self.path, dest)

        # Either copying or moving succeeded, so update the stored path.
        self.path = dest
示例#2
0
 def move(self, dest, copy=False):
     """Moves or copies the item's file, updating the path value if
     the move succeeds.
     """
     if copy:
         util.copy(self.path, dest)
     else:
         util.move(self.path, dest)
         
     # Either copying or moving succeeded, so update the stored path.
     self.path = dest
示例#3
0
    def move(self, dest, copy=False):
        """Moves or copies the item's file, updating the path value if
        the move succeeds. If a file exists at ``dest``, then it is
        slightly modified to be unique.
        """
        if not util.samefile(self.path, dest):
            dest = util.unique_path(dest)
        if copy:
            util.copy(self.path, dest)
        else:
            util.move(self.path, dest)

        # Either copying or moving succeeded, so update the stored path.
        self.path = dest
示例#4
0
 def move(self, dest, copy=False):
     """Moves or copies the item's file, updating the path value if
     the move succeeds. If a file exists at ``dest``, then it is
     slightly modified to be unique.
     """
     if not util.samefile(self.path, dest):
         dest = util.unique_path(dest)
     if copy:
         util.copy(self.path, dest)
     else:
         util.move(self.path, dest)
         
     # Either copying or moving succeeded, so update the stored path.
     self.path = dest
示例#5
0
    def set_art(self, path):
        """Sets the album's cover art to the image at the given path.
        The image is copied into place, replacing any existing art.
        """
        path = bytestring_path(path)
        oldart = self.artpath
        artdest = self.art_destination(path)

        if oldart and samefile(path, oldart):
            # Art already set.
            return
        elif samefile(path, artdest):
            # Art already in place.
            self.artpath = path
            return

        # Normal operation.
        if oldart == artdest:
            util.soft_remove(oldart)
        util.copy(path, artdest)
        self.artpath = artdest
示例#6
0
    def set_art(self, path):
        """Sets the album's cover art to the image at the given path.
        The image is copied into place, replacing any existing art.
        """
        path = bytestring_path(path)
        oldart = self.artpath
        artdest = self.art_destination(path)

        if oldart and samefile(path, oldart):
            # Art already set.
            return
        elif samefile(path, artdest):
            # Art already in place.
            self.artpath = path
            return

        # Normal operation.
        if oldart == artdest:
            util.soft_remove(oldart)
        util.copy(path, artdest)
        self.artpath = artdest
示例#7
0
    def move_art(self, copy=False):
        """Move or copy any existing album art so that it remains in the
        same directory as the items.
        """
        old_art = self.artpath
        if not old_art:
            return

        new_art = self.art_destination(old_art)
        if new_art == old_art:
            return

        log.debug("moving album art %s to %s" % (old_art, new_art))
        if copy:
            util.copy(old_art, new_art)
        else:
            util.move(old_art, new_art)
        self.artpath = new_art

        # Prune old path when moving.
        if not copy:
            util.prune_dirs(os.path.dirname(old_art), self._library.directory)
示例#8
0
    def move_art(self, copy=False):
        """Move or copy any existing album art so that it remains in the
        same directory as the items.
        """
        old_art = self.artpath
        if not old_art:
            return

        new_art = self.art_destination(old_art)
        if new_art == old_art:
            return

        log.debug('moving album art %s to %s' % (old_art, new_art))
        if copy:
            util.copy(old_art, new_art)
        else:
            util.move(old_art, new_art)
        self.artpath = new_art

        # Prune old path when moving.
        if not copy:
            util.prune_dirs(os.path.dirname(old_art), self._library.directory)