Page 1 of 1

Movie Mode : hr:min:sec format

Posted: 01 Jan 2022, 11:49
by RBCC
I would like to use hours,minutes and seconds to achieve the duration of a movie in the format of hours : minutes : seconds for example using 412 seconds is 6 minutes and 56 seconds or 6:56 . if the math is 412/60 = 6 and56/60 seconds. how is this done ? so the output is 6:56 thank you for the help! John

Re: Movie Mode : hr:min:sec format

Posted: 01 Jan 2022, 11:56
by rednoah
e.g.

Code: Select all

{ duration.format('HH∶mm∶ss') }
:idea: We're using ∶ ratio instead of : colon since the latter is not allowed in file paths.

Re: Movie Mode : hr:min:sec format

Posted: 01 Jan 2022, 19:41
by RBCC
using {d} can I format it like dec/25/2023?

Re: Movie Mode : hr:min:sec format

Posted: 02 Jan 2022, 00:44
by rednoah
e.g.

Code: Select all

{ d.format('MMM dd yyyy') }
:idea: Note that / is not allowed in file names.

Re: Movie Mode : hr:min:sec format

Posted: 05 Jan 2022, 04:30
by RBCC
IS there a way I can create an array to hold these :
array[1]="Sports"
array[2]="how to"
array[3} ="shorts"
Thank you for any Ideas , John

Re: Movie Mode : hr:min:sec format

Posted: 05 Jan 2022, 08:29
by rednoah

Re: Movie Mode : hr:min:sec format

Posted: 12 Jan 2022, 05:42
by RBCC
Can I use that in to GUI??

Re: Movie Mode : hr:min:sec format

Posted: 12 Jan 2022, 06:01
by rednoah
Yes. Format Expressions work the same in GUI and CLI.

Re: Movie Mode : hr:min:sec format

Posted: 19 Jan 2022, 01:50
by RBCC
can I see an example of it in GUI? thank you, John

Re: Movie Mode : hr:min:sec format

Posted: 19 Jan 2022, 01:54
by rednoah
What have you tried so far? Where are you stuck? Please include screenshots so that we can see what you see.

Re: Movie Mode : hr:min:sec format

Posted: 21 Jan 2022, 07:43
by RBCC

Code: Select all

{def characters=["Mickey"," Minnie"," Donald" ,"Daisy"]} {assert characters instance of List}
?How do I use them in my

Code: Select all

{"Main Charcter∶ " } {character.??? }
Please rewrite if necessary! Thank you John

Re: Movie Mode : hr:min:sec format

Posted: 21 Jan 2022, 08:47
by rednoah
What does the code you wrote try to do? The list is correct, but it's unclear what you're trying to do with that list.

Re: Movie Mode : hr:min:sec format

Posted: 21 Jan 2022, 18:38
by kim

Code: Select all

{def characters=["Mickey"," Minnie"," Donald" ,"Daisy"]; characters instanceof List}
stop this and use a CSV file like rednoah wrote back in 2018
viewtopic.php?p=36619#p36619

viewtopic.php?p=56089#p56089
viewtopic.php?p=40459#p40459

maybe you can use this ?

Code: Select all

{ def Character = net.filebot.WebServices.TheTVDB.getActors(series.id, Locale.ENGLISH).character.findAll{it}.collect{it.split('/')*.replaceAll(/\s\(.*\)|\sand/, '')*.trim()*.tokenize(',')}.flatten().unique();
Character.take(4)
}
sample:

Code: Select all

[Daisy Duck, Huey, Dewey, Louie]
or

Code: Select all

[Daffy Duck, Bugs Bunny, Porky Pig, Speedy Gonzales]
I don't know why there is not builtin way of doing this ?

Re: Movie Mode : hr:min:sec format

Posted: 22 Jan 2022, 00:26
by RBCC
What does the code you wrote try to do? The list is correct, but it's unclear what you're trying to do with that list
I am trying to use it in renaming files with filebot(in Gui).such as
{"character :") ( character. name[1] } for Mickey Mouse. DO i have to define the List first?

Re: Movie Mode : hr:min:sec format

Posted: 22 Jan 2022, 02:57
by kim
Don't write "code", but tell us the END RESULT you want and a sample show to test with.

Code: Select all

{"character :") ( character.name[1] } 
?

Code: Select all

{character.name[1]}
=
No such property: character for class
=
bad code

This does like above but work:

Code: Select all

{ def Character = net.filebot.WebServices.TheTVDB.getActors(series.id, Locale.ENGLISH).character.findAll{it}.collect{it.split('/')*.replaceAll(/\s\(.*\)|\sand/, '')*.trim()*.tokenize(',')}.flatten().unique();
'character: ' + Character[0]
}
you want "show" to = same characters in the way you want every time then use a CSV file like rednoah wrote back in 2018
viewtopic.php?p=36619#p36619
4. Mappings from a CSV file

Code: Select all

{ csv('/path/to/names.csv').get(n) ?: n }
something IN and output what you want

Re: Movie Mode : hr:min:sec format

Posted: 22 Jan 2022, 03:54
by rednoah
Creating a list, and then taking the first element from that list would look like this:

Code: Select all

{
	def characters = ["Mickey", "Minnie", "Donald", "Daisy"]
	characters[0]
}
The code above, if used as is, not useful, since it's just gonna yield the same constant value, thus functionally equivalent to just writing the value without any code at all:

Code: Select all

Mickey

:arrow: Presumably, you want to retrieve the names of characters from your selected database. This may or may not be supported depending on your chosen database.



For TheMovieDB / Movie Mode this will work:

Code: Select all

{ info.cast[0].character }
e.g.

Code: Select all

$ filebot -list --db TheMovieDB --q 19995 --format "{ info.cast[0].character }"
Jake Sully


If you want the same for episodes, then that is less well supported, and may or may not work for the individual episode from the chosen database, on a case-by-base basis:

Code: Select all

{ episode.info.cast[0].character }
e.g.

Code: Select all

$ filebot -list --db TheMovieDB::TV --q 01437 --format "{episode} => { episode.info.cast[0].character }"
Firefly - 1x01 - The Train Job => Lund
Firefly - 1x02 - Bushwhacked => Commander Harken
Firefly - 1x03 - Our Mrs. Reynolds =>
Firefly - 1x04 - Jaynestown => Magistrate Higgins
...