forked from len0rd/rockbox
Make playlist catalog and playlist save screen handle .m3u/.m3u8 better. Also fix a possible null-pointer case in the playlist save screen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11654 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ec14b0f989
commit
dc956ce993
2 changed files with 16 additions and 10 deletions
|
|
@ -453,13 +453,17 @@ bool catalog_add_to_a_playlist(char* sel, int sel_attr, bool new_playlist)
|
||||||
|
|
||||||
if (new_playlist)
|
if (new_playlist)
|
||||||
{
|
{
|
||||||
|
size_t len;
|
||||||
snprintf(playlist, MAX_PATH, "%s/", playlist_dir);
|
snprintf(playlist, MAX_PATH, "%s/", playlist_dir);
|
||||||
if (kbd_input(playlist, MAX_PATH))
|
if (kbd_input(playlist, MAX_PATH))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(strlen(playlist) <= 4 ||
|
len = strlen(playlist);
|
||||||
strcasecmp(&playlist[strlen(playlist)-4], ".m3u"))
|
|
||||||
strcat(playlist, ".m3u");
|
if(len > 4 && !strcasecmp(&playlist[len-4], ".m3u"))
|
||||||
|
strcat(playlist, "8");
|
||||||
|
else if(len <= 5 || strcasecmp(&playlist[len-5], ".m3u8"))
|
||||||
|
strcat(playlist, ".m3u8");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -79,19 +79,21 @@ bool playlist_menu(void)
|
||||||
|
|
||||||
int save_playlist_screen(struct playlist_info* playlist)
|
int save_playlist_screen(struct playlist_info* playlist)
|
||||||
{
|
{
|
||||||
char* filename;
|
|
||||||
char temp[MAX_PATH+1];
|
char temp[MAX_PATH+1];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
filename = playlist_get_name(playlist, temp, sizeof(temp));
|
playlist_get_name(playlist, temp, sizeof(temp));
|
||||||
|
len = strlen(temp);
|
||||||
|
|
||||||
if (!filename || (len=strlen(filename)) <= 5 ||
|
if (len > 4 && !strcasecmp(&temp[len-4], ".m3u"))
|
||||||
strcasecmp(&filename[len-5], ".m3u8"))
|
strcat(temp, "8");
|
||||||
strcpy(filename, DEFAULT_DYNAMIC_PLAYLIST_NAME);
|
|
||||||
|
|
||||||
if (!kbd_input(filename, sizeof(temp)))
|
if (len <= 5 || strcasecmp(&temp[len-5], ".m3u8"))
|
||||||
|
strcpy(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME);
|
||||||
|
|
||||||
|
if (!kbd_input(temp, sizeof(temp)))
|
||||||
{
|
{
|
||||||
playlist_save(playlist, filename);
|
playlist_save(playlist, temp);
|
||||||
|
|
||||||
/* reload in case playlist was saved to cwd */
|
/* reload in case playlist was saved to cwd */
|
||||||
reload_directory();
|
reload_directory();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue