必应图片作为桌面壁纸?


28

谁能帮我解决如何将Bing Picture制作到我的桌面墙纸吗?

  • 因此,它可以通过下载当今图片的最高质量来工作。
  • 然后将其存储在您帐户的“图片”文件夹中。
  • 之后,自动更改图片本身。
  • 它应该每天都继续进行,而不会在后台出现麻烦。
  • 可能我必须在启动应用程序中添加一些内容。
  • Ubuntu版本之间有什么区别?

-我需要写脚本吗?许多其他人也将不胜感激!先感谢您 :)


即使我很想用这个,但我相信它不可能..
Sukupa91

thejandroman.github.io/bing-wallpaper能解决吗?我个人没有使用它。
尼迪奇

我以前尝试过上面的链接,并提供了来自github @nitish的说明。但是它没有用,所以我正在尝试寻找其他解决方案。我收到有关与GitHubs服务器的连接失败的错误。该说明在不易遵循接地的地方。OMGUbuntu也有一个方法手册,但是即使这样也失败了
Amir Shahab

Answers:


21

可能最简单的方法是安装各种工具。它是墙纸管理员,确实可以出色地以所需频率更改墙纸。

以下是其一些设置:

  • 下载频率
  • 更改映像的频率(每天一次,每次重新启动,每分钟等等)
  • 您要从中下载图像的位置
  • 您要将它们存储在计算机上的位置
  • 引号(自动或来源)
  • 一个不错的时钟。

还有一个设置可以在登录时运行它。如果启用了该选项,然后添加日期网址(http://www.bing.com/images/search?q=picture+of+the+day&qpvt=picture+of+the+day&FORM=IGRE?)的必应图像,则一切就绪。

可以在软件中心中找到它,并且它的评级为5 *!

以下是一些屏幕截图:

在此处输入图片说明 在此处输入图片说明 在此处输入图片说明


1
14.04不存在品种。
Agoston Horvath 2014年


可在16.04上使用,但是GTK制作的GTK可以很好地与KDE一起使用。
夸德佩珀

综艺节目现在有一个内置选项,可以选择“每日Bing照片”。
Sandeep C

15

我写了一个小节点脚本来做到这一点:https : //github.com/dorian-marchal/bing-daily-wallpaper

要安装它,您需要nodejs:

sudo apt-get install nodejs npm

安装方式:

在命令行中,运行:

sudo npm install -g bing-daily-wallpaper

用法:

要更改墙纸,请执行以下操作(您可以将此命令添加到启动应用中):

bing-daily-wallpaper

不错,这是一个对我来说适用于Ubuntu 15的简单解决方案
Jon Onstott

我按照上述步骤操作,但在使用时 遇到了错误paper96@localhost:~$ bing-daily-wallpaper /usr/bin/env: ‘node’: No such file or directory @Dorian,您能告诉我怎么了
Pankaj Gautam,

@PankajGautam的原因是,在更新的ubuntu版本中,执行apt-get install nodejs节点可执行文件实际上nodejs不是,node因此,如果您编辑脚本sudo vim /usr/local/bin/bing-daily-wallpaper,则可以将第一行替换为该行nodenodejs并且效果很好。
0x7c0

8

不久前,我找到了以下脚本(我不记得现在的确切位置,但是当我找到时,我还将添加源代码)我对它进行了少许更改,并且对您所询问的内容非常有用设置为cron作业(请参阅此处的操作方法):

#!/bin/bash

# export DBUS_SESSION_BUS_ADDRESS environment variable useful when the script is set as a cron job
PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)


# $bing is needed to form the fully qualified URL for
# the Bing pic of the day
bing="www.bing.com"

# $xmlURL is needed to get the xml data from which
# the relative URL for the Bing pic of the day is extracted
#
# The mkt parameter determines which Bing market you would like to
# obtain your images from.
# Valid values are: en-US, zh-CN, ja-JP, en-AU, en-UK, de-DE, en-NZ, en-CA.
#
# The idx parameter determines where to start from. 0 is the current day,
# 1 the previous day, etc.
xmlURL="http://www.bing.com/HPImageArchive.aspx?format=xml&idx=1&n=1&mkt=en-US"

