Can I edit a recording database entry and tell the frontend to update?

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

Moderator: Forum Moderators

Post Reply
mtvf2894
Junior
Posts: 20
Joined: Sat Apr 10, 2021 2:33 pm
Great Britain

Can I edit a recording database entry and tell the frontend to update?

Post by mtvf2894 » Sun Jun 19, 2022 6:53 pm

You are using MythTV Frontend and have gone into Watch Recordings. You have the description of the recording displayed.

Is it possible to find this recording in the recorded table in the database and change the contents of description field and then tell MythTV to update the frontend so this change is displayed within the currently open frontend?

I have tried looking at the API and the Protocol but can't find anything that will tell MythTV to do this.

I was thinking the "recording list change" may allow this but I can't seem to find the correct method of using "mythutil --event" to test this or even if this is the correct method of attempting this.
https://www.mythtv.org/wiki/RECORDING_L ... _Protocol)

Thanks
MythTV v31 / Ubuntu 20.10 / AMD APU

User avatar
bill6502
Developer
Posts: 2057
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Can I edit a recording database entry and tell the frontend to update?

Post by bill6502 » Sun Jun 19, 2022 7:04 pm

The Services API endpoint solution hasn't been released yet.

In mythfrontend, position on the recording of interest (e.g. on the Watch Recordings page) and press:
Menu->Recording Options->Change Recording Metadata. You can edit the Description (and other data)
there.

mtvf2894
Junior
Posts: 20
Joined: Sat Apr 10, 2021 2:33 pm
Great Britain

Re: Can I edit a recording database entry and tell the frontend to update?

Post by mtvf2894 » Mon Jun 20, 2022 8:52 am

Many thanks for the reply.

I understand there is a frontend option but I would like to have something scriptable so I will cross fingers and hope for future API support.

Is trying to use commands like "mythutil --clearcache" and "mythutil --event" a dead end for what I am trying to do?

As a workaround does anyone know how existing user scripts that for example transcode handle the filename and filesize changing with regards to the database and them updating the frontend I may be able to adapt something?

Thanks
MythTV v31 / Ubuntu 20.10 / AMD APU

blm-ubunet
Senior
Posts: 194
Joined: Sun Jun 15, 2014 1:08 am
Cambodia

Re: Can I edit a recording database entry and tell the frontend to update?

Post by blm-ubunet » Mon Jun 20, 2022 9:20 am

I don't change the filename but replace existing file with modified one. The actual filename does not need changing.

ionice -c3 mythcommflag --rebuild --chanid $CHANID --starttime $temp3
mythutil --clearcutlist --chanid $CHANID --starttime $temp3
mythutil --clearskiplist --chanid $CHANID --starttime $temp3

then later notify the user..
mythutil --bcastaddr 192.168.1.32 --notification --type normal --message_text "Finished Job: "$basename --description "MythCutKey mpegts cutter" --timeout=3

User avatar
bill6502
Developer
Posts: 2057
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Can I edit a recording database entry and tell the frontend to update?

Post by bill6502 » Thu Jun 23, 2022 1:47 am

There's always the Python bindings. Consider this (which has no error checking, but it works.)

Code: Select all

#!/usr/bin/env python3                                                          
                                                                                
import sys                                                                      
from MythTV import Recorded                                                     
from MythTV.database import DBDataWrite                                         
                                                                                
                                                                                
class UpdateRecorded(DBDataWrite):                                              
    _table = 'recorded'                                                         
                                                                                
                                                                                
old = Recorded((sys.argv[1], sys.argv[2]))                                      
old.description = sys.argv[3]                                                   
                                                                                
new = UpdateRecorded()                                                          
new = old                                                                       
new.update()
The three arguments are: chanid, starttime (in localtime not UTC) and a description (enclosed in quotes).

mtvf2894
Junior
Posts: 20
Joined: Sat Apr 10, 2021 2:33 pm
Great Britain

Re: Can I edit a recording database entry and tell the frontend to update?

Post by mtvf2894 » Sat Jun 25, 2022 6:32 am

bill6502 wrote:
Thu Jun 23, 2022 1:47 am
There's always the Python bindings. Consider this (which has no error checking, but it works.)
Thanks for posting the Python bindings may be the solution. I will check it out.
MythTV v31 / Ubuntu 20.10 / AMD APU

mtvf2894
Junior
Posts: 20
Joined: Sat Apr 10, 2021 2:33 pm
Great Britain

Re: Can I edit a recording database entry and tell the frontend to update?

Post by mtvf2894 » Sat Jun 25, 2022 10:15 am

bill6502 wrote:
Thu Jun 23, 2022 1:47 am
There's always the Python bindings. Consider this (which has no error checking, but it works.)
Unfortunately this does not work.

It updates the database but you still have to exit the watch recordings screen and go back to the watch recordings screen for the new description to show.

It is no different than just updating the database directly. :? :(

At least I have learned a tiny bit more Python :D (make sure you get your time offsets correct or the bindings complain about a database error when it actually means it can't find a matching record)
MythTV v31 / Ubuntu 20.10 / AMD APU

User avatar
bill6502
Developer
Posts: 2057
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Can I edit a recording database entry and tell the frontend to update?

Post by bill6502 » Wed Jun 29, 2022 2:25 am

The new API endpoint does cause an update to an active recording. Let me know if you build from source
and I can get you copy of the changes. Need to know your version though.

Post Reply