It is currently March 28th, 2024, 9:30 am

Call for a coder to build an iTunes controller

Share and get help with Plugins and Addons
ctbear
Posts: 4
Joined: August 11th, 2009, 9:07 pm

Re: Call for a coder to build an iTunes controller

Post by ctbear »

i'm using my own personal skin
i did try the update rate thing but it didn't work
KiRe
Posts: 35
Joined: July 25th, 2009, 5:49 am
Location: USA

Re: Call for a coder to build an iTunes controller

Post by KiRe »

Can you post your code? I suspect it is something with the code...
User avatar
Rainy
Developer
Posts: 42
Joined: April 13th, 2009, 8:20 am

Re: Call for a coder to build an iTunes controller

Post by Rainy »

elestel, when you are making changes to the iTunesPlugin please make sure that you are using the latest sources from the Rainmeter's trunk. I had to make few changes to the original source code so that it's possible to compile the plugin with Visual Studio 2008 Express and if those are overwritten the build will fail.
ctbear
Posts: 4
Joined: August 11th, 2009, 9:07 pm

Re: Call for a coder to build an iTunes controller

Post by ctbear »

here is part of my code

Code: Select all

[Rainmeter]
Update=1000

[MeasureCurrentTrackArtist]
Measure=Plugin
Plugin=Plugins\iTunesPlugin.dll
Command=GetCurrentTrackArtist

[MeasureCurrentTrackName]
Measure=Plugin
Plugin=Plugins\iTunesPlugin.dll
Command=GetCurrentTrackName

[MeasurePlayerPosition]
Measure=Plugin
Plugin=Plugins\iTunesPlugin.dll
Command=GetPlayerPosition
MaxValue=100

[MeasureCurrentTrackArtwork]
Measure=Plugin
Plugin=Plugins\iTunesPlugin.dll
Command=GetCurrentTrackArtwork
DefaultArtwork=Skins\iTunes\img\defaultartwork.png

;---------------------------

[Meterheading]
Meter=STRING
X=950
y=55
FontColor=ACACAC
StringStyle=NORMAL
FontSize=7
StringAlign=LEFT
FontFace=Tahoma
antialias=1
Prefix="iTunes Now Playing:"

[MeterCurrentTrackArtist]
Meter=STRING
MeasureName=MeasureCurrentTrackArtist
X=1100
y=55
FontColor=100,100,100
StringAlign=Left
FontSize=7
FontFace=Tahoma
antialias=1
Text="%1"
hidden=0

[MeterCurrentTrackName]
Meter=STRING
MeasureName=MeasureCurrentTrackName
X=1100
y=67
FontColor=100,100,100
StringAlign=Left
FontSize=7
FontFace=Tahoma
antialias=1
Text="%1"
hidden=0

[MeterCurrentTrackArtwork]
Meter=IMAGE
X=1045
Y=30
W=50
H=50
ImageName="%1"
MeasureName=MeasureCurrentTrackArtwork
hidden=0
KiRe
Posts: 35
Joined: July 25th, 2009, 5:49 am
Location: USA

Re: Call for a coder to build an iTunes controller

Post by KiRe »

@elestel: I am starting to suspect the crashing issue is related to the itunes plugin

@ctbear: I quickly looked at your code and nothing popped out at me :|
User avatar
elestel
Developer
Posts: 57
Joined: May 6th, 2009, 6:06 am

Re: Call for a coder to build an iTunes controller

Post by elestel »

I tried hard but still can't reproduce the crash issue.
I do find some first-chance COM exception when iTunes is busy or iTunes is closed outside the skin.
However the first-chance exception should not crash the application.

Now the plugin checks iTunes window every second, to display default artwork properly when iTunes is closed outside the skin. Don't know If this would help the crash problem.
http://www.mirimo.org/project-itunesplugin.html

@Rainy: sorry I forgot to update Rainmeter codebase to 1.0 until yesterday...

