Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: [fb2k v2] SQLite Utilities (foo_sqlite) (Read 68493 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: foo_sqlite

Reply #125
Hello. I need to find songs with same duration. In foobar2000 in SQLite utilities/playlist table I want to create column duration_ms. I know that in playlist of foobar2000 that column is %length_ex% (in preferences/Display/Default user interface/Playlistview). How to create this column in SQlite?

Re: foo_sqlite

Reply #126
Add a new field under 'Preferences > Media Library > SQLite utilities > Playlist table' using the attached configuration.

Re: foo_sqlite

Reply #127
@VivinCels: Although the solution of @SimBun is totally correct, you should consider to use just the predefined column length_seconds for your comparisons as the evaluation is faster in general than using a title format based column.

If the value is too precise you can use the round() function to ignore (partially) fractions, e.g. round(length_seconds) to remove milliseconds at all or round(length_seconds,3) to get the same behaviour as provided by %length_ex%.

If you want to have formatted values for display purposes and you don't care about milliseconds you can also use format_length_hours(length_seconds).

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #128
New version, see first post.

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #129
Preferences window cut.

EDIT: Forgot to say, that I use Windows 11 at 125% DPI Scaling. With 100% its ok.

See: https://hydrogenaud.io/index.php/topic,116045.msg1010332.html#msg1010332

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #130
I'm enjoying the new component versions. Thank you for continuing to develop them. I nearly have all I need to jump to 64-bit fb2k now. The nodes load so fast that my attempts to get foobar to run under Wine in Linux might even get closer to success.

Naturally, though, I still have issues to raise.

Firstly, I'm still crashing when creating a new playlist by sending tracks to one, opening up the SQLite console, and executing SELECT * FROM Playlist. I noticed a new wrinkle, however. I reopened foobar after the crash and deleted the previously-new playlist, leaving just the default one. Then, sending another batch of tracks to a different new playlist, I could execute the console fine. Then, sending another batch of tracks into a third playlist, I crashed again. Is the total of open playlists somehow a factor? [ETA, in this test, I still have not yet put a SQL Tree in the layout and have been sending tracks with the DUI Album List. That's why there aren't any foo_uie_sql_tree files included.]

The second is a query of mine that no longer works which displayed the contents of foo_uie_sql_tree.sqlite_master. That table seems to no longer exist, which seems an odd one to go missing. I've tried querying it in an external program, SQLiteStudio, as well with similar problems. The query is something like this, executed in the SQLite console. [ETA: This and the rest of these issues are in my working foobar installation.]

Code: (sql) [Select]
ATTACH DATABASE 'profile/configuration/foo_uie_sql_tree.db' AS sqltree;


DROP TABLE IF EXISTS   sqltree_master;
CREATE TEMPORARY TABLE sqltree_master AS
SELECT   type
       , name
       , tbl_name
       , rootpage
       , sql
    FROM sqltree.sqlite_master
ORDER BY type
       , name
         ;


DETACH DATABASE sqltree;


SELECT *
  FROM sqltree_master

Third issue: in the properties window, I have to press the OK button twice when making changes to the MediaLibrary or Playlist tables. The first press acts like pressing Apply.

I have some issues in the SQL Tree as well, but I guess I'll just mention them here, if that's OK.

In the SQL Tree Edit query node Action tab, a previously set value for Target playlist appears blanked out if there is not currently a playlist of that name open in foobar. Pressing OK will overwrite the previous value with a blank one.

And then I have a feature request for the SQL Tree: I'd love for the scrollbars to be dark in dark mode.

Thanks again. Your components are the basis of my whole fb2k experience.

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #131
Preferences window cut.

EDIT: Forgot to say, that I use Windows 11 at 125% DPI Scaling. With 100% its ok.

See: https://hydrogenaud.io/index.php/topic,116045.msg1010332.html#msg1010332
See also: https://github.com/stuerp/foo_midi/issues/3

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #132
Preferences window cut.

EDIT: Forgot to say, that I use Windows 11 at 125% DPI Scaling. With 100% its ok.

See: https://hydrogenaud.io/index.php/topic,116045.msg1010332.html#msg1010332
See also: https://github.com/stuerp/foo_midi/issues/3
As I cannot reproduce this problem on my Windows 11 systems, I asked @Case what he did to fix it and implemented his solution. Well, it's just more or less the opposite of the fix for foo_midi.

Could you please with the attached 64bit version of foo_sqlite, if the issue is fixed on your PC?


Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #134
Firstly, I'm still crashing when creating a new playlist by sending tracks to one, opening up the SQLite console, and executing SELECT * FROM Playlist.
Finally, I could reproduce the problem and fix it.

Is the total of open playlists somehow a factor?
Yes, this was in general the problem.

That table seems to no longer exist,
It does, of course, exist, but I guess, that the file foo_uie_sql_tree.db is not found as the current working directory of the applications seems to have changed. Therefore you need to attach the database like this:

Code: [Select]
ATTACH fb2k_profile_path()||'\configuration\foo_uie_sql_tree.db' AS sqltree;

Third issue: in the properties window, I have to press the OK button twice when making changes to the MediaLibrary or Playlist tables. The first press acts like pressing Apply.
Fixed.

In the SQL Tree Edit query node Action tab, a previously set value for Target playlist appears blanked out if there is not currently a playlist of that name open in foobar. Pressing OK will overwrite the previous value with a blank one.
Fixed.

I'd love for the scrollbars to be dark in dark mode.
I just forgot to add dark mode support to the tree panel itself. It's done now.

Fixed.
Thanks for testing.


Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #136
I've been playing with the vsv() function looking for other ways to handle some of my default data, and I was wondering if there was a way to bridge the standard/portable installation difference with respect to filenames with it. For instance, I have a script that begins like this.

Code: (sql) [Select]
CREATE VIRTUAL TABLE temp.csv USING vsv(filename='profile/moodflag/csv/custom_tags_dflt.csv'
                                      , header=1
                                        );


ATTACH DATABASE (SELECT fb2k_profile_path()
                     || '/configuration/foo_sqlite.db'
                        )
             AS sqlitedb
                ;

I can't put a SELECT fb2k_profile_path() in the first statement like I can in the second, since I seem to have left SQLite inside those parentheses of the vsv() function. Is there some slick bit of C I can stick in there to do the same thing?

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #137
I can't put a SELECT fb2k_profile_path() in the first statement like I can in the second, since I seem to have left SQLite inside those parentheses of the vsv() function. Is there some slick bit of C I can stick in there to do the same thing?
No, just omit the SELECT. It's not possible in the first case and not necessary in the second case. Further more you should use Windows path separators.

Code: [Select]
CREATE VIRTUAL TABLE temp.csv USING vsv(filename=fb2k_profile_path()||'\moodflag\csv\custom_tags_dflt.csv'
                                                                   , header=1
                                                                    );

ATTACH DATABASE fb2k_profile_path()||'\configuration\foo_sqlite.db' AS sqlitedb;

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #138
I changed my code to that, and it fails now at the first line with a SQLite Error. I've tried several variations: backslash, forward slash, double backslash, omitting the first slash, double quotes, single quotes. I can't make it work the way the plain relative-to-foobar.exe-directory way does.

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #139
hi,

when I execute my query in console: after execution 5000 row limit is reached, but in [advanced] the query node limit is 100000 set.
Is there something wrong or is this only in SQLlite console view?

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #140
I changed my code to that, and it fails now at the first line with a SQLite Error.
Ah, yes. The parameters are virtual table module arguments which are always taken literally and parsed and interpreted by the module. It means, there is no way to specify the profile path.

when I execute my query in console: after execution 5000 row limit is reached, but in [advanced] the query node limit is 100000 set.
Is there something wrong or is this only in SQLlite console view?
The query node limit is for the SQL Tree. The relevant advanced setting for the SQLite console is "SQLite console row limit"

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #141
Hi,
@fbuser thx for poining :-) "he query node limit is for the SQL Tree. The relevant advanced setting for the SQLite console is "SQLite console row limit""

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #142
Hi @fbuser,
If you ever get a chance for a feature request, one thing I would love to see someday is a Title Format function that would allow one to specify a SQL Select statement, and then get back the query result. 
Just my two cents.
Regards

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #143
s a Title Format function that would allow one to specify a SQL Select statement, and then get back the query result. 
This is not possible. The possibility to define title format functions for 3rdparty components was removed form the SDK almost 15 years ago. Apart from this such a function would probably cause more problems than it solves.

