def fix_file(app, s, t): if t.path == s.path: app.printer.notice("sane - " + t.relativepath()); return; if not t.isfile() and not t.islink(): if app.lambdaenv.pretend: app.printer.action("would add insane file - " + s.relativepath()); app.printer.action(" as - " + t.relativepath()); else: app.printer.action("adding insane file - " + s.relativepath()); app.printer.action(" as - " + t.relativepath()); db.add(app, s, t); if s.isfile(): app.printer.action("removing insane file - " + s.relativepath()); app.lambdaenv.rm(s);
def op_add(app, source): """ Operation to add files to filestructure. @param source Path object to file being added. """ if source.isdir(): app.printer.notice("ignoring directory:", source.path); return; if not source.isfile(): app.printer.warning("not a file:", source.path); return; if not source.meta: app.printer.warning("could not open metadata:", source.path); return; # this causes nice display of artist/album app.printer.focus(source.meta); target = db.build_target(app, source); if app.locker.islocked(target): app.printer.warning("locked:", source.path); return if app.lambdaenv.pretend: app.printer.notice("would add:", source.path); app.printer.blanknotice(" as:", target.relativepath()); else: app.printer.action("adding file:", target.relativepath()); db.add(app, source, target); if app.lambdaenv.lock: op_lock(app, target);