@ctbear: the default artwork path format is changed after Rainmeter 1.0. It is relative to the skin's folder now.

@kenz0: I also update the help document. The default artwork path description is wrong in old document.
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN
Contact:

Re: Call for a coder to build an iTunes controller

Post by kenz0 »

elestel wrote: @kenz0: I also update the help document. The default artwork path description is wrong in old document.
OK, I'll fix the HELP.
By the way, since I am not watching at this topic all the time, I occasionally miss your calling to me. so if possible, please use PM for contact to me from now on.
ctbear
Posts: 4
Joined: August 11th, 2009, 9:07 pm

Re: Call for a coder to build an iTunes controller

Post by ctbear »

elestel wrote:I tried hard but still can't reproduce the crash issue.
I do find some first-chance COM exception when iTunes is busy or iTunes is closed outside the skin.
However the first-chance exception should not crash the application.

Now the plugin checks iTunes window every second, to display default artwork properly when iTunes is closed outside the skin. Don't know If this would help the crash problem.
http://www.mirimo.org/project-itunesplugin.html

@Rainy: sorry I forgot to update Rainmeter codebase to 1.0 until yesterday...

@ctbear: the default artwork path format is changed after Rainmeter 1.0. It is relative to the skin's folder now.

@kenz0: I also update the help document. The default artwork path description is wrong in old document.
the new plugin fixed everything! thanks a lot!
KiRe
Posts: 35
Joined: July 25th, 2009, 5:49 am
Location: USA

Re: Call for a coder to build an iTunes controller

Post by KiRe »

elestel wrote:I tried hard but still can't reproduce the crash issue.
I do find some first-chance COM exception when iTunes is busy or iTunes is closed outside the skin.
However the first-chance exception should not crash the application.

In case you missed it, since you posted the above people have posted on how the crash occurs, including myself and Rainy on how the crash happens.

Rainy wrote:I got it now. The crash happens in the event loop when the mouse timer is handled. Unfortunately that doesn't tell anything about the reason why it crashes. Are you able to reproduce this always when you wake the computer up from sleep? Does it happen only with certain skins or any of them? Does it happen if you don't have any skins enabled?
ymir wrote:I've noticed that it only crashes for me (when returning from sleep/locked screen) if iTunes was left running in my system tray. I've only used the Enigma skin, so I'm not sure if it's skin-dependent or not.
JamesAC wrote:I'm having a similar problem but only when waking from hibernation

sleep mode works fine but when my laptop hibernates, rainmeter dies silently on the wake up
KiRe wrote:i'm using a personalized skin (based off the enigma itunes) and it basically happens every time that i leave that skin on when i put my laptop to sleep before i go to bed. If i am recalling correctly, it doesn't crash when the computer is asleep for a short(er) periods of time but I don't know at what point it starts crashing tho.
User avatar
technologist
Posts: 5
Joined: September 11th, 2009, 5:26 pm
Location: Baltimore, MD

Re: Call for a coder to build an iTunes controller

Post by technologist »

I just started using Rainmeter recently (a couple weeks before the 1.0 release) and have been playing around with elestel's excellent iTunes plugin to try making my own iTunes skin. Since I noticed that there were a few features I'd like to see that weren't available in the plugin (such as the ability to get the rating as a number instead of "xx/100" text), I downloaded the source a couple weeks ago to see if I could modify it to do what I wanted. It's probably been 10 years since I touched C++ but elestel your design made it VERY easy to add new measures! I believe my end result could be useful so I was wondering what the process is to submit my changes for consideration (since I'm not a Rainmeter developer and only have read-only access to SVN and wouldn't want to just pop in new code out of the blue anyway!).

