[mythtv-users] Fwd: Find orphans.py

Raymond Wagner raymond at wagnerrp.com
Sat Jul 2 16:25:55 UTC 2011


On 7/2/2011 08:24, Travus Elm - discoverpc.NET wrote:
> my mythtv setup
>
> master server at home
> master server at work
>
> the at work server sends files with rsync to home server
> and i have a script that inserts the data of the recordings to the 
> home server
> would like to run this script of yours to remove old orphans files but 
> it looks like it is going to flag all the recordings from the 
> charter-slave-backend as not there but they are there and work.
>
> what do i need to do to edit it so it thinks that the files are there
> thanks

There are two operating modes for find_orphans.py.  You can either run 
for a whole system, or run for a single host.  The process when you run 
for a whole system is as follows.

1. Try to access all recording storage groups on ALL hosts (not just the 
host is designed for), and get a list of content.  Any subdirectories 
are ignored.
2. Get a list of all recordings known by the system.
3. Remove all filenames that match a recording known by the system.  
This handles duplicates as well, for the event a user has the same 
directories NFS mapped on multiple directories.
4. Remove all filenames that match the basename of a recording known by 
the system.  This handles any snapshots, as well as temporary and old 
files from transcoding.
5. Filter remaining content based off extension, and display for 
optional deletion.

This will recognize any content as long as it is anywhere on the 
system.  The only chance I know of for a false positive is if you have a 
slave backend, with content only stored on that slave backend, and it is 
currently powered down such that the script cannot get a file list.  Any 
content only stored on that backend will be marked as orphaned, and this 
is working as intended.  It will actually have false negatives if it 
finds a recording on a host different from what MythTV expects.



If instead, you specify a host to operate on through the command line, 
the first two steps are a bit different.  The storage groups searched 
are only those defined for that specific host.  It does not handle 
groups inherited from the master backend.  The recordings it knows about 
are only those that are supposed to exist on that host, not any for the 
whole system.  There are a number of scenarios where this may cause 
problems.

If running on a slave backend, that uses storage definitions inherited 
from the master backend, all content in those folders will not be 
scanned by this script, and instead marked as an orphaned recording.  If 
running on a master backend that shares its storage out to slave 
backends, the slaves may have stored content in those directories that 
does not belong to a recording known by the master backend, and the 
script will mark it as an orphaned video file.


More information about the mythtv-users mailing list