diff options
-rw-r--r-- | deadbeef.h | 1 | ||||
-rw-r--r-- | junklib.c | 30 | ||||
-rw-r--r-- | junklib.h | 3 | ||||
-rw-r--r-- | plugins.c | 1 |
4 files changed, 35 insertions, 0 deletions
@@ -346,6 +346,7 @@ typedef struct { int (*junk_read_id3v2) (DB_playItem_t *it, DB_FILE *fp); int (*junk_read_ape) (DB_playItem_t *it, DB_FILE *fp); int (*junk_get_leading_size) (DB_FILE *fp); + void (*junk_copy) (DB_playItem_t *from, DB_playItem_t *first, DB_playItem_t *last); // vfs DB_FILE* (*fopen) (const char *fname); void (*fclose) (DB_FILE *f); @@ -1284,3 +1284,33 @@ junk_recode (const char *in, int inlen, char *out, int outlen, const char *cs) { iconv_close (cd); } } + +void +junk_copy (playItem_t *from, playItem_t *first, playItem_t *last) { + const char *year = pl_find_meta (from, "year"); + const char *genre = pl_find_meta (from, "genre"); + const char *copyright = pl_find_meta (from, "copyright"); + const char *vendor = pl_find_meta (from, "vendor"); + const char *comment = pl_find_meta (from, "comment"); + playItem_t *i; + for (i = first; i; i = i->next[PL_MAIN]) { + if (year) { + pl_add_meta (i, "year", year); + } + if (genre) { + pl_add_meta (i, "genre", genre); + } + if (copyright) { + pl_add_meta (i, "copyright", copyright); + } + if (vendor) { + pl_add_meta (i, "vendor", vendor); + } + if (comment) { + pl_add_meta (i, "comment", comment); + } + if (i == last) { + break; + } + } +} @@ -40,4 +40,7 @@ junk_detect_charset (const char *s); void junk_recode (const char *in, int inlen, char *out, int outlen, const char *cs); +void +junk_copy (struct playItem_s *from, struct playItem_s *first, struct playItem_s *last); + #endif // __JUNKLIB_H @@ -146,6 +146,7 @@ static DB_functions_t deadbeef_api = { .junk_read_id3v2 = (int (*)(DB_playItem_t *it, DB_FILE *fp))junk_read_id3v2, .junk_read_ape = (int (*)(DB_playItem_t *it, DB_FILE *fp))junk_read_ape, .junk_get_leading_size = junk_get_leading_size, + .junk_copy = (void (*)(DB_playItem_t *from, DB_playItem_t *first, DB_playItem_t *last))junk_copy, // vfs .fopen = vfs_fopen, .fclose = vfs_fclose, |