is there a easier way to update movie Metadata

For discussion related to MythTV which doesn't belong in another forum.

Moderator: Forum Moderators

Post Reply
mtrax
Junior
Posts: 51
Joined: Sat Aug 16, 2014 6:44 am
Australia

is there a easier way to update movie Metadata

Post by mtrax »

Is there a easy way to update the metaData from MythWeb or API?
currently I have load the video, scan for updates, scroll down to new movie and select update video to edit so lookup can understand movie name, then retrieve details and perhaps select one of a few options.

Ideally I would like to be able to update the movie title and inetref from mythweb or API can ask the backend to load metadata and artwork etc..
but the current api doesn't seem to be able to do this.
Any ideas?
User avatar
bill6502
Developer
Posts: 2325
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: is there a easier way to update movie Metadata

Post by bill6502 »

Did you try this: https://www.mythtv.org/wiki/Video_Servi ... eoMetadata ?

Since it changes data, is must be a POST, not a GET. For example:

Code: Select all

curl --data 'Id=4' --data 'Title=Some Title' --data 'Inetref=1234' localhost:6544/Video/UpdateVideoMetadata
mtrax
Junior
Posts: 51
Joined: Sat Aug 16, 2014 6:44 am
Australia

Re: is there a easier way to update movie Metadata

Post by mtrax »

I was wanting to update Images for video list , from the backend .
doing it via frontend is a bit fiddly
Dai_Trying
Junior
Posts: 51
Joined: Tue May 24, 2022 10:18 am
Great Britain

Re: is there a easier way to update movie Metadata

Post by Dai_Trying »

When I am in the frontend I go to Videos and press "m" and then select scan for changes, this updates the video files and then looks for the metadata and after a short while it (usually) updates with the metadata. I haven't tested this recently as I have changed my server and still have a few creases to iron out before everything is up and running how I want, but that is how I have updated my videos for years...
mtrax
Junior
Posts: 51
Joined: Sat Aug 16, 2014 6:44 am
Australia

Re: is there a easier way to update movie Metadata

Post by mtrax »

I'm not sure if scan for changes resets the "movie" file name ? ie if the filename isn't quiet right it fails to match name, so I have to update the "title" and refresh metadata.
if would be great if this was a function on Web or I can script it from the backend.
white_haired_uncle
Senior
Posts: 278
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: is there a easier way to update movie Metadata

Post by white_haired_uncle »

Every time I try to use the GUI to make changes to the metadata, they just get overwritten when I do a scan/retrieve. I wish that worked.

Most of the time I end up renaming the file. In one case, I had to update the metadata on the file using mp4tags/mp4info (it picked up "WALKING_DEAD" from the DVD which kept matching TALKING_DEAD until I changed it to THE_WALKING_DEAD).

And then when it finds a video I'm just starting to encode, I end up with hash collisions and I've never been able to get rid of those entries short of editing mysql.

I'm using ttvdb4 for TV data (which seems to include TV shows ripped from DVD according to the logs). Suppose I should try the others at some point.

P.S. I was a little confused what was wrong with Bill's suggestion, since it's pointed at localhost I assume the example was run from the backend.
pnetherwood
Newcomer
Posts: 6
Joined: Thu Jun 01, 2023 3:52 pm
Great Britain

Re: is there a easier way to update movie Metadata

Post by pnetherwood »

If you're adding new files from a separate program then maybe this script will help. Given a file name and an inetref from say TTMDB it adds the file and updates it inetref in the myth database using the services API:

Code: Select all

#!/bin/bash

SERVICE_API=http://localhost:6544/Video/
FILENAME=$1
INETREF=$2

# Add the file to Myth
added=$(wget -q --post-data "FileName=${FILENAME}&HostName=mythbe" "${SERVICE_API}AddVideo" -O -)

# If added successfully
if [[ $added == *"true"* ]]; then

  # Lookup the details of the file just added
  xml=$(wget -q --post-data "FileName=${FILENAME}" "${SERVICE_API}GetVideoByFileName" -O -)

  # Search through the xml finding the id
  id=$(echo $xml| sed "s/.*<Id>\(.*\)<\/Id>.*/\1/")

  # Update video meta data
  response=$(wget -q --post-data "Id=${id}&Inetref=${INETREF}" "${SERVICE_API}UpdateVideoMetadata" -O -)
fi
I call this script as one of the post processing tasks in the program that generates the movie files.
I'm using wget here rather than curl as the script is running in a docker container.

I then have the following script in my /etc/cron.hourly:

Code: Select all

/usr/bin/mythutil --scanvideos
This then populates the metadata images. You could run this command at the end of the script above but as I said for me it's running in a docker container which doesn't have access to mythutil.

I find this all quite handy if you have an external program that knows the filename and the inetref. Since the script adds the entry the myth database with the correct inetref then when you run the scanvideos it will always get the right metadata as the inetref has already been set correctly.
Mythtv: v33 User since 2006
BE: HP i5 mini, Ubuntu 22.04, 24TB NAS (DS923+)
FEx3: Beelink Mini S, Lubuntu 22.04
mtrax
Junior
Posts: 51
Joined: Sat Aug 16, 2014 6:44 am
Australia

Re: is there a easier way to update movie Metadata

Post by mtrax »

so to break the script down all I need to do is update the Inetref field and then re-scan videos..
this sounds like a method I can use.
pnetherwood
Newcomer
Posts: 6
Joined: Thu Jun 01, 2023 3:52 pm
Great Britain

Re: is there a easier way to update movie Metadata

Post by pnetherwood »

Basically yes. If the inetref is set correctly then a video scan will populate the correct meta data and images.
(In the Video settings tick the box for updating meta data after a scan)
Mythtv: v33 User since 2006
BE: HP i5 mini, Ubuntu 22.04, 24TB NAS (DS923+)
FEx3: Beelink Mini S, Lubuntu 22.04
mtrax
Junior
Posts: 51
Joined: Sat Aug 16, 2014 6:44 am
Australia

Re: is there a easier way to update movie Metadata

Post by mtrax »

I just need to get / make script to get Inetref which I think should be somewhat easy??
Post Reply