Ejemplo n.º 1
0
def test_by_selected_and_tag(imgdir):
    """Select by selected flag and tag.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        idxfilter = photo.idxfilter.IdxFilter(select=True, tags="Tokyo")
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == ["dsc_4664.jpg"]
Ejemplo n.º 2
0
def test_by_not_selected(imgdir):
    """Select by not-selected flag.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        idxfilter = photo.idxfilter.IdxFilter(select=False)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == ["dsc_4623.jpg", "dsc_4831.jpg", "dsc_5167.jpg"]
Ejemplo n.º 3
0
def test_by_single_tag(imgdir):
    """Select by one single tag.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        idxfilter = photo.idxfilter.IdxFilter(tags="Shinto_shrine")
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == ["dsc_4664.jpg", "dsc_4831.jpg"]
Ejemplo n.º 4
0
def ls_bytag(imgdir, tag, qres, qwait):
    """List files by tag.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        idxfilter = photo.idxfilter.IdxFilter(tags=tag)
        qres.put((tag, [str(i.filename) for i in idxfilter.filter(idx)]))
        qwait.get()
Ejemplo n.º 5
0
def test_by_selected(imgdir):
    """Select by selected flag.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        idxfilter = photo.idxfilter.IdxFilter(select=True)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == ["dsc_4664.jpg", "dsc_5126.jpg"]
Ejemplo n.º 6
0
def test_by_not_selected(imgdir, argparser):
    """Select by not-selected flag.
    """
    idx = photo.index.Index(idxfile=imgdir)
    args = argparser.parse_args(["--not-selected"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == ["dsc_4623.jpg", "dsc_4831.jpg", "dsc_5167.jpg"]
Ejemplo n.º 7
0
def test_single_date():
    """Select by single date.
    """
    with photo.index.Index(idxfile=indexfile) as idx:
        date = (datetime.datetime(2016, 2, 29), datetime.datetime(2016, 3, 1))
        idxfilter = photo.idxfilter.IdxFilter(date=date)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == testimgs[1:4]
Ejemplo n.º 8
0
def lstags(args):
    with photo.index.Index(idxfile=args.directory) as idx:
        idxfilter = photo.idxfilter.IdxFilter.from_args(args)
        tags = set()
        for i in idxfilter.filter(idx):
            tags.update(i.tags)
        for t in sorted(tags):
            print(t)
Ejemplo n.º 9
0
def test_interval_date_date(argparser):
    """Select by an interval between two dates.
    """
    with photo.index.Index(idxfile=indexfile) as idx:
        args = argparser.parse_args(["--date=2016-02-29--2016-03-06"])
        idxfilter = photo.idxfilter.IdxFilter.from_args(args)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == testimgs[1:11]
Ejemplo n.º 10
0
def test_interval_date_date():
    """Select by an interval between two dates.
    """
    with photo.index.Index(idxfile=indexfile) as idx:
        date = (datetime.datetime(2016, 2, 29), datetime.datetime(2016, 3, 6))
        idxfilter = photo.idxfilter.IdxFilter(date=date)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == testimgs[1:11]
Ejemplo n.º 11
0
def test_single_date(argparser):
    """Select by single date.
    """
    idx = photo.index.Index(idxfile=indexfile)
    args = argparser.parse_args(["--date=2016-02-29"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == testimgs[1:4]
Ejemplo n.º 12
0
def test_interval_date_date(argparser):
    """Select by an interval between two dates.
    """
    idx = photo.index.Index(idxfile=indexfile)
    args = argparser.parse_args(["--date=2016-02-29--2016-03-05"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == testimgs[1:11]
Ejemplo n.º 13
0
def test_interval_datetime_date(argparser):
    """Select by an interval between start date/time and end date.
    """
    with photo.index.Index(idxfile=indexfile) as idx:
        args = argparser.parse_args(["--date=2016-03-03T11:21:40/2016-03-06"])
        idxfilter = photo.idxfilter.IdxFilter.from_args(args)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == testimgs[6:11]
Ejemplo n.º 14
0
def lstags(args):
    idx = photo.index.Index(idxfile=args.directory)
    idxfilter = photo.idxfilter.IdxFilter(args)
    tags = set()
    for i in idxfilter.filter(idx):
        tags.update(i.tags)
    for t in sorted(tags):
        print(t)
Ejemplo n.º 15
0
def test_by_single_tag(imgdir, argparser):
    """Select by one single tag.
    """
    idx = photo.index.Index(idxfile=imgdir)
    args = argparser.parse_args(["--tags=Shinto_shrine"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == ["dsc_4664.jpg", "dsc_4831.jpg"]
Ejemplo n.º 16
0
def test_by_selected_and_tag(imgdir, argparser):
    """Select by selected flag and tag.
    """
    idx = photo.index.Index(idxfile=imgdir)
    args = argparser.parse_args(["--selected", "--tags=Tokyo"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == ["dsc_4664.jpg"]
Ejemplo n.º 17
0
def test_interval_datetime_date(argparser):
    """Select by an interval between start date/time and end date.
    """
    idx = photo.index.Index(idxfile=indexfile)
    args = argparser.parse_args(["--date=2016-03-03T11:21:40/2016-03-05"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == testimgs[6:11]
Ejemplo n.º 18
0
def test_single_date(argparser):
    """Select by single date.
    """
    with photo.index.Index(idxfile=indexfile) as idx:
        args = argparser.parse_args(["--date=2016-02-29"])
        idxfilter = photo.idxfilter.IdxFilter.from_args(args)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == testimgs[1:4]
Ejemplo n.º 19
0
def test_by_files(imgdir):
    """Select by file names.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        files = ["dsc_4664.jpg", "dsc_4831.jpg"]
        idxfilter = photo.idxfilter.IdxFilter(files=files)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == files
