meta.c 17.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*****************************************************************************
 * meta.c : Metadata handling
 *****************************************************************************
 * Copyright (C) 1998-2004 the VideoLAN team
 * $Id$
 *
 * Authors: Antoine Cellerier <dionoea@videolan.org>
 *          Clément Stenac <zorglub@videolan.org
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#include <vlc/vlc.h>
Clément Stenac's avatar
Clément Stenac committed
26 27
#include <vlc_input.h>
#include <vlc_stream.h>
28
#include <vlc_meta.h>
Clément Stenac's avatar
Clément Stenac committed
29 30
#include <vlc_playlist.h>
#include <vlc_charset.h>
31
#include <vlc_strings.h>
32
#include "../playlist/playlist_internal.h"
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
33
#include <errno.h>
34
#include <limits.h>                                             /* PATH_MAX */
35 36 37 38 39

#ifdef HAVE_SYS_STAT_H
#   include <sys/stat.h>
#endif

40 41 42 43 44 45
static const char * meta_type_to_string[VLC_META_TYPE_COUNT] =
{
    [vlc_meta_Title]            = N_("Title"),
    [vlc_meta_Artist]           = N_("Artist"),
    [vlc_meta_Genre]            = N_("Genre"),
    [vlc_meta_Copyright]        = N_("Copyright"),
46 47
    [vlc_meta_Album]            = N_("Album"),
    [vlc_meta_TrackNumber]      = N_("Track number"),
48 49 50 51 52 53
    [vlc_meta_Description]      = N_("Description"),
    [vlc_meta_Rating]           = N_("Rating"),
    [vlc_meta_Date]             = N_("Date"),
    [vlc_meta_Setting]          = N_("Setting"),
    [vlc_meta_URL]              = N_("URL"),
    [vlc_meta_Language]         = N_("Language"),
54
    [vlc_meta_NowPlaying]       = N_("Now Playing"),
55 56 57 58 59 60 61 62 63 64 65 66
    [vlc_meta_Publisher]        = N_("Publisher"),
    [vlc_meta_EncodedBy]        = N_("Encoded by"),
    [vlc_meta_ArtworkURL]       = N_("Artwork URL"),
    [vlc_meta_TrackID]          = N_("Track ID"),
};

const char *
input_MetaTypeToLocalizedString( vlc_meta_type_t meta_type )
{
    return _(meta_type_to_string[meta_type]);
}

67 68
#define input_FindArtInCache(a,b) __input_FindArtInCache(VLC_OBJECT(a),b)
static int __input_FindArtInCache( vlc_object_t *, input_item_t *p_item );
69

Clément Stenac's avatar
Clément Stenac committed
70
vlc_bool_t input_MetaSatisfied( playlist_t *p_playlist, input_item_t *p_item,
71
                                uint32_t *pi_mandatory, uint32_t *pi_optional )
Clément Stenac's avatar
Clément Stenac committed
72
{
73
    (void)p_playlist;
74
    *pi_mandatory = VLC_META_ENGINE_TITLE | VLC_META_ENGINE_ARTIST;
Clément Stenac's avatar
Clément Stenac committed
75 76 77 78 79 80 81 82

    uint32_t i_meta = input_CurrentMetaFlags( p_item->p_meta );
    *pi_mandatory &= ~i_meta;
    *pi_optional = 0; /// Todo
    return *pi_mandatory ? VLC_FALSE:VLC_TRUE;
}

