Mercurial > audlegacy
changeset 1475:285215fd3123 trunk
[svn] - better support cuesheets outside of your directory
author | nenolod |
---|---|
date | Wed, 02 Aug 2006 22:57:08 -0700 |
parents | 6d690e50811f |
children | 5dbe7cfdcaf5 |
files | ChangeLog Plugins/Input/cue/cuesheet.c |
diffstat | 2 files changed, 20 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Aug 02 22:41:00 2006 -0700 +++ b/ChangeLog Wed Aug 02 22:57:08 2006 -0700 @@ -1,3 +1,12 @@ +2006-08-03 05:41:00 +0000 William Pitcock <nenolod@nenolod.net> + revision [1862] + - remove dependency on the client library. + + + Changes: Modified: + +0 -3 trunk/Plugins/Input/cue/cuesheet.c + + 2006-08-03 05:36:48 +0000 William Pitcock <nenolod@nenolod.net> revision [1860] - make sure our tuples we generate our pure.
--- a/Plugins/Input/cue/cuesheet.c Wed Aug 02 22:41:00 2006 -0700 +++ b/Plugins/Input/cue/cuesheet.c Wed Aug 02 22:57:08 2006 -0700 @@ -26,7 +26,7 @@ #define MAX_CUE_TRACKS 1000 static void init(void); -static void cache_cue_file(FILE *file); +static void cache_cue_file(gchar *f); static void free_cue_info(void); static void fix_cue_argument(char *line); static gboolean is_our_file(gchar *filespec); @@ -99,11 +99,10 @@ if (!strncasecmp(ext, ".cue", 4)) { gint i; - FILE *f = fopen(filename, "rb"); ret = TRUE; /* add the files, build cue urls, etc. */ - cache_cue_file(f); + cache_cue_file(filename); for (i = 1; i < last_cue_track; i++) { @@ -113,7 +112,6 @@ playlist_add_url(_buf); } - fclose(f); free_cue_info(); } @@ -160,7 +158,6 @@ gchar *path2 = g_strdup(uri + 6); gchar *_path = strchr(path2, '?'); gint track = 0; - FILE *f; InputPlugin *dec; TitleInput *phys_tuple, *out; @@ -171,9 +168,7 @@ track = atoi(_path); } - f = fopen(path2, "rb"); - cache_cue_file(f); - fclose(f); + cache_cue_file(path2); dec = input_check_file(cue_file, FALSE); @@ -239,7 +234,6 @@ gchar *path2 = g_strdup(uri + 6); gchar *_path = strchr(path2, '?'); gint track = 0; - FILE *f; if (_path != NULL && *_path == '?') { @@ -248,9 +242,7 @@ track = atoi(_path); } - f = fopen(path2, "rb"); - cache_cue_file(f); - fclose(f); + cache_cue_file(path2); real_ip = input_check_file(cue_file, FALSE); @@ -287,8 +279,9 @@ } } -static void cache_cue_file(FILE *file) +static void cache_cue_file(char *f) { + FILE *file = fopen(f, "rb"); gchar line[MAX_CUE_LINE_LENGTH+1]; while (TRUE) { @@ -322,8 +315,10 @@ } } else if (strcasecmp(line+p, "FILE") == 0) { + gchar *tmp = g_path_get_dirname(f); fix_cue_argument(line+q); - cue_file = g_strdup(line+q); /* XXX: yaz might need to UTF validate this?? -nenolod */ + cue_file = g_strdup_printf("%s/%s", tmp, line+q); /* XXX: yaz might need to UTF validate this?? -nenolod */ + g_free(tmp); } else if (strcasecmp(line+p, "TITLE") == 0) { fix_cue_argument(line+q); @@ -370,6 +365,8 @@ } } } + + fclose(file); } static void fix_cue_argument(char *line)