]> git.sesse.net Git - vlc/blob - modules/meta_engine/taglib.cpp
taglib: Fix #2466 and fix also for writting tag on win.
[vlc] / modules / meta_engine / taglib.cpp
1 /*****************************************************************************
2  * taglib.cpp: Taglib tag parser/writer
3  *****************************************************************************
4  * Copyright (C) 2003-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *          Rafaël Carré <funman@videolanorg>
9  *          Rémi Duraffort <ivoire@videolan.org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include <vlc_common.h>
31 #include <vlc_plugin.h>
32 #include <vlc_playlist.h>
33 #include <vlc_meta.h>
34 #include <vlc_demux.h>
35 #include <vlc_strings.h>
36 #include <vlc_charset.h>
37
38 #ifdef WIN32
39 # include <io.h>
40 #else
41 # include <unistd.h>
42 #endif
43
44
45 // Taglib headers
46 #include <fileref.h>
47 #include <tag.h>
48 #include <tbytevector.h>
49
50 #include <apetag.h>
51 #include <id3v2tag.h>
52 #include <xiphcomment.h>
53
54 #include <flacfile.h>
55 #include <mpcfile.h>
56 #include <mpegfile.h>
57 #include <oggfile.h>
58 #include <oggflacfile.h>
59 #include <speexfile.h>
60 #include <trueaudiofile.h>
61 #include <vorbisfile.h>
62 #include <wavpackfile.h>
63
64 #include <attachedpictureframe.h>
65 #include <textidentificationframe.h>
66 #include <uniquefileidentifierframe.h>
67
68
69 // Local functions
70 static int ReadMeta    ( vlc_object_t * );
71 static int DownloadArt ( vlc_object_t * );
72 static int WriteMeta   ( vlc_object_t * );
73
74 vlc_module_begin ()
75     set_capability( "meta reader", 1000 )
76     set_callbacks( ReadMeta, NULL )
77     add_submodule ()
78         set_capability( "art downloader", 50 )
79         set_callbacks( DownloadArt, NULL )
80     add_submodule ()
81         set_capability( "meta writer", 50 )
82         set_callbacks( WriteMeta, NULL )
83 vlc_module_end ()
84
85 using namespace TagLib;
86
87
88 /**
89  * Read meta informations from APE tags
90  * @param tag: the APE tag
91  * @param p_demux; the demux object
92  * @param p_demux_meta: the demuxer meta
93  * @param p_meta: the meta
94  */
95 static void ReadMetaFromAPE( APE::Tag* tag, demux_t* p_demux, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
96 {
97     APE::Item item;
98 #define SET( keyName, metaName ) \
99     item = tag->itemListMap()[keyName]; \
100     vlc_meta_Set##metaName( p_meta, item.toString().toCString( true ) );\
101
102     SET( "COPYRIGHT", Copyright );
103     SET( "LANGUAGE", Language );
104     SET( "PUBLISHER", Publisher );
105
106 #undef SET
107 }
108
109
110
111 /**
112  * Read meta information from id3v2 tags
113  * @param tag: the id3v2 tag
114  * @param p_demux; the demux object
115  * @param p_demux_meta: the demuxer meta
116  * @param p_meta: the meta
117  */
118 static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
119 {
120     // Get the unique file identifier
121     ID3v2::FrameList list = tag->frameListMap()["UFID"];
122     ID3v2::FrameList::Iterator iter;
123     for( iter = list.begin(); iter != list.end(); iter++ )
124     {
125         ID3v2::UniqueFileIdentifierFrame* p_ufid =
126                 dynamic_cast<ID3v2::UniqueFileIdentifierFrame*>(*iter);
127         const char *owner = p_ufid->owner().toCString();
128         if (!strcmp( owner, "http://musicbrainz.org" ))
129         {
130             /* ID3v2 UFID contains up to 64 bytes binary data
131              * but in our case it will be a '\0'
132              * terminated string */
133             char psz_ufid[64];
134             int max_size = __MIN( p_ufid->identifier().size(), 63);
135             strncpy( psz_ufid, p_ufid->identifier().data(), max_size );
136             psz_ufid[max_size] = '\0';
137             vlc_meta_SetTrackID( p_meta, psz_ufid );
138         }
139     }
140
141     // Get the use text
142     list = tag->frameListMap()["TXXX"];
143     for( iter = list.begin(); iter != list.end(); iter++ )
144     {
145         ID3v2::UserTextIdentificationFrame* p_txxx =
146                 dynamic_cast<ID3v2::UserTextIdentificationFrame*>(*iter);
147         vlc_meta_AddExtra( p_meta, p_txxx->description().toCString( true ),
148                            p_txxx->fieldList().toString().toCString( true ) );
149     }
150
151     // Get some more informations
152 #define SET( tagName, metaName )                                               \
153     list = tag->frameListMap()[tagName];                                       \
154     if( !list.isEmpty() )                                                      \
155         vlc_meta_Set##metaName( p_meta,                                        \
156                                 (*list.begin())->toString().toCString( true ) );
157
158     SET( "TCOP", Copyright );
159     SET( "TENC", EncodedBy );
160     SET( "TLAN", Language );
161     SET( "TPUB", Publisher );
162
163 #undef SET
164
165     /* Preferred type of image
166      * The 21 types are defined in id3v2 standard:
167      * http://www.id3.org/id3v2.4.0-frames */
168     static const int pi_cover_score[] = {
169         0,  /* Other */
170         5,  /* 32x32 PNG image that should be used as the file icon */
171         4,  /* File icon of a different size or format. */
172         20, /* Front cover image of the album. */
173         19, /* Back cover image of the album. */
174         13, /* Inside leaflet page of the album. */
175         18, /* Image from the album itself. */
176         17, /* Picture of the lead artist or soloist. */
177         16, /* Picture of the artist or performer. */
178         14, /* Picture of the conductor. */
179         15, /* Picture of the band or orchestra. */
180         9,  /* Picture of the composer. */
181         8,  /* Picture of the lyricist or text writer. */
182         7,  /* Picture of the recording location or studio. */
183         10, /* Picture of the artists during recording. */
184         11, /* Picture of the artists during performance. */
185         6,  /* Picture from a movie or video related to the track. */
186         1,  /* Picture of a large, coloured fish. */
187         12, /* Illustration related to the track. */
188         3,  /* Logo of the band or performer. */
189         2   /* Logo of the publisher (record company). */
190     };
191     int i_score = -1;
192
193     // Try now to get embedded art
194     list = tag->frameListMap()[ "APIC" ];
195     if( list.isEmpty() )
196         return;
197
198     TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
199     for( iter = list.begin(); iter != list.end(); iter++ )
200     {
201         ID3v2::AttachedPictureFrame* p_apic =
202             dynamic_cast<ID3v2::AttachedPictureFrame*>(*iter);
203         input_attachment_t *p_attachment;
204
205         const char *psz_mime;
206         char *psz_name, *psz_description;
207
208         // Get the mime and description of the image.
209         // If the description is empty, take the type as a description
210         psz_mime = p_apic->mimeType().toCString( true );
211         if( p_apic->description().size() > 0 )
212             psz_description = strdup( p_apic->description().toCString( true ) );
213         else
214         {
215             if( asprintf( &psz_description, "%i", p_apic->type() ) == -1 )
216                 psz_description = NULL;
217         }
218
219         if( !psz_description )
220             continue;
221         psz_name = psz_description;
222
223         /* some old iTunes version not only sets incorrectly the mime type
224          * or the description of the image,
225          * but also embeds incorrectly the image.
226          * Recent versions seem to behave correctly */
227         if( !strncmp( psz_mime, "PNG", 3 ) ||
228             !strncmp( psz_name, "\xC2\x89PNG", 5 ) )
229         {
230             msg_Warn( p_demux, "Invalid picture embedded by broken iTunes version" );
231             free( psz_description );
232             continue;
233         }
234
235         const ByteVector picture = p_apic->picture();
236         const char *p_data = picture.data();
237         const unsigned i_data = picture.size();
238
239         msg_Dbg( p_demux, "Found embedded art: %s (%s) is %u bytes",
240                  psz_name, psz_mime, i_data );
241
242         p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
243                                 psz_description, p_data, i_data );
244         if( p_attachment )
245             TAB_APPEND_CAST( (input_attachment_t**),
246                              p_demux_meta->i_attachments, p_demux_meta->attachments,
247                              p_attachment );
248         free( psz_description );
249
250         if( pi_cover_score[p_apic->type()] > i_score )
251         {
252             i_score = pi_cover_score[p_apic->type()];
253             char *psz_url;
254             if( asprintf( &psz_url, "attachment://%s",
255                           p_attachment->psz_name ) == -1 )
256                 continue;
257             vlc_meta_SetArtURL( p_meta, psz_url );
258             free( psz_url );
259         }
260     }
261 }
262
263
264
265 /**
266  * Read the meta informations from XiphComments
267  * @param tag: the Xiph Comment
268  * @param p_demux; the demux object
269  * @param p_demux_meta: the demuxer meta
270  * @param p_meta: the meta
271  */
272 static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_t* p_demux, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
273 {
274 #define SET( keyName, metaName )                                               \
275     StringList list = tag->fieldListMap()[keyName];                            \
276     if( !list.isEmpty() )                                                      \
277         vlc_meta_Set##metaName( p_meta, (*list.begin()).toCString( true ) );
278
279     SET( "COPYRIGHT", Copyright );
280 #undef SET
281
282     // Try now to get embedded art
283     StringList mime_list = tag->fieldListMap()[ "COVERARTMIME" ];
284     StringList art_list = tag->fieldListMap()[ "COVERART" ];
285
286     // We get only the first covert art
287     if( mime_list.size() > 1 || art_list.size() > 1 )
288         msg_Warn( p_demux, "Found %i embedded arts, so using only the first one",
289                   art_list.size() );
290     else if( mime_list.size() == 0 || art_list.size() == 0 )
291         return;
292
293     input_attachment_t *p_attachment;
294
295     const char* psz_name = "cover";
296     const char* psz_mime = mime_list[0].toCString(true);
297     const char* psz_description = "cover";
298
299     uint8_t *p_data;
300     int i_data = vlc_b64_decode_binary( &p_data, art_list[0].toCString(true) );
301
302     msg_Dbg( p_demux, "Found embedded art: %s (%s) is %i bytes",
303              psz_name, psz_mime, i_data );
304
305     TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
306               p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
307               psz_description, p_data, i_data );
308     free( p_data );
309
310     TAB_APPEND_CAST( (input_attachment_t**),
311                      p_demux_meta->i_attachments, p_demux_meta->attachments,
312                      p_attachment );
313
314     vlc_meta_SetArtURL( p_meta, "attachment://cover" );
315 }
316
317
318
319 /**
320  * Get the tags from the file using TagLib
321  * @param p_this: the demux object
322  * @return VLC_SUCCESS if the operation success
323  */
324 static int ReadMeta( vlc_object_t* p_this)
325 {
326     demux_t*        p_demux = (demux_t*)p_this;
327     demux_meta_t*   p_demux_meta = (demux_meta_t*)p_demux->p_private;
328     vlc_meta_t*     p_meta;
329     FileRef f;
330
331     p_demux_meta->p_meta = NULL;
332
333
334 #if defined(WIN32) || defined (UNDER_CE)
335     if(GetVersion() < 0x80000000)
336     {
337         wchar_t wpath[MAX_PATH + 1];
338         if( !MultiByteToWideChar( CP_UTF8, 0, p_demux->psz_path, -1, wpath, MAX_PATH) )
339             return VLC_EGENERIC;
340         wpath[MAX_PATH] = L'\0';
341         f = FileRef( wpath );
342     }
343     else
344         return VLC_EGENERIC;
345 #else
346     const char* local_name = ToLocale( p_demux->psz_path );
347     if( !local_name )
348         return VLC_EGENERIC;
349     f = FileRef( local_name );
350     LocaleFree( local_name );
351 #endif
352
353     if( f.isNull() )
354         return VLC_EGENERIC;
355     if( !f.tag() || f.tag()->isEmpty() )
356         return VLC_EGENERIC;
357
358     p_demux_meta->p_meta = p_meta = vlc_meta_New();
359     if( !p_meta )
360         return VLC_ENOMEM;
361
362
363     // Read the tags from the file
364     Tag* p_tag = f.tag();
365
366 #define SET( tag, meta )                                                       \
367     if( !p_tag->tag().isNull() && !p_tag->tag().isEmpty() )                    \
368         vlc_meta_Set##meta( p_meta, p_tag->tag().toCString(true) )
369 #define SETINT( tag, meta )                                                    \
370     if( p_tag->tag() )                                                         \
371     {                                                                          \
372         char psz_tmp[10];                                                      \
373         snprintf( psz_tmp, 10, "%d", p_tag->tag() );                           \
374         vlc_meta_Set##meta( p_meta, psz_tmp );                                 \
375     }
376
377     SET( title, Title );
378     SET( artist, Artist );
379     SET( album, Album );
380     SET( comment, Description );
381     SET( genre, Genre );
382     SETINT( year, Date );
383     SETINT( track, TrackNum );
384
385 #undef SETINT
386 #undef SET
387
388
389     // Try now to read special tags
390     if( FLAC::File* flac = dynamic_cast<FLAC::File*>(f.file()) )
391     {
392         if( flac->ID3v2Tag() )
393             ReadMetaFromId3v2( flac->ID3v2Tag(), p_demux, p_demux_meta, p_meta );
394         else if( flac->xiphComment() )
395             ReadMetaFromXiph( flac->xiphComment(), p_demux, p_demux_meta, p_meta );
396     }
397     else if( MPC::File* mpc = dynamic_cast<MPC::File*>(f.file()) )
398     {
399         if( mpc->APETag() )
400             ReadMetaFromAPE( mpc->APETag(), p_demux, p_demux_meta, p_meta );
401     }
402     else if( MPEG::File* mpeg = dynamic_cast<MPEG::File*>(f.file()) )
403     {
404         if( mpeg->ID3v2Tag() )
405             ReadMetaFromId3v2( mpeg->ID3v2Tag(), p_demux, p_demux_meta, p_meta );
406         else if( mpeg->APETag() )
407             ReadMetaFromAPE( mpeg->APETag(), p_demux, p_demux_meta, p_meta );
408     }
409     else if( Ogg::File* ogg = dynamic_cast<Ogg::File*>(f.file()) )
410     {
411         if( Ogg::FLAC::File* ogg_flac = dynamic_cast<Ogg::FLAC::File*>(f.file()))
412             ReadMetaFromXiph( ogg_flac->tag(), p_demux, p_demux_meta, p_meta );
413         else if( Ogg::Speex::File* ogg_speex = dynamic_cast<Ogg::Speex::File*>(f.file()) )
414             ReadMetaFromXiph( ogg_speex->tag(), p_demux, p_demux_meta, p_meta );
415         else if( Ogg::Vorbis::File* ogg_vorbis = dynamic_cast<Ogg::Vorbis::File*>(f.file()) )
416             ReadMetaFromXiph( ogg_vorbis->tag(), p_demux, p_demux_meta, p_meta );
417     }
418     else if( TrueAudio::File* trueaudio = dynamic_cast<TrueAudio::File*>(f.file()) )
419     {
420         if( trueaudio->ID3v2Tag() )
421             ReadMetaFromId3v2( trueaudio->ID3v2Tag(), p_demux, p_demux_meta, p_meta );
422     }
423     else if( WavPack::File* wavpack = dynamic_cast<WavPack::File*>(f.file()) )
424     {
425         if( wavpack->APETag() )
426             ReadMetaFromAPE( wavpack->APETag(), p_demux, p_demux_meta, p_meta );
427     }
428
429     return VLC_SUCCESS;
430 }
431
432
433
434 /**
435  * Write meta informations to APE tags
436  * @param tag: the APE tag
437  * @param p_item: the input item
438  */
439 static void WriteMetaToAPE( APE::Tag* tag, input_item_t* p_item )
440 {
441     char* psz_meta;
442 #define WRITE( metaName, keyName )                      \
443     psz_meta = input_item_Get##metaName( p_item );      \
444     if( psz_meta )                                      \
445     {                                                   \
446         String key( keyName, String::UTF8 );            \
447         String value( psz_meta, String::UTF8 );         \
448         tag->addValue( key, value, true );              \
449     }                                                   \
450     free( psz_meta );
451
452     WRITE( Copyright, "COPYRIGHT" );
453     WRITE( Language, "LANGUAGE" );
454     WRITE( Publisher, "PUBLISHER" );
455
456 #undef WRITE
457 }
458
459
460
461 /**
462  * Write meta information to id3v2 tags
463  * @param tag: the id3v2 tag
464  * @param p_input: the input item
465  */
466 static void WriteMetaToId3v2( ID3v2::Tag* tag, input_item_t* p_item )
467 {
468     char* psz_meta;
469 #define WRITE( metaName, tagName )                                            \
470     psz_meta = input_item_Get##metaName( p_item );                            \
471     if( psz_meta )                                                            \
472     {                                                                         \
473         ByteVector p_byte( tagName, 4 );                                      \
474         tag->removeFrames( p_byte );                                         \
475         ID3v2::TextIdentificationFrame* p_frame =                             \
476             new ID3v2::TextIdentificationFrame( p_byte, String::UTF8 );       \
477         p_frame->setText( psz_meta );                                         \
478         tag->addFrame( p_frame );                                             \
479     }                                                                         \
480     free( psz_meta );
481
482     WRITE( Copyright, "TCOP" );
483     WRITE( EncodedBy, "TENC" );
484     WRITE( Language,  "TLAN" );
485     WRITE( Publisher, "TPUB" );
486
487 #undef WRITE
488 }
489
490
491
492 /**
493  * Write the meta informations to XiphComments
494  * @param tag: the Xiph Comment
495  * @param p_input: the input item
496  */
497 static void WriteMetaToXiph( Ogg::XiphComment* tag, input_item_t* p_item )
498 {
499     char* psz_meta;
500 #define WRITE( metaName, keyName )                      \
501     psz_meta = input_item_Get##metaName( p_item );      \
502     if( psz_meta )                                      \
503     {                                                   \
504         String key( keyName, String::UTF8 );            \
505         String value( psz_meta, String::UTF8 );         \
506         tag->addField( key, value, true );              \
507     }                                                   \
508     free( psz_meta );
509
510     WRITE( Copyright, "COPYRIGHT" );
511
512 #undef WRITE
513 }
514
515
516
517 /**
518  * Set the tags to the file using TagLib
519  * @param p_this: the demux object
520  * @return VLC_SUCCESS if the operation success
521  */
522
523 static int WriteMeta( vlc_object_t *p_this )
524 {
525     playlist_t *p_playlist = (playlist_t *)p_this;
526     meta_export_t *p_export = (meta_export_t *)p_playlist->p_private;
527     input_item_t *p_item = p_export->p_item;
528     FileRef f;
529
530     if( !p_item )
531     {
532         msg_Err( p_this, "Can't save meta data of an empty input" );
533         return VLC_EGENERIC;
534     }
535
536 #if defined(WIN32) || defined (UNDER_CE)
537     if(GetVersion() < 0x80000000)
538     {
539         wchar_t wpath[MAX_PATH + 1];
540         if( !MultiByteToWideChar( CP_UTF8, 0, p_export->psz_file, -1, wpath, MAX_PATH) )
541             return VLC_EGENERIC;
542         wpath[MAX_PATH] = L'\0';
543         f = FileRef( wpath );
544     }
545     else
546         return VLC_EGENERIC;
547 #else
548     const char* local_name = ToLocale( p_export->psz_file );
549     if( !local_name )
550         return VLC_EGENERIC;
551     f = FileRef( local_name );
552     LocaleFree( local_name );
553 #endif
554
555     if( f.isNull() || !f.tag() || f.file()->readOnly() )
556     {
557         msg_Err( p_this, "File %s can't be opened for tag writing\n",
558             p_export->psz_file );
559         return VLC_EGENERIC;
560     }
561
562     msg_Dbg( p_this, "Writing metadata for %s", p_export->psz_file );
563
564     Tag *p_tag = f.tag();
565
566     char *psz_meta;
567
568 #define SET( a, b )                                         \
569     if( b )                                                 \
570     {                                                       \
571         String* psz_tmp = new String( b, String::UTF8 );    \
572         p_tag->set##a( *psz_tmp );                          \
573         delete psz_tmp;                                     \
574     }
575
576     // Saving all common fields
577     // If the title is empty, use the name
578     psz_meta = input_item_GetTitle( p_item );
579     if( !psz_meta ) psz_meta = input_item_GetName( p_item );
580     SET( Title, psz_meta );
581     free( psz_meta );
582
583     psz_meta = input_item_GetArtist( p_item );
584     SET( Artist, psz_meta );
585     free( psz_meta );
586
587     psz_meta = input_item_GetAlbum( p_item );
588     SET( Album, psz_meta );
589     free( psz_meta );
590
591     psz_meta = input_item_GetDescription( p_item );
592     SET( Comment, psz_meta );
593     free( psz_meta );
594
595     psz_meta = input_item_GetGenre( p_item );
596     SET( Genre, psz_meta );
597     free( psz_meta );
598
599 #undef SET
600
601     psz_meta = input_item_GetDate( p_item );
602     if( psz_meta ) p_tag->setYear( atoi( psz_meta ) );
603     free( psz_meta );
604
605     psz_meta = input_item_GetTrackNum( p_item );
606     if( psz_meta ) p_tag->setTrack( atoi( psz_meta ) );
607     free( psz_meta );
608
609
610     // Try now to write special tags
611     if( FLAC::File* flac = dynamic_cast<FLAC::File*>(f.file()) )
612     {
613         if( flac->ID3v2Tag() )
614             WriteMetaToId3v2( flac->ID3v2Tag(), p_item );
615         else if( flac->xiphComment() )
616             WriteMetaToXiph( flac->xiphComment(), p_item );
617     }
618     else if( MPC::File* mpc = dynamic_cast<MPC::File*>(f.file()) )
619     {
620         if( mpc->APETag() )
621             WriteMetaToAPE( mpc->APETag(), p_item );
622     }
623     else if( MPEG::File* mpeg = dynamic_cast<MPEG::File*>(f.file()) )
624     {
625         if( mpeg->ID3v2Tag() )
626             WriteMetaToId3v2( mpeg->ID3v2Tag(), p_item );
627         else if( mpeg->APETag() )
628             WriteMetaToAPE( mpeg->APETag(), p_item );
629     }
630     else if( Ogg::File* ogg = dynamic_cast<Ogg::File*>(f.file()) )
631     {
632         if( Ogg::FLAC::File* ogg_flac = dynamic_cast<Ogg::FLAC::File*>(f.file()))
633             WriteMetaToXiph( ogg_flac->tag(), p_item );
634         else if( Ogg::Speex::File* ogg_speex = dynamic_cast<Ogg::Speex::File*>(f.file()) )
635             WriteMetaToXiph( ogg_speex->tag(), p_item );
636         else if( Ogg::Vorbis::File* ogg_vorbis = dynamic_cast<Ogg::Vorbis::File*>(f.file()) )
637             WriteMetaToXiph( ogg_vorbis->tag(), p_item );
638     }
639     else if( TrueAudio::File* trueaudio = dynamic_cast<TrueAudio::File*>(f.file()) )
640     {
641         if( trueaudio->ID3v2Tag() )
642             WriteMetaToId3v2( trueaudio->ID3v2Tag(), p_item );
643     }
644     else if( WavPack::File* wavpack = dynamic_cast<WavPack::File*>(f.file()) )
645     {
646         if( wavpack->APETag() )
647             WriteMetaToAPE( wavpack->APETag(), p_item );
648     }
649
650     // Save the meta data
651     f.save();
652
653     return VLC_SUCCESS;
654 }
655
656
657
658 static int DownloadArt( vlc_object_t *p_this )
659 {
660     /* We need to be passed the file name
661      * Fetch the thing from the file, save it to the cache folder
662      */
663     return VLC_EGENERIC;
664 }
665