[mythtv-users] clearing out old, non-existent videos

Raymond Wagner raymond at wagnerrp.com
Wed Sep 4 14:31:38 UTC 2013


On Sep 4, 2013, at 10:16, "Michael T. Dean" <mtdean at thirdcontact.com> wrote:

> On 09/04/2013 09:13 AM, Raymond Wagner wrote:
>> On Sep 4, 2013, at 9:04, "Michael T. Dean"<mtdean at thirdcontact.com>  wrote:
>> 
>>> On 09/04/2013 05:30 AM, John Pilkington wrote:
>>>> Arising from this thread:
>>>> 
>>>> http://www.gossamer-threads.com/lists/mythtv/dev/551029#551029
>>>> 
>>>>>> On 30/08/13 13:34, Michael T. Dean wrote:
>>>>> We don't really have a good way of clearing out old, non-existent videos
>>>>> from old, non-existent hosts in Video Library at this point.
>>>> Wouldn't a 'Clear all hashes from the Video List', with 'Are you sure?' protection, do this?  It would be much simpler.
>>> AIUI, in the case of a "missing" (no-longer-existent) host, any Video Library videos in the database will always remain in the database and the only way to remove them is to let that host say, "I don't have any videos, anymore."
>> If a video cannot be found during a scan, and the host it is thought to be on took part in the scan, it and all associated metadata will be wiped from the database.
> 
> So if the host doesn't exist, anymore (and, therefore, didn't take part in the scan), the video will remain in the library, right?

Correct.  If the system running the scan cannot query the system holding the files, it plays it safe and does nothing.  In order to remove it otherwise, you either must remove each video from the library individually, or perform a successful scan.  Alternatively, this should do the trick.


#!/usr/bin/env python

import sys
import MythTV

DB = MythTV.MythDB()
for vid in DB.searchVideos(host=sys.argv[1]):
    vid.delete()


More information about the mythtv-users mailing list