Project

General

Profile

How can I "rebuild" the "finished recordings"-Database?

Added by Anonymous over 8 years ago

Hi *.*

Okay, whatever stupid mistake I did, I fucked up the folder where my recordings are stored. Now 95% of these files are gone, but TVH says there are no finsihed recordings. TVH does a recording which i can succesfully watch via the CIFS-Share, but the recording does show up in the web-ui nor in the conncted Kodi.

What can I do to clean this mess up, i made?

Thanks for the help in advance.


Replies (7)

RE: How can I "rebuild" the "finished recordings"-Database? - Added by Jonathan Thomson over 8 years ago

The 'database' is nothing more than a series of files on the disk which the TVHeadend indexes on startup. If you've deleted the files, you're pretty screwed. If it's just a case that TVHeadend can't 'see' the files then try this...

First off, just try restarting TVHeadend if you haven't already then move on to the next step if things haven't resolved themselves...

Check in <THVRoot>/dvr/log - there should be loads of files with random filenames - each one of those represents an entry in the completed recordings list. If this folder is empty then unless they are elsewhere on the disk then that's pretty terminal.

Couple of things to check;
In the web interface, switch to the 'Digital Video Recorder' tab then the 'Failed Recordings' tab - are all your recordings there?
If so, are they showing as 'File missing'?

If the folder of TV recordings (the actual video files) is in the same place it's always been but TVHeadend says the files are missing, just restart TVHeadend. There is what I consider to be a bug that if TVHeadend can't access the recordings folder, it marks ALL recordings as failed instead of periodically checking if the folder is back up. I suspect this is due to how TVHeadend loads the recording log from disk and the web interface isn't able to dynamically update all that data but it's still a bad user experience.

If the folder has changed, you have two options;
Set it back to what was stored in the recording log (open one of the files from the above DVR log and see where TVHeadend was pointing before stuff went wrong) then restart TVHeadend and things should line up
Cycle through each of the DVR logs and update the file path - this is not easy to do and I'd recommend just putting the files back where they were originally.

Let me know how you get on.

RE: How can I "rebuild" the "finished recordings"-Database? - Added by Anonymous over 8 years ago

Okay, the TVH-System can access the folder of the recordings files (*.ts) and there are files in <THVRoot>/dvr/log (See sample content below) but there are no entries in finsihed recording nor in failed. Not even those TVH did succesfully record since the phenomenon happen.

Due that most of the records are gone enayways, is it worth the try to delete everything in <THVRoot>/dvr/log hopefully that this will fix the problem?

{
"start": 1469666700,
"start_extra": 0,
"stop": 1469669100,
"stop_extra": 0,
"channel": "797c21001d021a74a6e495a5dd9a037e",
"channelname": "Einsfestival HD",
"title": {
"ger": "The Tonight Show Starring Jimmy Fallon"
},
"subtitle": {
"ger": "Gäste: Michael Fassbender, Abby Elliott und Bastille"
},
"description": {
"ger": "Eine große Dosis Hollywood und Glamour auf EinsFestival - unter der Woche jeden Abend vor dem Schlafengehen. Der amerikanisch$
},
"pri": 4,
"retention": 0,
"container": -1,
"config_name": "c0afd3b6b006247c2ba242299172d276",
"owner": "moppen",
"creator": "Auto recording by: moppen",
"directory": "Tonight Show",
"errorcode": 0,
"errors": 0,
"data_errors": 0,
"dvb_eid": 37809,
"noresched": false,
"autorec": "63e9cb86929c7f8a14545305379e25f3",
"timerec": "",
"content_type": 1,
"broadcast": 217181,
"comment": "Created from EPG query"
}

RE: How can I "rebuild" the "finished recordings"-Database? - Added by Jonathan Thomson over 8 years ago

Did you truncate that log entry? right after "comment" there should be a "files" section, are all your log entries like that?

Here's a sample from my install;

