Posts: 1,894
Threads: 296
Joined: Sep 2014
Reputation:
33
07-20-2017, 04:57 PM
(This post was last modified: 08-29-2017, 08:38 PM by itsme.)
I can select "Duration" in the filter section, but I fail when it comes to entering the value I'm looking for. I suppose I have to enter the time in a specific format.
How can I find e.g. all songs with a duration of 3:00
Posts: 13,455
Threads: 302
Joined: Apr 2012
Reputation:
240
07-22-2017, 04:05 PM
(This post was last modified: 07-22-2017, 04:05 PM by Zubersoft.)
I will check on this but I believe it's doing the comparison based upon the total number of seconds (as that is how I store it internally). So if you have a song with a duration of 3:47, that's 227 seconds, which is the value it's comparing. I'll have to adjust the filtering to be a little smarter than that and accept other formats though.
Posts: 1,894
Threads: 296
Joined: Sep 2014
Reputation:
33
No, it's not by time in seconds. It seems to be something like "search for string containing the specified characters" as it is the case for other fields. It's not usable at all for Duration.
My use case as a background info:
I want to use MSPs calculation of setlist's total duration. That requires that Duration is specified for all songs. If I don't know a song's duration (yet), I want to enter a default duration like 3:00, 3:01 or the like and want to reserve this default value for estimated durations. So I want to search for songs that already have that default value as a "real" duration and I want to search songs with Duration = 0:00 (not entered).
It also could be achieved by this feature request:
- don't enter a default value for Duration in the database
- make "not specified" and 0:00 two different database values for Duration
- allow specifying a default value for Duration that is used ONLY when a totol Duration of a setlist is calculated and a song's Duration is "not specified"
Posts: 13,455
Threads: 302
Joined: Apr 2012
Reputation:
240
Okay, you are right, I'm doing string comparison of the song's duration against whatever is entered in the search bar, but I'm incorrectly stripping punction characters such as the ":" as this is normally required for other searches. I'm fixing the code right now so that the comparison is different when the search is set to "Duration".
Due to me storing duration as an integer value in the database, there really isn't an easy way for me to default the duration to nothing. I guess I could set it to something like -999, and in the song editor, display "Not Set" for duration instead of 0:00 if I detect that negative value. Then I will have to code when calculating setlist duration to ignore all negative values, and make sure nothing in my code explodes if there is a negative value in that field.
Posts: 1,894
Threads: 296
Joined: Sep 2014
Reputation:
33
07-23-2017, 02:12 AM
(This post was last modified: 07-23-2017, 02:12 AM by itsme.)
Thanks for checking, Mike.
Don't invest too much effort in that probably pretty rare use case. I'm fine when the basic functionality works.
Posts: 1,894
Threads: 296
Joined: Sep 2014
Reputation:
33
It works fine in 1.9.0. Thank you Mike.