Ejemplo n.º 20
0
def test_by_gpspos(imgdir):
    """Select by GPS position.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        pos = GeoPosition("35.6883 N, 139.7544 E")
        idxfilter = photo.idxfilter.IdxFilter(gpspos=pos, gpsradius=20.0)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == ["dsc_4623.jpg", "dsc_4664.jpg"]
Ejemplo n.º 21
0
def test_by_date(imgdir):
    """Select by date.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        date = (datetime.datetime(2016, 3, 5), datetime.datetime(2016, 3, 6))
        idxfilter = photo.idxfilter.IdxFilter(date=date)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == ["dsc_4831.jpg"]
Ejemplo n.º 22
0
def test_by_empty_tag(imgdir):
    """Select by empty tags.

    The empty string as tag selects images having no tag.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        idxfilter = photo.idxfilter.IdxFilter(tags="")
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == ["dsc_5126.jpg", "dsc_5167.jpg"]
Ejemplo n.º 23
0
def test_interval_datetime_date():
    """Select by an interval between start date/time and end date.
    """
    with photo.index.Index(idxfile=indexfile) as idx:
        date = (datetime.datetime(2016, 3, 3, 11, 21,
                                  40), datetime.datetime(2016, 3, 6))
        idxfilter = photo.idxfilter.IdxFilter(date=date)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == testimgs[6:11]
Ejemplo n.º 24
0
def test_interval_datetime_datetime(argparser):
    """Select by an interval between two date/times.
    """
    idx = photo.index.Index(idxfile=indexfile)
    args = argparser.parse_args(["--date=2016-03-03T11:21:41"
                                 "--2016-03-05T03:47:08"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == testimgs[7:9]
Ejemplo n.º 25
0
def test_by_files(imgdir, argparser):
    """Select by file names.
    """
    idx = photo.index.Index(idxfile=imgdir)
    args = argparser.parse_args(["dsc_4664.jpg", "dsc_4831.jpg"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == ["dsc_4664.jpg", "dsc_4831.jpg"]
    idx.write()
Ejemplo n.º 26
0
def test_by_date(imgdir, argparser):
    """Select by date.
    """
    idx = photo.index.Index(idxfile=imgdir)
    args = argparser.parse_args(["--date=2016-03-05"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == ["dsc_4831.jpg"]
    idx.write()
Ejemplo n.º 27
0
def test_single_datetime(argparser):
    """Select by single date/time.

    Probably not very useful in the praxis, but valid.
    """
    with photo.index.Index(idxfile=indexfile) as idx:
        args = argparser.parse_args(["--date=2016-03-03T11:21:40"])
        idxfilter = photo.idxfilter.IdxFilter.from_args(args)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == testimgs[6:7]
Ejemplo n.º 28
0
def test_by_mult_tags(imgdir):
    """Select by multiple tags.

    Combining multiple tags acts like an and, it selects only images
    having all the tags set.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        idxfilter = photo.idxfilter.IdxFilter(tags="Tokyo,Shinto_shrine")
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == ["dsc_4664.jpg"]
Ejemplo n.º 29
0
def test_by_neg_tags(imgdir):
    """Select by negating tags.

    Prepending a tag by an exclamation mark selects the images having
    the tag not set.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        idxfilter = photo.idxfilter.IdxFilter(tags="Tokyo,!Shinto_shrine")
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == ["dsc_4623.jpg"]
Ejemplo n.º 30
0
def test_single_datetime(argparser):
    """Select by single date/time.

    Probably not very useful in the praxis, but valid.
    """
    idx = photo.index.Index(idxfile=indexfile)
    args = argparser.parse_args(["--date=2016-03-03T11:21:40"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == testimgs[6:7]
Ejemplo n.º 31
0
def test_interval_datetime_datetime(argparser):
    """Select by an interval between two date/times.
    """
    with photo.index.Index(idxfile=indexfile) as idx:
        args = argparser.parse_args(
            ["--date=2016-03-03T11:21:41"
             "--2016-03-05T03:47:09"])
        idxfilter = photo.idxfilter.IdxFilter.from_args(args)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == testimgs[7:9]
Ejemplo n.º 32
0
def test_by_gpspos(imgdir, argparser):
    """Select by GPS position.
    """
    idx = photo.index.Index(idxfile=imgdir)
    args = argparser.parse_args(["--gpspos=35.6883 N, 139.7544 E", 
                                 "--gpsradius=20.0"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == ["dsc_4623.jpg", "dsc_4664.jpg"]
    idx.write()
Ejemplo n.º 33
0
def test_by_empty_tag(imgdir, argparser):
    """Select by empty tags.

    The empty string as tag selects images having no tag.
    """
    idx = photo.index.Index(idxfile=imgdir)
    args = argparser.parse_args(["--tags="])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == ["dsc_5126.jpg", "dsc_5167.jpg"]
Ejemplo n.º 34
0
def test_single_datetime():
    """Select by single date/time.

    Probably not very useful in the praxis, but valid.
    """
    with photo.index.Index(idxfile=indexfile) as idx:
        date = (datetime.datetime(2016, 3, 3, 11, 21, 40),
                datetime.datetime(2016, 3, 3, 11, 21, 41))
        idxfilter = photo.idxfilter.IdxFilter(date=date)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == testimgs[6:7]
Ejemplo n.º 35
0
def test_by_neg_tags(imgdir, argparser):
    """Select by negating tags.

    Prepending a tag by an exclamation mark selects the images having
    the tag not set.
    """
    idx = photo.index.Index(idxfile=imgdir)
    args = argparser.parse_args(["--tags=Tokyo,!Shinto_shrine"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == ["dsc_4623.jpg"]
Ejemplo n.º 36
0
def test_by_mult_tags(imgdir, argparser):
    """Select by multiple tags.

    Combining multiple tags acts like an and, it selects only images
    having all the tags set.
    """
    idx = photo.index.Index(idxfile=imgdir)
    args = argparser.parse_args(["--tags=Tokyo,Shinto_shrine"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == ["dsc_4664.jpg"]
Ejemplo n.º 37
0
def test_by_date_and_tag(imgdir, argparser):
    """Select by date and tags.

    Multiple selection criteria, such as date and tags may be
    combined.
    """
    idx = photo.index.Index(idxfile=imgdir)
    args = argparser.parse_args(["--tags=Tokyo", "--date=2016-02-28"])
    idxfilter = photo.idxfilter.IdxFilter(args)
    fnames = [ i.filename for i in idxfilter.filter(idx) ]
    assert fnames == ["dsc_4623.jpg"]
Ejemplo n.º 38
0
def test_by_date_and_tag(imgdir):
    """Select by date and tags.

    Multiple selection criteria, such as date and tags may be
    combined.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        date = (datetime.datetime(2016, 2, 28), datetime.datetime(2016, 2, 29))
        idxfilter = photo.idxfilter.IdxFilter(tags="Tokyo", date=date)
        fnames = [str(i.filename) for i in idxfilter.filter(idx)]
        assert fnames == ["dsc_4623.jpg"]
