Export recorded programs metadata
#1
When recording, or viewing recorded, TV programs, TvHeadend's UI (both the XBMC interface and the WebUI interface) accurately show program metadata (based on the channel's EPG). However, after downloading these recordings, there is no metadata .nfo file to accompany them. (Nor is there anything xml related which could contain these metadata in the /recordings directory.) I loaded epg.db and TV22.db in an SQL editor, and there is no such information in these db files either; nor is there anything metadata related in the /userdata/addon_data/service.multimedia.tvheadend directory. Yet this information is surely stored somewhere in the system, for it is visible in the UI. How can it be retrieved/exported?

ADDENDUM: I noticed some reports about TvHeadend not being able to write metadata. This is clearly not my case since metadata are correctly shown in the UI.

Reply
#2
You don't say what OS you're using, but have a look in /home/hts/.hts/tvheadend/dvr/log if you're on a 'buntu-alike. That contains individual log files for each recording (numbered, not named): I believe you get one for each recording scheduled or completed. There's metadata in there. Some metadata gets written to .mkv files as well, but it's really just title/content type/source channel stuff, not a full description.
Reply
#3

Thanks for the reply. I use OpenELEC, where the /dvr/og directory is located under the /userdata/addon_data/service.multimedia.tvheadend directory. And yes, in this /dvr/og directory TvHeadend writes the data you describe, "...one for each recording scheduled or completed." So there I could retrieve my metadata, except that they are, as you rightly point out, not presented in a way as to make this easy. E.g., recordings are not taged by date/channel name, but, rather, by what seems to be a unique db identifier.

You then say "Some metadata gets written to .mkv files as well, but it's really just title/content type/source channel stuff, not a full description." If that is so, XBMC would not be able to deal with them, for it cannot read metadata inside .mkv files (cf. jmarshall, http://forum.xbmc.org/showthread.php?tid=123596). If you know a way to deal with this problem, even if it involves a separate Windows or Linux utitiy, please state so.

My point is that when you open TvHeadend's GUI, you get as nearly a perfect metadata description as is possibe based on what the channel's EPG furnishes. So XBMC is after all not helpless at all when dealing with metadata inside or alongside .mkv files recorded by TvHeadend. Why, then, cannot these metadata be exorted to a same name .nfo file to be processed by the library, much the same way as happens with movies and tvshows? I have tried the system/library export function several times and it yielded nothing.

Reply
#4
I think XBMC is blind to all the metadata - VLC can read what's in an mkv, so maybe mkvinfo or similar would extract it.

XBMC is displaying what the tvheadend backend is telling it to, and it's tvheadend that reads the dvr log files - presumably, this is also how tvheadend works out whether something is complete or not, by what's in these files.

Library export will only work if the file is actually in XBMC's library; if it's in the Recordings list then it's not, it's still under the backend's control. This isn't a tvheadend-specific item, it's part of the architecture of the system. You can move the file to any suitable library folder (wherever you keep your TV shows or Films as appropriate, or even define your Recordings folder as a source if that works for you), name it correctly and scan it into the library - and you'll get all the information as usual from your chosen scraper source (thetvdb.com, for example). This still has nothing to do with tvheadend's metadata or the EPG information, though, it's purely what XBMC goes and gets based on that filename. If you now export the library, you'll get the corresponding .nfo file with this scraper information.

If you want to manufacture something, the only thing I can suggest would be to grep the dvr/log files for the appropriate file name (which is unique if you include time of recording), extract the description, and dump that into a template .nfo file. You could do the same with the title, and perhaps even date and time as well if you were feeling adventurous.

You'd maybe need some help with someone more current with shell scripting than me, but a combination of grep -H and xargs would probably get you there, as would awk.
Reply
#5

So it is either a bug or a missing feature on the part of tvheadend.

Reply
#6
It's hardly a bug when something doesn't do what you want it to... if you think it's a missing feature, by all means raise a feature request and I'm sure the developers will get back to you.
Reply
#7

I run the tvheadend-created .mkvs through mkvinfo as you suggested. All channel/date data have been written correctly as tags, but as far as content metadata are concerned the only information written to the .mkv is the program's title. Description ---surey the most important tag as far as media information is concerned--- has not been written to the .mkv, though it is displayed in the GUI.

Developers, please take notice.

Reply
#8
Raise a ticket on https://www.lonelycoder.com/redmine/proj...issues/new if you want to raise a feature request.
Reply
#9
I can't understand this problem at all. Why do you need to take these files outside your tvheadend/xbmc ecosystem anyway? If xbmc has the metadata what is the problem?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#10
@nickr:
1. I do not want to take these files outside the tvheadend/xbmc ecosystem.

2. The problem is, precisely, (a) TvHeadend does have the metadata, but (b) does not care to export them to XBMC. In other words, XBMC does not have the metadata.
Reply
#11
As I said, if you feel that it's a feature you'd like, please raise a feature request on the tvheadend forum - it could be an easy thing to address (I haven't looked at the code myself to see, but I suspect it's simply another field to be written during mux-ing the mkv). That would allow you to see the information in VLC and similar.

However, XBMC will still not be able to see this information, as you rightly point out: XBMC doesn't use in-file metadata (too many variations of container, I suspect), but instead uses scrapers and its own database. This is by design, so I doubt that having anything included in the files by any backend will change that simply because of the number of different sources/backends/formats.
Reply
#12
Hello all, it's a quite old thread, but if anyone has the problem i have a solution:

As before mentioned, the logged metadata are sittin in the /hts/tvheadend/dvr/log folder..
You need a shellscript, that copies these data beside your record *after* recording.
You must grep the name from inside the data, because the filename is not explicit.

My shell script is as as follows:
----------------------------------------------------
#!/bin/bash
last_dir=$(ls -rt /home/NEU | tail -n1 | tr " " "\ ") # this provides the last recording dirname at /home/NEU
such=$(ls -rt /home/NEU | tail -n1) # this is the search pattern for the grep next line
quelle=$(egrep -l "$such" /hts/tvheadend/dvr/log/*) # egrep (not grep because of spaces in filename) looks for the appropriate filename in the logs
install -m 777 $quelle "/home/NEU/$last_dir" # install (not cp) because its an easy way to set the appropriate user rights in one shot
----------------------------------------------------

I let it run after recording and have no probs.
Hope that helps anyone

Greetings robw
Reply

Logout Mark Read Team Forum Stats Members Help
Export recorded programs metadata0