Larger Dilbert image plugin

Post plugins and custom CSS snippets here
amha
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 16 Mar 2013, 12:30

Larger Dilbert image plugin

Postby amha » 17 Apr 2013, 18:00

Due to change in the dilbert feed, this plugin is now obsolete. However fox made a nice plugin that will solve this inconvenience : af_dilbert, which comes with tt-rss since 1.9.



Replace smaller (print) version with the largest (zoom) version of the Dilbert Daily Strip.
I used to have a Greasemonkey script to do that, but I find it better handled by TT-RSS.
Enjoy!
Attachments
dilbert_large.zip
Version 1.06
(871 Bytes) Downloaded 380 times
Last edited by amha on 21 Jul 2013, 15:18, edited 10 times in total.

amha
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 16 Mar 2013, 12:30

Re: Larger Dilbert image plugin

Postby amha » 19 Apr 2013, 16:42

Version 1.01: remove $link for compliance with TT-RSS version 1.7.9 (works with 1.7.8 too).

jmozmoz
Bear Rating Trainee
Bear Rating Trainee
Posts: 26
Joined: 14 Apr 2013, 18:07

Re: Larger Dilbert image plugin

Postby jmozmoz » 19 Apr 2013, 19:05

I unzip the archive in the plugins directory but the plugin does not show up in the preferences (github HEAD version of tt-rss): This is in the sytem/log window:

Code: Select all

E_USER_WARNING (512)   classes/pluginhost.php:139   Plugin dilbert_large is not compatible with current API version (need: 2, got: 1)

You have to add

Code: Select all

        function api_version() {
                return 2;
        }

amha
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 16 Mar 2013, 12:30

Re: Larger Dilbert image plugin

Postby amha » 19 Apr 2013, 19:25

Thank you for pointing that out. As I'm currently using the stable 1.7.8 I didn't catch that.

Version 1.02: added api_version().

Napkin
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 29 Mar 2013, 01:07

Re: Larger Dilbert image plugin

Postby Napkin » 19 Apr 2013, 23:38

It's not working for me, I think: The image from April 19th, 2013 has a size of 560x174 when looked at in the reader. Looking at the website the image is 640x199.

Is it maybe caused by the fact that I configured the feed to "Cache images locally"?
Last edited by Napkin on 20 Apr 2013, 12:54, edited 1 time in total.

Rundfunk
Bear Rating Trainee
Bear Rating Trainee
Posts: 10
Joined: 19 Mar 2013, 17:00

Re: Larger Dilbert image plugin

Postby Rundfunk » 20 Apr 2013, 00:57

