LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-04-2016, 03:01 PM   #1
daveoxford
LQ Newbie
 
Registered: Oct 2016
Location: Oxford, UK
Distribution: bunsenlabs
Posts: 8

Rep: Reputation: Disabled
Conky help - image with spaces in path


Hope this is the right forum for this!

I am trying to include album art in Conky. How can I use paths with spaces in them in ${image ...}?

I am getting the data from dbus (from gmusicbrowser) in a perl script.

Can anybody help?

Dave
 
Old 10-04-2016, 03:05 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,237

Rep: Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657
Either rename your directories to not have spaces - "/home/music/the_new_album/the_pics" or whatever.

Or try escaping the spaces:

${image /home/music/the\ new\ album/the\ pics}
 
1 members found this post helpful.
Old 10-04-2016, 03:10 PM   #3
daveoxford
LQ Newbie
 
Registered: Oct 2016
Location: Oxford, UK
Distribution: bunsenlabs
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks for the quick reply.

I've just tried escaping the spaces, but it doesn't work.

(Renaming everything would be a mammoth task!)
 
Old 10-04-2016, 03:11 PM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,237

Rep: Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657
Maybe in quotes?

${image "/home/music/the\ new\ album/the\ pics"}
or
${image "/home/music/the new album/the pics"}
 
Old 10-04-2016, 03:16 PM   #5
daveoxford
LQ Newbie
 
Registered: Oct 2016
Location: Oxford, UK
Distribution: bunsenlabs
Posts: 8

Original Poster
Rep: Reputation: Disabled
Tried that with " and ', and still nothing. (Putting " or ' round it doesn't even work on paths with no spaces.)

I can't find anything on the web about it, so I suspect I'm missing something really obvious.
 
Old 10-04-2016, 03:23 PM   #6
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
You can use a script to replace spaces with underscores.
 
Old 10-04-2016, 03:29 PM   #7
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,237

Rep: Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657
Quote:
Originally Posted by daveoxford View Post
Tried that with " and ', and still nothing. (Putting " or ' round it doesn't even work on paths with no spaces.)

I can't find anything on the web about it, so I suspect I'm missing something really obvious.

Unfortunately There are other people that have described the issue, but no answers:

https://bbs.archlinux.org/viewtopic....76067#p1576067
http://superuser.com/questions/92980...-configuration
 
Old 10-04-2016, 03:33 PM   #8
daveoxford
LQ Newbie
 
Registered: Oct 2016
Location: Oxford, UK
Distribution: bunsenlabs
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks - you found some references, which is more than I could!

I may try copying to a temp file in the perl script with no spaces if the name has changed since the last call.
 
1 members found this post helpful.
Old 10-04-2016, 03:34 PM   #9
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,237

Rep: Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657Reputation: 1657
Right on. Maybe share that when you have it written - so the next person that scours the internet may find a workable answer.
 
Old 10-04-2016, 03:52 PM   #10
daveoxford
LQ Newbie
 
Registered: Oct 2016
Location: Oxford, UK
Distribution: bunsenlabs
Posts: 8

Original Poster
Rep: Reputation: Disabled
Will do!
 
Old 10-04-2016, 04:19 PM   #11
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 417

Rep: Reputation: 74
Quote:
Originally Posted by daveoxford View Post
Tried that with " and ', and still nothing. (Putting " or ' round it doesn't even work on paths with no spaces.)

I can't find anything on the web about it, so I suspect I'm missing something really obvious.
There's no reason quoting would not work. Remember that when quoting with single (or double quote), you don't escape the space itself, contrary to what you would do if not quoting, such as:

Code:
ls -l 'filename with space'

Last edited by c0wb0y; 10-04-2016 at 04:19 PM. Reason: .
 
Old 10-04-2016, 04:42 PM   #12
daveoxford
LQ Newbie
 
Registered: Oct 2016
Location: Oxford, UK
Distribution: bunsenlabs
Posts: 8

Original Poster
Rep: Reputation: Disabled
It doesn't work within ${image} in Conky.
 
Old 10-04-2016, 04:56 PM   #13
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 417

Rep: Reputation: 74
Quote:
Originally Posted by daveoxford View Post
It doesn't work within ${image} in Conky.
I'm a bit confused here. ${image} is a variable. Do you want to append/assign the filenames_with_spaces to it?

Last edited by c0wb0y; 10-04-2016 at 04:56 PM. Reason: .
 
Old 10-04-2016, 05:02 PM   #14
daveoxford
LQ Newbie
 
Registered: Oct 2016
Location: Oxford, UK
Distribution: bunsenlabs
Posts: 8

Original Poster
Rep: Reputation: Disabled
I've got a working workaround.

In perl script:

Code:
use File::Copy;

...

open (FILE, '<', '/home/david/bin/albumtmp.txt'); 
my $line = <FILE>; 
close (FILE);
if ($info->{album_picture} ne $line) { 
	print $info->{album_picture};
	copy($info->{album_picture}, "/home/david/bin/albumtmp.jpg");
	open (FILE, '>/home/david/bin/albumtmp.txt'); 
	print FILE $info->{album_picture}; 
	close (FILE);
}
I'd prefer to save the file name in an environment variable, but the script runs in its own shell of course.
Is there an easy way to set environment variables for the main bash shell?
 
Old 10-04-2016, 05:04 PM   #15
daveoxford
LQ Newbie
 
Registered: Oct 2016
Location: Oxford, UK
Distribution: bunsenlabs
Posts: 8

Original Poster
Rep: Reputation: Disabled
I meant ${image pathtofile ....}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with conky and path please linuxmarble Linux - Software 5 08-31-2014 02:10 PM
java applet not loading image with relative path but loads image with absolute path amolgupta Programming 2 07-20-2009 01:58 PM
passing variable (a path) with spaces aolong Linux - General 2 06-28-2009 05:50 PM
samba: getting directories with spaces in its path genmaicha Linux - Software 1 06-02-2009 08:48 PM
makefiles with spaces in path teuf Programming 7 08-30-2007 03:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration