[mythtv-users] scan for changes

Raymond Wagner raymond at wagnerrp.com
Mon Mar 26 20:01:27 UTC 2012

On 3/26/2012 13:51, Tom Lichti wrote:
> On Mon, Mar 26, 2012 at 1:28 PM, Raymond Wagner<raymond at wagnerrp.com>  wrote:
>> On 3/26/2012 12:58, Mike Perkins wrote:
>>> On 26/03/12 04:45, Raymond Wagner wrote:
>>>> On 3/25/2012 22:51, Joe Mythtv wrote:
>>>>> I wish there were a command line way to initiate the scan - I could run
>>>>> my own script to look at the 'new footage' folder and rescan when I see
>>>>> new
>>>>> files.
>>>> In 0.25, there is an option in 'mythutil' to trigger a scan in the master
>>>> backend. Prior to that, JAMU had a scanner, and there was a scanner built
>>>> into
>>>> the Python bindings. What I'm getting at is that none of that should be
>>>> necessary, and the interactive scanner should be plenty fast. I'm
>>>> interested in
>>>> whether there might be some flaw in the scanner that needs to be
>>>> resolved.
>>> I'm currently importing some videos which need heavy editing beforehand,
>>> so I'm doing it on another machine elsewhere on the network which does not
>>> have myth on it. Once I'm satisfied I'm copying them to the video storage
>>> directory via NFS.
>>> It would be useful to be able to trigger a rescan when I'm done for the
>>> day. Most of these videos are for my son who isn't up to rescanning when he
>>> brings up the front end, and I often forget. A remotely-run mythutil option
>>> would be useful in this circumstance. Speed is not important in this case.
>> If you have some script set up to automate much of this process, I would
>> actually consider it better to have that script add the video itself.
>>   Tacking this onto the end of the script should perform the same process as
>> the scanner would, only selectively.
>> from MythTV import Video, VideoGrabber
>> vid = Video.fromFilename(<filename relative to SG root>)
>> vid.create()
>> ## if movie
>> grab = VideoGrabber('movie')
>> res = grab.sortedSearch(vid.title)
>> if (len(res) == 1) or ((len(res)>  1) and (res[0].levenshtein == 0)):
>>     vid.importMetadata(res[0])
>> ## if television
>> grab = VideoGrabber('television')
>> res = grab.sortedSearch(vid.title, vid.subtitle)
>> if (len(res) == 1) or ((len(res)>  1) and (res[0].levenshtein == 0)):
>>     vid.importMetadata(grab.grabInetref(res[0].inetref, res[0].season,
>> res[0].episode))
> That looks like a neat way to do it. Is there a corresponding
> recording function? Right now I have a hand crafted script that copies
> records from videos into recordings, but having an easier way of doing
> it would be nice. Or perhaps a better question would be is there
> documentation about what methods are available in the bindings? I know
> I've tried to look and haven't had much success in the past, maybe
> things have changed, or I just wasn't looking in the right place?


There is a similar 'importMetadata()' method for Recorded objects, 
matching one recording entry in the `recorded` table.  However, the 
Video Library was designed for arbitrary addition of content, the 
Recording Library was not.  There are around a dozen tables you need to 
touch to add a single fake recording to MythTV, and a few additional 
that carry optional data.  For some not-so-light reading, dig through 
MiroBridge for what is needed to add your own files as recordings.

More information about the mythtv-users mailing list