Mailing List Archive

find_orphans.py script doesn't delete anything
I had some sort of disk crash and all my recording files have gone. But
that's OK I didn't need them. However, it means I now have thousands of
records in the database that don't have a matching recording file on disk.

I thought I could clean that up with find_orphans.py but it doesn't delete
anything. It lists recording and I enter "1" for Delete orphaned recording
entries and confirm 'yes'. It then thinks for a couple of minutes and then
says it couldn't delete one of the recordings. It then just presents the
same recordings list again. And this goes on forever.

Am I doing something wrong? Is there another way I can delete all
the database recording values without using this script (and without
manually doing it in Mythweb)?

Regards,
Phill
Re: find_orphans.py script doesn't delete anything [ In reply to ]
What MythTV version are you running?

There are pre and post v31 versions of that script. Are you running the
right one?

I'm no programmer but I'd be having a look at the script and maybe adding a
print statement or two.

On Mon, 11 Mar 2024 at 04:26, Phill Edwards <philledwards@gmail.com> wrote:

> I had some sort of disk crash and all my recording files have gone. But
> that's OK I didn't need them. However, it means I now have thousands of
> records in the database that don't have a matching recording file on disk.
>
> I thought I could clean that up with find_orphans.py but it doesn't delete
> anything. It lists recording and I enter "1" for Delete orphaned recording
> entries and confirm 'yes'. It then thinks for a couple of minutes and then
> says it couldn't delete one of the recordings. It then just presents the
> same recordings list again. And this goes on forever.
>
> Am I doing something wrong? Is there another way I can delete all
> the database recording values without using this script (and without
> manually doing it in Mythweb)?
>
> Regards,
> Phill
>
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
>
Re: find_orphans.py script doesn't delete anything [ In reply to ]
>
> MythTV version are you running?
>
> There are pre and post v31 versions of that script. Are you running the
> right one?
>
> I'm no programmer but I'd be having a look at the script and maybe adding
> a print statement or two.
>

I'm running v31.

Can I just delete the recordings from the database easily?

>
Re: find_orphans.py script doesn't delete anything [ In reply to ]
On Mon, 11 Mar 2024 20:29:25 +1100, you wrote:

>>
>> MythTV version are you running?
>>
>> There are pre and post v31 versions of that script. Are you running the
>> right one?
>>
>> I'm no programmer but I'd be having a look at the script and maybe adding
>> a print statement or two.
>>
>
>I'm running v31.
>
>Can I just delete the recordings from the database easily?

If you are going to be deleting all recordings in the database, then
you can just add them all to a playlist and then delete the entire
playlist. But I am not sure if playlist deleting works when the
recording file is missing, as I have never done that.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: find_orphans.py script doesn't delete anything [ In reply to ]
On 3/11/24 00:23, Phill Edwards wrote:
> I had some sort of disk crash and all my recording files have gone.
> But that's OK I didn't need them. However, it means I now have
> thousands of records in the database that don't have a matching
> recording file on disk.
>
> I thought I could clean that up with find_orphans.py but it doesn't
> delete anything. It lists recording and I enter "1" for Delete
> orphaned recording entries and confirm 'yes'. It then thinks for a
> couple of minutes and then says it couldn't delete one of the
> recordings. It then just presents the same recordings list again. And
> this goes on forever.
>
> Am I doing something wrong? Is there another way I can delete all
> the database recording values without using this script (and without
> manually doing it in Mythweb)?
>
> Regards,
> Phill
>
>
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
This is the way I do it,it's not very elegant,but does work.

#1 Go to watch recordings.

#2 High-lite the entry you want to delete.

#3 Hit D, you will be presented with 3 options,choose the option you
would like to do. Continue to the end of the recording list.

It can be quite tedious,but you won't corrupt the database.

This step is optional: After you are done deleting all the listings, go
to System Status,look for Auto-expire list. It will list all the
recordings you just deleted. Cursor left and high-lite the entry and hit
enter..

Hope this helps.

Greg
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: find_orphans.py script doesn't delete anything [ In reply to ]
On Tue, Mar 12 2024, Stephen Worthington <stephen_agent@jsw.gen.nz> wrote:

> On Mon, 11 Mar 2024 20:29:25 +1100, you wrote:
>
>>>
>>> MythTV version are you running?
>>>
>>> There are pre and post v31 versions of that script. Are you running the
>>> right one?
>>>
>>> I'm no programmer but I'd be having a look at the script and maybe adding
>>> a print statement or two.
>>>
>>
>>I'm running v31.
>>
>>Can I just delete the recordings from the database easily?
>
> If you are going to be deleting all recordings in the database, then
> you can just add them all to a playlist and then delete the entire
> playlist. But I am not sure if playlist deleting works when the
> recording file is missing, as I have never done that.

I would recommend this option, with one cavaet.

I know from experience that on v32 (and lower), the orphaned entries
stay in the "deleted" list until the backed can find a file to delete.

Since thee non-existent files names end up in the backend logfile, a
simple script can finds the filenames and touch the files. The next time
the backend does its deletions, the files are deleted and the recordings
are removed from the deleted list.

Leo
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: find_orphans.py script doesn't delete anything [ In reply to ]
On Tue, 12 Mar 2024 02:30:32 +1300, you wrote:

