[mythtv-users] Get list of all recordings' filenames and sizes

Stephen Worthington stephen_agent at jsw.gen.nz
Tue Aug 11 18:01:02 UTC 2015


On Tue, 11 Aug 2015 17:30:13 +0100, you wrote:

>Hi,
>
>Yes, I should backup more often! My XFS partition is scrambled 
>(partition table and XFS master superblock overwritten) and I'm not 
>hopeful of a fast fix.  I'm currently imaging the disk to see if 
>xfs_repair can use a secondary, but I'm pretty sure there will be data 
>loss.
>
>It occurred to me that I could use xfs_irecover to just get all (or 
>most of?) the files off but without handy things like file names and 
>dates.
>
>http://man.gnu.org.ua/manpage/?8+xfs_irecover
>
>But mythtv knows about all the recordings, including I hope the exact 
>file size, so if someone can tell me how to extract this from mysql I 
>can get a file of recovered files and sizes, one of database files and 
>sizes, and use Python to rename the files that match. I'm kind of 
>hoping that there aren't too many files with exactly the right size!
>
>OK, so I might lose my .png files but maybe there is a way to recreate 
>these?
>
>Is there any merit to this idea?
>
>Thanks

Yes, the exact file sizes are indeed recorded in the database.  I have
used file sizes to recover file names before and it works well, but
that was not with MythTV.  Here is a query to get you going:

select chanid,starttime,title,subtitle,basename,filesize from recorded
order by filesize;

Having many files of the same size is unlikely, due to the differing
compression of transmitted video data.

If you need a batch file to give you mysql command prompt access to
the mythconverg database, I have one on my web server:

  http://www.jsw.gen.nz/mythtv/do_mythconverg.sh

As long as you only use desc or select commands, you can not damage
the database, but beware any commands that write to it.

To get the screen output copied to a text file, cd to a directory
where you can write files before running do_mythconverg.sh.  Then do:

tee log.txt
select chanid,starttime,title,subtitle,basename,filesize from recorded
order by filesize;
notee
quit


More information about the mythtv-users mailing list