getmusicbee.com

Support => Bug Reports => Topic started by: The Incredible Boom Boom on June 15, 2020, 07:05:14 PM

Title: $Now() and <Last Played> Between 12:00:00 AM-12:59:59 AM Not Handling Correctly
Post by: The Incredible Boom Boom on June 15, 2020, 07:05:14 PM
Running version 3.4.7422.

Code
 $If($Now()>=<Last Played>,T,F)

$Now() -> 06/15/20 11:04:33 AM
<Last Played> -> 06/14/20 11:57 PM

This correctly displays "T," but...

$Now() -> 06/15/20 11:04:33 AM
<Last Played> -> 06/15/20 12:03 AM

...incorrectly shows "F."

$Now() -> 06/15/20 11:04:33 AM
$AddDurationToDateTime(<Last Played>,01:00:00) -> 06/15/20 01:03 AM

Correctly displays "T."
Title: Re: $Now() and <Last Played> Between 12:00:00 AM-12:59:59 AM Not Handling Correctly
Post by: Steven on June 20, 2020, 03:10:00 AM
I dont know how it would work at all as there is no $Now() function implemented by musicbee itself. Maybe its a plugin function someone has implemented. On the MusicBee side, <Last Played> would be converted to a local date/time so perhaps $Now() has been implemented as a UTC date/time
Title: Re: $Now() and <Last Played> Between 12:00:00 AM-12:59:59 AM Not Handling Correctly
Post by: The Incredible Boom Boom on August 02, 2020, 07:16:13 PM
I was planning - one day - to getting around to trying to test out your suggestion, but, since it would likely be fairly daunting, I put it off. However, a couple weeks ago, I noticed another number-related thing when using the Additional Tagging & Reporting Tools plug-in, which I reported here (https://getmusicbee.com/forum/index.php?topic=3833.msg177915#msg177915) and today, while helping another user out, I realized what's happening.

This code will return all expected results, i.e.
1 hour, 25 minutes...
1 hour, 1 minute
2 hours, 50 minutes
Code
$If($Div($Split(<Album Duration>,:,1),60)<1,,$RoundDown($Div($Split(<Album Duration>,:,1),60),0)" hour"$If($Pad($Split(<Album Duration>,:,1),3)>=120,"s",)", ")$Mod($Split(<Album Duration>,:,1),60)" minute"$If($Pad($Mod($Split(<Album Duration>,:,1),60),2)=01,,"s")

Removing the $Pad() function when checking if an album's duration is two hours or more returns incorrect results.
Code
$If($Div($Split(<Album Duration>,:,1),60)<1,,$RoundDown($Div($Split(<Album Duration>,:,1),60),0)" hour"$If($Split(<Album Duration>,:,1)>=120,"s",)", ")$Mod($Split(<Album Duration>,:,1),60)" minute"$If($Pad($Mod($Split(<Album Duration>,:,1),60),2)=01,,"s")

Furthermore...
Code
$If($Pad(1,2)=1,T,F)
...returns "F."

So... derp to me. I'm guessing this is intentional in how you want MB to handle numbers?