GNOME Bugzilla – Bug 612145
iPod Plugin: /* FIXME: should create a unique filename */
Last modified: 2010-03-19 22:54:42 UTC
rhythmbox-0.12.7/plugins/ipod/rb-ipod-source.c in the function: generate_ipod_filename There is a comment: "/* FIXME: should create a unique filename */" So I can't download a lot of same named files. For example: CD 1: "Track 1" CD 2: "Track 1" Two files are named "Track 1" If they are changed to the following code, this problem will be solved. (generate_ipod_filename, ipod_get_filename_for_uri) ==== static gchar * generate_ipod_filename (const gchar *mount_point, const gchar *extension) { gchar *ipod_filename = NULL; gchar *rand_filename; gchar *random_str; gint tries = 0; gint i; FILE *fp; /* Make a random file name */ random_str = g_malloc (sizeof (gchar) * 9); for (;;) { random_str[8] = 0; for (i = 7; i >= 0; i--) random_str[i] = 'A' + g_random_int_range (0, 26); rand_filename = g_strdup_printf ("%s.%s", random_str, extension); /* Now we have a random filename, try to find out where to put * it on the iPod */ do { g_free (ipod_filename); ipod_filename = get_ipod_filename (mount_point, rand_filename); tries++; if (tries > MAX_TRIES) { g_free(rand_filename); g_free(random_str); return NULL; } } while ((ipod_filename == NULL) || (g_file_test (ipod_filename, G_FILE_TEST_EXISTS))); /* If ipod_filename already exist, re-create a random filename. */ fp = fopen(ipod_filename, "rb"); if(fp == NULL) break; fclose(fp); } g_free(rand_filename); g_free(random_str); return ipod_filename; } static gchar * ipod_get_filename_for_uri (const gchar *mount_point, const gchar *uri_str, const gchar *mimetype, const gchar *extension) { gchar *result; /* FIXME: we really need a mapping (audio/mpeg->mp3) and not * just rely on the user's audio profile havign the "right" one */ result = generate_ipod_filename (mount_point, extension); return result; } /* End of generation of the filename on the iPod */
You already reported this bug. *** This bug has been marked as a duplicate of bug 609609 ***
This one has what can be seen as a patch
*** Bug 609609 has been marked as a duplicate of this bug. ***
bug #442137 is about using random filenames as you suggest for the iPod. Bug #570600 is about remaining duplicate filename issues in Rhythmbox, so I'll close this bug as a duplicate. I added a link to your suggested code in bug #442137 *** This bug has been marked as a duplicate of bug 570600 ***