int input_MetaFetch( playlist_t *p_playlist, input_item_t *p_item )
83 84
{
    struct meta_engine_t *p_me;
Clément Stenac's avatar
Clément Stenac committed
85
    uint32_t i_mandatory, i_optional;
86

87
    input_MetaSatisfied( p_playlist, p_item, &i_mandatory, &i_optional );
Clément Stenac's avatar
Clément Stenac committed
88 89
    // Meta shouldn't magically appear
    assert( i_mandatory );
90

91
    /* FIXME: object creation is overkill, use p_private */
Clément Stenac's avatar
Clément Stenac committed
92
    p_me = vlc_object_create( p_playlist, VLC_OBJECT_META_ENGINE );
93
    p_me->i_flags |= OBJECT_FLAGS_NOINTERACT;
94
    p_me->i_flags |= OBJECT_FLAGS_QUIET;
95 96 97
    p_me->i_mandatory = i_mandatory;
    p_me->i_optional = i_optional;

98 99 100 101 102 103 104 105 106
    p_me->p_item = p_item;
    p_me->p_module = module_Need( p_me, "meta fetcher", 0, VLC_FALSE );
    if( !p_me->p_module )
    {
        vlc_object_destroy( p_me );
        return VLC_EGENERIC;
    }
    module_Unneed( p_me, p_me->p_module );
    vlc_object_destroy( p_me );
107 108 109

    input_item_SetMetaFetched( p_item, VLC_TRUE );

110 111 112
    return VLC_SUCCESS;
}

113
/* Return codes:
114
 *   0 : Art is in cache or is a local file
115 116 117 118
 *   1 : Art found, need to download
 *  -X : Error/not found
 */
int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
119
{
120 121
    int i_ret = VLC_EGENERIC;
    module_t *p_module;
122
    char *psz_title, *psz_artist, *psz_album;
123

Rafaël Carré's avatar
Rafaël Carré committed
124
    psz_artist = input_item_GetArtist( p_item );
125
    psz_album = input_item_GetAlbum( p_item );
126 127 128
    psz_title = input_item_GetTitle( p_item );
    if(!psz_title)
        psz_title = input_item_GetName( p_item );
Rafaël Carré's avatar
Rafaël Carré committed
129

130
    if( !psz_title && !psz_artist && !psz_album )
131
        return VLC_EGENERIC;
132

Rafaël Carré's avatar
Rafaël Carré committed
133
    free( psz_title );
134

135
    /* If we already checked this album in this session, skip */
Rafaël Carré's avatar
Rafaël Carré committed
136
    if( psz_artist && psz_album )
137 138
    {
        FOREACH_ARRAY( playlist_album_t album, p_playlist->p_fetcher->albums )
Rafaël Carré's avatar
Rafaël Carré committed
139 140
            if( !strcmp( album.psz_artist, psz_artist ) &&
                !strcmp( album.psz_album, psz_album ) )
141
            {
142
                msg_Dbg( p_playlist, " %s - %s has already been searched",
Rafaël Carré's avatar
Rafaël Carré committed
143
                         psz_artist, psz_album );
144
        /* TODO-fenrir if we cache art filename too, we can go faster */
Rafaël Carré's avatar
Rafaël Carré committed
145 146
                free( psz_artist );
                free( psz_album );
147 148
                if( album.b_found )
                {
149 150 151 152
                    if( !strncmp( album.psz_arturl, "file://", 7 ) )
                        input_item_SetArtURL( p_item, album.psz_arturl );
                    else /* Actually get URL from cache */
                        input_FindArtInCache( p_playlist, p_item );
153 154 155 156 157 158
                    return 0;
                }
                else
                {
                    return VLC_EGENERIC;
                }
159
            }
160 161
        FOREACH_END();
    }
Rafaël Carré's avatar
Rafaël Carré committed
162 163
    free( psz_artist );
    free( psz_album );
164 165

    input_FindArtInCache( p_playlist, p_item );
166 167

    char *psz_arturl = input_item_GetArtURL( p_item );
Rafaël Carré's avatar
Rafaël Carré committed
168 169 170
    if( !EMPTY_STR( psz_arturl ) )
    {
        free( psz_arturl );
171
        return 0; /* Art is in cache, no need to go further */
Rafaël Carré's avatar
Rafaël Carré committed
172 173
    }
    free( psz_arturl );
174 175 176

    PL_LOCK;
    p_playlist->p_private = p_item;
Rafaël Carré's avatar
Rafaël Carré committed
177 178 179
    psz_album = input_item_GetAlbum( p_item );
    psz_artist = input_item_GetArtist( p_item );
    psz_title = input_item_GetTitle( p_item );
180 181 182
    if( !psz_title )
        psz_title = input_item_GetName( p_item );

Rafaël Carré's avatar
Rafaël Carré committed
183
    if( psz_album && psz_artist )
184 185
    {
        msg_Dbg( p_playlist, "searching art for %s - %s",
Rafaël Carré's avatar
Rafaël Carré committed
186
             psz_artist, psz_album );
187 188 189 190
    }
    else
    {
        msg_Dbg( p_playlist, "searching art for %s",
191
             psz_title );
192
    }
Rafaël Carré's avatar
Rafaël Carré committed
193
    free( psz_title );
194

195 196 197 198 199 200 201 202
    p_module = module_Need( p_playlist, "art finder", 0, VLC_FALSE );

    if( p_module )
        i_ret = 1;
    else
        msg_Dbg( p_playlist, "unable to find art" );

    /* Record this album */
Rafaël Carré's avatar
Rafaël Carré committed
203
    if( psz_artist && psz_album )
204 205
    {
        playlist_album_t a;
Rafaël Carré's avatar
Rafaël Carré committed
206 207
        a.psz_artist = psz_artist;
        a.psz_album = psz_album;
208
        a.psz_arturl = input_item_GetArtURL( p_item );
209 210 211
        a.b_found = (i_ret == VLC_EGENERIC ? VLC_FALSE : VLC_TRUE );
        ARRAY_APPEND( p_playlist->p_fetcher->albums, a );
    }
Rafaël Carré's avatar
Rafaël Carré committed
212 213 214 215 216
    else
    {
        free( psz_artist );
        free( psz_album );
    }
217 218

    if( p_module )
Clément Stenac's avatar
Clément Stenac committed
219
        module_Unneed( p_playlist, p_module );
220 221
    p_playlist->p_private = NULL;
    PL_UNLOCK;
Clément Stenac's avatar
Clément Stenac committed
222

223
    return i_ret;
224 225
}

