forked from len0rd/rockbox
Fix Red playlist update a few functions
Change-Id: I0d9b4c8f7e4b128dd7378c6b7515f8195534fce7
This commit is contained in:
parent
98c7505c60
commit
f033fd390e
2 changed files with 26 additions and 19 deletions
|
@ -203,10 +203,10 @@ static void copy_filerefs(struct dircache_fileref *dcfto,
|
||||||
/* Check if the filename suggests M3U or M3U8 format. */
|
/* Check if the filename suggests M3U or M3U8 format. */
|
||||||
static bool is_m3u8(const char* filename)
|
static bool is_m3u8(const char* filename)
|
||||||
{
|
{
|
||||||
int len = strlen(filename);
|
char *dot = strrchr(filename, '.');
|
||||||
|
|
||||||
/* Default to M3U8 unless explicitly told otherwise. */
|
/* Default to M3U8 unless explicitly told otherwise. */
|
||||||
return !(len > 4 && strcasecmp(&filename[len - 4], ".m3u") == 0);
|
return (!dot || strcasecmp(dot, ".m3u") != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -468,20 +468,21 @@ static void update_playlist_filename(struct playlist_info* playlist,
|
||||||
*/
|
*/
|
||||||
static void empty_playlist(struct playlist_info* playlist, bool resume)
|
static void empty_playlist(struct playlist_info* playlist, bool resume)
|
||||||
{
|
{
|
||||||
playlist->filename[0] = '\0';
|
|
||||||
playlist->utf8 = true;
|
playlist->utf8 = true;
|
||||||
|
playlist->control_created = false;
|
||||||
|
playlist->in_ram = false;
|
||||||
|
|
||||||
if(playlist->fd >= 0)
|
if(playlist->fd >= 0) /* If there is an already open playlist, close it. */
|
||||||
/* If there is an already open playlist, close it. */
|
{
|
||||||
close(playlist->fd);
|
close(playlist->fd);
|
||||||
|
}
|
||||||
playlist->fd = -1;
|
playlist->fd = -1;
|
||||||
|
|
||||||
if(playlist->control_fd >= 0)
|
if(playlist->control_fd >= 0)
|
||||||
close(playlist->control_fd);
|
close(playlist->control_fd);
|
||||||
playlist->control_fd = -1;
|
playlist->control_fd = -1;
|
||||||
playlist->control_created = false;
|
|
||||||
|
|
||||||
playlist->in_ram = false;
|
playlist->num_inserted_tracks = 0;
|
||||||
|
|
||||||
if (playlist->buffer)
|
if (playlist->buffer)
|
||||||
playlist->buffer[0] = 0;
|
playlist->buffer[0] = 0;
|
||||||
|
@ -492,14 +493,16 @@ static void empty_playlist(struct playlist_info* playlist, bool resume)
|
||||||
playlist->first_index = 0;
|
playlist->first_index = 0;
|
||||||
playlist->amount = 0;
|
playlist->amount = 0;
|
||||||
playlist->last_insert_pos = -1;
|
playlist->last_insert_pos = -1;
|
||||||
playlist->seed = 0;
|
|
||||||
playlist->shuffle_modified = false;
|
|
||||||
playlist->deleted = false;
|
|
||||||
playlist->num_inserted_tracks = 0;
|
|
||||||
playlist->started = false;
|
|
||||||
|
|
||||||
playlist->num_cached = 0;
|
playlist->deleted = false;
|
||||||
|
playlist->started = false;
|
||||||
playlist->pending_control_sync = false;
|
playlist->pending_control_sync = false;
|
||||||
|
playlist->shuffle_modified = false;
|
||||||
|
|
||||||
|
playlist->seed = 0;
|
||||||
|
playlist->num_cached = 0;
|
||||||
|
|
||||||
|
playlist->filename[0] = '\0';
|
||||||
|
|
||||||
if (!resume && playlist->current)
|
if (!resume && playlist->current)
|
||||||
{
|
{
|
||||||
|
@ -656,19 +659,23 @@ static void display_playlist_count(int count, const unsigned char *fmt,
|
||||||
{
|
{
|
||||||
static long talked_tick = 0;
|
static long talked_tick = 0;
|
||||||
long id = P2ID(fmt);
|
long id = P2ID(fmt);
|
||||||
if(global_settings.talk_menu && id>=0)
|
|
||||||
|
if(id >= 0 && global_settings.talk_menu)
|
||||||
{
|
{
|
||||||
if(final || (count && (talked_tick == 0
|
long next_tick = talked_tick + (HZ * 5);
|
||||||
|| TIME_AFTER(current_tick, talked_tick+5*HZ))))
|
|
||||||
|
if (final || talked_tick == 0)
|
||||||
|
next_tick = current_tick - 1;
|
||||||
|
|
||||||
|
if(count && TIME_AFTER(current_tick, next_tick))
|
||||||
{
|
{
|
||||||
talked_tick = current_tick;
|
talked_tick = current_tick;
|
||||||
talk_number(count, false);
|
talk_number(count, false);
|
||||||
talk_id(id, true);
|
talk_id(id, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt = P2STR(fmt);
|
|
||||||
|
|
||||||
splashf(0, fmt, count, str(LANG_OFF_ABORT));
|
splashf(0, P2STR(fmt), count, str(LANG_OFF_ABORT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ struct playlist_info
|
||||||
to disk */
|
to disk */
|
||||||
struct playlist_control_cache control_cache[PLAYLIST_MAX_CACHE];
|
struct playlist_control_cache control_cache[PLAYLIST_MAX_CACHE];
|
||||||
int num_cached; /* number of cached entries */
|
int num_cached; /* number of cached entries */
|
||||||
struct mutex mutex; /* mutex for control file access */
|
struct mutex *control_mutex; /* mutex for control file access */
|
||||||
#ifdef HAVE_DIRCACHE
|
#ifdef HAVE_DIRCACHE
|
||||||
struct dircache_fileref *dcfrefs; /* Dircache entry shortcuts */
|
struct dircache_fileref *dcfrefs; /* Dircache entry shortcuts */
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue