Page 1 of 1

Script you have help me with before.

Posted: 28 Jan 2024, 11:22
by MickeMM
In my MovieFormat.groovy i have this code that you have help me with before.
Everything works but i have a little problem.

Today its sunday and filebot makes week 5, but here in Sweden its stil week 4. New week every monday.

I have try to google some java code and try to change yyyy to YYYY and ww to WW but nothing helps what i can see.

Code: Select all

{ 'omkodat/film' + today.format('/yyyy/ww') }
Any idea how to fix this?

Re: Script you have help me with before.

Posted: 29 Jan 2024, 10:56
by rednoah
That'll be quite a bit more complicated, but this should work:

Format: Select all

{
	new java.text.SimpleDateFormat("yyyy/ww", Locale.GERMANY).format(today.toLocalDate().toDate())
}




EDIT:

FileBot r10180 adds additional API for this kind of use case:

Format: Select all

{
	today.format("yyyy/ww", Locale.GERMANY)
}

Re: Script you have help me with before.

Posted: 29 Jan 2024, 20:20
by MickeMM
Thank you so much.
Do u know why its not working with SWEDEN as country but GERMANY work?

Thanks again! <3

Re: Script you have help me with before.

Posted: 30 Jan 2024, 04:54
by rednoah
SWEDEN does not have a static constant in the Locale class:
https://docs.oracle.com/en/java/javase/ ... ld-summary


You can use new Locale("sv","SE") instead of Locale.GERMANY though. Both locales use "week starts on Monday" so either will work for your use case.

Re: Script you have help me with before.

Posted: 30 Jan 2024, 13:25
by MickeMM
Thanks for the link and explanation, i appreciate it.