226
static void ArtCacheCreateDir( const char *psz_dir )
227
{
228
    char newdir[strlen( psz_dir ) + 1];
229 230 231 232
    strcpy( newdir, psz_dir );
    char * psz_newdir = newdir;
    char * psz = psz_newdir;

233
    while( *psz )
234
    {
235
        while( *psz && *psz != DIR_SEP_CHAR) psz++;
236
        if( !*psz ) break;
237
        *psz = 0;
238 239
        if( !EMPTY_STR( psz_newdir ) )
            utf8_mkdir( psz_newdir, 0700 );
240
        *psz = DIR_SEP_CHAR;
241
        psz++;
242
    }
243
    utf8_mkdir( psz_dir, 0700 );
244 245
}

246
static char * ArtCacheGetSanitizedFileName( const char *psz )
247 248 249 250
{
    char *dup = strdup(psz);
    int i;

251 252
    filename_sanitize( dup );

253 254 255 256
    /* Doesn't create a filename with invalid characters
     * TODO: several filesystems forbid several characters: list them all
     */
    for( i = 0; dup[i] != '\0'; i++ )
257
    {
258
        if( dup[i] == DIR_SEP_CHAR )
259
            dup[i] = ' ';
260
    }
261
    return dup;
262
}
263

264 265
#define ArtCacheGetDirPath(a,b,c,d,e) __ArtCacheGetDirPath(VLC_OBJECT(a),b,c,d,e)
static void __ArtCacheGetDirPath( vlc_object_t *p_obj,
266
                                  char *psz_dir,
267 268
                                  const char *psz_title,
                                  const char *psz_artist, const char *psz_album )
269
{
270
    if( !EMPTY_STR(psz_artist) && !EMPTY_STR(psz_album) )
271
    {
272 273
        char * psz_album_sanitized = ArtCacheGetSanitizedFileName( psz_album );
        char * psz_artist_sanitized = ArtCacheGetSanitizedFileName( psz_artist );
274

275
        snprintf( psz_dir, PATH_MAX, "%s" DIR_SEP
276
                  "art" DIR_SEP "artistalbum" DIR_SEP "%s" DIR_SEP "%s",
277
                      p_obj->p_libvlc->psz_cachedir,
278 279 280
                      psz_artist_sanitized, psz_album_sanitized );
        free( psz_album_sanitized );
        free( psz_artist_sanitized );
281 282 283
    }
    else
    {
284
        char * psz_title_sanitized = ArtCacheGetSanitizedFileName( psz_title );
285
        snprintf( psz_dir, PATH_MAX, "%s" DIR_SEP
286
                  "art" DIR_SEP "title" DIR_SEP "%s",
287
                  p_obj->p_libvlc->psz_cachedir,
288 289
                  psz_title_sanitized );
        free( psz_title_sanitized );
290
    }
291
}
292 293 294



