GNOME Bugzilla – Bug 741562
local-metadata: Broken title with another TV episode format
Last modified: 2015-01-06 00:14:02 UTC
This episode title came from a different source and isn't being parsed properly. It not showing up as a TV show is the biggest problem.
Created attachment 292758 [details] [review] local-metadata: Add a test for more episode formats
Real Humans S01 EP01 [X264] [HD 720p] [FR] [SWE] [SRT FR] [MRPHU].mkv TV SHOW: Real Humans Season: 1 Episode: 1 audio (first): FR audio (second): SWE subtitles (first) FR is that right? We don't have metadata-key for audio-language, do we?
(In reply to comment #2) > Real Humans S01 EP01 [X264] [HD 720p] [FR] [SWE] [SRT FR] [MRPHU].mkv > > TV SHOW: Real Humans > Season: 1 > Episode: 1 > audio (first): FR > audio (second): SWE > subtitles (first) FR > > is that right? Yes. > We don't have metadata-key for audio-language, do we? But I wouldn't bother trying to parse anything but show-name, season/episode and episode title. The subtitles file is a separate file, and metadata about the audio tracks is in the file itself.
Created attachment 293004 [details] [review] local-metadata: Improve string sanitise * Do not get substring with a blacklisted word. * Only allow a few chars to finish the substring. * Include new blacklist word "x264".
Created attachment 293005 [details] [review] local-metadata: Improve regexp for tv shows * Get episode number in the format of "..EP01.."
Review of attachment 293004 [details] [review]: It would be good to have tests which excercise those changes in the same commit. ::: src/local-metadata/grl-local-metadata.c @@ +273,3 @@ + gchar last_char = *(line_end - 1); + + /* After removing substrings, ignore non alpha-numeric in the substrings are what in this case? @@ +275,3 @@ + /* After removing substrings, ignore non alpha-numeric in the + * end of the string */ + while (g_ascii_isalnum (last_char) == FALSE && You should probably be using unicode functions here, no? g_unichar_isalnum() and g_utf8_next_char() to skip to the next character.
Review of attachment 293005 [details] [review]: Looks good.
(In reply to comment #6) > Review of attachment 293004 [details] [review]: > > It would be good to have tests which excercise those changes in the same > commit. I'll combine the test with the second patch. > > ::: src/local-metadata/grl-local-metadata.c > @@ +273,3 @@ > + gchar last_char = *(line_end - 1); > + > + /* After removing substrings, ignore non alpha-numeric in the > > substrings are what in this case? The substring which contain the blacklisted word. Real Humans S01 EP01 [X264] [HD 720p] [FR] [SWE] [SRT FR] [MRPHU].mkv <-- used in regexp --><------------- discarded ---------------------> > > @@ +275,3 @@ > + /* After removing substrings, ignore non alpha-numeric in the > + * end of the string */ > + while (g_ascii_isalnum (last_char) == FALSE && > > You should probably be using unicode functions here, no? g_unichar_isalnum() > and g_utf8_next_char() to skip to the next character. Thanks! Fixing...
Created attachment 293088 [details] [review] changes since v1: - using g_utf8_find_prev_char in the end of the string - using g_unichar_isalnum instead of ascii - improve comment local-metadata: Improve string sanitise * Do not get substring with a blacklisted word. * Only allow a few chars to finish the substring. * Include new blacklist word "x264".
Review of attachment 293088 [details] [review]: Looks good. ::: src/local-metadata/grl-local-metadata.c @@ +276,3 @@ + * char in the end of the sanitised string */ + while (g_unichar_isalnum (*line_end) == FALSE && + *line_end != '!' && *line_end != '?' && *line_end != '.') { Can you please put one statement on each line, so: while (g_unichar_isalnum (*line_end) == FALSE && *line_end != '!' && *line_end != '?' && *line_end != '.') { I found it more readable.
Created attachment 293089 [details] [review] local-metadata: improve regexp for tv shows changes since v1: Combined with test case provided by Bastien
Review of attachment 293088 [details] [review]: git bz fail :( pushed as 92141ba9dcecacdca3a8469b4edeaed10237d8ac
Review of attachment 293089 [details] [review]: pushed as bd2e42a796fcb9b5333f669087863ae0bd8723d4
Comment on attachment 292758 [details] [review] local-metadata: Add a test for more episode formats Test was already merged into the commit with the fix.