# $saveDir is used to set the location where Bing pics of the day
# are stored.  $HOME holds the path of the current user's home directory
saveDir="$HOME/Pictures/BingDesktopImages/"

# Create saveDir if it does not already exist
mkdir -p $saveDir

# Set picture options
# Valid options are: none,wallpaper,centered,scaled,stretched,zoom,spanned
picOpts="zoom"

# The desired Bing picture resolution to download
# Valid options: "_1024x768" "_1280x720" "_1366x768" "_1920x1200"
desiredPicRes="_1366x768"

# The file extension for the Bing pic
picExt=".jpg"

# Extract the relative URL of the Bing pic of the day from
# the XML data retrieved from xmlURL, form the fully qualified
# URL for the pic of the day, and store it in $picURL

# Form the URL for the desired pic resolution
desiredPicURL=$bing$(echo $(curl -s $xmlURL) | grep -oP "<urlBase>(.*)</urlBase>" | cut -d ">" -f 2 | cut -d "<" -f 1)$desiredPicRes$picExt

# Form the URL for the default pic resolution
defaultPicURL=$bing$(echo $(curl -s $xmlURL) | grep -oP "<url>(.*)</url>" | cut -d ">" -f 2 | cut -d "<" -f 1)

# $picName contains the filename of the Bing pic of the day

