Esempio n. 1
0
def migrate_sessions(inst, session_dir, path):
    if os.path.exists(session_dir):
        try:
            copytree(session_dir, path)
        except Exception as e:
            print(f"Failed to copy directories - {e}")
            return False
    else:
        if check_dir(path):
            data.update_row(inst, "path", path)
            inst.save()
            return True
        else:
            return False
    return True
Esempio n. 2
0
def finalize_img(img, session):
    final_path = f"{session.path}/final"
    img_name = os.path.splitext(img.display)[0]
    jpg_path = f'{final_path}/{img_name}.jpg'
    os.rename(img.active_file, jpg_path)
    data.update_row(img, "position", "FINAL")
    data.update_row(img, "jpg", jpg_path)
    data.update_row(img, "active", 0)
    data.update_row(img, "active_file", "")
    print(f"{img.name} finalized ===> {jpg_path}")
    img.gen_proof(session)
Esempio n. 3
0
def migrate_update(origin, new_p, rows):
    for cls in rows:
        for inst in cls:
            parent = os.path.dirname(inst.path)
            head = f"{os.path.split(os.path.split(parent)[0])[1]}/{os.path.basename(parent)}"
            new_path = f"{new_p}/{head}/{inst.name}"
            print(new_path)
            data.update_row(inst, "path", new_path)
            try:
                thead = f"{os.path.split(os.path.split(inst.thumb)[0])[1]}/{os.path.basename(inst.thumb)}"
                tpath = f"{new_p}/{thead}"
                data.update_row(inst, "thumb", tpath)
            except AttributeError:
                print(f'No Thumbs Found for {inst.name}')
    try:
        rmtree(origin)
    except Exception as e:
        print(f"Could not remove origin directory - {e}")

    return True
Esempio n. 4
0
 def set_jpg(self, path):
     data.update_row(self, "active_file", path)
     print("SET JPG REPLY -- ")
     print(self.active_file)
Esempio n. 5
0
 def set_active(self, state):
     data.update_row(self, "active", state)