How to automatically deleted old TV recordings (1 Viewer)

C Johansen

New Member
February 20, 2017
3
0
57
Home Country
Singapore Singapore
I'm using MediaPortal 1 TV server with Kodi 17 Krypton as a front-end, so no MediaPortal front-end at all. My TV Server version is 1.15.0. I'm using a MP extension (TVServerKodi) and the Kodi PVR plug-in for MediaPortal to enable live TV and TV recording. This all work great, and the TV server is shared by several Kodi installations in different rooms.

But there is a problem with automatically deleting old and irrelevant TV recordings. The Kodi MP plugin correctly sets the flags KeepUntil and KeepUntilDate for new TV recordings in the MediaPortal database, but it expect MediaPortal to do the actual deletions. But alas, this does not happen, so I'm stuck with a lot of old and irrelevant TV recordings that has to be manually deleted. Quite annoying and time consuming, and not very "wife friendly" either.

The only thing I can find in the MediaPortal docs regarding deleting old recordings has to do with Disk Quota and how MediaPortal will (automatically? done by the TV server?) delete old recordings (oldest first it what it says) if a minimum configured disk space is reached. I have this enabled but I will never reach that minimum space as I have a huge share for TV recordings. So my need for deleting more for "housekeeping" and tidyness rather than disk space.

Exactly how is deleting of TV recordings according to the KeepUntil and KeepUntilDate for each recording supposed to happen?

I really need this so if MediaPortal doesn't do this I guess I'll have to write something myself that check all the recordings in the database and deletes any recording that is due for deleting according to KeepUntil and KeepUntilDate. But I would rather not do this, and since these flags are there I would expect MP to actually use them.

Does anyone have any insight on this?
 

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hello and welcome :)

    ...Disk Quota and how MediaPortal will (automatically? done by the TV server?)...
    Yes and yes.

    ...but I will never reach that minimum space as I have a huge share for TV recordings.
    Size doesn't stop you from configuring a larger disk quota.

    Exactly how is deleting of TV recordings according to the KeepUntil and KeepUntilDate for each recording supposed to happen?
    The answer depends what the "keep until..." configuration is.

    If it's "keep until... always", the recording will never be automatically deleted. Obvious. :)
    If it's "keep until... watched", the client (ie. KODI in your case) is responsible for deleting it after you finish watching it. The enables the client to define "watched" in whatever way you prefer. For example, a movie might be considered watched and deletable at 85 to 90% viewed because you skipped the credits.
    If it's "keep until... space needed" (the default), that ties into the disk quota functionality. As you said, the server should automatically start deleting the oldest recordings which are marked "keep until space needed" once the space threshold/quota is reached.
    If it's "keep until... date X", the server should automatically delete it when the date arrives.

    All this assumes that the user account that TV Server is using (usually a system account) has the requisite permissions for deleting files on the share.

    [edit: Recordings inherit the "keep until..." and "keep until date" values from the associated schedule that triggers them. The default "keep until..." is "...until space needed". Changing a schedule's settings after it has been created will not affect recordings that were triggered/created before you changed the settings (hope that makes sense). Maybe this is what's tripping you up.]

    Does anyone have any insight on this?
    Further insight may be possible if you would provide your TV Server log files.

    Regards,
    mm
     
    Last edited:

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    The other thing you can do is set the number of recordings (episodes) to keep for each schedule.
     

    C Johansen

    New Member
    February 20, 2017
    3
    0
    57
    Home Country
    Singapore Singapore
    Great feedback, thanks a million! I'll do some more testing and get back here with the results.

    Regarding setting the number of recordings to keep for each schedule, that is not possible in Kodi with the MP Live TV plugin, in other words there is no such option to set.

    I did notice one thing when I examined the mptvdb though. I created a "timer" to record my daily news, the schedule was created 2017-02-19 and I chose to keep the recorings for 7 days for that schedule.

    When I examine the resulting recordings I notice that both the recording made on the 19th and the 21st have KeepUntilDate set to 2016-02-26, eg 7 days after the *recording shedule* was created but for the recording made on the 21st, onmly 5 days after the recording was made. This does not make sense to me, as I would expect this to be set to 7 days after the *recording* was made. But then again I don't know how the internals of this logic is working, so this might not be an issue.
     

    C Johansen

    New Member
    February 20, 2017
    3
    0
    57
    Home Country
    Singapore Singapore
    As a follow up question to the above, is I am now wondering who sets KeepUntilDate for each recording. I can only guess but my guess is that it is done by the client (and not MP TV server), in which case I suspect that the Kodi MP PVR Plugin sets this incorrectly to the value of keepDate for thet schedule. When it probably should be something like:

    startTime [from the recording] PLUS ( keepDate [from the schedule] MINUS startTime [from the shedule])

    Do take note of the parenthesis in that equation, the brackets not included.

    This is of course just a guess as I don't know the internal logic here but it makes sense if it is this way.

    Any input would be greatly appreciated, I don't really want to write my own program to check each recording in the DB, then find the parent "shedule" the recording belongs to and then finally delete the recording (file and DB record) if todays date (eg the date this imaginary program is being run) is past the result of my equation above.

    Does any of this make sense?
     

    Users who are viewing this thread

    Top Bottom