You are not logged in.
Well, more like a wish list, really. In my .conkyrc file, I pull an rss feed of headlines from BBC News:
${image /home/walt/1a_accuweather_conkyweather_font/bbc.png -p 0,700}${color1}${font Cantarell:Bold:size=12} Headlines ${hr 2}
${color1}${font Cantarell:Bold:size=9}${voffset 10}${rss http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml 2 item_titles 5}
There are two things I'd like to be able to do, if possible. The first is to make longer headlines wrap so they don't cut off parts of a word or words. I read about the 'fold' command, but that doesn't seem to work for rss feeds, unless I was doing something wrong, which is entirely possible (and probably likely).
The second thing I'd like to be able to do and something that is likely way over my head and way out of my league is to be able to click on a headline and have it take me to the corresponding story on the BBC News website. Is that possible? I'm guessing that even if it is possible, there probably is not an easy way to accomplish this.
Regardless, thanks already for all the help. Thanks to the suggestions and coding advice received in my previous cry for help, my Conky hasn't frozen in several hoursa.
Last edited by WaltH (2016-08-29 15:07:32)
Offline
The way I accomplished the folding was to parse the output through fmt. I do not have any clicky setups for my conky at this point, however. bl-rss is a python script I use to pull and parse the atom feed, which I then pipe into fmt.
#! /bin/bash
$HOME/bin/bl-rss | fmt -t -w 70
exit 0
Offline
The way I accomplished the folding was to parse the output through fmt. I do not have any clicky setups for my conky at this point, however. bl-rss is a python script I use to pull and parse the atom feed, which I then pipe into fmt.
#! /bin/bash $HOME/bin/bl-rss | fmt -t -w 70 exit 0
While I know what Python is, most coding and scripting is way over my head. (So of course I chose to run Linux and run Conky 1.10 ).Is this script available somewhere, and would it "easily" modified to work with my BBC rss feed? I guess I would also need to know how to get that output into Conky. Or does the code you posted go into the .conkyrc file and serve that exact purpose?
Offline
You can find the scripts here:
However, at present the script is nowhere near perfect as parsing output of these forums alone is a non-trivial task, given its international base, along with the fact that conky scripts in code tags nearly always break formatting. The scripts are setup to go into ~/bin and the conky goes into ~/.config/conky. At present this script is only setup to parse BunsenLabs atom feeds and would need modification to parse anything different. The script does have one dependency, feedparser which is available in the Debian repos. It is definitely not yet a complete solution, however. This is the line you would need to place with the link to your BBC feed:
bunsen_labs_url = "https://forums.bunsenlabs.org/extern.php?action=feed&type=atom"
EDIT: Don't change the variable name, just the url, so leave the bunsen_labs_url part alone or the program will break.
You can also do some basic color formatting with the variables color_1 and color_2, define horizontal rule thickness and also most important the number of posts to show. By default, I have set it up to to only show the first 255 characters of a post. It will clip any overflow. Also, in run-rss, where you see the 70, you can define your column width there, It may take some tinkering to get it to look right as we are going from pixels to characters (from conky into fmt). The width I specified in my .conkyrc should work in most cases. Occasionally, the conky window will get a bit wider.
If it breaks, you get to keep all the pieces As I said, it is a fairly rough draft and is definitely one of those programs I need to go back and do some more work on.
EDIT II: Changed post to reflect proper name of dependency on feedparser.
Last edited by tknomanzr (2016-08-22 12:04:26)
Offline
Okay. Thanks. I'll take a look at it and see if I can understand enough to make it work for me. Thanks again.
Offline
WaltH, i'd like to add some general explanation:
- conky itself does not provide clickability. there have been attempts, but you have to search through some of the conky threads here and on crunchbang forums.
- you cannot pipe the output of a conky command to a shell command (as i think you attempted with "fold"). so what you do is, you disregard conky's inbuilt rss function, and create some sort of external script that produces the desired result, and call that with one of these conky functions:
${exec somescript}
${execi somescript}
${execp somescript}
${execpi somescript}
please have a look at conky's documentation for variables:
http://conky.sourceforge.net/variables.html
(warning: i think this part applies 100% even to conky 1.10)
-= Mod edit as a courtesy to ohnonot's post - dated: Mon 22 Aug 2016 08:37:54 =-
Tested with conky v1.10 - it does apply.
Also: At this time the link provided at sourceforge.net reflects the variables for conky v1.90
Easiest way to tell: check for "pre_exec" - if it is there, it's for conky v1.90, this command does not exist in conky 1.10.
Man page for conky 1.10:
pop3_used (args)
Displays the amount of space (in MiB, 2^20) used in your global POP3 inbox by default. You can
define individual POP3 inboxes separately by passing arguments to this object. Arguments are:
"host user pass [-i interval (in seconds)] [-p port] [-e 'command'] [-r retries]". Default port
is 110, default interval is 5 minutes, and default number of retries before giving up is 5. If
the password is supplied as '*', you will be prompted to enter the password when Conky starts.
processes
Total processes (sleeping and running)
man page for conky v1.90
pop3_used (args)
Displays the amount of space (in MiB, 2^20) used in your global POP3 inbox by default. You can
define individual POP3 inboxes separately by passing arguments to this object. Arguments are:
"host user pass [-i interval (in seconds)] [-p port] [-e 'command'] [-r retries]". Default port
is 110, default interval is 5 minutes, and default number of retries before giving up is 5. If
the password is supplied as '*', you will be prompted to enter the password when Conky starts.
pre_exec shell command
Executes a shell command one time before conky displays anything and puts output as text.
processes
Total processes (sleeping and running)
Best to check the man page locally. I created them here as text files as I answer questions for both:
/home/sector11/man.conky.v1.9.txt
/home/sector11/man.conky.v10.txt
man conky > man.conky.<ver>.txt
@ohnonot - sorry for the intrusion.
Last edited by Sector11 (2016-08-22 11:42:30)
Offline
@tknomanzr - I can't find "feedreader" in the repos.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
#! Linux Archived Forums: Index » Tips, Tricks & Scripts » interactive conky
47 pages - using LUA
ohnonot is right, interactivity is NOT native to conky but mrpeachy was making great headway with "clickable conkys" via lua scripts.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
^ So sorry. I listed the package wrong. It should be feedparser.
Offline
I did actually look through *all* 47 pages of the interactive conky thread, and while I could tell some impressive things were being done, I felt a bit as if I had walked into a convention on another planet as the only English speaker. From scanning those pages, I did manage to gather that people were making Conky do things it was not initially designed to do, which gave me hope.
I will read through the man pages for Conky again. I'll also take a look at making and calling some external script as suggested by ohnonot and tknomanzr. I think with regard to Conky, my eyes are bigger that my stomach, as it were, in that I want to make it do more than I am capable at present of making it do.
Offline
Don't see that either. ?? Not my day.
unless you mean:
22 Aug 16 @ 09:09:43 ~
$ ser feed
alias ser = aptitude search
{snip}
p php-horde-feed - Horde Feed libraries
p python-feed - set of Python modules for working with syndication feeds
p python-feedgenerator - Syndication feed generation library
p python-feedparser - Universal Feed Parser for Python
p python-feedvalidator - library and tool for validating syndication feeds
p python3-feedparser - Universal Feed Parser for Python 3
p ruby-feedparser - Ruby library to parse ATOM/RSS feeds
22 Aug 16 @ 09:10:06 ~
$
python-feedparser
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
EDIT: Don't change the variable name, just the url, so leave the bunsen_labs_url part alone or the program will break.
In looking through your bl-rss script, it looks like I *could* change the "bunsen_labs_url" to something else as long as I change both of the instances throughout the script to reflect the new name. Would that work?
Offline
I felt a bit as if I had walked into a convention on another planet as the only English speaker.
That describes me to a T in so many ways. mrpeachy and falldown worked magic in there.
I will read through the man pages for Conky again. I'll also take a look at making and calling some external script as suggested by ohnonot and tknomanzr. I think with regard to Conky, my eyes are bigger that my stomach, as it were, in that I want to make it do more than I am capable at present of making it do.
Did a search of my /media/5/Conky/scripts directory for anything rss and found a couple of scripts:
curl-rss.sh
# RSS Feed Display Script by Hellf[i]re v0.1
#
# This script is designed for most any RSS Feed. As some feeds may not be
# completely compliant, it may need a bit of tweaking
#
# This script depends on curl.
# Gentoo: emerge -av net-misc/curl
# Debian: apt-get install curl
# Homepage: http://curl.haxx.se/
#
# Usage:
# .conkyrc: ${execi [time] /path/to/script/conky-rss.sh}
#
# Usage Example
# ${execi 300 /home/youruser/scripts/conky-rss.sh}
#RSS Setup
URI=http://www.nasa.gov/rss/image_of_the_day.rss #URI of RSS Feed
LINES=5 #Number of headlines
#Environment Setup
EXEC="/usr/bin/curl -s" #Path to curl
#Work Start
$EXEC $URI | grep title |\
sed -e :a -e 's/<[^>]*>//g;/</N' |\
sed -e 's/[ \t]*//' |\
sed -e 's/\(.*\)/ \1/' |\
sed -e 's/\.//' |\
sed -e 's/\"//' |\
sed -e 's/\"//' |\
head -n $(($LINES + 2)) |\
tail -n $(($LINES))
and: simple-rss-reader-v3.pl
#!/usr/bin/perl -w
############################
# Creator: Jeff Israel
#
# Script: ./simple-rss-reader-v3.pl
# Version: 3.001
#
# Coded for for Wikihowto http://howto.wikia.com
#
# Description: This code downloads an RSS feed,
# extracts the <title> lines,
# cleans them up lines,
# prints the pretty lines
# exits on max-lines
# Usage:
# .conkyrc: ${execi [time] /path/to/script/simple-rss-reader-v3.pl}
#
# Usage Example
# ${execi 300 /path/to/script/simple-rss-reader-v3.pl}
#
use LWP::Simple;
############################
# Configs
#
#$rssPage = "http://tvrss.net/feed/combined/";
#$rssPage = "http://tvrss.net/feed/eztv/";
$rssPage = "http://www.nasa.gov/rss/image_of_the_day.rss";
$numLines = 10;
$maxTitleLenght = 35;
###########################
# Code
#
# Downloading RSS feed
my $pageCont = get($rssPage);
# Spliting the page to lines
@pageLines = split(/\n/,$pageCont);
# Parse each line, strip no-fun data, exit on max-lines
$numLines--; #correcting count for loop
$x = 0;
foreach $line (@pageLines) {
if($line =~ /\<title\>/){ # Is a good line?
#print "- $line\n";
$lineCat = $line;
$lineCat =~ s/.*\<title\>//;
$lineCat =~ s/\<\/title\>.*//;
$lineCat =~ s/\[.{4,25}\]$//; # strip no-fun data ( [from blaaa] )
$lineCat = substr($lineCat, 0, $maxTitleLenght);
print "- $lineCat \n";
$x++;
}
if($x > $numLines) {
last; #exit on max-lines
}
}
#print $page;
#print "\nBy Bye\n";
to give you some samples.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
WaltH wrote:I felt a bit as if I had walked into a convention on another planet as the only English speaker.
That describes me to a T in so many ways. mrpeachy and falldown worked magic in there.
WaltH wrote:I will read through the man pages for Conky again. I'll also take a look at making and calling some external script as suggested by ohnonot and tknomanzr. I think with regard to Conky, my eyes are bigger that my stomach, as it were, in that I want to make it do more than I am capable at present of making it do.
Did a search of my /media/5/Conky/scripts directory for anything rss and found a couple of scripts:
curl-rss.sh
# RSS Feed Display Script by Hellf[i]re v0.1 # # This script is designed for most any RSS Feed. As some feeds may not be # completely compliant, it may need a bit of tweaking # # This script depends on curl. # Gentoo: emerge -av net-misc/curl # Debian: apt-get install curl # Homepage: http://curl.haxx.se/ # # Usage: # .conkyrc: ${execi [time] /path/to/script/conky-rss.sh} # # Usage Example # ${execi 300 /home/youruser/scripts/conky-rss.sh} #RSS Setup URI=http://www.nasa.gov/rss/image_of_the_day.rss #URI of RSS Feed LINES=5 #Number of headlines #Environment Setup EXEC="/usr/bin/curl -s" #Path to curl #Work Start $EXEC $URI | grep title |\ sed -e :a -e 's/<[^>]*>//g;/</N' |\ sed -e 's/[ \t]*//' |\ sed -e 's/\(.*\)/ \1/' |\ sed -e 's/\.//' |\ sed -e 's/\"//' |\ sed -e 's/\"//' |\ head -n $(($LINES + 2)) |\ tail -n $(($LINES))
and: simple-rss-reader-v3.pl
#!/usr/bin/perl -w ############################ # Creator: Jeff Israel # # Script: ./simple-rss-reader-v3.pl # Version: 3.001 # # Coded for for Wikihowto http://howto.wikia.com # # Description: This code downloads an RSS feed, # extracts the <title> lines, # cleans them up lines, # prints the pretty lines # exits on max-lines # Usage: # .conkyrc: ${execi [time] /path/to/script/simple-rss-reader-v3.pl} # # Usage Example # ${execi 300 /path/to/script/simple-rss-reader-v3.pl} # use LWP::Simple; ############################ # Configs # #$rssPage = "http://tvrss.net/feed/combined/"; #$rssPage = "http://tvrss.net/feed/eztv/"; $rssPage = "http://www.nasa.gov/rss/image_of_the_day.rss"; $numLines = 10; $maxTitleLenght = 35; ########################### # Code # # Downloading RSS feed my $pageCont = get($rssPage); # Spliting the page to lines @pageLines = split(/\n/,$pageCont); # Parse each line, strip no-fun data, exit on max-lines $numLines--; #correcting count for loop $x = 0; foreach $line (@pageLines) { if($line =~ /\<title\>/){ # Is a good line? #print "- $line\n"; $lineCat = $line; $lineCat =~ s/.*\<title\>//; $lineCat =~ s/\<\/title\>.*//; $lineCat =~ s/\[.{4,25}\]$//; # strip no-fun data ( [from blaaa] ) $lineCat = substr($lineCat, 0, $maxTitleLenght); print "- $lineCat \n"; $x++; } if($x > $numLines) { last; #exit on max-lines } } #print $page; #print "\nBy Bye\n";
to give you some samples.
Thanks. I'll take a look at these and see if I can make heads or tails of them. Right now, I have an injured beagle to tend to.
Offline
While I'm dreaming big things, I was struck by the wild idea of being able to display my Google Calendar (or more specifically the tasks and appointments for a given day) in Conky. Has anyone heard of anything close to that being done?
Offline
^ Yes, it's been done. I think you need the gcalcli (google calendar command line) which is in the repos so you can install it with apt. It's a command line interface for accessing google calendar in a terminal. Should be able to run the appropriate command in conky to get the output. Never actually done it myself.
You must unlearn what you have learned.
-- yoda
Offline
^ Yes, it's been done. I think you need the gcalcli (google calendar command line) which is in the repos so you can install it with apt. It's a command line interface for accessing google calendar in a terminal. Should be able to run the appropriate command in conky to get the output. Never actually done it myself.
Have it installed. Now to figure out how to incorporate the output. Thanks.
Offline
^ Yes, it's been done. I think you need the gcalcli (google calendar command line) which is in the repos so you can install it with apt. It's a command line interface for accessing google calendar in a terminal. Should be able to run the appropriate command in conky to get the output. Never actually done it myself.
Okay, I have my Google Calendar agenda inported into Conky. I need to play with the file to see if I can tweak the colors of the displayed information so they fit fit my overall Conky theme.
Offline
Okay, I have my Google Calendar agenda inported into Conky. I need to play with the file to see if I can tweak the colors of the displayed information so they fit fit my overall Conky theme.
Would you mind sharing your code and perhaps a screenshot?
I'm sure other forum users would be interested
In fact, we have a whole thread for just for that:
https://forums.bunsenlabs.org/viewtopic.php?id=512
Also, if you consider your problems to be resolved please add [SOLVED] to the thread title.
Offline
Don't see that either. ?? Not my day.
unless you mean:
22 Aug 16 @ 09:09:43 ~ $ ser feed alias ser = aptitude search {snip} p php-horde-feed - Horde Feed libraries p python-feed - set of Python modules for working with syndication feeds p python-feedgenerator - Syndication feed generation library p python-feedparser - Universal Feed Parser for Python p python-feedvalidator - library and tool for validating syndication feeds p python3-feedparser - Universal Feed Parser for Python 3 p ruby-feedparser - Ruby library to parse ATOM/RSS feeds 22 Aug 16 @ 09:10:06 ~ $
python-feedparser
p python-feedparser - Universal Feed Parser for Python
^ It's that one. I don't know why that package name is giving me so much trouble. I need to sit down and re-write this into a proper tool. ATM, it is a mish-mash that I got working just good enough to say it's a passable first draft. NEED MOAR TIME! 8)
Offline