Scheduler sync to STB (dual tuner) & recording import

What would you like to see in MythTV and why? Find others who might want to help implement your ideas!
Forum rules
Please be reasonable and positive with your feature requests, remember that all contributions to MythTV are by volunteers in their spare time. MythTV won't support piracy in any form, including torrents and use of soft cams, so to avoid embarrassment please do not ask.

* One suggestion per thread please. Do not post new suggestions in replies. *
Post Reply
mythrec
Newcomer
Posts: 7
Joined: Thu Aug 17, 2017 10:52 am
Great Britain

Scheduler sync to STB (dual tuner) & recording import

Post by mythrec » Fri Aug 18, 2017 4:05 am

Summary

This is for where you have an external STB capable of receiving channels not available to the internal tuner(s). I already have a working solution so I am looking to see if the developers may be interested in this ability. It could be adapted to any similar setup whereby you have the relevant scripts or programs to perform the actual tasks. The issue being manufactures & service providers may not provide any official API and or may alter / remove currently available functionality. Conceptually I would see MythTV as the master and the STB as the slave (excepting the level of control / feedback may be limited). The import recorder in Myth currently seems broken and recordings need to be serialised (dual tuner, single playback) which is not a good fit for the way things currently work.

I have some patches which get the import recorder working and if nothing else comes of this it would be good if this could be fixed as the Wiki and setup program all indicate that it should be a usable feature.

Potential new feature group


I know the idea is to do one post per feature but I do not want to spam the forum and without knowing what types of feature might be considered it could end up being a waste of time etc. I will therefore just put a summary of the sorts of features that would improve the ability to do this.
  • Import on demand i.e. push recordings. At the moment Myth wants to control the recording process however if you have an external STB that does its own recordings this is futile. What would work best in this scenario is to mark a tuner as recording when there is an upload slot available (could be managed externally) and then import the recording. This is partly about the right level of feedback in the backend and frontend as well as the ability to play recordings while they are importing (i.e. the same way you can play an in progress recording now). If would also be nice if we had some ability to tell Myth that an external program didn't record properly so it can schedule the next one. Ideally this should be checked / updated just before the end of the show so we get an opportunity to schedule the next showing which could be on a plus one channel.
  • XMLTV additional field support. To make the scheduler sync work we need to know the external identifier(s) of a program so the STB can schedule it. Multiple ways to do this but level of complexity etc. varies considerably. Personally I just put the data in an additional table and do a lookup when I need to get the identifiers. It would be more straightforward if each program (that could be scheduled on the STB) contained the appropriate external identifiers. Currently the grabber updates another table which is sort of messy when mythfilldatabase could bring everything in to the database in one go.
  • Scheduler sync. At the moment I just use an event script which does an add / remove sync. This involves storing a list and comparing it which is a bit messy. A better way might be to have specific events when adding or removing a scheduled item. Ideally it would be nice if there was feedback on failures and they were retried as appropriate. There is also an additional identifier to store i.e. that of the scheduled item so it can be played back or deleted.
  • Scheduler failure. From the above it would be nice to mark a scheduled item as failed to sync. I did a brief experiment with the python bindings and manipulating the oldrecorded table but this was not looking very hopeful. This could be as simple as being able to mark an item as conflicted so we can see there is a problem in upcoming recordings. The issue is right now that it would just fix itself if I try to manipulate the table and trying to make the schedule inactive with the python bindings didn't seem to work right now. This has the potential to get a bity messy if I mark an item as inactive and it tries to schedule the next available match etc. Either way feedback is golden as knowing there is a problem to fix is half the battle.
  • On air scheduler / tuner sync. Right now if I want to pick up an on air guide I schedule a recording on the correct (EPG) channel and run mythfilldatabase at the same time. This seems to work ok but if there was a concept covering this it may be a bit more flexible maybe allowing an adhoc run of mythfilldatabase whenever at least one tuner is available. Not an important feature I guess but I thought maybe the EIT infrastructure could be updated to understand there is a single channel that carries the EPG and that mythfilldatabase can then be run.
