]> git.wh0rd.org - tt-rss.git/commitdiff
allow caching of audio files
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Thu, 23 Mar 2017 12:03:22 +0000 (15:03 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Thu, 23 Mar 2017 12:03:22 +0000 (15:03 +0300)
include/functions2.php

index 39c7f746b6e0b01d8eb84b46826333b3474c2b75..9d6eb9330f07e385137b6264522a19ec2542f044 100644 (file)
 
                        if ($entry->hasAttribute('src')) {
                                $src = rewrite_relative_url($rewrite_base_url, $entry->getAttribute('src'));
+                               $cached_filename = CACHE_DIR . '/images/' . sha1($src);
 
-                               // check cache only for video and images for the time being
-                               if ($entry->nodeName == 'img' || ($entry->parentNode && $entry->parentNode->nodeName == "video")) {
+                               if (file_exists($cached_filename)) {
+                                       $src = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($src);
 
-                                       $cached_filename = CACHE_DIR . '/images/' . sha1($src);
-                                       $extension = $entry->tagName == 'source' ? '.mp4' : '.png';
-
-                                       if (file_exists($cached_filename)) {
-                                               $src = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($src) . $extension;
-
-                                               if ($entry->hasAttribute('srcset')) {
-                                                       $entry->removeAttribute('srcset');
-                                               }
+                                       if ($entry->hasAttribute('srcset')) {
+                                               $entry->removeAttribute('srcset');
+                                       }
 
-                                               if ($entry->hasAttribute('sizes')) {
-                                                       $entry->removeAttribute('sizes');
-                                               }
+                                       if ($entry->hasAttribute('sizes')) {
+                                               $entry->removeAttribute('sizes');
                                        }
                                }