# Attempt to download the desired image resolution. If it doesn't
# exist then download the default image resolution
if wget --quiet --spider "$desiredPicURL"
then

    # Set picName to the desired picName
    picName=${desiredPicURL##*/}
    # Download the Bing pic of the day at desired resolution
    curl -s -o $saveDir$picName $desiredPicURL
else
    # Set picName to the default picName
    picName=${defaultPicURL##*/}
    # Download the Bing pic of the day at default resolution
    curl -s -o $saveDir$picName $defaultPicURL
fi

# Set the GNOME3 wallpaper
gsettings set org.gnome.desktop.background picture-uri "file://$saveDir$picName"

# Set the GNOME 3 wallpaper picture options
gsettings set org.gnome.desktop.background picture-options $picOpts

# Remove pictures older than 30 days
#find $saveDir -atime 30 -delete

# Exit the script
exit

在哪里添加当天图片的链接?
speedox 2014年

@speedox我无法理解您的问题...
RaduRădeanu2014年

3

此处列出了一个不错的脚本,该脚本在Ubuntu 14.04上仍然可以很好地运行(需要安装curl):

http://ubuntuforums.org/showthread.php?t=2074098

我将在这里复制最新版本:

#!/bin/bash

# $bing is needed to form the fully qualified URL for
# the Bing pic of the day
bing="www.bing.com"

# $xmlURL is needed to get the xml data from which
# the relative URL for the Bing pic of the day is extracted
#
# The mkt parameter determines which Bing market you would like to
# obtain your images from.
# Valid values are: en-US, zh-CN, ja-JP, en-AU, en-UK, de-DE, en-NZ, en-CA.
#
# The idx parameter determines where to start from. 0 is the current day,
# 1 the previous day, etc.
xmlURL="http://www.bing.com/HPImageArchive.aspx?format=xml&idx=0&n=1&mkt=en-US"

# $saveDir is used to set the location where Bing pics of the day
# are stored.  $HOME holds the path of the current user's home directory
saveDir=$HOME'/Pictures/BingDesktopImages/'

# Create saveDir if it does not already exist
mkdir -p $saveDir

# Set picture options
# Valid options are: none,wallpaper,centered,scaled,stretched,zoom,spanned
picOpts="zoom"

# The desired Bing picture resolution to download
# Valid options: "_1024x768" "_1280x720" "_1366x768" "_1920x1200"
desiredPicRes="_1920x1200"

# The file extension for the Bing pic
picExt=".jpg"

# Extract the relative URL of the Bing pic of the day from
# the XML data retrieved from xmlURL, form the fully qualified
# URL for the pic of the day, and store it in $picURL

# Form the URL for the desired pic resolution
desiredPicURL=$bing$(echo $(curl -s $xmlURL) | grep -oP "<urlBase>(.*)</urlBase>" | cut -d ">" -f 2 | cut -d "<" -f 1)$desiredPicRes$picExt

# Form the URL for the default pic resolution
defaultPicURL=$bing$(echo $(curl -s $xmlURL) | grep -oP "<url>(.*)</url>" | cut -d ">" -f 2 | cut -d "<" -f 1)

# $picName contains the filename of the Bing pic of the day

# Attempt to download the desired image resolution. If it doesn't
# exist then download the default image resolution
if wget --quiet --spider "$desiredPicURL"
then

    # Set picName to the desired picName
    picName=${desiredPicURL##*/}
    # Download the Bing pic of the day at desired resolution
    curl -s -o $saveDir$picName $desiredPicURL
else
    # Set picName to the default picName
    picName=${defaultPicURL##*/}
    # Download the Bing pic of the day at default resolution
    curl -s -o $saveDir$picName $defaultPicURL
fi

# Set the GNOME3 wallpaper
DISPLAY=:0 GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.background picture-uri '"file://'$saveDir$picName'"'

# Set the GNOME 3 wallpaper picture options
DISPLAY=:0 GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.background picture-options $picOpts

# Exit the script
exit

2

我检查了一段时间,似乎正在工作。

#!/bin/bash
cd 
rm ./dodo.html
wget --no-proxy --output-document=dodo.html http://www.bing.com
rm ./dwallpaper.jpg
wget --no-proxy --output-document=dwallpaper `sed -n "s/^.*g_img *= *{ *url:'\([^']*\)'.*$/\1/p" < dodo.html | sed 's/^&quot;\(.*\)&quot;$/\1/' | sed 's/^\/\(.*\)/http:\/\/www.bing.com\/\1/'`
rm ./dodo.html
gsettings set org.gnome.desktop.background picture-uri 'file:///home/YourName/dwallpaper'

如果您使用代理服务器,请--no-proxy从第4行和第6行中删除,并代替YourName,放置主文件夹的名称。

将其另存为一些脚本,使其可执行,然后在希望更新墙纸时执行它。

我不知道如何在启动时安全地执行此操作。添加此来rc.local当我从知道是不是安全这个

如果有任何问题,请发表评论。


如果脚本正在运行(未经测试),则可以每天使用cron作业(或在需要时)执行一次。看看例如askubuntu.com/questions/2368/how-do-i-set-up-cron-job
Rmano 2013年

我认为没有必要每天执行一次以上。此外,在一天中,当建立互联网连接时,仅执行一次。cron工作可以做到吗?我们可以知道何时建立连接吗?
nitishch 2013年

检查Internet连接,下载图像,设置桌面背景以及创建日志以指示当天的工作是待处理还是已完成的所有工作都应由您的脚本处理;而cron将会处理调用脚本根据自己的需要..
精确的

为了更好的可移植性,将最后一行(gsettings set org.gnome.desktop.background picture-uri 'file:///home/YourName/dwallpaper')替换为gsettings set org.gnome.desktop.background picture-uri ` echo "'file:///home/$USER/dwallpaper'" `
totti


0

我搜索了答案,但没有找到,所以我写了一个脚本来设置bing壁纸。这是脚本...

#!/ bin / sh

ping -q -c5 bing.com

如果[$?-eq 0]

然后

wget“ http://www.bing.com/HPImageArchive.aspx?format=rss&idx=0&n=1&mkt=zh-CN” -O bing.txt
img_result = $(grep -o'src =“ [^”] *“'bing.txt | grep -o'/.*.jpg')
wget“ http://www.bing.com” $ img_result
img_name = $(grep -o'src =“ [^”] *“'bing.txt | grep -o'[^ /] *。jpg')
pwdPath = $(pwd)
picPath =“ / home /您的用户名/图片/墙纸”
cp $ pwdPath“ /” $ img_name $ picPath
gsettings设置org.gnome.desktop.background picture-uri“ file://” $ picPath“ /” $ img_name

睡觉10
rm $ img_name
rm bing.txt 
科幻
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.