295 296
#define ArtCacheGetFilePath(a,b,c,d,e,f) __ArtCacheGetFilePath(VLC_OBJECT(a),b,c,d,e,f)
static void __ArtCacheGetFilePath( vlc_object_t *p_obj,
297
                                   char * psz_filename,
298 299
                                   const char *psz_title,
                                   const char *psz_artist, const char *psz_album,
300
                                   const char *psz_extension )
301
{
302
    char psz_dir[PATH_MAX+1];
303
    char * psz_ext;
304
    ArtCacheGetDirPath( p_obj, psz_dir, psz_title, psz_artist, psz_album );
305

306
    if( psz_extension )
307
    {
308 309
        psz_ext = strndup( psz_extension, 6 );
        filename_sanitize( psz_ext );
310
    }
311 312
    else psz_ext = strdup( "" );

313
    snprintf( psz_filename, PATH_MAX, "file://%s" DIR_SEP "art%s",
314 315 316
              psz_dir, psz_ext );

    free( psz_ext );
317 318 319
}

static int __input_FindArtInCache( vlc_object_t *p_obj, input_item_t *p_item )
320
{
Rafaël Carré's avatar
Rafaël Carré committed
321 322 323
    char *psz_artist;
    char *psz_album;
    char *psz_title;
324 325
    char psz_dirpath[PATH_MAX+1];
    char psz_filepath[PATH_MAX+1];
326
    char * psz_filename;
327
    DIR * p_dir;
328

329 330 331
    psz_artist = input_item_GetArtist( p_item );
    psz_album = input_item_GetAlbum( p_item );
    psz_title = input_item_GetTitle( p_item );
Rafaël Carré's avatar
Rafaël Carré committed
332
    if( !psz_title ) psz_title = input_item_GetName( p_item );
333

Rafaël Carré's avatar
Rafaël Carré committed
334 335 336 337 338 339 340
    if( !psz_title && ( !psz_album || !psz_artist ) )
    {
        free( psz_artist );
        free( psz_album );
        free( psz_title );
        return VLC_EGENERIC;
    }
341

342
    ArtCacheGetDirPath( p_obj, psz_dirpath, psz_title,
343 344 345 346
                           psz_artist, psz_album );

    free( psz_artist );
    free( psz_album );
Rafaël Carré's avatar
Rafaël Carré committed
347
    free( psz_title );
348

349
    /* Check if file exists */
350
    p_dir = utf8_opendir( psz_dirpath );
351 352
    if( !p_dir )
        return VLC_EGENERIC;
353

354
    while( (psz_filename = utf8_readdir( p_dir )) )
355
    {
356
        if( !strncmp( psz_filename, "art", 3 ) )
357
        {
358
            snprintf( psz_filepath, PATH_MAX, "file://%s" DIR_SEP "%s",
359 360 361
                      psz_dirpath, psz_filename );
            input_item_SetArtURL( p_item, psz_filepath );
            free( psz_filename );
362 363
            closedir( p_dir );
            return VLC_SUCCESS;
364
        }
365
        free( psz_filename );
366
    }
367

368
    /* Not found */
369
    closedir( p_dir );
370
    return VLC_EGENERIC;
371 372 373 374 375 376
}

/**
 * Download the art using the URL or an art downloaded
 * This function should be called only if data is not already in cache
 */