Anyway, for certain use cases the tagging functionality of foo_sqlite could be used, at least in a limited way. What exactly do you want to achieve with the mentioned title format function?

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #144
Hi, I just installed this component for the very first time. I wanted to play around with the lookup tables, but all the buttons in the lookup tables dialog are disabled.
How am I supposed to proceed?
I'm late

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #145
Hi, I just installed this component for the very first time. I wanted to play around with the lookup tables, but all the buttons in the lookup tables dialog are disabled.
This should not be. Could you please post a screen shot of your dialog?

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #146
This should not be. Could you please post a screen shot of your dialog?

See the image attached.
FYI, I'm testing SQLite utilities 3.0.4 on a x64 2.0 fresh installation. I only configured the library (which is around 338.000 tracks) and a few properties dialog settings. No other user plugin is installed.
Thanks for helping.
I'm late

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #147
See the image attached.
Ok. Actually, there is one situation, where all buttons are disabled: You didn't define any SQLite tag. The key of a lookup table can only be a SQLite tag. Furthermore any columns of a lookup table are also required to be SQLite tags, as they are defined in the SQLite tag dialog. In the lookup table dialog only the name and the key of the lookup table are specified.

Here the documentation is not clear. This will be changed.

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #148
In the lookup table dialog only the name and the key of the lookup table are specified.

I see, thanks for the clarification. I managed to create my first lookup table, but how should I populate it now? I tried to insert a record with the SQLite console, but it didn't work.
One more thing puzzles me: I was expecting the newly created SQLite tags to show up in the details section of the properties dialog, but they don't.
I'm late

Re: [fb2k v2] SQLite Utilities (foo_sqlite)

Reply #149
I managed to create my first lookup table, but how should I populate it now?
By populating the relevant tags in the properties dialog or by any other means to write tags. Just make sure that the "SQLite tagger" track info filter is active (see also in the help file under "SQLite Utilities - Preferences SQLite tags dialog").

I tried to insert a record with the SQLite console, but it didn't work.
Of course, not. The lookup tables are not meant to be filled by the user. There is a reason why the tags database is not exposed to the user. The values in these table require a specific format.

One more thing puzzles me: I was expecting the newly created SQLite tags to show up in the details section of the properties dialog, but they don't.
They are only shown for single files and only, if SQLite tags for the relevant file are written to the database.