Removing hundreds of damaged recordings

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
Amorget
Newcomer
Posts: 8
Joined: Sat Mar 05, 2016 5:17 pm
United States of America

Removing hundreds of damaged recordings

Post by Amorget »

Backstory: I had my antenna disconnected from my HDHomeRuns for over a year, which caused MythTV to record literally hundreds of shows with basically no file.

Is there some way I can bulk delete all the damaged recordings and set them to re-record? I looked at some of the existing scripts, but neither have a damaged parameter.

Thanks,
Douglas
PhilB
Senior
Posts: 403
Joined: Sun May 11, 2014 6:23 pm
Great Britain

Re: Removing hundreds of damaged recordings

Post by PhilB »

I have not used this but it looks powerful.
https://www.mythtv.org/wiki/Delete_recordings.py

Alternatively a hand crafted script to use the api
GetRecordedList
Identify those with starttime during the downtime
DeleteRecording
Allow backend time to process them.
Hth
Phil
Amorget
Newcomer
Posts: 8
Joined: Sat Mar 05, 2016 5:17 pm
United States of America

Re: Removing hundreds of damaged recordings

Post by Amorget »

PhilB, I had looked at the Delete_recordings script (specifically the alt one as it has a --rerecord option), but I wasn't think that I could just use a start and end date to filter out all my broken ones.

I used the start and end date and deleted all my recordings. Initially it didn't seem to work, but after a few hours I checked back and they were all gone.
User avatar
bill6502
Developer
Posts: 2299
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Removing hundreds of damaged recordings

Post by bill6502 »

The following will produce a list of titles and recordedids that can be fed to the Dvr/DeleteRecording endpoint
that Phil mentioned above:

Code: Select all

mysql --batch --user=mythtv --password mythconverg --execute     "SELECT r.title,r.recordedid FROM recorded AS r,recordedprogram AS p WHERE r.chanid = p.chanid
        AND r.starttime = p.starttime AND FIND_IN_SET('DAMAGED', p.videoprop)
                        ORDER BY r.recordedid" | grep --invert-match recordedid > damaged.recordings.out
Run that and make sure the titles are what you expect, then if it's OK, remove the "r.title," after the SELECT
to produce a file with just the recordedids. Those can be used in the following curl.

Note that DeleteRedording must be a POST, not a GET. Sample line:

Code: Select all

curl --data RecordedId=<one recordedid> --data AllowRerecord=true --header Accept:Application/JSON localhost:6544/Dvr/GetRecorded
Post Reply