[grilo-plugins] local-metadata: Improve regexp for tv shows
- From: Victor Toso de Carvalho <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] local-metadata: Improve regexp for tv shows
- Date: Fri, 19 Dec 2014 20:02:34 +0000 (UTC)
commit bd2e42a796fcb9b5333f669087863ae0bd8723d4
Author: Victor Toso <me victortoso com>
Date: Thu Dec 18 21:33:12 2014 +0100
local-metadata: Improve regexp for tv shows
* Get episode number in the format of "..EP01.."
https://bugzilla.gnome.org/show_bug.cgi?id=741562
src/local-metadata/grl-local-metadata.c | 8 +++++---
tests/local-metadata/test_local_metadata.c | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/local-metadata/grl-local-metadata.c b/src/local-metadata/grl-local-metadata.c
index b4b88ab..2fced68 100644
--- a/src/local-metadata/grl-local-metadata.c
+++ b/src/local-metadata/grl-local-metadata.c
@@ -49,8 +49,8 @@ GRL_LOG_DOMAIN_STATIC(local_metadata_log_domain);
#define TV_REGEX \
"(?<showname>.*)\\." \
"(?<season>[sS\\.]\\d{1,2}|\\d{1,2})" \
- "(?<episode>(?:[eExX\\.]\\d{1,2}))" \
- "\\.?(?<name>.*|(?:\().*))?"
+ "\\.?(?<episode>(?:(?i)ep|[ex\\.])\\d{1,2})" \
+ "\\.?(?<name>(?:\().*|.*))?"
#define MOVIE_REGEX \
"(?<name>.*)" \
"(?<year>19\\d{2}|20\\d{2})"
@@ -404,7 +404,9 @@ video_guess_values_from_display_name (const gchar *display_name,
if (episode) {
gchar *e = g_match_info_fetch_named (info, "episode");
if (e) {
- if (*e == 'e' || *e == 'E' || *e == 'x' || *e == '.') {
+ if (g_ascii_strncasecmp (e, "ep", 2) == 0) {
+ *episode = atoi (e + 2);
+ } else if (*e == 'e' || *e == 'E' || *e == 'x' || *e == '.') {
*episode = atoi (e + 1);
} else {
*episode = atoi (e);
diff --git a/tests/local-metadata/test_local_metadata.c b/tests/local-metadata/test_local_metadata.c
index 10fb592..ffdb951 100644
--- a/tests/local-metadata/test_local_metadata.c
+++ b/tests/local-metadata/test_local_metadata.c
@@ -102,6 +102,7 @@ test_episodes (void)
{ "Boardwalk.Empire.S04E01.HDTV.x264-2HD.mp4", NULL, "Boardwalk Empire", NULL, 4, 1 },
{ NULL, "file:///home/test/My%20super%20series.S01E01.mp4", "My super series", NULL, 1, 1 },
{ "Adventure Time - 2x01 - It Came from the Nightosphere.mp4", NULL, "Adventure Time", "It Came from the
Nightosphere", 2, 1 },
+ { "Real Humans S01 EP01 [X264] [HD 720p] [FR] [SWE] [SRT FR] [MRPHU].mkv", NULL, "Real Humans", NULL, 1,
1 },
/* Episode and Series separated by '.' and Title inside parenthesis */
{ NULL, "file:///home/toso/Downloads/Felicity/Felicity%202.05%20(Crash).avi", "Felicity", "Crash", 2, 5
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]