]> git.wh0rd.org Git - tt-rss.git/commitdiff
parse media:content tags as attachments, some feed content detection tweaks
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 28 May 2008 04:34:29 +0000 (05:34 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 28 May 2008 04:34:29 +0000 (05:34 +0100)
functions.php

index 6f93e6a24cd229f0e64ba89c15743db2543e5f8e..d255161ddeb0d89c29c4d5bf68da3bfd294a2e2b 100644 (file)
                                        $entry_content = $item["content:escaped"];
 
                                        if (!$entry_content) $entry_content = $item["content:encoded"];
+                                       if (!$entry_content) $entry_content = $item["content"]["encoded"];
                                        if (!$entry_content) $entry_content = $item["content"];
 
                                        // Magpie bugs are getting ridiculous
 
                                        if (!$entry_content) $entry_content = $item["atom_content"];
                                        if (!$entry_content) $entry_content = $item["summary"];
-                                       if (!$entry_content) $entry_content = $item["description"];
+
+                                       if (!$entry_content || 
+                                               strlen($entry_content) < strlen($item["description"])) {
+                                                       $entry_content = $item["description"];
+                                       };
 
                                        // WTF
                                        if (is_array($entry_content)) {
                                        }
 
                                } else {
+                                       // <enclosure>
+
                                        $e_ctr = $item['enclosure#'];
 
                                        if ($e_ctr > 0) {
                                                }
                                        }
 
+                                       // <media:content>
+                                       // can there be many of those? -fox
+
+                                       $m_ctr = $item['media']['content#'];
+
+                                       if ($m_ctr > 0) {
+                                               $e_item = array($item['media']['content@url'],
+                                                       $item['media']['content@medium'],
+                                                       $item['media']['content@length']);
+
+                                               array_push($enclosures, $e_item);
+                                       }
+
+                                       // FIXME: parse more of those, if needed.
                                }
 
                                # sanitize content