Giter VIP home page Giter VIP logo

tagfs's Introduction

tagfs - tag file system

1) Introduction
2) Requirements
3) Installation
4) Tagging Files
5) Usage
6) Configuration
6.1) Options
6.1.1) tagFileName
6.1.2) enableValueFilters
6.1.3) enableRootItemLinks
7) Freebase Integration
8) Bugs
9) Further Reading
10) Contact


---------------------------------------------------------------------
Introduction

tagfs is used to organize your files using tags.

This document contains basic usage instructions for users. To develop or debug
tagfs see the README.dev file.


---------------------------------------------------------------------
Requirements

* python 2.5, 2.6, 2.7
* Linux kernel with fuse enabled
* python-fuse installed
* python-matplotlib


---------------------------------------------------------------------
Installation

To install tagfs into your home directory type the following:

$ python setup.py test e2e_test install --home ~/.local

If you haven't already extended your local python path then add the following
to your environment configuration script. For example to your ~/.bashrc:

$ export PYTHONPATH=~/.local/lib/python:$PYTHONPATH

You may also need to add ~/.local/bin to your PATH environment variable:

$ export PATH=~/.local/bin:$PATH


---------------------------------------------------------------------
Tagging Files

Before you can filter anything using tagfs you need to tag your items. An item
is a directory which contains a file called .tag. All items must be below one
directory.

Let's create a simple item structure.

First we create the root directory for all items:
$ mkdir items

Then we create our first item:
$ mkdir items/Ted

We tag the 'Ted' item as movie:
$ echo movie >> items/Ted/.tag

We also tag 'Ted' as genre comedy:
$ echo 'genre: comedy' >> items/Ted/.tag

Then we add a second item:
$ mkdir items/banana
$ echo fruit >> items/banana/.tag
$ echo 'genre: delicious' >> items/banana/.tag

Modifying .tag files using echo, grep, sed may be a little hard sometimes.
There are some convenience scripts available through the tagfs-utils project.
See https://github.com/marook/tagfs-utils for details.


---------------------------------------------------------------------
Usage

After installation tagfs can be started the following way.

Mount a tagged directory:
$ tagfs -i /path/to/my/items/directory /path/to/my/mount/point

Unmount a tagged directory: 
$ fusermount -u /path/to/my/mount/point

Right now tagfs reads the taggings only when it's getting mounted. So if you
modify the tags after mounting you will not see any changes in the tagfs file
system.

In general tagfs will try to reduce the number of filter directories below the
virtual file system. That's why you may not see some filters which would not
reduce the number of selected items.


---------------------------------------------------------------------
Configuration

tagfs can be configured through configuration files. Configuration files are
searched in different locations by tagfs. The following locations are used.
Locations with higher priority come first:
- <items directory>/.tagfs/tagfs.conf
- ~/.tagfs/tagfs.conf
- /etc/tagfs/tagfs.conf

Right now the following configuration options are supported.


---------------------------------------------------------------------
Configuration - Options - tagFileName

Through this option the name of the parsed tag files can be specified. The
default value is '.tag'.

Example:

[global]
tagFileName = ABOUT


---------------------------------------------------------------------
Configuration - Options - enableValueFilters

You can enable or disable value filters. If you enable value filters you will
see filter directories for each tag value. For value filters the tag's
context can be anyone. The default value is 'false'.

Example:

[global]
enableValueFilters = true


---------------------------------------------------------------------
Configuration - Options - enableRootItemLinks

To show links to all items in the tagfs '/' directory enable this option. The
default value is 'false'.

Example:

[global]
enableRootItemLinks = true


---------------------------------------------------------------------
Freebase Integration

Freebase is an open graph of people, places and things. See
http://www.freebase.com/ for details. tagfs allows you to extend your own
taggings with data directly from the freebase graph.

WARNING! Freebase support is currently experimental. It is very likely that the
freebase syntax within the .tag files will change in future releases of tagfs.

In order to use freebase you need to install the freebase-python bindings. They
are available via https://code.google.com/p/freebase-python/

To extend an item's taggings with freebase data you have to add a freebase query
to the item's .tag file. Here's an example:

_freebase: {"id": "/m/0clpml", "type": "/fictional_universe/fictional_character", "name": null, "occupation": null}

tagfs uses the freebase MQL query format which is described below the following
link http://wiki.freebase.com/wiki/MQL

The query properties with null values are added as context/tag pairs to the
.tag file's item.

Generic freebase mappings for all items can be specified in the file
'<items directory>/.tagfs/freebase'. Every line is one freebase query. You can
reference tagged values via the '$' operator. Here's an example MQL query with
some demo .tag files:

<items directory>/.tagfs/freebase:
{"type": "/film/film", "name": "$name", "genre": null, "directed_by": null}

<items directory>/Ted/.tag:
name: Ted

<items directory>/Family Guy/.tag:
name: Family Guy

When mounting this example the genre and director will be fetched from freebase
and made available as filtering directories.


---------------------------------------------------------------------
Bugs

Viewing existing and reporting new bugs can be done via the github issue
tracker:
https://github.com/marook/tagfs/issues


---------------------------------------------------------------------
Further Reading

Using a file system for my bank account (Markus Pielmeier)
http://pielmeier.blogspot.com/2010/08/using-file-system-for-my-bank-account.html