{
    "enabled": true,
    "start": 1466361000,
    "start_extra": 0,
    "stop": 1466364600,
    "stop_extra": 0,
    "channel": "",
    "channelname": "ITV HD",
    "title": {
        "eng": "Coronation Street" 
    },
    "description": {
        "eng": "Sarah is tipped over the edge. Alex does Gemma a favour. Luke's suspicions about Caz grow." 
    },
    "pri": 2,
    "retention": 0,
    "removal": 0,
    "config_name": "c5a551a4060ae812e8b936979437760d",
    "owner": "admin",
    "creator": "admin",
    "errorcode": 0,
    "errors": 0,
    "data_errors": 0,
    "dvb_eid": 0,
    "noresched": true,
    "norerecord": false,
    "autorec": "",
    "timerec": "",
    "parent": "",
    "child": "",
    "content_type": 1,
    "broadcast": 0,
    "comment": "Auto recording",
    "files": [
        {
            "filename": "/mnt/recordedtv/Coronation Street/Coronation Street_ITV HD_2016-06-19_19-30.ts",
            "info": [
                {
                    "type": "H264",
                    "width": 1920,
                    "height": 1080,
                    "duration": 3600,
                    "aspect_num": 0,
                    "aspect_den": 0
                },
                {
                    "type": "AAC",
                    "language": "eng",
                    "audio_type": 0
                },
                {
                    "type": "DVBSUB",
                    "language": "eng",
                    "composition_id": 1,
                    "ancillary_id": 1
                }
            ],
            "start": 1466361000,
            "stop": 1466364900
        }
    ]
}

RE: How can I "rebuild" the "finished recordings"-Database? - Added by Jonathan Thomson over 8 years ago

Rather than deleting anything, if you do;

mv dvr/ dvr-bak/

from the TVHeadend root directory then restart TVHeadend, it will recreate the DVR structure but anything already recorded will still not show up - things should work going forward though.

If you've got lots of recording schedules already set up then do this instead from the DVR directory;

mv log/ log-bak/

This will simply move the DVR log directory and leave your recording schedules intact if they are indeed still visible via the web UI.

RE: How can I "rebuild" the "finished recordings"-Database? - Added by Anonymous over 8 years ago

No, sir, truncated nothing ;)

And yes, it seems that all the entries in the log-directory haven't that section.

Furthermore I tried this:

  1. stopped TVH via init.d
  2. moved all the file in log/ somewhere else
  3. started TVH via init.d

... and all the files where magically back in log/, with other filenames, but again without the files section.

Just to be sure, i include my config.

{
"enabled": true,
"name": "",
"profile": "1d927eff7ae648fd6786b81de49a56e0",
"cache": 1,
"retention-days": 20000,
"pre-extra-time": 0,
"post-extra-time": 5,
"epg-update-window": 86400,
"storage": "/media/Aufnahmen",
"file-permissions": "0664",
"charset": "ASCII",
"tag-files": true,
"skip-commercials": true,
"directory-permissions": "0775",
"day-dir": false,
"channel-dir": false,
"title-dir": false,
"channel-in-title": false,
"date-in-title": false,
"time-in-title": false,
"episode-in-title": false,
"episode-before-date": false,
"subtitle-in-title": false,
"omit-title": false,
"clean-title": false,
"whitespace-in-title": false,
"windows-compatible-filenames": false
}

RE: How can I "rebuild" the "finished recordings"-Database? - Added by Anonymous over 8 years ago

Has no one, any idea how to fix this?

RE: How can I "rebuild" the "finished recordings"-Database? - Added by Dimitar Maznekov almost 8 years ago

I'm interested too!
It's unlogical such sophisticated service don't have ability to "save" your existing dvr records.
I have log record, files are in folder, but not listed as finished but failed. Kodi which I use as frontend can't lists it in PVR :/

BTW - status is "Time missing"

    (1-7/7)