forked from len0rd/rockbox
playlist: Remove playlist_add()
It was only used in filetree.c. It's still implemented in Lua so scripts using rb.playlist_add() won't break, but has been removed from the Lua API "backend". Change-Id: I5625a47f0692456008c6b10dee14755151d22f29
This commit is contained in:
parent
129fb4016b
commit
9ba51e3552
8 changed files with 14 additions and 28 deletions
|
@ -74,6 +74,7 @@ int ft_build_playlist(struct tree_context* c, int start_index)
|
|||
int i;
|
||||
int res = 0;
|
||||
int start=start_index;
|
||||
struct playlist_info *playlist = playlist_get_current();
|
||||
|
||||
tree_lock_cache(c);
|
||||
struct entry *entries = tree_get_entries(c);
|
||||
|
@ -82,7 +83,8 @@ int ft_build_playlist(struct tree_context* c, int start_index)
|
|||
{
|
||||
if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO)
|
||||
{
|
||||
res = playlist_add(entries[i].name);
|
||||
res = playlist_insert_track(playlist, entries[i].name,
|
||||
PLAYLIST_INSERT_LAST, false, false);
|
||||
if (res < 0)
|
||||
break;
|
||||
}
|
||||
|
@ -127,10 +129,9 @@ bool ft_play_playlist(char* pathname, char* dirname,
|
|||
if (playlist_create(dirname, filename) != -1)
|
||||
{
|
||||
if (global_settings.playlist_shuffle)
|
||||
{
|
||||
playlist_shuffle(current_tick, -1);
|
||||
}
|
||||
|
||||
playlist_set_modified(NULL, false);
|
||||
playlist_start(0, 0, 0);
|
||||
return true;
|
||||
}
|
||||
|
@ -528,6 +529,7 @@ int ft_enter(struct tree_context* c)
|
|||
start_index = 0;
|
||||
}
|
||||
|
||||
playlist_set_modified(NULL, false);
|
||||
playlist_start(start_index, 0, 0);
|
||||
play = true;
|
||||
}
|
||||
|
|
|
@ -1207,6 +1207,8 @@ static int create_and_play_dir(int direction, bool play_last)
|
|||
if (global_settings.playlist_shuffle)
|
||||
playlist_shuffle(current_tick, -1);
|
||||
|
||||
playlist_set_modified(NULL, false);
|
||||
|
||||
if (play_last && direction <= 0)
|
||||
index = current_playlist.amount - 1;
|
||||
else
|
||||
|
@ -2024,21 +2026,6 @@ void playlist_shutdown(void)
|
|||
playlist_write_unlock(playlist);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add track to end of the playlist. Prefer playlist_insert_track(),
|
||||
* this is DEPRECATED and will be going away at some point.
|
||||
*/
|
||||
int playlist_add(const char *filename)
|
||||
{
|
||||
int ret = playlist_insert_track(NULL, filename, PLAYLIST_INSERT_LAST,
|
||||
false, true);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
playlist_set_modified(NULL, false);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* returns number of tracks in playlist (includes queued/inserted tracks) */
|
||||
int playlist_amount_ex(const struct playlist_info* playlist)
|
||||
{
|
||||
|
|
|
@ -103,7 +103,6 @@ void playlist_init(void) INIT_ATTR;
|
|||
void playlist_shutdown(void);
|
||||
int playlist_create(const char *dir, const char *file);
|
||||
int playlist_resume(void);
|
||||
int playlist_add(const char *filename);
|
||||
int playlist_shuffle(int random_seed, int start_index);
|
||||
unsigned int playlist_get_filename_crc32(struct playlist_info *playlist,
|
||||
int index);
|
||||
|
|
|
@ -692,7 +692,6 @@ static const struct plugin_api rockbox_api = {
|
|||
playlist_resume_track,
|
||||
playlist_set_modified,
|
||||
playlist_start,
|
||||
playlist_add,
|
||||
playlist_sync,
|
||||
playlist_remove_all_tracks,
|
||||
playlist_create,
|
||||
|
|
|
@ -797,7 +797,6 @@ struct plugin_api {
|
|||
void (*playlist_set_modified)(struct playlist_info *playlist, bool modified);
|
||||
void (*playlist_start)(int start_index, unsigned long elapsed,
|
||||
unsigned long offset);
|
||||
int (*playlist_add)(const char *filename);
|
||||
void (*playlist_sync)(struct playlist_info* playlist);
|
||||
int (*playlist_remove_all_tracks)(struct playlist_info *playlist);
|
||||
int (*playlist_create)(const char *dir, const char *file);
|
||||
|
|
|
@ -28,7 +28,7 @@ rb.playlist_amount = function()
|
|||
return rb.playlist("amount")
|
||||
end
|
||||
rb.playlist_add = function (filename)
|
||||
return rb.playlist("add", filename)
|
||||
return rb.playlist("insert_track", filename, rb.PLAYLIST_INSERT_LAST, false, true)
|
||||
end
|
||||
rb.playlist_create = function(dir, filename)
|
||||
return rb.playlist("create", dir, filename)
|
||||
|
|
|
@ -317,13 +317,13 @@ RB_WRAP(splash_scroller)
|
|||
RB_WRAP(playlist)
|
||||
{
|
||||
/* just passes NULL to work with the current playlist */
|
||||
enum e_playlist {PLAYL_AMOUNT = 0, PLAYL_ADD, PLAYL_CREATE,
|
||||
enum e_playlist {PLAYL_AMOUNT = 0, PLAYL_CREATE,
|
||||
PLAYL_START, PLAYL_RESUMETRACK, PLAYL_RESUME,
|
||||
PLAYL_SHUFFLE, PLAYL_SYNC, PLAYL_REMOVEALLTRACKS,
|
||||
PLAYL_INSERTTRACK, PLAYL_INSERTDIRECTORY, PLAYL_INSERTPLAYL,
|
||||
PLAYL_ECOUNT};
|
||||
|
||||
const char *playlist_option[] = {"amount", "add", "create", "start", "resume_track",
|
||||
const char *playlist_option[] = {"amount", "create", "start", "resume_track",
|
||||
"resume", "shuffle", "sync", "remove_all_tracks",
|
||||
"insert_track", "insert_directory", "insert_playlist", NULL};
|
||||
|
||||
|
@ -339,10 +339,6 @@ RB_WRAP(playlist)
|
|||
case PLAYL_AMOUNT:
|
||||
result = rb->playlist_amount();
|
||||
break;
|
||||
case PLAYL_ADD:
|
||||
filename = luaL_checkstring(L, 2);
|
||||
result = rb->playlist_add(filename);
|
||||
break;
|
||||
case PLAYL_CREATE:
|
||||
dir = luaL_checkstring(L, 2);
|
||||
filename = luaL_checkstring(L, 3);
|
||||
|
|
|
@ -1105,6 +1105,8 @@ bool bookmark_play(char *resume_file, int index, unsigned long elapsed,
|
|||
{
|
||||
if (global_settings.playlist_shuffle)
|
||||
playlist_shuffle(seed, -1);
|
||||
|
||||
playlist_set_modified(NULL, false);
|
||||
playlist_start(index, elapsed, offset);
|
||||
started = true;
|
||||
}
|
||||
|
@ -1156,6 +1158,8 @@ bool bookmark_play(char *resume_file, int index, unsigned long elapsed,
|
|||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
playlist_set_modified(NULL, false);
|
||||
playlist_start(index, elapsed, offset);
|
||||
started = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue