INTERACT FORUM

Please login or register.

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

Author Topic: How to get Year/Date from sidecar files  (Read 2516 times)

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
How to get Year/Date from sidecar files
« on: October 16, 2011, 08:21:36 am »

I want to change it my self or ask the developer to make a change to a Meta Data app to make it possible to add Year or Release Date to a sidecar file. How is this most easily done?

<Field Name="Date">39726</Field>
Actual Date in MC: "05.10.2008"

The release date is an integer for days/year, and decimals for time. I'm thinking that this calculations from year 1899 or what ever to the actual release might be a bit troublesome. Is this easy to calculate? And how exactly could it be done without built in .Net components or what ever. If not, is there a way you can add a simple Year with 4 numbers to a sidecar file, import it to a custom field, and add this to the date field via an expression or something?

Any help would be appreciated!
Logged
- I may not always believe what I'm saying

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
Re: How to get Year/Date from sidecar files
« Reply #1 on: October 20, 2011, 03:44:12 am »

Nobody who could give me any pointers?

If I do this my self, I could probably add 365 days to get the year, but with the different days in months, it would be quite a project getting the exact day from this. Is there no easier way to convert Year to the date format in a sidecar file and import it to show date in MC? Perhaps I should only focus on calculating the year and just find a random number in that year. This could be reasonably simple.
Logged
- I may not always believe what I'm saying

Lasse_Lus

  • Citizen of the Universe
  • *****
  • Posts: 999
Re: How to get Year/Date from sidecar files
« Reply #2 on: October 20, 2011, 04:15:46 am »

if you only want the year (4 digits), why not use a string or integer field ?
Logged
MT5FR

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
Re: How to get Year/Date from sidecar files
« Reply #3 on: October 20, 2011, 04:29:37 am »

I could do that. But then every user who want to use this scraping method have to add their own custom field and edit Views and so on. It would work for me though. But I want to help some others as well if I can.
Logged
- I may not always believe what I'm saying

CountryBumkin

  • Citizen of the Universe
  • *****
  • Posts: 3352
Re: How to get Year/Date from sidecar files
« Reply #4 on: October 20, 2011, 04:40:16 am »

Nobody who could give me any pointers?

If I do this my self, I could probably add 365 days to get the year, but with the different days in months, it would be quite a project getting the exact day from this. Is there no easier way to convert Year to the date format in a sidecar file and import it to show date in MC? Perhaps I should only focus on calculating the year and just find a random number in that year. This could be reasonably simple.

As you know, Excel stores dates as sequential serial numbers so that they can be used in calculations (add 30 days to an existing date, etc.). By default, January 1, 1900, is serial number 1, and January 1, 2008, is serial number 39448 because it is 39,448 days after January 1, 1900.
 There is a simple convertion formula in Excel, but the trick would be how to automate it so you can convert the "number" in the Metadata field to the corresponding date. If you wanted to do each one by hand, you could open you Excel program enter the "number" and have it conver to a date format, but that would take a bit of time if you have a lot of conversions.
Would a batch file that reads the meta-data and converts the serial number in the"Date"  field to a standard date format be useful? Or is the intent/request to just have MC store the data the way you want it in the first place - without needing to convert it?
Logged

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
Re: How to get Year/Date from sidecar files
« Reply #5 on: October 20, 2011, 04:46:28 am »

Would a batch file that reads the meta-data and converts the serial number in the"Date"  field to a standard date format be useful?

The problem is that I want to do it the other way. I found a fully automatic meta scraper for movies and I have already made a Powershell script that converts xbmc sidecar files and what not to JRiver MC sidecar files. The thing I'm stuck with is the Year. I want to convert year strings to integer values for MC to pick up. Perhaps powershell have a built in way to convert Year to integer values??

Or perhaps there is an automatic scraper tool out there that can be customized so I don't need to make this script? That would be the best.


*EDIT*
Yes, you actually have a converter in Powershell. ToFileTime()
Testing it out now
Logged
- I may not always believe what I'm saying

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
Re: How to get Year/Date from sidecar files
« Reply #6 on: October 20, 2011, 05:30:44 am »

Aaaaah. I found the right function! ToOADate()

Here's one example:
Code: [Select]
$DateIn = "2011/01/01"
$IntegerDate = [datetime]::Parse($DateIn,[System.Globalization.CultureInfo]::InvariantCulture)
$IntegerDate = $IntegerDate.ToOADate()
 
write-host $IntegerDate

Will return 40544, which I think MC will be pretty happy with :) Cool. I'll post something later when I have the script ready.
Logged
- I may not always believe what I'm saying

Alex B

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 10121
  • The Cosmic Bird
Re: How to get Year/Date from sidecar files
« Reply #7 on: October 20, 2011, 12:31:41 pm »

Logged
The Cosmic Bird - a triple merger of galaxies: http://eso.org/public/news/eso0755

mbagge

  • Galactic Citizen
  • ****
  • Posts: 255
Re: How to get Year/Date from sidecar files
« Reply #8 on: October 20, 2011, 01:52:52 pm »

Just a piece of bonus-info. (This is copied from MSDN:)
An OLE Automation date is implemented as a floating-point number whose integral component is the number of days before or after midnight, 30 December 1899, and whose fractional component represents the time on that day divided by 24. For example, midnight, 31 December 1899 is represented by 1.0; 6 A.M., 1 January 1900 is represented by 2.25; midnight, 29 December 1899 is represented by -1.0; and 6 A.M., 29 December 1899 is represented by -1.25.

I am noting that the date number can go negative to specify dates before 1900.
Logged

Alex B

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 10121
  • The Cosmic Bird
Re: How to get Year/Date from sidecar files
« Reply #9 on: October 20, 2011, 02:50:01 pm »

You could have found a similar explanation by following my above link. :)

The day zero (December 30, 1899) didn't work in MC when I tested it (that was about four years ago, but I don't think a fix has been announced): http://yabb.jriver.com/interact/index.php?topic=67118.msg450177#msg450177
Logged
The Cosmic Bird - a triple merger of galaxies: http://eso.org/public/news/eso0755
Pages: [1]   Go Up