Project

General

Profile

Issue: recording a movie results in a file being saved in "tvshows" instead of the "tvmovies" directory.

Added by Thomas - 5 months ago

Issue
Recording a movie results in a file being saved in "tvshows" instead of the "tvmovies" directory.

What is expected?
The recording to be saved in the appropriate movie directory "recorded_movies".

What was the actual result?
The movie "Eden" was not detected as movie, while the content_type seems correct. The recording was saved to the wrong location. Relevant Tvheadend dvr debug log:

2021-05-03 17:26:04.600 [  DEBUG]:dvr: fmt = q$n.$x is_movie = 0 content_type = 1
2021-05-03 17:26:04.600 [  DEBUG]:dvr: File "/volume1/video/recorded_shows/Eden/Eden.mkv" -- No such file or directory -- Using for recording

What environment/settings might be relevant to reproduce the issue?
Version: HTS Tvheadend 4.3-1941~g817a8d4e4
System: Docker container from Linuxserver.io (Alpine based) running on a Synology DS220+

The following DVR config variables are set:
pathname (fmt): "$q$n.$x"
format-tvmovies-subdir: "recorded_movies"
format-tvshows-subdir: "recorded_shows"

Enabled EPG grabbers config:

"xmltv": {
    "class": "epggrab_mod_ext_xmltv",
    "dn_chnum": true,
    "scrape_extra": true,
    "scrape_onto_desc": false,
    "use_category_not_genre": false,
    "name": "XMLTV",
    "type": "External",
    "enabled": true,
    "priority": 3
},
"eit": {
    "class": "epggrab_mod_eit",
    "short_target": 2,
    "running_immediate": false,
    "scrape_episode": true,
    "scrape_title": true,
    "scrape_subtitle": true,
    "scrape_summary": true,
    "name": "EIT: EPG Grabber",
    "type": "Over-the-air",
    "enabled": true,
    "priority": 1
}

XMLTV EPG fed to Tvheadend: xmltv.xml (see attachment)
Tvheadend internal EPG according to http://localhost:9981/xmltv/channelnumber/91: NPO 2 Extra.xml (see attachment)

What did I do to debug the issue?
I'm no C programmer, but I believe the problem must be along these lines: https://github.com/tvheadend/tvheadend/blob/fdc3f945f2b759a743a595b134786b881538f52e/src/dvr/dvr_rec.c#L494
The first two conditions don't apply, as I don't force a format.
In the else: ebc->category should probably equate to true, as the broadcast has categories originating from the XMLTV feed. The categories have the string "movie" in them, so I believe this is what SHOULD set is_movie to true/1.
The last resort situation doesn't seem to get triggered because content_type is actually 1 and there is no episode information, so this would've resulted in is_movie=1, which is clearly not the case.

I'm developing the tool that generates the mentioned XMLTV feed and have made sure that tvshow programmes never receive one of the ETSI "Movie / Drama" subcategories and vice versa for movie programmes (they exclusively get subcategories from the "Movie / Drama" genre section). But maybe there is something wrong with the categories in the feeds I create? Do the slashes need a space before and after them? Do I need to add capitals? Split categories up?

I've searched and read many relevant topics like https://tvheadend.org/issues/3753 but I am really stuck at the moment.

xmltv.xml (1.8 KB) xmltv.xml feed-to-tvheadend
NPO 2 Extra.xml (1.69 KB) NPO 2 Extra.xml tvheadend-internal-epg

Replies (2)

RE: Issue: recording a movie results in a file being saved in "tvshows" instead of the "tvmovies" directory. - Added by Dave Pickles 5 months ago

From a quick look at the code, dvr/dvr_rec.c calls string_list_contains_string() to check whether the category list includes 'movie' or 'film'. That function in turn calls string_list_item_cmp() which uses the C function strcmp() to do the actual comparison. Unfortunately strcmp() looks for an exact match; and since you are looking for 'movie' but the category is 'movie/drama' the result is false.

RE: Issue: recording a movie results in a file being saved in "tvshows" instead of the "tvmovies" directory. - Added by Thomas - 5 months ago

Thanks a bunch for taking the time to help me Dave! For now I will work around this by manually adding a "movie" category to applicable XMLTV programmes. I expected Tvheadend to prefer ETSI style categories and was mapping them like this

When comparing the xmltv.xml I produced

<category lang="en">serious/classical/religious/historical movie/drama</category>
<category lang="en">movie/drama</category>
to the XMLTV that represents Tvheadend's internal EPG
<category>movie/drama</category>
<category>serious/classical/religious/historical movie/drama</category>
<category lang="en">Movie / Drama : Serious / Classical / Religious / Historical mo</category>
I notice that the language attributes from my categories are lost (not important), but also that my categories are used to create an additional category in ETSI style (unless this information somehow originates from EIT). Aside from the strange cut-off on the end of the value: if this information is present in the internal EPG, why does dvr_rec.c not use this to determine "is_movie"? Either in addition to or instead of the static non-ETSI category values "movie" or "film". Is it worth creating a feature request for this?

On a sidenote: I actually did visit the string_list_contains_string() method in the string_list.c source, but my knowledge came short at line 206. In my noobie eyes sizeof() is called on a variable (or reference/pointer?) *skel that appears out of nowhere and it's trying to allocate memory or something? Investigating RB_FIND didn't help me and I didn't think of searching it's last parameter.

    (1-2/2)