You are here

Reset the seconds

7 posts / 0 new
Last post
martos
Offline
Donator
Joined: 11 years
Last seen: 1 month
Reset the seconds

Hello,

I have xml like:

<programme start="20240805000022 +0300" stop="20240805235538 -0800" channel="Some Channel">

What is the recommended way to make it with zeroed seconds like this:

<programme start="20240805000000 +0300" stop="20240805235500 -0800" channel="Some Channel">

mat8861
Offline
WG++ Team memberDonator
Joined: 9 years
Last seen: 13 hours

strange xml start is with +3hrs and stop -8hrs. Anyway if you want to round seconds i think sed can help. You can run the grab and then with a sed script round the seconds, although is a strange request. Just make sure you round to zero both start and stop otherwise it will be a mess.

martos
Offline
Donator
Joined: 11 years
Last seen: 1 month
mat8861 wrote:

strange xml start is with +3hrs and stop -8hrs

My apologies for the confusion—the XML is actually in just one timezone; it was a mistake with copy/pasting. By the way, I believe I found a method to round the seconds:

index_start.modify {calculate(format=date,unix)}
index_stop.modify {calculate(format=date,unix)}

This approach seems to work for me, though I’m not certain it’s the most optimal solution.

mat8861
Offline
WG++ Team memberDonator
Joined: 9 years
Last seen: 13 hours

What is the input from the site (the scrubbed data) for start/stop?

martos
Offline
Donator
Joined: 11 years
Last seen: 1 month
mat8861 wrote:

What is the input from the site (the scrubbed data) for start/stop?

I receive a ready for use xml file for that channel and merge it. I don't know what is the original input.

Blackbear199
Offline
Blackbear199's picture
WG++ Team memberDonator
Joined: 9 years
Last seen: 8 hours

date,unix is in seconds so it should make no difference.

index_start.modify {calculate(format=date,"dd-MM-yyyy HH:mm")}
index_stop.modify {calculate(format=date,"dd-MM-yyyy HH:mm")}

this should work as it doesnt use the seconds.

martos
Offline
Donator
Joined: 11 years
Last seen: 1 month

I don't know how and why, but format=date,unix works :)

format=date,"dd-MM-yyyy HH:mm" works too and I will be happy to use it.

Thanks for help

Log in or register to post comments

Brought to you by Jan van Straaten

Program Development - Jan van Straaten ------- Web design - Francis De Paemeleere
Supported by: servercare.nl