[mythtv-users] Filenames of recordings: access from the desktop

John Pilkington johnpilk222 at gmail.com
Mon Jan 10 10:40:55 UTC 2022


On 10/01/2022 09:12, Stephen Worthington wrote:
> On Sun, 9 Jan 2022 16:25:02 +0000, you wrote:
> 
>> I have several postprocessing scripts which I run from the desktop.
>> Some include box-specific workarounds to use the chanid_starttime.ext
>> format and some need the full file name including the storage group.  I
>> use multiple tabs, so can usually modify an earlier command line.
>>
>> But I have tried, in setting up, to keep an obvious relationship between
>> the chanid and the Logical Channel Number used in the EPG.  This has
>> been becoming more difficult, with a recording made today from LCN 26
>> having a chanid of 35238 (shown by an I from the Watch Recordings page
>> in the MythCenter-Wide theme).  I think I'll just have to live with it,
>> although it does make it harder to pick a given recording from a
>> file-manager display.
>>
>> Before I try some other kludge, is there an easy way of displaying and
>> 'copying' the full filename from a windowed Myth display?  Or some other
>> approach?  I guess that adding it to the 'Watch Recordings' screen
>> itself isn't going to improve the family experience...
>>
>> FWIW the 'M > Playback > Playback Data' popup shows the full filename.
>>
>> TIA
>>
>> John P
> 
> Displaying the file name (but not the file location) is easy.  From a
> recording, I twice gives you a lot of information about a recording,
> including its file name (the "basename")  It is not really possible to
> copy the file name from there though - mythfrontend turns the mouse
> cursor off.  In scripts attached to MythTV events, you can pass the
> basename to the script using one of the builtin parameters.
> 
> I normally just do a database query to find a recording file:
> 
> MariaDB [mythconverg]> select
> chanid,nzt(starttime),title,subtitle,left(description,20),season,episode,seriesid,programid,filesize/1024/1024/1024
> as filesize,basename from recorded where title like '%schindler%'
> order by starttime;
> +--------+---------------------+------------------------------------------+----------+----------------------+--------+---------+-----------+-----------+----------------+-------------------------+
> | chanid | nzt(starttime)      | title                                    | subtitle | left(description,20) | season | episode | seriesid  | programid | filesize       | basename                |
> +--------+---------------------+------------------------------------------+----------+----------------------+--------+---------+-----------+-----------+----------------+-------------------------+
> |  10073 | 2021-01-27 22:43:00 | Oskar Schindler: The Man Behind The List |          | The amazing story of |      0 |       0 | 128075076 |           | 1.577273443341 | 10073_20210127094300.ts |
> +--------+---------------------+------------------------------------------+----------+----------------------+--------+---------+-----------+-----------+----------------+-------------------------+
> 1 row in set (0.071 sec)
> 
> Then to find the file location, I use locate:
> 
> root at mypvr:~# locate 10073_20210127094300.ts
> /mnt/rec1/recordings/10073_20210127094300.ts
> /mnt/rec1/recordings/10073_20210127094300.ts.png
> 
> That only works if the recording is a day or so old - the location
> database only gets updated once a day.  You can force it to be updated
> manually:
> 
> sudo updatedb
> 
> but that takes a while as it scans all the partitions mounted on your
> system.
> 
> I believe there is some Python on the wiki that has an example of how
> to find a recording file using the storage directories in the
> database.  I have never used it, as in my MythTV Python programs I am
> moving lots of recording files, so I pre-build a database table giving
> all the locations of the recordings before I start moving files.  See
> my mythsgu program if you want to do something like that:
> 
> http://www.jsw.gen.nz/mythtv/mythsgu




Thank you Stephen.  I had seen your use of 'locate' earlier but hadn't 
tried it;  I thought it looked like overkill, but maybe it learns over 
time.   One of my scripts uses parts of dvbradioexport.pl, from the 
wiki, to unpick the Storage Groups;  again, my integration lacks polish, 
and would need a re-work for more general use.  The second 'info' screen 
only provides 'Default' for the SG, which seems unhelpful.  I'll see if 
I can make anything more of the API stuff.

{{{

[john at HP_Box ~]$ cat ~/showSGs.sh
#!/bin/bash

# list default SG directories.  See 
http://irc.mythtv.org/ircLog/channel/6/2021-10-20

# see also  curl -H "Accept: application/json" --silent 
http://127.0.0.1:6544/Myth/GetStorageGroupDirs | jq 
.StorageGroupDirList.StorageGroupDirs

# but using grep seems more direct to get the required output

curl -H "Accept: application/json" --silent 
http://127.0.0.1:6544/Myth/GetStorageGroupDirs | jq . | grep -A2 Default 
| grep Dir

exit

[john at HP_Box ~]$ ~/showSGs.sh
         "DirName": "/home/john/SGs/RcSG1",
         "DirName": "/home/john/SGs/RcSG2",
         "DirName": "/home/john/SGs/RcSG3",
[john at HP_Box ~]$

}}}


More information about the mythtv-users mailing list