Clément Stenac's avatar
Clément Stenac committed
377
int input_DownloadAndCacheArt( playlist_t *p_playlist, input_item_t *p_item )
378 379 380
{
    int i_status = VLC_EGENERIC;
    stream_t *p_stream;
381
    char psz_filename[PATH_MAX+1];
382 383
    char *psz_artist = NULL;
    char *psz_album = NULL;
384
    char *psz_title = NULL;
385
    char *psz_arturl;
386
    char *psz_type;
Rafaël Carré's avatar
Rafaël Carré committed
387

388 389 390
    psz_artist = input_item_GetArtist( p_item );
    psz_album = input_item_GetAlbum( p_item );
    psz_title = input_item_GetTitle( p_item );
391 392
    if( !psz_title )
        psz_title = input_item_GetName( p_item );
393

394
    if( !psz_title && (!psz_artist || !psz_album) )
395
    {
396 397 398
        free( psz_title );
        free( psz_album );
        free( psz_artist );
399
        return VLC_EGENERIC;
400 401
    }

402 403
    psz_arturl = input_item_GetArtURL( p_item );
    assert( !EMPTY_STR( psz_arturl ) );
404

Rafaël Carré's avatar
Rafaël Carré committed
405 406 407 408 409 410 411
    if( !strncmp( psz_arturl , "file://", 7 ) )
    {
        msg_Dbg( p_playlist, "Album art is local file, no need to cache" );
        free( psz_arturl );
        return VLC_SUCCESS;
    }
    else if( !strncmp( psz_arturl , "APIC", 4 ) )
412 413 414 415 416 417 418
    {
        msg_Warn( p_playlist, "APIC fetch not supported yet" );
        free( psz_arturl );
        return VLC_EGENERIC;
    }

    psz_type = strrchr( psz_arturl, '.' );
419
    if( strlen( psz_type ) > 5 )
420
        psz_type = NULL; /* remove extension if it's > to 4 characters */
421

422
    /* Warning: psz_title, psz_artist, psz_album may change in ArtCache*() */
423

424
    ArtCacheGetDirPath( p_playlist, psz_filename, psz_title, psz_artist,
425 426
                        psz_album );
    ArtCacheCreateDir( psz_filename );
427
    ArtCacheGetFilePath( p_playlist, psz_filename, psz_title, psz_artist,
428
                         psz_album, psz_type );
429 430 431

    free( psz_artist );
    free( psz_album );
432
    free( psz_title );
433

434
    p_stream = stream_UrlNew( p_playlist, psz_arturl );
435 436
    if( p_stream )
    {
437
        uint8_t p_buffer[65536];
438 439
        long int l_read;
        FILE *p_file = utf8_fopen( psz_filename+7, "w" );
440
        if( p_file == NULL ) {
441 442
            msg_Err( p_playlist, "Unable write album art in %s",
                     psz_filename + 7 );
443
            free( psz_arturl );
444 445
            return VLC_EGENERIC;
        }
446 447
        int err = 0;
        while( ( l_read = stream_Read( p_stream, p_buffer, sizeof (p_buffer) ) ) )
448
        {
449 450 451 452 453
            if( fwrite( p_buffer, l_read, 1, p_file ) != 1 )
            {
                err = errno;
                break;
            }
454
        }
455 456
        if( fclose( p_file ) && !err )
            err = errno;
457
        stream_Delete( p_stream );
458 459

        if( err )
460 461 462 463
        {
            errno = err;
            msg_Err( p_playlist, "%s: %m", psz_filename );
        }
464 465 466
        else
            msg_Dbg( p_playlist, "album art saved to %s\n", psz_filename );

467
        input_item_SetArtURL( p_item, psz_filename );
468 469
        i_status = VLC_SUCCESS;
    }
470
    free( psz_arturl );
471 472
    return i_status;
}
473

