[Xfce4-commits] <tumbler:nick/cover-thumbnailer> Always check in the title for a year.

Nick Schermer noreply at xfce.org
Wed Dec 12 22:10:02 CET 2012


Updating branch refs/heads/nick/cover-thumbnailer
         to 073865272920bbc5d1ef6cae9b449cab86d5c199 (commit)
       from 375d8b0504da9307ceb9a22189d6570e40b09ed1 (commit)

commit 073865272920bbc5d1ef6cae9b449cab86d5c199
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Dec 12 22:09:28 2012 +0100

    Always check in the title for a year.

 plugins/cover-thumbnailer/cover-thumbnailer.c |   42 ++++++++++++-------------
 1 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/plugins/cover-thumbnailer/cover-thumbnailer.c b/plugins/cover-thumbnailer/cover-thumbnailer.c
index 34302e9..14a70ff 100644
--- a/plugins/cover-thumbnailer/cover-thumbnailer.c
+++ b/plugins/cover-thumbnailer/cover-thumbnailer.c
@@ -533,33 +533,31 @@ cover_thumbnailer_get_title (CoverThumbnailer  *cover,
           && start_pos > 0)
         basename[start_pos] = '\0';
       g_match_info_free (match_info);
+    }
 
-      if (!is_series)
+  /* for non-series, look for a year in the title */
+  if (!is_series
+      && g_regex_match (cover->year_regex, basename, 0, &match_info))
+    {
+      /* store year and remove the suffix from the title */
+      if (g_match_info_fetch_pos (match_info, 0, &start_pos, &end_pos)
+          && start_pos >= 0
+          && end_pos > start_pos)
         {
-          /* for non-series, look for a year in the title */
-          if (g_regex_match (cover->year_regex, basename, 0, &match_info))
+          year = g_strndup (basename + start_pos, end_pos - start_pos);
+
+          if (start_pos == 0)
             {
-              /* store year and remove the suffix from the title */
-              if (g_match_info_fetch_pos (match_info, 0, &start_pos, &end_pos)
-                  && start_pos >= 0
-                  && end_pos > start_pos)
-                {
-                  year = g_strndup (basename + start_pos, end_pos - start_pos);
-
-                  if (start_pos == 0)
-                    {
-                      temp = g_strdup (basename + end_pos);
-                      g_free (basename);
-                      basename = temp;
-                    }
-                  else
-                    {
-                      basename[start_pos] = '\0';
-                    }
-                }
-              g_match_info_free (match_info);
+              temp = g_strdup (basename + end_pos);
+              g_free (basename);
+              basename = temp;
+            }
+          else
+            {
+              basename[start_pos] = '\0';
             }
         }
+      g_match_info_free (match_info);
     }
 
   /* append the possible title part of the filename */


More information about the Xfce4-commits mailing list