While I was at it I also made a small change to rainmeter.cpp to support a new bang: RainmeterPluginBangWithArg. I wanted to be able to set the iTunes volume directly instead of going up and down in 5% increments (I'm working up a skin with a volume meter that's clickable). I did something similar for setting ratings in a 5-star scale where I created meters like "SetCurrentTrackStar1," "SetCurrentTrackStar2," etc but the idea of writing 20 volume setters ("SetVolume5," "SetVolume10," etc) seemed ridiculous. Looking at the code it occurred to me that it would be easy to create a bang that passes along a single parameter so I did. I considered modifying the PluginBang to accept a variable number of arguments but realized
  • it would take more work to parse out the arguments in advance than I wanted to spend at that time (doable, but I was looking for a quick fix at the time),
  • I don't know the source code NEARLY well enough to go tampering around with such base functions, and
  • a single parameter probably encompasses most of the parameter-passing needs people would have (and multiple parameters might be able to be passed within a quoted string, but I haven't tried that yet).
The format for this new bang is:

Code: Select all

[!RainmeterPluginBang "MeasureName" value]
for example:

Code: Select all

[!RainmeterPluginBang "SetVolume" 50]
Here's a list of changes I've made:
  • Added the following Measures:
    • GetCurrentTrackStars - Returns the number of stars (0 - 5) that correspond to the iTunes rating.
    • SetCurrentTrackRating - Takes a parameter (using the new RainmeterPluginBangWithArg) and sets the iTunes volume to that value.
    • IsITunesOpen - Returns 0 if iTunes is closed and 1 if iTunes is open (useful for setting the state of meters in a skin).
    • GetPreviousState - Returns an indicator to the state of the "Previous" button in iTunes (0 = disabled, 1 = enabled).
    • GetPlayPauseStopState - Returns an indicator to the state of the "Play/Pause/Stop" button in iTunes (0 = disabled Play button, 1 = enabled Play button, 2 = enabled Pause button, 3 = disabled Pause button, 4 = enabled Stop button, 5 = disabled Stop button).
    • GetNextState - Returns an indicator to the state of the "Next" button in iTunes (0 = disabled, 1 = enabled).
  • Modified the Quit measure to call iTunes.Release and set

    Code: Select all

    InstanceCreated = false[/color].  I did this because the [b]Power[/b] measure did both of these steps when closing iTunes in addition to calling iTunes->Quit.  Calling the [b]Quit[/b] measure without these was causing the [b]Power[/b] measure to not synch properly with the current iTunes state and I couldn't think of any reason why [b]Quit[/b] [i]shouldn't[/i] do this.
    [*]Modified [b]ExecuteBang[/b] to check if iTunes is open instead of relying on its internal InstanceCreated flag.  I did this to help skins better synchronize with iTunes.  For example, if iTunes was closed through some means other than the skin, the skin wasn't aware of the change and actions like the [b]Power[/b] toggle wouldn't work correctly (it was one step out of phase with reality and thought iTunes was still open so it tried to close it again).  This solved that problem.
    [*]Modified [b]ExecuteBang[/b] to start iTunes if it wasn't already started (except when calling Quit).  This is just a personal preference, but it seems to make the most sense to me to just start iTunes when trying to execute a command like Play if iTunes isn't already started rather than just bailing and doing nothing.[/list]
    
    I'm still finishing up my skin based on these modifications, but it has a the main controls (play/pause, prevtrack, nexttrack), listing of artist, song, and album, a progress bar, song duration, and album artwork (a thumbnail that can be clicked to display a larger image).  With the changes I made to the plugin and the new bang, I also added a set of 5 stars that display the current song's star rating and which can be clicked on to change the rating in iTunes.  The skin also has (or will have once I'm done with it!) a volume control panel containing a mute button on one end, a "max volume" button at the other end, and a slider control consisting of 19 bars in between, all of which can be clicked on (with some MouseOver animations) to display and adjust the current volume.
    
    I hope I'm not stepping on anyone's toes by posting this... I know the iTunes plugin i elestel's baby, but I started playing with it as a personal challenge and then later realized that I had something that others might find useful as well.
Post Reply