Ejemplo n.º 39
0
def ls(args):
    idx = photo.index.Index(idxfile=args.directory)
    idxfilter = photo.idxfilter.IdxFilter(args)
    for i in idxfilter.filter(idx):
        if args.checksum:
            try:
                checksum = i.checksum[args.checksum]
            except KeyError:
                continue
            print("%s  %s" % (checksum, i.filename))
        else:
            print(i.filename)
Ejemplo n.º 40
0
def ls(args):
    with photo.index.Index(idxfile=args.directory) as idx:
        idxfilter = photo.idxfilter.IdxFilter.from_args(args)
        for i in idxfilter.filter(idx):
            if args.checksum:
                try:
                    checksum = i.checksum[args.checksum]
                except KeyError:
                    continue
                print("%s  %s" % (checksum, i.filename))
            else:
                print(i.filename)
Ejemplo n.º 41
0
def test_tag_ref(imgdir):
    idxfname = str(imgdir / ".index.yaml")
    reffname = str(imgdir / "index-ref.yaml")
    shutil.copy(gettestdata("index-create.yaml"), idxfname)
    with photo.index.Index(idxfile=imgdir) as idx:
        taglist = [ "Japan", "Tokyo", "Hakone", "Kyoto", 
                    "Ginza", "Shinto_shrine", "Geisha", "Ryoan-ji" ]
        for t in taglist:
            idxfilter = photo.idxfilter.IdxFilter(files=tags[t])
            for i in idxfilter.filter(idx):
                i.tags.add(t)
        idx.write()
    shutil.copy(idxfname, reffname)