As an avid Dilbert reader, I applaud this plugin. However, it also does not work for me. (I'm using the official Dilbert RSS feed btw)

I get the following image in my TT-RSS: http://dilbert.com/dyn/str_strip/000000 ... .strip.gif , while the bigger image can be found at: http://dilbert.com/dyn/str_strip/000000 ... p.zoom.gif

craywolf
Mr. Awesome
Posts: 97
Joined: 19 Mar 2013, 18:07

Re: Larger Dilbert image plugin

Postby craywolf » 20 Apr 2013, 01:17

Until the author provides a fix, you can open up init.php and replace this line:

Code: Select all

      $article['content'] = str_replace('.strip.print.gif', '.strip.gif', $article['content']);


With this:

Code: Select all

      $article['content'] = str_replace('.strip.print.gif', '.strip.zoom.gif', $article['content']);


It looks like strip.gif is in fact bigger than strip.print.gif but not by a lot. The zoom version is plenty big.

amha
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 16 Mar 2013, 12:30

Re: Larger Dilbert image plugin

Postby amha » 20 Apr 2013, 10:08

For years I was only getting the average size pictures… Thanks!

Version 1.03: even bigger Dilbert.

amha
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 16 Mar 2013, 12:30

Re: Larger Dilbert image plugin

Postby amha » 20 Apr 2013, 12:03

Version 1.04: tiny modification to the description.

No need to update if you're using 1.03.

Napkin
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 29 Mar 2013, 01:07

Re: Larger Dilbert image plugin

Postby Napkin » 20 Apr 2013, 13:10

Hmm, I'm wondering how this works for you guys? Maybe we're using different feeds? On dilbert.com when I click "RSS" and choose "Strips" I'm offered this feed: http://feed.dilbert.com/dilbert/daily_strip?format=xml

I looked at the articles in the ttrss SQL database and none of Dilbert's articles had the string "DilbertDailyStrip" in it's link attribute - as searched for in hook_render_article_cdm(). My articles of Dilbert have something like this:

Code: Select all

http://feed.dilbert.com/~r/dilbert/daily_strip/~3/qe5dKS2UpTw/

I changed the plugin as below (and disable caching of the images locally) to make it work here.

Code: Select all

--- /usr/local/src/tt-rss/dilbert_large/init.php   2013-04-20 10:00:36.000000000 +0200
+++ init.php   2013-04-20 10:49:49.831741467 +0200
@@ -35,7 +35,7 @@
   }
 
   function hook_render_article_cdm($article) {
-    if (strpos($article['link'], 'DilbertDailyStrip') !== FALSE) {
+    if (strpos($article['link'], 'feed.dilbert.com') !== FALSE) {
       $article['content'] = str_replace('.strip.print.gif', '.strip.zoom.gif', $article['content']);
     }
     return $article;

amha
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 16 Mar 2013, 12:30

Re: Larger Dilbert image plugin

Postby amha » 20 Apr 2013, 20:28

@Napkin

You're right. I'm not using the official feed directly but the one from feedburner, provided years ago by dilbert.com.

The feeds urls:

Code: Select all

http://feed.dilbert.com/dilbert/daily_strip

Code: Select all

http://feeds.feedburner.com/DilbertDailyStrip


The links:

Code: Select all

http://feed.dilbert.com/~r/dilbert/daily_strip/~3/qe5dKS2UpTw/

Code: Select all

http://feedproxy.google.com/~r/DilbertDailyStrip/~3/qe5dKS2UpTw/


If everyone is confortable with it I propose a simple:

Code: Select all

if (strpos($article['link'], 'DilbertDailyStrip') !== FALSE || strpos($article['link'], 'dilbert/daily_strip') !== FALSE)

amha
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 16 Mar 2013, 12:30

Re: Larger Dilbert image plugin

Postby amha » 20 Apr 2013, 20:39

Version 1.05: handle both the official feed and the feedburner one.

Napkin
Bear Rating Trainee
Bear Rating Trainee
Posts: 21
Joined: 29 Mar 2013, 01:07

Re: Larger Dilbert image plugin

Postby Napkin » 21 Apr 2013, 12:44

Ah, great, thank you!

entaled
Bear Rating Trainee
Bear Rating Trainee
Posts: 2
Joined: 08 Apr 2013, 19:03

Re: Larger Dilbert image plugin

Postby entaled » 24 Apr 2013, 11:38

Using this feed:

Code: Select all

http://feed.dilbert.com/dilbert/daily_strip

which I believe is the listed official feed, the images were not being replaced. I dug into the db and my 'link' entries look like this:

Code: Select all

http://dilbert.com/strips/comic/2013-04-24/

so I replaced

Code: Select all

if (strpos($article['link'], 'DilbertDailyStrip') !== FALSE || strpos($article['link'], 'dilbert/daily_strip') !== FALSE) {

with

Code: Select all

if (strpos($article['link'], 'DilbertDailyStrip') !== FALSE || strpos($article['link'], 'dilbert') !== FALSE) {

which I know isn't likely the best or most robust solution, but it's working for me. It could be some other plugin changing the links, I tried disabling af_unburn but that didn't change anything. I'm not sure what's doing it.

amha
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 16 Mar 2013, 12:30

Re: Larger Dilbert image plugin

Postby amha » 24 Apr 2013, 15:02

Hi entaled,

I'm quite surprised. Looking at the feed itself I can see 3 values that could be interpreted as link:

Code: Select all

<link>http://feed.dilbert.com/~r/dilbert/daily_strip/~3/0yECkz9IKd8/</link>
<guid isPermaLink="false"><![CDATA[http://dilbert.com/strips/comic/2013-04-24/]]></guid>
<feedburner:origLink>http://dilbert.com/strips/comic/2013-04-24/</feedburner:origLink>


I thought the first one was the one. I tried to add this feed but it seems it mixed with the one I already have.
I deleted both from my feeds list and I'll see tomorow how it goes.


Return to “Themes and plugins”

Who is online

Users browsing this forum: No registered users and 0 guests