TMSU icon indicating copy to clipboard operation
TMSU copied to clipboard

List all the tags with values

Open nkh opened this issue 3 years ago • 11 comments

I'm integrating TMSU in my file manager (maybe this time I'll tag for longer than 2 weeks before giving up) and adding the possibility to select existing tags to apply on the selected files

tmsu tags doesn't report "tag=value" but just "tag", this means that I have to first get all the tags, then get all the files that have the tag, then parse all the files tags till I get the one that has a value, if it has one, then extract the values.

Can we, I please , get a tmsu tags --with-values, or something equivalent that wouldn't force one to go through hoops (that would be fine if it didn't take a noticeable time) or shall one hack the data out of the database?

Cheers

nkh avatar Oct 15 '22 20:10 nkh

You can do tmsu values TAG to get the existing values for a tag. So you could get all the tags with tmsu tags and look up the values for each with tmsu values TAG. Not precisely what you want but not too bad.

On Sat, 15 Oct 2022, 21:49 Nadim Khemir, @.***> wrote:

I'm integrating TMSU in my file manager (maybe this time I'll tag for longer than 2 weeks before giving up) and adding the possibility to select existing tags to apply on the selected files

tmsu tags doesn't report "tag=value" but just "tag", this means that I have to first get all the tags, then get all the files that have the tag, then parse all the files tags till I get the one that has a value, if it has one, then extract the values.

Can we, I please , get a tmsu tags --with-values, or something equivalent that wouldn't force one to go through hoops (that would be fine if it didn't take a noticeable time) or shall one hack the data out of the database?

Cheers

— Reply to this email directly, view it on GitHub https://github.com/oniony/TMSU/issues/257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABOB3XCYMMKJQCT662LJ3WDMKDRANCNFSM6AAAAAARGBZJII . You are receiving this because you are subscribed to this thread.Message ID: @.***>

oniony avatar Oct 15 '22 22:10 oniony

certainly not too bad!

is there a way to get all the queries? I can "find" ~/mnt/queries but there may be a simpler way

nkh avatar Oct 16 '22 10:10 nkh

and nice that one can give multiple tags to "tmsu values"!

nkh avatar Oct 16 '22 10:10 nkh

Yeah, you should be able to do something like tmsu tags | xargs tmsu values.

There's currently no way to query the queries from the CLI.

On Sun, 16 Oct 2022, 11:33 Nadim Khemir, @.***> wrote:

and nice that one can give multiple tags to "tmsu values"!

— Reply to this email directly, view it on GitHub https://github.com/oniony/TMSU/issues/257#issuecomment-1279941487, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABOB4OF5WRATRT7FBKULLWDPKZJANCNFSM6AAAAAARGBZJII . You are receiving this because you commented.Message ID: @.***>

oniony avatar Oct 16 '22 10:10 oniony

@oniony, could you please add the possibility to query the queries? I'd rather avoid mounting a filesystem just to find them but I'll do it in the worst case.

I'm adding the possibility to find files per tags, via fzf, and I'd like to add the queries to the list as I believe that I will most often re-use the same queries. I'll be ready with most of the integration in a few days, I can send a video if you're interested.

nkh avatar Oct 17 '22 10:10 nkh

Yeah, can do, but it'll probably be in the Rust rewrite I'm planning and I'm really busy with work at the moment so won't be for a while.

As an alternative you can query the database directly.

On Mon, 17 Oct 2022, 11:06 Nadim Khemir, @.***> wrote:

@oniony https://github.com/oniony, could you please add the possibility to query the queries? I'd rather avoid mounting a filesystem just to find them but I'll do it in the worst case.

I'm adding the possibility to find files per tags, via fzf, and I'd like to add the queries to the list as I believe that I will most often re-use the same queries. I'll be ready with most of the integration in a few days, I can send a video if you're interested.

— Reply to this email directly, view it on GitHub https://github.com/oniony/TMSU/issues/257#issuecomment-1280611335, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABOB25QA5OWK6Z7OOQ4BLWDUQJHANCNFSM6AAAAAARGBZJII . You are receiving this because you were mentioned.Message ID: @.***>

oniony avatar Oct 17 '22 10:10 oniony

query the db directly is fine for me, could you please set me on the tracks?

nkh avatar Oct 17 '22 12:10 nkh

The schema is detailed here: https://github.com/oniony/TMSU/wiki/Database-Schema

You can install the Sqlite3 tooling and access the tmsu.db file directly from the command-line or you can install any tool that has Sqlite3 connectivity. I'm quite fond of DBeaver for a GUI tool, for example.

From your app you would need a Sqlite3 provider.

Bear in mind the database schema could change from version to version. It's very unlikely to considering I've not made any updates on a while. It'll likely be different in the Rust rewrite.

On Mon, 17 Oct 2022, 13:12 Nadim Khemir, @.***> wrote:

query the db directly is fine for me, could you please set me on the tracks?

— Reply to this email directly, view it on GitHub https://github.com/oniony/TMSU/issues/257#issuecomment-1280760585, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABOB5PPIIW37TXDADBLKLWDU7CXANCNFSM6AAAAAARGBZJII . You are receiving this because you were mentioned.Message ID: @.***>

oniony avatar Oct 17 '22 12:10 oniony

Will the filesystem still be the same? in that case I may as well use it, it's just a few lines of code and speed is no problem for what I want to do. It's also fewer dependencies and I think it's nice to use core utilities.

nkh avatar Oct 17 '22 13:10 nkh

I'm not sure yet.

On Mon, 17 Oct 2022, 14:42 Nadim Khemir, @.***> wrote:

Will the filesystem still be the same? in that case I may as well use it, it's just a few lines of code and speed is no problem for what I want to do. It's also fewer dependencies and I think it's nice to use core utilities.

— Reply to this email directly, view it on GitHub https://github.com/oniony/TMSU/issues/257#issuecomment-1280882514, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABOB2UE472LVQOHVDEL3DWDVJVJANCNFSM6AAAAAARGBZJII . You are receiving this because you were mentioned.Message ID: @.***>

oniony avatar Oct 17 '22 13:10 oniony

OK, then, I'll get it out of the file system in the meantime, it's just a few lines. Apropos file system, I had some difficulties getting to work as I expected, I got broken links and error messages about "Transport endpoint is not connected" and "deleted directories". I'll fill an issue when I'm sure I'm not the one doing something wrong.

I made a short video about the integration of tmsu in a file manager, download the video to play it, the preview's resolution is horrible and a waste of internet bits.

https://drive.google.com/file/d/1BgTiiwqBTEy9jMGwYGPcMGe2jvoBodsN/view?usp=sharing

nkh avatar Oct 18 '22 00:10 nkh