Ejemplo n.º 42
0
def test_tag_ref(imgdir, argparser):
    idxfname = os.path.join(imgdir, ".index.yaml")
    reffname = os.path.join(imgdir, "index-ref.yaml")
    shutil.copy(gettestdata("index-create.yaml"), idxfname)
    idx = photo.index.Index(idxfile=imgdir)
    taglist = [ "Japan", "Tokyo", "Hakone", "Kyoto", 
                "Ginza", "Shinto_shrine", "Geisha", "Ryoan-ji" ]
    for t in taglist:
        args = argparser.parse_args(tags[t])
        idxfilter = photo.idxfilter.IdxFilter(args)
        for i in idxfilter.filter(idx):
            i.tags.add(t)
    idx.write()
    shutil.copy(idxfname, reffname)
Ejemplo n.º 43
0
def test_tag_shuffle(imgdir):
    """Same as test_tag_ref(), only the order of setting the tags differ.
    """
    idxfname = str(imgdir / ".index.yaml")
    reffname = str(imgdir / "index-ref.yaml")
    shutil.copy(gettestdata("index-create.yaml"), idxfname)
    with photo.index.Index(idxfile=imgdir) as idx:
        taglist = [ "Ginza", "Hakone", "Japan", "Geisha", 
                    "Shinto_shrine", "Tokyo", "Kyoto", "Ryoan-ji" ]
        for t in taglist:
            idxfilter = photo.idxfilter.IdxFilter(files=tags[t])
            for i in idxfilter.filter(idx):
                i.tags.add(t)
        idx.write()
    assert filecmp.cmp(idxfname, reffname), "index file differs from reference"
Ejemplo n.º 44
0
def test_tag_shuffle(imgdir, argparser):
    """Same as test_tag_ref(), only the order of setting the tags differ.
    """
    idxfname = os.path.join(imgdir, ".index.yaml")
    reffname = os.path.join(imgdir, "index-ref.yaml")
    shutil.copy(gettestdata("index-create.yaml"), idxfname)
    idx = photo.index.Index(idxfile=imgdir)
    taglist = [ "Ginza", "Hakone", "Japan", "Geisha", 
                "Shinto_shrine", "Tokyo", "Kyoto", "Ryoan-ji" ]
    for t in taglist:
        args = argparser.parse_args(tags[t])
        idxfilter = photo.idxfilter.IdxFilter(args)
        for i in idxfilter.filter(idx):
            i.tags.add(t)
    idx.write()
    assert filecmp.cmp(idxfname, reffname), "index file differs from reference"
