[tracker/cuesheets] tracker-extract: Fixed various coding style issues
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/cuesheets] tracker-extract: Fixed various coding style issues
- Date: Thu, 29 Sep 2011 16:44:18 +0000 (UTC)
commit 09db417ea672ba8c3abb1767295fc84088feb49b
Author: Martyn Russell <martyn lanedo com>
Date: Thu Sep 29 17:25:44 2011 +0100
tracker-extract: Fixed various coding style issues
src/miners/fs/tracker-miner-files.c | 8 ++--
src/tracker-extract/tracker-cue-sheet.c | 22 +++++++-----
src/tracker-extract/tracker-cue-sheet.h | 7 ++--
src/tracker-extract/tracker-extract-gstreamer.c | 39 +++++++++++++----------
4 files changed, 42 insertions(+), 34 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 5977904..31c53ab 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -1977,10 +1977,10 @@ sparql_builder_finish (ProcessFileData *data,
tracker_sparql_builder_prepend (data->sparql, preupdate);
}
- /* Append postupdate */
- if (postupdate && *postupdate) {
- tracker_sparql_builder_append (data->sparql, postupdate);
- }
+ /* Append postupdate */
+ if (postupdate && *postupdate) {
+ tracker_sparql_builder_append (data->sparql, postupdate);
+ }
uuid = g_object_get_qdata (G_OBJECT (data->file),
data->miner->private->quark_mount_point_uuid);
diff --git a/src/tracker-extract/tracker-cue-sheet.c b/src/tracker-extract/tracker-cue-sheet.c
index 7f05ccc..e98891b 100644
--- a/src/tracker-extract/tracker-cue-sheet.c
+++ b/src/tracker-extract/tracker-cue-sheet.c
@@ -33,12 +33,12 @@
#include <libcue/libcue.h>
#endif
-#include <libtracker-common/tracker-utils.h>
+#include <libtracker-common/tracker-file-utils.h>
#include "tracker-cue-sheet.h"
static TrackerToc *
-tracker_toc_new ()
+tracker_toc_new (void)
{
TrackerToc *toc;
@@ -55,6 +55,10 @@ tracker_toc_free (TrackerToc *toc)
TrackerTocEntry *entry;
GList *n;
+ if (!toc) {
+ return;
+ }
+
for (n = toc->entry_list; n != NULL; n = n->next) {
entry = n->data;
gst_tag_list_free (entry->tag_list);
@@ -78,8 +82,9 @@ add_cdtext_string_tag (Cdtext *cd_text,
text = cdtext_get (index, cd_text);
- if (text != NULL)
+ if (text != NULL) {
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, tag, text, NULL);
+ }
}
static void
@@ -258,7 +263,7 @@ parse_cue_sheet_for_file (const gchar *cue_sheet,
cd_get_rem (cd));
}
- toc_entry = g_slice_new0 (TrackerTocEntry);
+ toc_entry = g_slice_new (TrackerTocEntry);
toc_entry->tag_list = gst_tag_list_new ();
toc_entry->start = track_get_start (track) / 75.0;
toc_entry->duration = track_get_length (track) / 75.0;
@@ -298,10 +303,10 @@ find_local_cue_sheets (GFile *audio_file)
GFile *cue_sheet;
GFileEnumerator *e;
GFileInfo *file_info;
- gchar *container_path;
+ gchar *container_path;
const gchar *file_name;
const gchar *file_content_type;
- gchar *file_path;
+ gchar *file_path;
GList *result = NULL;
GError *error = NULL;
@@ -331,8 +336,7 @@ find_local_cue_sheets (GFile *audio_file)
g_debug ("Unable to get info for file %s/%s",
container_path,
g_file_info_get_display_name (file_info));
- } else
- if (strcmp (file_content_type, "application/x-cue") == 0) {
+ } else if (strcmp (file_content_type, "application/x-cue") == 0) {
file_path = g_build_filename (container_path, file_name, NULL);
cue_sheet = g_file_new_for_path (file_path);
result = g_list_prepend (result, cue_sheet);
@@ -418,4 +422,4 @@ tracker_process_external_cue_sheets (const gchar *audio_uri)
return NULL;
}
-#endif
+#endif /* ! HAVE_LIBCUE */
diff --git a/src/tracker-extract/tracker-cue-sheet.h b/src/tracker-extract/tracker-cue-sheet.h
index e705e48..79b7a24 100644
--- a/src/tracker-extract/tracker-cue-sheet.h
+++ b/src/tracker-extract/tracker-cue-sheet.h
@@ -30,18 +30,17 @@ G_BEGIN_DECLS
typedef struct {
/* Values in seconds */
- gdouble start, duration;
-
+ gdouble start;
+ gdouble duration;
GstTagList *tag_list;
} TrackerTocEntry;
typedef struct {
GstTagList *tag_list;
-
GList *entry_list;
} TrackerToc;
-void tracker_toc_free (TrackerToc *toc);
+void tracker_toc_free (TrackerToc *toc);
TrackerToc *tracker_parse_cue_sheet (const gchar *cue_sheet);
TrackerToc *tracker_process_external_cue_sheets (const gchar *audio_uri);
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index f7313fa..6d55dc7 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -174,7 +174,7 @@ add_artist (MetadataExtractor *extractor,
*p_artist_uri = tracker_sparql_escape_uri_printf ("urn:artist:%s", artist_name);
/* Check if already added to the preupdate, to avoid sending 9 identical INSERTs */
- if (g_slist_find_custom (extractor->artist_list, artist_name, (GCompareFunc)g_ascii_strcasecmp))
+ if (g_slist_find_custom (extractor->artist_list, artist_name, (GCompareFunc) g_ascii_strcasecmp))
return;
tracker_sparql_builder_insert_open (preupdate, NULL);
@@ -372,9 +372,8 @@ replace_double_gst_tag (TrackerSparqlBuilder *preupdate,
tracker_sparql_builder_insert_close (preupdate);
}
-static void
-get_embedded_cue_sheet_data (GstTagList *tag_list,
- gchar **p_data)
+static gchar *
+get_embedded_cue_sheet_data (GstTagList *tag_list)
{
gint i, count;
gchar *buffer;
@@ -384,8 +383,12 @@ get_embedded_cue_sheet_data (GstTagList *tag_list,
gst_tag_list_get_string_index (tag_list, GST_TAG_EXTENDED_COMMENT, i, &buffer);
if (g_ascii_strncasecmp (buffer, "cuesheet=", 9) == 0) {
- *p_data = buffer;
- break;
+ gchar *result;
+
+ result = g_strdup (buffer + 9);
+ g_free (buffer);
+
+ return result;
}
g_free (buffer);
@@ -532,7 +535,12 @@ extractor_apply_general_metadata (MetadataExtractor *extractor,
tracker_guarantee_title_from_file (metadata, "nie:title", title, file_url);
- add_date_time_gst_tag_with_mtime_fallback (metadata, file_url, "nie:contentCreated", tag_list, GST_TAG_DATE_TIME, GST_TAG_DATE);
+ add_date_time_gst_tag_with_mtime_fallback (metadata,
+ file_url,
+ "nie:contentCreated",
+ tag_list,
+ GST_TAG_DATE_TIME,
+ GST_TAG_DATE);
add_string_gst_tag (metadata, "nie:copyright", tag_list, GST_TAG_COPYRIGHT);
add_string_gst_tag (metadata, "nie:license", tag_list, GST_TAG_LICENSE);
@@ -733,8 +741,8 @@ extractor_apply_device_metadata (MetadataExtractor *extractor,
tracker_sparql_builder_predicate (metadata, "nfo:equipment");
tracker_sparql_builder_object_iri (metadata, equip_uri);
- g_free (equip_uri);
+ g_free (equip_uri);
g_free (model);
g_free (manuf);
}
@@ -748,7 +756,7 @@ extractor_apply_audio_metadata (MetadataExtractor *extractor,
const gchar *album_uri,
const gchar *album_disc_uri)
{
- add_uint_gst_tag (metadata, "nmm:trackNumber", tag_list, GST_TAG_TRACK_NUMBER);
+ add_uint_gst_tag (metadata, "nmm:trackNumber", tag_list, GST_TAG_TRACK_NUMBER);
add_string_gst_tag (metadata, "nfo:codec", tag_list, GST_TAG_AUDIO_CODEC);
add_double_gst_tag (metadata, "nfo:gain", tag_list, GST_TAG_TRACK_GAIN);
add_double_gst_tag (metadata, "nfo:peakGain", tag_list, GST_TAG_TRACK_PEAK);
@@ -889,8 +897,6 @@ delete_existing_tracks (TrackerSparqlBuilder *postupdate,
g_free (sparql);
}
-
-
static void
extract_metadata (MetadataExtractor *extractor,
const gchar *file_url,
@@ -929,7 +935,6 @@ extract_metadata (MetadataExtractor *extractor,
if (extractor->mime == EXTRACT_MIME_GUESS && extractor->tagcache)
extractor_guess_content_type (extractor);
-
if (extractor->mime == EXTRACT_MIME_GUESS) {
g_warning ("Cannot guess real stream type if no tags were read! "
"Defaulting to Video.");
@@ -1021,7 +1026,7 @@ extract_metadata (MetadataExtractor *extractor,
tracker_sparql_builder_graph_open (postupdate, graph);
}
- for (node=extractor->toc->entry_list; node; node=node->next)
+ for (node = extractor->toc->entry_list; node; node = node->next)
extract_track_metadata (extractor,
node->data,
file_url,
@@ -1856,14 +1861,14 @@ tracker_extract_gstreamer (const gchar *uri,
#endif
if (extractor->tagcache) {
- gchar *cue_sheet = NULL;
+ gchar *cue_sheet;
- get_embedded_cue_sheet_data (extractor->tagcache, &cue_sheet);
+ cue_sheet = get_embedded_cue_sheet_data (extractor->tagcache);
if (cue_sheet) {
- extractor->toc = tracker_parse_cue_sheet (cue_sheet + strlen("cuesheet="));
- g_free (cue_sheet);
g_debug ("Using embedded CUE sheet.");
+ extractor->toc = tracker_parse_cue_sheet (cue_sheet);
+ g_free (cue_sheet);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]