>On Mon, 11 Mar 2024 20:29:25 +1100, you wrote:
>
>>>
>>> MythTV version are you running?
>>>
>>> There are pre and post v31 versions of that script. Are you running the
>>> right one?
>>>
>>> I'm no programmer but I'd be having a look at the script and maybe adding
>>> a print statement or two.
>>>
>>
>>I'm running v31.
>>
>>Can I just delete the recordings from the database easily?
>
>If you are going to be deleting all recordings in the database, then
>you can just add them all to a playlist and then delete the entire
>playlist. But I am not sure if playlist deleting works when the
>recording file is missing, as I have never done that.

I just had a hunt around on my development box and found the program I
wrote for someone last year that had a similar problem. Unlike
find-orphans.py, it uses the Services API to do the deletes, so it may
possibly work better for you. But it was only tested on v32, so I do
not know if it will work on v31. It can be downloaded from here:

http://www.jsw.gen.nz/mythtv/myth-delete-missing.py

Note that the "drc" command is not working, but you probably only want
the "d" command anyway.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: find_orphans.py script doesn't delete anything [ In reply to ]
>
> I just had a hunt around on my development box and found the program I
> wrote for someone last year that had a similar problem. Unlike
> find-orphans.py, it uses the Services API to do the deletes, so it may
> possibly work better for you. But it was only tested on v32, so I do
> not know if it will work on v31. It can be downloaded from here:
>
> http://www.jsw.gen.nz/mythtv/myth-delete-missing.py



Hi Stephen, that link doesn't appear to be working. I get an error:

This site can’t be reached
www.jsw.gen.nz took too long to respond.
Re: find_orphans.py script doesn't delete anything [ In reply to ]
On Wed, 13 Mar 2024 21:49:43 +1100, you wrote:

>>
>> I just had a hunt around on my development box and found the program I
>> wrote for someone last year that had a similar problem. Unlike
>> find-orphans.py, it uses the Services API to do the deletes, so it may
>> possibly work better for you. But it was only tested on v32, so I do
>> not know if it will work on v31. It can be downloaded from here:
>>
>> http://www.jsw.gen.nz/mythtv/myth-delete-missing.py
>
>
>
>Hi Stephen, that link doesn't appear to be working. I get an error:
>
>This site can?t be reached
>www.jsw.gen.nz took too long to respond.

Yes, my Ubuntu server box was down most of today while I moved it all
into a new case. And, of course, when it was all in the new case
there was a cable problem that took a couple of hours to work out - no
power to one hard drive. I have it working temporarily on a different
power cable for now, so you can try again now. I will have to shut it
down again some time tomorrow to fix the bad cable.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: find_orphans.py script doesn't delete anything [ In reply to ]
>
>
> I just had a hunt around on my development box and found the program I
> wrote for someone last year that had a similar problem. Unlike
> find-orphans.py, it uses the Services API to do the deletes, so it may
> possibly work better for you. But it was only tested on v32, so I do
> not know if it will work on v31. It can be downloaded from here:
>
> http://www.jsw.gen.nz/mythtv/myth-delete-missing.py
>
> Note that the "drc" command is not working, but you probably only want
> the "d" command anyway.
>

Hi Stephen, it seems to run OK on V31. It lists hundreds of recordings and
then says:
Proceed with deletions (y/N) ?

When I enter Y it looks like it's deleting things. But if I then run it
again afterwards for a second time it lists the same recordings and asks me
if I want to proceed again. That makes me think it didn't actually delete
anything. Am I misunderstanding how it works?

BTW it also stops with an error:
Exception while trying to delete recording recordedid=4216
Re: find_orphans.py script doesn't delete anything [ In reply to ]
On Thu, 14 Mar 2024 13:31:26 +1100, you wrote:

>>
>>
>> I just had a hunt around on my development box and found the program I
>> wrote for someone last year that had a similar problem. Unlike
>> find-orphans.py, it uses the Services API to do the deletes, so it may
>> possibly work better for you. But it was only tested on v32, so I do
>> not know if it will work on v31. It can be downloaded from here:
>>
>> http://www.jsw.gen.nz/mythtv/myth-delete-missing.py
>>
>> Note that the "drc" command is not working, but you probably only want
>> the "d" command anyway.
>>
>
>Hi Stephen, it seems to run OK on V31. It lists hundreds of recordings and
>then says:
> Proceed with deletions (y/N) ?
>
>When I enter Y it looks like it's deleting things. But if I then run it
>again afterwards for a second time it lists the same recordings and asks me
>if I want to proceed again. That makes me think it didn't actually delete
>anything. Am I misunderstanding how it works?

No, you are not misunderstanding things. However, deleting is not a
straightforward operation - things get queued for deletion, then
deleted and queued again in a different queue and then actually
deleted later from that queue. So we need to do some diagnosis of
what is happening. Some SQL might shed some light, so please run
these commands and report the results:

sudo mysql
select count(*) from recorded where deletepending!=0;
quit
exit

If it is a non-zero result, then run it again after a few minutes to
see if it is changing.

And what does this show:

sudo mysql
select count(*) from recorded where recgroup='Deleted';
quit
exit

>BTW it also stops with an error:
> Exception while trying to delete recording recordedid=4216

Please post the full exception message with the backtrace (if there is
one), so I can try to work out what the problem is.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org