LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Conky help - image with spaces in path (https://www.linuxquestions.org/questions/linux-software-2/conky-help-image-with-spaces-in-path-4175590764/)

daveoxford 10-04-2016 03:01 PM

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

szboardstretcher 10-04-2016 03:05 PM

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}

daveoxford 10-04-2016 03:10 PM

Thanks for the quick reply.

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

(Renaming everything would be a mammoth task!)

szboardstretcher 10-04-2016 03:11 PM

Maybe in quotes?

${image "/home/music/the\ new\ album/the\ pics"}
or
${image "/home/music/the new album/the pics"}

daveoxford 10-04-2016 03:16 PM

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.

Emerson 10-04-2016 03:23 PM

You can use a script to replace spaces with underscores.

szboardstretcher 10-04-2016 03:29 PM

Quote:

Originally Posted by daveoxford (Post 5613892)
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

daveoxford 10-04-2016 03:33 PM

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.

szboardstretcher 10-04-2016 03:34 PM

Right on. Maybe share that when you have it written - so the next person that scours the internet may find a workable answer.

daveoxford 10-04-2016 03:52 PM

Will do! :)

c0wb0y 10-04-2016 04:19 PM

Quote:

Originally Posted by daveoxford (Post 5613892)
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'

daveoxford 10-04-2016 04:42 PM

It doesn't work within ${image} in Conky.

c0wb0y 10-04-2016 04:56 PM

Quote:

Originally Posted by daveoxford (Post 5613937)
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?

daveoxford 10-04-2016 05:02 PM

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?

daveoxford 10-04-2016 05:04 PM

I meant ${image pathtofile ....}


All times are GMT -5. The time now is 10:52 AM.