Ejemplo n.º 45
0
def test_stats_filtered(imgdir):
    """Get statistics on a selection of images.
    """
    with photo.index.Index(idxfile=imgdir) as idx:
        idxfilter = photo.idxfilter.IdxFilter(tags="Tokyo")
        stats = Stats(idxfilter.filter(idx))
    assert stats.count == 2
    assert stats.selected == 1
    assert stats.oldest == datetime.datetime(2016, 2, 28, 17, 26, 39)
    assert stats.newest == datetime.datetime(2016, 2, 29, 11, 37, 51)
    assert stats.by_date == {
        datetime.date(2016, 2, 28).toordinal() : 1,
        datetime.date(2016, 2, 29).toordinal() : 1,
    }
    assert stats.by_tag == {
        "Shinto_shrine": 1,
        "Tokyo": 2,
    }
Ejemplo n.º 46
0
def test_tag_extra(imgdir):
    """Add a spurious extra tag first and remove it later.
    """
    idxfname = str(imgdir / ".index.yaml")
    reffname = str(imgdir / "index-ref.yaml")
    shutil.copy(gettestdata("index-create.yaml"), idxfname)
    with photo.index.Index(idxfile=imgdir) as idx:
        taglist = [ "Japan", "Tokyo", "Hakone", "Kyoto", 
                    "Ginza", "Shinto_shrine", "Geisha", "Ryoan-ji" ]
        for i in idx:
            i.tags.add("extra")
        for t in taglist:
            idxfilter = photo.idxfilter.IdxFilter(files=tags[t])
            for i in idxfilter.filter(idx):
                i.tags.add(t)
        for i in idx:
            i.tags.remove("extra")
        idx.write()
    assert filecmp.cmp(idxfname, reffname), "index file differs from reference"
Ejemplo n.º 47
0
def test_tag_extra(imgdir, argparser):
    """Add a spurious extra tag first and remove it later.
    """
    idxfname = os.path.join(imgdir, ".index.yaml")
    reffname = os.path.join(imgdir, "index-ref.yaml")
    shutil.copy(gettestdata("index-create.yaml"), idxfname)
    idx = photo.index.Index(idxfile=imgdir)
    taglist = [ "Japan", "Tokyo", "Hakone", "Kyoto", 
                "Ginza", "Shinto_shrine", "Geisha", "Ryoan-ji" ]
    for i in idx:
        i.tags.add("extra")
    for t in taglist:
        args = argparser.parse_args(tags[t])
        idxfilter = photo.idxfilter.IdxFilter(args)
        for i in idxfilter.filter(idx):
            i.tags.add(t)
    for i in idx:
        i.tags.remove("extra")
    idx.write()
    assert filecmp.cmp(idxfname, reffname), "index file differs from reference"
Ejemplo n.º 48
0
def stats(args):
    with photo.index.Index(idxfile=args.directory) as idx:
        idxfilter = photo.idxfilter.IdxFilter.from_args(args)
        stats = Stats(idxfilter.filter(idx))
        print(str(stats))
Ejemplo n.º 49
0
def deselect(args):
    with photo.index.Index(idxfile=args.directory) as idx:
        idxfilter = photo.idxfilter.IdxFilter.from_args(args)
        for i in idxfilter.filter(idx):
            i.selected = False
        idx.write()
Ejemplo n.º 50
0
def rmtag(args):
    with photo.index.Index(idxfile=args.directory) as idx:
        idxfilter = photo.idxfilter.IdxFilter.from_args(args)
        for i in idxfilter.filter(idx):
            i.tags.discard(args.tag)
        idx.write()
Ejemplo n.º 51
0
def rmtag(args):
    idx = photo.index.Index(idxfile=args.directory)
    idxfilter = photo.idxfilter.IdxFilter(args)
    for i in idxfilter.filter(idx):
        i.tags.discard(args.tag)
    idx.write()
Ejemplo n.º 52
0
def deselect(args):
    idx = photo.index.Index(idxfile=args.directory)
    idxfilter = photo.idxfilter.IdxFilter(args)
    for i in idxfilter.filter(idx):
        i.selected = False
    idx.write()