Page 1 of 1

How to find movie name with cli

Posted: Wed Aug 29, 2018 7:38 am
by shoubam
Description of problem or question:

I would like to determine the movie name with the cli. My ideal outcome would be that the output file would have the name of the movie (and ideally the year, but I guess that is seperate problem). Currently I have to set the name manually, which is a problem for automated, headless ripping.

Is this featuer available? I guess it somehow is, because the gui can do it, just not the cli. Let me know if I should make that a feature request. Just wanted to ask in case I have overlooked something.


Steps to reproduce the problem (If Applicable):
HandBrakeCLI version 1.1.1 does not provide any options to determine the movie title.



HandBrake version (e.g., 1.0.0):
1.1.1



Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):

Ubuntu Server 18.04

HandBrake Activity Log ***required*** (see How-to get an activity log)
N/A

Code: Select all

Please replace this text with the contents of your log file between the two code tags - OR -  provide a pastebin URL in place of these 3 lines.

Re: How to find movie name with cli

Posted: Wed Aug 29, 2018 1:32 pm
by Woodstock
The CLI isn't intended for that sort of mischief. Where are you expecting it to find such information?

Re: How to find movie name with cli

Posted: Wed Aug 29, 2018 1:41 pm
by shoubam
No Idea, thats why I am asking :)
I see that the gui gets this kind of information from somewhere, so there must be a way to grammatically determine this information. If the gui can do it, at least in my understanding it should be possible for the cli to acquire that same information.

Re: How to find movie name with cli

Posted: Wed Aug 29, 2018 2:05 pm
by rollin_eng
The GUI defaults to the file input name, is that what you mean?

Re: How to find movie name with cli

Posted: Wed Aug 29, 2018 4:17 pm
by JohnAStebbins
The title is sometimes available depending on the source. BD and DVD often (but not always) store the title in the volume info. Other formats often have the title in metadata tags. The CLI doesn't show this by default, but there is a "--json" option that outputs status information including the full title details in json. The title you are looking for is in the "Name" element of each "TitleList" item in the "Title Set". The year is not available for BD and DVD sources. But for other sources, the year is sometimes stored in the "Metadata".

Re: How to find movie name with cli

Posted: Wed Aug 29, 2018 9:22 pm
by shoubam
Thank you, JohnAStebbins. I was not able to find the items you mention in the output, however I did find the title in the output of HandBrakeCLI (makes me feel stupid now that I did not look there). libdvdread reads that title.

The following is a total hack, but works for me:

Code: Select all

HandBrakeCLI --scan  -i /dev/sr0 | awk -F: '/DVD Title/ {print $3}' |python -c "import sys; print(sys.stdin.read().title().replace('_', ' '))" |head -1
Problem solved.