Cover image as wallpaper

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Cover image as wallpaper

Re: Cover image as wallpaper

by wonda » Mon Sep 12, 2011 10:03 am

This is the script I use. It is very simple and straight forward (I'm not a vbs programmer...), but it works for XP and Win7 32 and 64 bits. It has a switch in the view menu. The first choice is a picture file with a uniform name in the same directory; the second choice is the first picture stored in the tag. The images are blown up to full screen, so they should have a reasonable format.

Code: Select all

' Cover As Wallpaper script v.0.4
' By Wonda Waay, updated 2011-05-11
' 
' This script sets the cover of the current song as wallpaper
' if needed and a picture is available
' enable/disable switch in the view menu.
' In fact the job is done by the splendid program IrfanView
' that has to be installed (http://www.irfanview.com/)

' Tested with MediaMonkey 3.2.5 and Irfanview 4.30
'
' Location: MediaMonkey\Scripts\Auto\CoverAsWallpaper.vbs
'---------------------
Option Explicit

Dim AppTitle : AppTitle = "CoverAsWallpaper"
Dim Version : Version = "0.4"
Dim WallpaperEnabled : WallpaperEnabled = True
Dim MenuItem, PreviousAlbumArtist, PreviousAlbum

' To customize:
' Location where Irfanview has been installed; add (x86) for Win7 64b
Dim Irfanview : Irfanview = "C:\Program Files\IrfanView\i_view32.exe"
' Name of cover picture file (can be left blank to allways use embedded cover)
Dim WallPicName : WallPicName = "Cover.jpg"
' Two temporary files
Dim WallInfo : WallInfo = "C:\Temp\Cover.txt"	' to get Irfanview closed
Dim WallTemp : WallTemp = "C:\Temp\Cover.jpg"	' external copy of embedded image

'---------------------
Sub OnStartup()
   SDB.IniFile.StringValue(AppTitle,"Version") = Version

    If Not SDB.IniFile.ValueExists(AppTitle,"Enabled") Then
       SDB.IniFile.BoolValue(AppTitle,"Enabled") = WallpaperEnabled
    End If
    WallpaperEnabled = SDB.IniFile.BoolValue(AppTitle,"Enabled")

	Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_View,1,8)
    MenuItem.Caption = "Wallpaper"
    Script.RegisterEvent MenuItem, "OnClick", "ToggleWallpaper"
    MenuItem.Visible = True
    MenuItem.Checked = WallpaperEnabled

	PreviousAlbumArtist = PreviousAlbum = ""	' fresh start

	If WallpaperEnabled Then
		Script.RegisterEvent SDB, "OnPlay", "WallpaperRefresh"
	End If
End Sub

Sub ToggleWallpaper(q)
    WallpaperEnabled = Not WallpaperEnabled
    MenuItem.Checked = WallpaperEnabled
    SDB.IniFile.BoolValue(AppTitle,"Enabled") = WallpaperEnabled

    If WallpaperEnabled Then
		Script.RegisterEvent SDB, "OnPlay", "WallpaperRefresh"
		WallpaperRefresh
    Else
        Script.UnregisterEvents SDB
		PreviousAlbumArtist = PreviousAlbum = ""	' fresh start next time
    End If
End Sub

