External cue sheet file for "file.flac" should be named as "file.flac.cue".

---
 src/decoder/flac_plugin.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index 965a8b4..41e0f3a 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -300,6 +300,8 @@ flac_cue_tag_load(const char *file)
        FLAC__uint64 track_time = 0;
 #ifdef HAVE_CUE /* libcue */
        FLAC__StreamMetadata* vc = 
FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
+        char* cs_filename;
+        FILE* cs_file;
 #endif /* libcue */
        FLAC__StreamMetadata* si = 
FLAC__metadata_object_new(FLAC__METADATA_TYPE_STREAMINFO);
        FLAC__StreamMetadata* cs = 
FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET);
@@ -328,6 +330,23 @@ flac_cue_tag_load(const char *file)
                }
                FLAC__metadata_object_delete(vc);
        }
+
+        if (tag == NULL)
+        {
+            cs_filename = g_strconcat(file, ".cue", NULL);
+
+            if (cs_filename != NULL)
+            {
+                cs_file = fopen(cs_filename, "rt");
+                g_free(cs_filename);
+
+                if (cs_file != NULL)
+                {
+                    tag = cue_tag_file(cs_file, tnum);
+                    fclose(cs_file);
+                }
+            }
+        }
 #endif /* libcue */
 
        if (tag == NULL)
-- 
1.6.3.2


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to