Commit f17e985a authored by Clément Stenac's avatar Clément Stenac

Skeleton for taglib art downloader and tags writer

parent 937b6249
......@@ -431,6 +431,7 @@ typedef struct vlm_schedule_t vlm_schedule_t;
/* divers */
typedef struct vlc_meta_t vlc_meta_t;
typedef struct meta_export_t meta_export_t;
/* Stats */
typedef struct counter_t counter_t;
......
......@@ -185,4 +185,10 @@ enum {
ALBUM_ART_WHEN_PLAYED,
ALBUM_ART_ALL };
struct meta_export_t
{
input_item_t *p_item;
const char *psz_file;
};
#endif
......@@ -30,11 +30,19 @@
#include <mpegfile.h>
#include <flacfile.h>
static int ReadMeta ( vlc_object_t * );
static int ReadMeta ( vlc_object_t * );
static int DownloadArt ( vlc_object_t * );
static int WriteMeta ( vlc_object_t * );
vlc_module_begin();
set_capability( "meta reader", 1000 );
set_callbacks( ReadMeta, NULL );
add_submodule();
set_capability( "art downloader", 50 );
set_callbacks( DownloadArt, NULL );
add_submodule();
set_capability( "meta writer", 50 );
set_callbacks( WriteMeta, NULL );
vlc_module_end();
static bool checkID3Image( const TagLib::ID3v2::Tag *tag )
......@@ -101,3 +109,29 @@ static int ReadMeta( vlc_object_t *p_this )
}
return VLC_EGENERIC;
}
static int WriteMeta( vlc_object_t *p_this )
{
playlist_t *p_playlist = (playlist_t *)p_this;
meta_export_t *p_export = (meta_export_t *)p_playlist->p_private;
input_item_t *p_item = p_export->p_item;
TagLib::FileRef f( p_export->psz_file );
if( !f.isNull() && f.tag() )
{
TagLib::Tag *tag = f.tag();
tag->setArtist( p_item->p_meta->psz_artist );
f.save();
return VLC_SUCCESS;
}
return VLC_EGENERIC;
}
static int DownloadArt( vlc_object_t *p_this )
{
/* We need to be passed the file name
* Fetch the thing from the file, save it to the cache folder
*/
return VLC_EGENERIC;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment