INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Different date formats in MCWS between Windows and Linux [Solved]  (Read 844 times)

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Different date formats in MCWS between Windows and Linux [Solved]
« on: September 08, 2023, 01:03:48 pm »

When I have a scheduled recording and get its info via http://localhost:52199/MCWS/v1/Television/GetRecordingScheduleXML, I get two different encodings for the start date and time.

So on Windows (which has been working for a while now) I get a response of
Code: [Select]
<Item Name="Recordings">
<Rec>
<ProgKey>585202</ProgKey>
<ChannelKey>350828</ChannelKey>
<RecordingID>543143068</RecordingID>
<StartTime>11/09/2023 20:55</StartTime>
<Duration>4499</Duration>
<ProgName>The Inheritance</ProgName>
<Description>While the police investigate Dennis' death, the Watson siblings hunt for their father's previous will as they try to show his original intentions, and that his death was not accidental.</Description>
<Status>Scheduled to be recorded.</Status>
<TypeOfRecording>One time recording based on programming guide</TypeOfRecording>
<IsRecordingNow>0</IsRecordingNow>
</Rec>
</Item>

But in my new Linux port I get
Code: [Select]
<Item Name="Recordings">
<Rec>
<ProgKey>74770</ProgKey>
<ChannelKey>44845</ChannelKey>
<RecordingID>2137823542</RecordingID>
<StartTime>11/09/23 08:55 pm</StartTime>
<Duration>4499</Duration>
<ProgName>The Inheritance</ProgName>
<Description>While the police investigate Dennis' death, the Watson siblings hunt for their father's previous will as they try to show his original intentions, and that his death was not accidental.</Description>
<Status>Scheduled to be recorded.</Status>
<TypeOfRecording>One time recording based on programming guide</TypeOfRecording>
<IsRecordingNow>0</IsRecordingNow>
</Rec>
</Item>

The StartTime values are just so weirdly different and make porting a real hassle! No only does the Linux version use an AM/PM 12-hour time, but it only has a 2-digit year.

Are these (different) fixed formats or are they culture-specific in any way?
Logged

Yaobing

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10854
  • Dogs of the world unite!
Re: Different date formats in MCWS between Windows and Linux
« Reply #1 on: September 08, 2023, 10:41:58 pm »

I don't think we have two-track coding for Linux and Windows, not with regard to TV recording schedules and MCWS.  I would guess it is the default date format setting of each OS that determines the output format, but I am not sure, as I don't know how we handle date time format for Linux.
Logged
Yaobing Deng, JRiver Media Center

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Different date formats in MCWS between Windows and Linux
« Reply #2 on: September 09, 2023, 01:05:15 am »

OK Thanks.

I am now handling either/both of the DateTime formats I have seen used, in the hope that it is only OS-dependent and not culture-dependent.

If it turns out to be culture-dependent as well, then the code will not work except in the UK!

And there is actually only that single instance where I need to parse a formatted DateTime string which I have not written myself. All other TV DateTime values returned by MCWS (e.g. in the EPG) are encoded as fractional days since 30-dec-1899
Logged

Yaobing

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10854
  • Dogs of the world unite!
Re: Different date formats in MCWS between Windows and Linux
« Reply #3 on: September 12, 2023, 12:38:15 pm »

I took another look.  Our FormatDate() function is implemented differently for different OS.  Since I don't quite know how it works in Linux, I am going to add a parameter in GetRecordingScheduleXML function so the datetime can be in either formatted form, or "number of days since..."
Logged
Yaobing Deng, JRiver Media Center

Yaobing

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10854
  • Dogs of the world unite!
Re: Different date formats in MCWS between Windows and Linux
« Reply #4 on: September 12, 2023, 01:30:22 pm »

It's done (for build 55 - not built yet).

Changed: Added a parameter FormatDateTime to MCWS function GetRecordingScheduleXML to specify whether to format the StartTime returned value.

Add a parameter FormatDateTime=0 to get StartTime returned as a string of decimal numbers.
Logged
Yaobing Deng, JRiver Media Center

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Different date formats in MCWS between Windows and Linux
« Reply #5 on: September 14, 2023, 10:54:48 am »

Thanks for this.

I'll update my code to use it once I upgrade my test and live machines to that latest version.
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Different date formats in MCWS between Windows and Linux
« Reply #6 on: October 04, 2023, 09:31:57 am »

The new parameter works as it should. I consider this issue as solved.
Logged

Yaobing

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10854
  • Dogs of the world unite!
Re: Different date formats in MCWS between Windows and Linux
« Reply #7 on: October 12, 2023, 01:33:33 pm »

Thanks for the update.
Logged
Yaobing Deng, JRiver Media Center
Pages: [1]   Go Up