summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-06-12 22:08:19 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-06-12 22:09:00 +0200
commita46e39c5bc58d77a376652fe7f85f9c5b3b8e67b (patch)
treeda93ae83f697e02856c4ede4441f9c1ce0ebc25b
parent9dc48204208b22b998c981da4840951db6daf731 (diff)
pl_save_all won't save unmodified playlists
-rw-r--r--playlist.c5
-rw-r--r--playlist.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/playlist.c b/playlist.c
index ff9e8435..7a3bf5a0 100644
--- a/playlist.c
+++ b/playlist.c
@@ -1921,6 +1921,7 @@ pl_crop_selected (void) {
int
plt_save (playlist_t *plt, playItem_t *first, playItem_t *last, const char *fname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) {
LOCK;
+ plt->last_save_modification_idx = plt->last_save_modification_idx;
const char *ext = strrchr (fname, '.');
if (ext) {
DB_playlist_t **plug = deadbeef->plug_get_playlist_list ();
@@ -2187,6 +2188,9 @@ pl_save_all (void) {
err = -1;
break;
}
+ if (p->last_save_modification_idx == p->modification_idx) {
+ continue;
+ }
err = plt_save (p, NULL, NULL, path, NULL, NULL, NULL);
if (err < 0) {
break;
@@ -2542,6 +2546,7 @@ pl_load_all (void) {
plt->current_row[PL_MAIN] = deadbeef->conf_get_int (conf, -1);
snprintf (conf, sizeof (conf), "playlist.scroll.%d", i);
plt->scroll = deadbeef->conf_get_int (conf, 0);
+ plt->last_save_modification_idx = plt->modification_idx = 0;
plt_unref (plt);
if (!it) {
diff --git a/playlist.h b/playlist.h
index 9328dcca..44149aba 100644
--- a/playlist.h
+++ b/playlist.h
@@ -62,6 +62,7 @@ typedef struct playlist_s {
int count[2];
float totaltime;
int modification_idx;
+ int last_save_modification_idx;
playItem_t *head[PL_MAX_ITERATORS]; // head of linked list
playItem_t *tail[PL_MAX_ITERATORS]; // tail of linked list
int current_row[PL_MAX_ITERATORS]; // current row (cursor)