Time duration as ##:##:## in a phone call flow
Moderator: Martin
-
- Posts: 186
- Joined: 12 Feb 2014 01:45
Re: Time duration as ##:##:## in a phone call flow
Martin, thanks for your answer on that other thread. I've been eyeing this thread but couldn't see anything suitable for me. I tried different things through trial and error and still couldn't find solution.
Currently this is where I'm at. Could you help me forward? http://automagic4android.com/flow.php?i ... a5adaef6ee
The "duration" variable received from Poweramp is in seconds. The notification output returns always 02:00:00 and the script(before formatting in notification action) returns always some integer even though there should be some digits also.
Currently this is where I'm at. Could you help me forward? http://automagic4android.com/flow.php?i ... a5adaef6ee
The "duration" variable received from Poweramp is in seconds. The notification output returns always 02:00:00 and the script(before formatting in notification action) returns always some integer even though there should be some digits also.
-
- Posts: 186
- Joined: 12 Feb 2014 01:45
Re: Time duration as ##:##:## in a phone call flow
A thought;
Probably the number of seconds you get from PowerAmp is nothing more than number (it does not represent a point in time or a time duration).
In Excel you have an adapted format not the normal time/date format to calculate hours and minutes and so on, I could not find any number formats here that would do the trick.
But I would think you should be able to make it look right HH:mm:ss, by nested "if expressions" or similar, although it will not be a time format really. I am not able to write an expression in "Automagic code" to make it into HH:mm:ss, as I could in Excel/VB.
Hope Martin can help you out ( I am very interested, calculating/formatting time is always troublesome)
Probably the number of seconds you get from PowerAmp is nothing more than number (it does not represent a point in time or a time duration).
In Excel you have an adapted format not the normal time/date format to calculate hours and minutes and so on, I could not find any number formats here that would do the trick.
But I would think you should be able to make it look right HH:mm:ss, by nested "if expressions" or similar, although it will not be a time format really. I am not able to write an expression in "Automagic code" to make it into HH:mm:ss, as I could in Excel/VB.
Hope Martin can help you out ( I am very interested, calculating/formatting time is always troublesome)
Best regards,
AngelAtwOrk
AngelAtwOrk
Re: Time duration as ##:##:## in a phone call flow
The number is a variable that shows a length of the song so yes, it is just a plain number. I should somehow make Automagic to understand that were talking about seconds(or milliseconds, whatever suits Automagic) so it could be formatted.
As I stated in my original thread, I was able to format it to "XXm YYs" , but that format is problematic because of the extra space between minutes and seconds. Toast message sometimes cuts the seconds to a new line which makes it hard to read fast and in many other ways that is impractical way to show song duration.
As I stated in my original thread, I was able to format it to "XXm YYs" , but that format is problematic because of the extra space between minutes and seconds. Toast message sometimes cuts the seconds to a new line which makes it hard to read fast and in many other ways that is impractical way to show song duration.
Re: Time duration as ##:##:## in a phone call flow
The duration of the song is returned in seconds by PowerAMP so you can use following action to display the duration formatted:
Notification on Screen: {duration*1000,dateformat,timezone,UTC,HH:mm:ss}
This should display something like 00:02:54 when the song has a duration of 174 seconds.
Notification on Screen: {duration*1000,dateformat,timezone,UTC,HH:mm:ss}
This should display something like 00:02:54 when the song has a duration of 174 seconds.
-
- Posts: 186
- Joined: 12 Feb 2014 01:45
Re: Time duration as ##:##:## in a phone call flow
ok, thanks Martin,
it clarifies it for me, at least (it was in seconds then). Hope it works for you Murtuma
it clarifies it for me, at least (it was in seconds then). Hope it works for you Murtuma

Best regards,
AngelAtwOrk
AngelAtwOrk
Re: Time duration as ##:##:## in a phone call flow
That works. However is there a way to remove the hours if it shows zeroes?
Re: Time duration as ##:##:## in a phone call flow
If the songs are not that long you could remove the hours completely (Notification on Screen: {duration*1000,dateformat,timezone,UTC,mm:ss}) or use a condition and two actions:
-condition Expression: duration>60*60
-->true: -action Notification on Screen: {duration*1000,dateformat,timezone,UTC,HH:mm:ss}
-->false: -action Notification on Screen: {duration*1000,dateformat,timezone,UTC,mm:ss}
..or create the text in an action Script:
-condition Expression: duration>60*60
-->true: -action Notification on Screen: {duration*1000,dateformat,timezone,UTC,HH:mm:ss}
-->false: -action Notification on Screen: {duration*1000,dateformat,timezone,UTC,mm:ss}
..or create the text in an action Script:
Code: Select all
if(duration>60*60)
{
text = "{duration*1000,dateformat,timezone,UTC,HH:mm:ss}";
}
else
{
text = "{duration*1000,dateformat,timezone,UTC,mm:ss}";
}
Re: Time duration as ##:##:## in a phone call flow
It's solved. Thank you a lot!