474 475 476 477 478 479
void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
{
    input_item_t *p_item = p_input->p->input.p_item;
    char *psz_arturl;
    char *psz_artist = NULL;
    char *psz_album = NULL;
480
    char *psz_title = NULL;
481
    char *psz_type = NULL;
482
    char psz_filename[PATH_MAX+1];
483 484 485 486 487 488 489 490
    FILE *f;
    input_attachment_t *p_attachment;
    struct stat s;
    int i_idx;

    /* TODO-fenrir merge input_ArtFind with download and make it set the flags FETCH
     * and then set it here to to be faster */

Rafaël Carré's avatar
Rafaël Carré committed
491
    psz_arturl = input_item_GetArtURL( p_item );
492 493
    if( !psz_arturl || strncmp( psz_arturl, "attachment://", strlen("attachment://") ) )
    {
Rafaël Carré's avatar
Rafaël Carré committed
494
        free( psz_arturl );
495 496 497
        msg_Err( p_input, "internal input error with input_ExtractAttachmentAndCacheArt" );
        return;
    }
498
    input_item_SetArtURL( p_item, NULL );
499

500
    if( input_item_IsArtFetched( p_item ) )
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
    {
        /* XXX Weird, we should not have end up with attachment:// art url unless there is a race
         * condition */
        msg_Warn( p_input, "internal input error with input_ExtractAttachmentAndCacheArt" );
        input_FindArtInCache( p_input, p_item );
        free( psz_arturl );
        return;
    }

    /* */
    for( i_idx = 0, p_attachment = NULL; i_idx < p_input->p->i_attachment; i_idx++ )
    {
        if( !strcmp( p_input->p->attachment[i_idx]->psz_name,
                     &psz_arturl[strlen("attachment://")] ) )
        {
            p_attachment = p_input->p->attachment[i_idx];
            break;
        }
    }
    if( !p_attachment || p_attachment->i_data <= 0 )
    {
        msg_Warn( p_input, "internal input error with input_ExtractAttachmentAndCacheArt" );
        goto end;
    }

526 527 528 529 530
    psz_artist = input_item_GetArtist( p_item );
    psz_album = input_item_GetAlbum( p_item );
    psz_title = input_item_GetTitle( p_item );
    if( !psz_title )
        psz_title = input_item_GetName( p_item );
531

532
    if( (!psz_artist || !psz_album ) && !psz_title )
533 534 535 536
        goto end;

    /* */
    psz_type = strrchr( psz_arturl, '.' );
537

538
    ArtCacheGetDirPath( p_input, psz_filename, psz_title, psz_artist, psz_album );
539
    ArtCacheCreateDir( psz_filename );
540
    ArtCacheGetFilePath( p_input, psz_filename, psz_title, psz_artist, psz_album, psz_type );
541 542 543 544 545 546 547 548 549

    /* Check if we already dumped it */
    if( !utf8_stat( psz_filename+7, &s ) )
        goto end;

    f = utf8_fopen( psz_filename+7, "w" );
    if( f )
    {
        if( fwrite( p_attachment->p_data, p_attachment->i_data, 1, f ) != 1 )
550
            msg_Err( p_input, "%s: %m", psz_filename );
551 552 553 554 555 556 557 558
        else
            msg_Dbg( p_input, "album art saved to %s\n", psz_filename );
        fclose( f );
    }

end:
    if( psz_artist ) free( psz_artist );
    if( psz_album ) free( psz_album );
559
    if( psz_title ) free( psz_title );
560 561 562 563
    if( psz_arturl ) free( psz_arturl );
}


Clément Stenac's avatar
Clément Stenac committed
564
uint32_t input_CurrentMetaFlags( vlc_meta_t *p_meta )
565 566 567
{
    uint32_t i_meta = 0;

568 569 570
    if( !p_meta )
        return 0;

571
#define CHECK( a, b ) \
572
    if( !EMPTY_STR( vlc_meta_Get( p_meta, vlc_meta_ ## a ) ) ) \
573 574
        i_meta |= VLC_META_ENGINE_ ## b;

575 576 577
    CHECK( Title, TITLE )
    CHECK( Artist, ARTIST )
    CHECK( Album, COLLECTION )
578 579 580
#if 0
    /* As this is not used at the moment, don't uselessly check for it.
     * Re-enable this when it is used */
581 582 583 584 585 586 587 588
    CHECK( Genre, GENRE )
    CHECK( Copyright, COPYRIGHT )
    CHECK( Tracknum, SEQ_NUM )
    CHECK( Description, DESCRIPTION )
    CHECK( Rating, RATING )
    CHECK( Date, DATE )
    CHECK( URL, URL )
    CHECK( Language, LANGUAGE )
589
#endif
590
    CHECK( ArtworkURL, ART_URL )
591 592 593

    return i_meta;
}