Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fulltext tag values #37

Closed
tomassedovic opened this issue May 18, 2015 · 6 comments
Closed

Fulltext tag values #37

tomassedovic opened this issue May 18, 2015 · 6 comments

Comments

@tomassedovic
Copy link

Would it be possible to add full text tags? For things like summary of a TV episode, song's lyrics, etc.

The full text values would be different from the existing values in that they're arbitrary long, without character restrictions and usually unique for each file & tag.

It would probably require a new command line option:

$ tmsu tag summer.mp3 music big-jazz mp3 --text "comments=Best. Song. Ever."

which would save the value Best. Song. Ever. for file summer.mp3 and tag comments.

@oniony
Copy link
Owner

oniony commented May 18, 2015

This is something I have considered. Indeed it's on the TODO list list (under 'low').

It would certainly be possible to do, for values at least. I don't think it would require any special option: the quotes alone should make the intent clear.

I'll see if I can squeeze it into the next release. For now you can use '-' or '_' to separate words, as a workaround:

$ tmsu tag spaced.doc full-name=totally-spaced

@tomassedovic
Copy link
Author

Oh, cool!

Not sure the quotes will be enough, though. I just tried argv in Python and C (don't have Go installed now but I imagine it'll work the same). Passing comments="Best. Song. Ever." means the program receives the string comments=Best. Song. Ever. (no quotes). But there are other ways (e.g. if the value is invalid, treat it as full text).

I may send you a pull request at some point if you're open to it. In case you are, do you want to just extend values to accept whitespace and punctuation or have the fulltext ones treated separately?

@oniony
Copy link
Owner

oniony commented May 18, 2015

Yeah, it'll take some care but it should be fairly straightforward.

I'm happy for pull requests but please don't be offended if I don't apply them verbatim. I see this as simply handling whitespace rather than new 'fulltext' funcitonality so I wouldn't expect there to be any new option: simply that the following will then be possible:

$ tmsu tag somefile tag="value with spaces"
$ tmsu tag somefile tag='value with spaces'
$ tmsu tag somefile tag=value\ with\ spaces

When I've thought about this in the past it seemed relatively straightforward as the shell should do the parsing for you and put the whole string, spaces and all, into a single ARGV array element. I.e. 'tmsu tag somefile tag=value with spaces' should result in ['tag=', 'value', 'with', 'spaces'] whereas 'tmsu tag somefile tag='value with spaces' should be received as ['tag=value with spaces'].

The complications come from other aspects:

  • 'tmsu files' supports queries and so TMSU currently joins the ARGV arguments together with spaces between before parsing the query language. This could potentially be handled by enquoting each element before joining with spaces and then upgrading the query parser to handle quotes.
  • 'tmsu tag -' allows the user to tag from standard input or other file in which case there is no shell parsing support.
  • The virtual filesystem exposes the tags/values as directories. I imagine this will work fine without changes but there could be unforeseen problems.

@oniony
Copy link
Owner

oniony commented May 18, 2015

It would also have to support spaces in the --tags option:

tmsu tag --tags="tag='value with spaces' othertag"
tmsu tag --tags='tag="value with spaces" othertag'
tmsu tag --tags="tag=value\ with\ spaces othertag"

@oniony
Copy link
Owner

oniony commented May 18, 2015

There is a tokenizer in tmsu/common/text for tokenising a string into fields with consideration for quotes.

@oniony
Copy link
Owner

oniony commented Sep 7, 2015

This is being implemented as part of issue #45.

@oniony oniony closed this as completed Sep 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants