[mythtv-users] Script to remove all old recordings prior a given date
Michael T. Dean
mtdean at thirdcontact.com
Mon Nov 28 14:08:31 UTC 2016
On 11/27/2016 06:08 AM, Jean-Yves Avenard wrote:
> On 26 November 2016 at 08:59, Michael T. Dean <mtdean at thirdcontact.com> wrote:
>> On 11/23/2016 10:49 PM, Jean-Yves Avenard wrote:
>>> Having a 32TB backend, the amount of recordings kept has become insane.
>>>
>>> How could I remove in one go all the recording that are older than two
>>> years old?
>>>
>>> I guess after that, I can use the find_orphans script to clean up the
>>> storage space.
>>
>> https://www.mythtv.org/wiki/Delete_recordings.py
>>
>> Lets you delete recording by most any search criteria. Will ask you before
>> doing the actual delete, so don't worry about trial and error to get the
>> right search. That said, I think the wiki page will give you exactly what
>> you need. (Oh, and it should be fine with current MythTV, too--the 0.24 on
>> the page means that it was verified to work on that version (someone
>> actually used it then) and no one has updated the page to say it works on
>> other, newer versions.)
> It seems to have trouble handling more than 999 recordings.
>
> On first go, I didn't see any recordings having been deleted,
>
> so I ran it again and got:
> Traceback (most recent call last):
> File "./delete_recordings.py", line 81, in <module>
> rec.delete()
> File "/usr/lib/python2.7/dist-packages/MythTV/dataheap.py", line
> 367, in delete
> raise MythError("Program could not be found")
> MythTV.exceptions.MythError: Program could not be found
It, like find_orphans.py , sends requests to the backend to delete the
videos. Because that takes time, if you re-run it shortly after the
first run, it will query the database and get back some of the videos
that the backend is still busy trying to delete. If you tell it to send
a delete request for any of those, you'd get the error above.
Did something specific make you think the 999 was a problem? Or do you
just mean it only gets the "first 999" of the ones that match your query
(meaning you'd have to re-run after it deleted them)?
Mike
More information about the mythtv-users
mailing list