summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-06-17 20:54:11 +0200
committerGravatar waker <wakeroid@gmail.com>2011-06-17 20:54:11 +0200
commit081386fa03e82ca64aa14a5bd5e8bd3ba8b2ba9a (patch)
tree5d7f7ee7bf27794fc4a8f0a55c20eb81e382bb25 /playlist.c
parent274ad5ecdbc4c6a638f9f5be710b2a73db452bb3 (diff)
medialib scanner prototype: scan folder, build index, etc
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/playlist.c b/playlist.c
index 9aee5540..bd2d1d2e 100644
--- a/playlist.c
+++ b/playlist.c
@@ -327,6 +327,15 @@ plt_get_sel_count (int plt) {
return 0;
}
+playlist_t *
+plt_alloc (const char *title) {
+ playlist_t *plt = malloc (sizeof (playlist_t));
+ memset (plt, 0, sizeof (playlist_t));
+ plt->refc = 1;
+ plt->title = strdup (title);
+ return plt;
+}
+
int
plt_add (int before, const char *title) {
assert (before >= 0);
@@ -335,10 +344,7 @@ plt_add (int before, const char *title) {
fprintf (stderr, "can't create more than 100 playlists. sorry.\n");
return -1;
}
- playlist_t *plt = malloc (sizeof (playlist_t));
- memset (plt, 0, sizeof (playlist_t));
- plt->refc = 1;
- plt->title = strdup (title);
+ playlist_t *plt = plt_alloc (title);
plt_modified (plt);
LOCK;
@@ -398,7 +404,7 @@ plt_add (int before, const char *title) {
conf_save ();
messagepump_push (DB_EV_PLAYLISTSWITCHED, 0, 0, 0);
}
- return playlists_count-1;
+ return before;
}
// NOTE: caller must ensure that configuration is saved after that call
@@ -980,7 +986,7 @@ plt_process_cue_track (playlist_t *playlist, playItem_t *after, const char *fnam
pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKPEAK, atof (replaygain_track_peak));
}
it->_flags |= DDB_IS_SUBTRACK | DDB_TAG_CUESHEET;
- after = pl_insert_item (after, it);
+ after = plt_insert_item (playlist, after, it);
pl_item_unref (it);
*prev = it;
return it;
@@ -3897,3 +3903,13 @@ plt_init_shuffle_albums (playlist_t *plt, int r) {
}
pl_unlock ();
}
+
+void
+plt_set_fast_mode (playlist_t *plt, int fast) {
+ plt->fast_mode = (unsigned)fast;
+}
+
+int
+plt_is_fast_mode (playlist_t *plt) {
+ return plt->fast_mode;
+}