---------------------------------------------------------------------
Contact

* homepage: http://wiki.github.com/marook/tagfs
* author: Markus Peröbner <[email protected]>

tagfs's People

Contributors

davvolun avatar marook avatar pitrp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tagfs's Issues

Configuration files reading in opposite order

According to documentation,

'..The following locations are used.
Locations with higher priority come first:

  • /.tagfs/tagfs.conf
  • ~/.tagfs/tagfs.conf
  • /etc/tagfs/tagfs.conf'

After inserting the contents of the above three, respectively:

[global]
tagFileName = ITEMS

[global]
tagFileName = HOME

[global]
tagFileName = ROOT

and enabling logging, the result produces:

DEBUG Using configuration [tagFileName: ROOT, enableValueFilters: False, enableRootItemLinks: False]

This appears to be the reverse of what should occur. The HOME setting should override the ROOT setting and the ITEMS setting should override the HOME setting.

Infinite nesting of subcategories

I am currently unable to replicate the example given using 'Ted' and 'banana'.

If I create the directories and .tag files as specified:

/items
|-- Ted
    |-- .tag
|-- banana
    |-- .tag

Where the contents of /items/Ted/.tag is:
movie
genre: comedy

and /items/banana/.tag is:
fruit
genre: delicious

Then run 'fstag -i /items /test', the result is:

/test
|-- genre
    |-- comedy
        |-- Ted -> /items/Ted
        |-- genre
            |-- comedy
                |-- Ted -> /items/Ted
                |-- genre
                ....
    |-- delicious
        |-- banana -> /items/banana  
        |-- genre
            |-- delicious
            ....

I also have a question as to why i don't see 'movie' or 'fruit' appear anywhere, but I suspect that is coming from the default value of enableValueFilters.

Mishandling of empty tags

If any of tag-files contains an empty tag (i.e., a tag with empty value, for example:
SomeTag:
), TagFS mounts it fine, but when I try to open it, I get an "Invalid argument" message.

Example:

$ tail -3 db/Sample/tag
composer: Galina Lupandina
poet: Svetlana Kopylova
genre:
$ tagfs dbm -i db -t tag
$ ls dbm
ls: reading directory dbm: Invalid argument
$ fusermount -u dbm
$

Expected result: either ignoring such tag or issuing an error message during mount.

Unable to set enableValueFilters=true, possible short term solution

I'm not sure if this is related to a version of Python or what, but if I set enableValueFilters = true in my configuration, I get an error attempting to ls the mount directory. Disabling valueFilters works successfully.

It appears to be a problem with line 303 of item_access.py, as per the following log: http://pastebin.com/BRNtqs78

I've created a patch file which does fix the symptom (though I'm not presuming that it is fixing the issue as it should be fixed):
http://pastebin.com/rXy0KPFv

The patch simply wraps item.tags inside a set() call to avoid the type mismatch.

e2e_test pulling settings from configuration files

It looks like re-running the e2e_test after creating a config file (e.g. ~/.tagfs/tagfs.conf) will read the settings in the configuration file for the end-to-end tests. I don't know if this is the expected behavior, but I suspect not.

Program hangs when mountpoint and items directory are the same

I made a directory /tmp/x with subdirectories /tmp/x/a and /tmp/x/b, which in turn contained simple index files. Then I issued a following command:
$ tagfs /tmp/x -i /tmp/x
And it hung. I couldn't terminate it even with killall -9 tagfs. Then I tried to rmmod -f fuse, and it worked. But few minutes later system hung completely.
I didn't investigate problem deeper yet.

[minor] Exception when calling tagfs without passing items directory

When I call tagfs without passing it an items directory:
$ tagfs /mountpoint
It prints help message, says "Error: Missing items directory option", but then falls with an exception "Cannot find module sys" or like this.
Fix is trivial:

--- tagfs.py.bak 2011-01-17 04:02:14.000000000 +0300
+++ tagfs.py 2011-01-17 04:01:56.000000000 +0300
@@ -155,6 +155,7 @@
fs.parser.print_help()
# items dir should probably be an arg, not an option.
print "Error: Missing items directory option."

  •   import sys
      sys.exit()
    
 return fs.main()

(sorry for ugly markup...)

Please document how to use this tool

Hi!

I wanted to evaluate tagfs as a tagging tool.

Meanwhile, I am able to mount this thing (by using root and omitting «--home ~/.local» for installation - contrary to the documentation).

But what then?

vk@gary ~2d/2012-12-19-tagfs % ls -la
ls: cannot access mountpoint: Permission denied
total 24
drwxr-xr-x 4 vk vk 4096 Dec 19 14:27 ./
drwxrwxr-x 34 vk vk 16384 Dec 20 14:13 ../
drwxr-xr-x 2 vk vk 4096 Dec 20 20:03 items/
d????????? ? ? ? ? ? mountpoint/
1 vk@gary ~2d/2012-12-19-tagfs %

The mountpoint looks very strange and whatever I copy to «items» it does not provoke any action at all.
I can not change into «mountpoint» as well.

So either the source code is broken or the tool is not working on my machine.

The documentation needs some basic description on how to use tagfs anyway:

  • how to tag a file
  • how to use tags to find a file
  • how to change tags
  • ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.