2010-03-07 05:07:09 -05:00
|
|
|
|
|
|
|
#ifndef __ARTWORK_H__
|
|
|
|
#define __ARTWORK_H__
|
|
|
|
|
2011-03-30 12:27:23 -04:00
|
|
|
#define ART_FMT_PNG 1
|
|
|
|
#define ART_FMT_JPEG 2
|
|
|
|
|
2018-11-28 14:28:38 -05:00
|
|
|
#define ART_DEFAULT_HEIGHT 600
|
|
|
|
#define ART_DEFAULT_WIDTH 600
|
|
|
|
|
2015-10-19 15:15:29 -04:00
|
|
|
#include <event2/buffer.h>
|
2020-05-15 17:14:14 -04:00
|
|
|
#include <stdbool.h>
|
2011-03-30 12:27:23 -04:00
|
|
|
|
2015-12-28 18:26:52 -05:00
|
|
|
/*
|
|
|
|
* Get the artwork image for an individual item (track)
|
|
|
|
*
|
|
|
|
* @out evbuf Event buffer that will contain the (scaled) image
|
|
|
|
* @in id The mfi item id
|
|
|
|
* @in max_w Requested maximum image width (may not be obeyed)
|
|
|
|
* @in max_h Requested maximum image height (may not be obeyed)
|
|
|
|
* @return ART_FMT_* on success, -1 on error or no artwork found
|
|
|
|
*/
|
2010-03-07 05:07:09 -05:00
|
|
|
int
|
2015-04-09 15:23:20 -04:00
|
|
|
artwork_get_item(struct evbuffer *evbuf, int id, int max_w, int max_h);
|
2010-03-07 05:07:09 -05:00
|
|
|
|
2015-12-28 18:26:52 -05:00
|
|
|
/*
|
|
|
|
* Get the artwork image for a group (an album or an artist)
|
|
|
|
*
|
|
|
|
* @out evbuf Event buffer that will contain the (scaled) image
|
|
|
|
* @in id The group id (not the persistentid)
|
|
|
|
* @in max_w Requested maximum image width (may not be obeyed)
|
|
|
|
* @in max_h Requested maximum image height (may not be obeyed)
|
|
|
|
* @return ART_FMT_* on success, -1 on error or no artwork found
|
|
|
|
*/
|
2010-03-07 05:07:09 -05:00
|
|
|
int
|
2015-04-09 15:23:20 -04:00
|
|
|
artwork_get_group(struct evbuffer *evbuf, int id, int max_w, int max_h);
|
2014-11-10 16:53:08 -05:00
|
|
|
|
2015-12-28 18:26:52 -05:00
|
|
|
/*
|
|
|
|
* Checks if the file is an artwork file (based on user config)
|
|
|
|
*
|
|
|
|
* @in filename Name of the file
|
2020-05-15 17:14:14 -04:00
|
|
|
* @return true/false
|
2015-12-28 18:26:52 -05:00
|
|
|
*/
|
2020-05-15 17:14:14 -04:00
|
|
|
bool
|
2014-11-10 16:53:08 -05:00
|
|
|
artwork_file_is_artwork(const char *filename);
|
2010-03-07 05:07:09 -05:00
|
|
|
|
2020-05-15 17:14:14 -04:00
|
|
|
/*
|
|
|
|
* Checks if the path (or URL) has file extension that is recognized as a
|
|
|
|
* supported file type (e.g. ".jpg"). Also supports URL-encoded paths, e.g.
|
|
|
|
* http://foo.com/bar.jpg?something
|
|
|
|
*
|
|
|
|
* @in path Path to the file (can also be a URL)
|
|
|
|
* @return true/false
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
artwork_extension_is_artwork(const char *path);
|
|
|
|
|
2010-03-07 05:07:09 -05:00
|
|
|
#endif /* !__ARTWORK_H__ */
|