Changeset 7443 for extensions/AMetaData
- Timestamp:
- Oct 27, 2010, 11:23:36 PM (13 years ago)
- Location:
- extensions/AMetaData
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMetaData/amd_ajax.php
r6977 r7443 40 40 class AMD_ajax extends AMD_root 41 41 { 42 private $tagSeparators=array( 43 'xmp.digiKam:TagsList' => '/', 44 'xmp.lr:hierarchicalSubject' => '|' 45 ); 46 42 47 /** 43 48 * constructor … … 1505 1510 $returned=array(); 1506 1511 $keywordsList=array(); 1507 $sql="SELECT pait.value, pait.imageId, paut.numId1512 $sql="SELECT DISTINCT pait.value, pait.imageId, paut.numId, paut.tagId 1508 1513 FROM (".$this->tables['images_tags']." pait 1509 1514 JOIN ".$this->tables['used_tags']." paut ON pait.numId = paut.numId) 1510 1515 1511 1516 WHERE (paut.tagId = 'xmp.dc:subject' OR 1512 paut.tagId = 'xmp.digiKam:tagsList' OR 1517 paut.tagId = 'xmp.digiKam:TagsList' OR 1518 paut.tagId = 'xmp.lr:hierarchicalSubject' OR 1513 1519 paut.tagId = 'iptc.Keywords');"; 1514 1520 $result=pwg_query($sql); … … 1525 1531 foreach($tmp['values'] as $val) 1526 1532 { 1527 $keywordsList[]="('".mysql_escape_string($val)."', ".$row['imageId'].")"; 1533 if($row['tagId']=='xmp.digiKam:TagsList' or $row['tagId']=='xmp.lr:hierarchicalSubject') 1534 { 1535 $list=explode($this->tagSeparators[$row['tagId']], $val); 1536 foreach($list as $subTag) 1537 { 1538 $keywordsList[]="('".mysql_escape_string(trim($subTag))."', ".$row['imageId'].")"; 1539 } 1540 } 1541 else 1542 { 1543 $keywordsList[]="('".mysql_escape_string($val)."', ".$row['imageId'].")"; 1544 } 1528 1545 } 1529 1546 } … … 1554 1571 LEFT JOIN ".IMAGE_TAG_TABLE." pit ON pit.tag_id = ptt.id 1555 1572 GROUP BY att.value 1556 HAVING nbPicturesTagged < nbPictures"; 1573 HAVING nbPicturesTagged < nbPictures 1574 ORDER BY att.value"; 1557 1575 $result=pwg_query($sql); 1558 1576 if($result) … … 1595 1613 */ 1596 1614 $keywordsList=array(); 1597 $sql="SELECT pait.value, pait.imageId, paut.numId1615 $sql="SELECT DISTINCT pait.value, pait.imageId, paut.numId, paut.tagId 1598 1616 FROM (".$this->tables['images_tags']." pait 1599 1617 JOIN ".$this->tables['used_tags']." paut ON pait.numId = paut.numId) 1600 1618 1601 1619 WHERE (paut.tagId = 'xmp.dc:subject' OR 1602 paut.tagId = 'xmp.digiKam:tagsList' OR 1620 paut.tagId = 'xmp.digiKam:TagsList' OR 1621 paut.tagId = 'xmp.lr:hierarchicalSubject' OR 1603 1622 paut.tagId = 'iptc.Keywords');"; 1604 1623 $result=pwg_query($sql); … … 1615 1634 foreach($tmp['values'] as $val) 1616 1635 { 1617 $keywordsList[]="('".mysql_escape_string($val)."', ".$row['imageId'].")"; 1636 if($row['tagId']=='xmp.digiKam:TagsList') 1637 { 1638 $list=explode($this->tagSeparators[$row['tagId']], $val); 1639 foreach($list as $subTag) 1640 { 1641 $keywordsList[]="('".mysql_escape_string(trim($subTag))."', ".$row['imageId'].")"; 1642 } 1643 } 1644 else 1645 { 1646 $keywordsList[]="('".mysql_escape_string($val)."', ".$row['imageId'].")"; 1647 } 1618 1648 } 1619 1649 } … … 1640 1670 /* 1641 1671 * 2/ join temp table with piwigo tags table, found the keywords 1642 * that don't have a corresponding keyword1672 * that don't have a corresponding tag 1643 1673 */ 1644 1674 $sql="SELECT DISTINCT att.value 1645 1675 FROM amd_temp_tags att LEFT JOIN ".TAGS_TABLE." ptt ON att.value = ptt.name 1646 1676 WHERE ptt.id IS NULL 1647 AND ".implode(' OR ', $keywords);1677 AND (".implode(' OR ', $keywords).") "; 1648 1678 $result=pwg_query($sql); 1649 1679 if($result) … … 1675 1705 } 1676 1706 } 1677 1678 1707 return($returned); 1679 1708 } -
extensions/AMetaData/main.inc.php
r7399 r7443 150 150 | | | user 151 151 | | | 152 | | | * mantis bug:1912 153 | | | . Reading digiKam hierarchical keywords as 'flat' 154 | | | keywords 155 | | | 156 | | | * mantis bug:1968 157 | | | . Keyword to tag conversion generate duplicated tags 152 158 | | | 153 159 | | |
Note: See TracChangeset
for help on using the changeset viewer.