Changeset 45 in flacrip


Ignore:
Timestamp:
09/19/15 18:59:30 (9 years ago)
Author:
peter
Message:

if the barcode element is present but empty, return '[none]' as the value of the BARCODE tag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/MusicBrainz.pm

    r44 r45  
    110110    $info{LANGUAGE}            = $xpath->findvalue('text-representation/language', $release)->value; 
    111111    $info{SCRIPT}              = $xpath->findvalue('text-representation/script', $release)->value; 
    112     $info{BARCODE}             = $xpath->findvalue('barcode', $release)->value; 
     112 
     113    # add the barcode tag if the element exists 
     114    # if the barcode tag is empty, it is a release that explicitly has no barcode 
     115    # use the dummy value "[none]" for those cases 
     116    if ($xpath->exists('barcode', $release)) { 
     117        $info{BARCODE} = $xpath->findvalue('barcode', $release)->value || '[none]'; 
     118    } 
    113119 
    114120    # select the proper medium (important for multidisc releases) 
Note: See TracChangeset for help on using the changeset viewer.