Example #1
0
 def save_changes(self, objs):
     """Save a list of updated Model objects to the database.
     """
     # Save to the database and possibly write tags.
     for ob in objs:
         if ob._dirty:
             self._log.debug(u'saving changes to {}', ob)
             ob.try_sync(ui.should_write(), ui.should_move())
Example #2
0
 def save_changes(self, objs):
     """Save a list of updated Model objects to the database.
     """
     # Save to the database and possibly write tags.
     for ob in objs:
         if ob._dirty:
             self._log.debug(u'saving changes to {}', ob)
             ob.try_sync(ui.should_write(), ui.should_move())
Example #3
0
    def func(self, lib, opts, args):
        """Command handler for the mbsync function.
        """
        move = ui.should_move(opts.move)
        pretend = opts.pretend
        write = ui.should_write(opts.write)
        query = ui.decargs(args)

        self.singletons(lib, query, move, pretend, write)
        self.albums(lib, query, move, pretend, write)
Example #4
0
    def func(self, lib, opts, args):
        """Command handler for the bpsync function.
        """
        move = ui.should_move(opts.move)
        pretend = opts.pretend
        write = ui.should_write(opts.write)
        query = ui.decargs(args)

        self.singletons(lib, query, move, pretend, write)
        self.albums(lib, query, move, pretend, write)
Example #5
0
    def import_begin(self, session):
        self.should_write = ui.should_write()
        self.should_move = ui.should_move()

        for name, model_cls in [('album', Album), ('singleton', Item)]:
            modifies = self.get_modifies(self.config['modify_' + name].items(), model_cls, 'modify_' + name)
            setattr(self, name + '_modifies', modifies)

        self.album_item_modifies = []
        for albumquery, itemmodifies in self.config['modify_album_items'].items():
            albumdbquery, _ = parse_query_string(util.as_string(albumquery), Album)
            modifies = self.get_modifies(itemmodifies.items(), Item, u'modify_album_items.{0}'.format(albumquery))
            self.album_item_modifies.append((albumdbquery, modifies))
Example #6
0
 def modify_func(self, lib, opts, args):
     query, mods, dels = modify_parse_args(decargs(args))
     if not mods and not dels:
         raise ui.UserError(u'no modifications specified')
     self.modify_items(lib, mods, dels, query, ui.should_write(opts.write),
                       ui.should_move(opts.move), opts.album, not opts.yes)