get-iplayer / get_iplayer

A utility for downloading TV and radio programmes from BBC iPlayer and BBC Sounds
https://github.com/get-iplayer/get_iplayer/wiki
GNU General Public License v3.0
2.13k stars 229 forks source link

Using 'episode' as part of --fields omits Doctor Who episode "Rogue" from search results #473

Open BtEtta opened 2 months ago

BtEtta commented 2 months ago

Do not file a bug report if you are using get_iplayer outside the UK. If you do, your report will be ignored.

Do not file a bug report if you are using get_iplayer with a VPN or proxy from any location, including the UK. If you do, your report will be ignored.

Search the repository (search field at top left) to see if a report already exists for the bug in the issue tracker. Do not create a duplicate report. Duplicate reports will be ignored.

Review recent open and closed entries in the issue tracker to see if a report already exists for the bug. Do not create a duplicate report. Duplicate reports will be ignored.

Ensure that you are using get_iplayer 3.35 or higher. If not, your report will be ignored.

Identify the operating system and version where get_iplayer demonstrates the bug

Windows 10

Provide a clear and concise description of the bug. Do not paste get_iplayer output or screenshots into the field below. If you do, your report will be ignored.

When using --fields=name,episode to search for content certain entries do not show up which do correctly appear if --fields is not specified or if episode is not specified as one of the fields.

This error occurs even if I search for something that should be included in the episode field. E.g. "Rogue" returns no results with --fields=name,episode while "Dot" returns the expected results. This behaviour also continues to occur even if I use --rebuild-cache

I have found no problems with any other actions related to the entries that get excluded when using the index number: --info works, as does downloading.

Upon investigating the code the source appears to be that if --exclude --exclude-category or --exclude-channel are not specified on the command-line they are given ^ROGUE$ as the default regex so this will only happen to a broadcast where one or more of the fields being searched is exactly "Rogue" (case-insensitive)

Changing the $exclude_regex default to ^$ fixes the problem in this use case as the name and episode should never be empty as far as I can see—but some other searchable fields can be blank. This fix also works for $channel_exclude_regex but not $category_exclude_regex, presumably because the latter is only meant to be used with --history and is blank in normal searches.

In the long term a better solution should probably be implemented that doesn't try to apply any exclusions at all if none have been specified on the command-line or in the options file. I note that "ROGUE" or variations thereof (including "ROUGE") are used in several other places throughout the script and may be hiding similar edge cases depending on how they're used.

Provide the PID or URL of the programme you are attempting to download, if applicable. Provide the PID or URL for only one programme.

No response

Provide the complete get_iplayer command line that demonstrates the bug. Do not truncate or excerpt the command. If you do, your report will be ignored. If you are using the Web PVR, list the steps necessary to reproduce the bug, in as much detail as possible.

get_iplayer.pl --fields=name,episode "Doctor Who"

Drag your verbose log file into the field below to create an attachment. Your verbose log file must be added as an attachment. Do not paste its contents into the field below. If you do, your report will be ignored. You may enter a URL linking to your verbose log file on a pastebin site. If the bug prevents get_iplayer from running, enter "N/A" in the field below. If you enter any other text in the field below, your report will be ignored.

log.txt

If you are using the Web PVR, provide your web browser name and version. This information typically can be found from the application menu via Chrome/Firefox/Safari->About... (macOS) or Help->About... (Linux/Windows)

No response