I know this may seem a bit sketchy right now but it already took quite a while to do the post so I'd like to see if the developers are interested and in which bits before filling in any more details etc.
Last edited by mythrec on Mon Aug 21, 2017 11:33 am, edited 1 time in total.

User avatar
paulh
Developer
Posts: 352
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: Scheduler sync to STB (dual tuner) & recording import

Post by paulh » Sat Aug 19, 2017 9:29 am

It's something I'm interested in but never found time to implement or even think too hard about how to achieve it.

I did the original VBox support and the company that makes them had been approached by a customer with a request that would make it possible for the VBox to record stuff at the request of MythTV and then the recordings could be imported into Myth like any other recordings (there was a little more to it than that but was the basic idea). I did put the idea to the MythTV devs but it didn't really attract much attention so the idea was dropped.

I'd love a solution that works with the VBox and also with my SkyHD box ;) the VBox has a good API so getting that to work would be relatively easy. The SkyHD box would be more difficult :cry:

mythrec
Newcomer
Posts: 7
Joined: Thu Aug 17, 2017 10:52 am
Great Britain

Re: Scheduler sync to STB (dual tuner) & recording import

Post by mythrec » Mon Aug 21, 2017 11:24 am

Thanks for the feedback. Always hard to guess how many others will be interested.

I suspect more would be interested if they new it could be done and worked properly etc. Personally I think the goal should be to allow us to create a bunch of scripts to do this sort of thing so we can share / update those whenever required (STBs that have no API are always going to be a PITA to get working and probably more hassle to keep working but if a new script can be shared then it may be able to fix things when they go wrong).

The thing that feels like it needs most attention is the import recorder as it's broken and makes it hard to create any sort of external integration work smoothly. Off the top of my head I think the following were the worst issues (or something along these lines).
  • Mythbackend crashes without an import filename entered (I did a bt but can't remember the exact details, think it was probably an invalid pointer calling findconflicts)
  • Recordings always marked failed causing lots of rescheduled recordings and broken duplication detection etc
  • Seek table not created, ringbuffer file not marked for write causing the comm flag player to exit early rather than wait for the file to finish writing
  • Recording duration not updated, causes additional seek issues when trying to play an in progress recording
Most of the above are fixed so it would just be a case of trying to get them merged.

As mentioned the thing that would really help external integration is to do an on demand recording so something like the following via the python bindings.

Code: Select all

prog=mythtv.getNextImportRecording() #prog=mythtv.getRecording(ch,st)
if prog and mythtv.startImport(card,prog): #ratio of import and tuners not equal 
    #do the import
    mythtv.endImport(card,prog,status)
This could be kept running as a daemon and kicked into life everytime there was a relevant new recording. It would keep running till everything was imported then go to sleep again. Currently things don't work smoothly if you're writing to a file and the tuner isn't trying to record the same program. The frontend doesn't understand that the file is still being updated and the seeking gets broken again. It's also poor from a feedback point of view as we can't see what's actually coming in.

If you are trying to use something like an hdpvr2 then another annoyance is that the device itself has a whole bunch of issues one of which appears to be that it occasionally corrupts the video stream. If you use the method I'm talking about here you can just start over and begin again until it works (what I am currently forced to do). The issue again is the recording will long since have finished if you start over, nicer to see it's still going and yes it would of course be very annoying if you were actually watching it and it suddenly stops but that’s why having the feedback is useful so you know it has genuinely finished importing.

Anyway there would be a lot of potential room for improvement and I don't want to labour it if it's going nowhere.

User avatar
paulh
Developer
Posts: 352
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: Scheduler sync to STB (dual tuner) & recording import

Post by paulh » Tue Aug 22, 2017 6:22 am

I would suggest as a starting point you create a ticket in Trac and put your patches to fix any issues with the import recorder on there so others can review them.

mythrec
Newcomer
Posts: 7
Joined: Thu Aug 17, 2017 10:52 am
Great Britain

Re: Scheduler sync to STB (dual tuner) & recording import

Post by mythrec » Sat Sep 02, 2017 1:56 pm

Although extra features are always nice I think some basic workaround like manipulating the start / end recording time might work just as well.

Post Reply