Sub WallpaperRefresh()

	Dim itm, albumartist, album
	Set itm = SDB.Player.CurrentSong
	albumartist = itm.AlbumArtistName
	album = itm.AlbumName

	If albumartist = PreviousAlbumArtist And album = PreviousAlbum Then	 ' same album, same cover
		Exit Sub
	End If

	Dim jpgpath, fso, path, dir, albumart, image, tmpcover
	jpgpath = ""
	Set fso = SDB.Tools.FileSystem  
	If WallPicName <> "" Then	'	separate file in current directory?
		path =  itm.Path
		dir = Left(path,InStrRev(path,"\"))
		jpgpath = dir & WallPicName
		If fso.FileExists(jpgpath) = False Then
			jpgpath = ""
		End If
	End If
	If jpgpath = "" Then	'	now try image in the tag
		Set albumart = itm.AlbumArt 
		If albumart.count > 0 Then	'	is there any image 
			Set image = AlbumArt.Item(0).Image 
			Set tmpcover = fso.CreateTextFile( WallTemp, True) 
			tmpcover.WriteData Image.ImageData, Image.ImageDataLen 
			tmpcover.close 
			jpgpath = WallTemp
		End If
	End If
	Set fso = Nothing

	If jpgpath = "" Then	 '	No cover found: end of story
		Exit Sub
	End If

	Dim winshell, irfantask
	Set winshell = CreateObject("WScript.Shell")
	irfantask =  "/bf /wall=3 /info=" & Chr(34) & WallInfo & Chr(34)
	winshell.Run Chr(34) & Irfanview  & Chr(34) & " " & Chr(34) & jpgpath & Chr(34) & " " & irfantask, 7, 1
'	To prevent screen saver timeout
	winshell.SendKeys "%{F12}"
	Set winshell = Nothing

	PreviousAlbumArtist = albumartist
	PreviousAlbum = album

End Sub

Re: Cover image as wallpaper

by Dreadlau » Sun Oct 17, 2010 5:26 am

I use MM mainly as a player.
And I know by reading this forum.
That a lot of the people on here use it that way too.

Re: Cover image as wallpaper

by rovingcowboy » Sat Oct 16, 2010 10:15 pm

i use my pc jukebox every day all day. and monkey is the player i use on it.

but there are a lot of mp3 players out there.

my sister uses mm when she plays music on this computer cause she has to listen to the mp3 player at work.

my jukebox has replaced my stereo player i only use the tuner on it now. as i don't record to tapes i just put the record in to the computer by the usb turntable.

and there are a few others in the forum here that play music on jukeboxes like i do, but i don't know how many others. :)

Re: Cover image as wallpaper

by pl5bnsf » Sat Oct 16, 2010 10:22 am

It's been a long while since I looked at this script. It has just kept on working for me. But I have stuck with XP so no change since 2005!

Don't know what the definitive answer is for it. Seems like there are variables such as Active Desktop or not, XP/Win7/Vista, your existing screensaver/desktop setting, etc.

I just really like having the cover art tiled across my screens while MM plays. It would be a nice built in feature of MM. But frankly what percentage of people these days actually play music ON the computer vs an MP3 player? I'm only using MM to actually play music maybe 5-10% of the time anyway. MM is the best organizer and sync tool out there. And it's the best player as well but most listening is with an MP3 player (lots of podcasts and audiobooks as well for me).

Re: Cover image as wallpaper

by rovingcowboy » Sat Oct 16, 2010 8:22 am

look at the date here and the first line.

it says 2005, and mm 2.5

that means this script is not for mm 3 and the script code in it is made for mm 2.5 which was not made for win7

8)

Re: Cover image as wallpaper

by wonda » Sat Oct 16, 2010 8:05 am

This script will not work in Windows 7. Because of the function UpdatePerUserSystemParameters.
Why not resolve the whole problem with Irfanview? I use:

WShell.Run "c:\bin\irfanview\i_view32.exe c:\tmp\Cover.jpg /resize=(900,900) /convert=c:\tmp\Cover.bmp /wall=0", 7, 1

That is all; the register stuff is not needed.
To prevent the screensaver and monitor timeout when the music is playing I added:

WShell.SendKeys "^{F16}"

by pl5bnsf » Mon Nov 14, 2005 12:53 pm

I don't run with active desktop turned on. I did try to use it before with jpg cover images but I could not get it to tile the image. I tried making a web page that tiled the image but I still did not like how active desktop displayed the wallpaper. Using a bitmap image with active desktop turned off give me the best effect. Of course maybe I did not set up active desktop right so if there is a way to have an image show up tiled seamlessly with AD on, I'd be very interested.

by rovingcowboy » Mon Nov 14, 2005 1:09 am

loookin' goooodd

just why not make the convert to bmp an option with an alert pop up for those that use windows with out active desktop turned on?

because if you use windows with active desktop on, then it will show jpg's and gif's as desktop images.

8)

Cover image as wallpaper

by pl5bnsf » Sun Nov 13, 2005 8:23 pm

Thanks to the new functionality in MM 2.5, here is an improved method to display the current songs cover image as your desktop wallpaper, changing when the song changes.

It does require the IrfanView graphics program to convert the cover graphic to a BMP file. http://www.irfanview.com (When the updated script doco comes out for MM 2.5, the ImageConvert function may eliminate the need for an external jpg-->BMP step)

Add this to your scripts.ini:

Code: Select all

[ShowCover]
FileName=ShowCover.vbs
ProcName=ShowCover
Order=1
DisplayName=&ShowCover
Description=ShowCover
Language=VBScript
ScriptType=2
Create a ShowCover.vbs file in your scripts directory and update the path to IrfanView as needed.

Code: Select all

Sub ShowCover 
  Set fso = SDB.Tools.FileSystem 

  Set itm = SDB.Player.CurrentSong

  Set AlbumArt = itm.AlbumArt

  if (AlbumArt.count > 0) Then

      Set Image = AlbumArt.Item(0).Image

      fname = "Cover.jpg"
      Set falbum = fso.CreateTextFile( "C:\tmp\Cover.jpg", True) 
      falbum.WriteData Image.ImageData, Image.ImageDataLen 

      falbum.close

      ' Prepare WScript.Shell object, which can be used for execution of applications
      Set WShell = CreateObject("WScript.Shell") 

      ' This WShell.Run is one long line, do not LINE WRAP
      WShell.Run "c:\bin\irfanview\i_view32.exe c:\tmp\Cover.jpg /silent /convert=c:\tmp\Cover.bmp", 7, 1

      WShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", "c:\tmp\Cover.bmp"
      WShell.RegWrite "HKCU\Control Panel\Desktop\TileWallpaper","1"
      WShell.run "rundll32.exe user32.dll,UpdatePerUserSystemParameters 1,True"

  end if

end sub
Then when you play a song that has embedded cover art your desktop wallpaper should show the cover image as your tiled wallpaper. ONLY shows art that is stored as a tag in the MP3.

Top