Author Topic: iTunes mini web player  (Read 2094 times)

0 Members and 1 Guest are viewing this topic.

yokel

  • Jr. Member
  • **
  • Posts: 26
  • Karma: 2
    • View Profile
iTunes mini web player
« on: June 15, 2015, 09:51:29 AM »
I know there probably aren't a lot of iTunes users here but it's easily adaptable to your preferred software.  Only caveat here is the file structure of you media library.  It's pulling the jpegs directly from the album folder where your music resides.  My folder structure is as follows, if yours is different you'll need to change the regex a little to get the album art pulling correctly.  Music\Mp3 Official Release\{Genre}\{Artist}\{Artist} - {Album}\{Artist} - {Album}.jpg .  If your music is tagged well, Mp3tag works quite quickly at pulling cover art out to the appropriate filename.  http://download.mp3tag.de/mp3tagv270setup.exe .

Thanks to Kalle for helping me out with the volume controls. 

Necessary plugings: TCP(with webserver on), Robo Browser, Python

Unzip the attached html.zip to your VC\plugins\TCP folder(it's okay to overwrite, all original files are included)

Update: In my haste I forgot to mention that you'll need to change the html references to your ip:port in iTunes.html.  There is one regEx reference to your ip:port in the iTunes is paused macro to change also.  I'm setting up a variable for ip:port now, so in the future you'll just have to enter it once.  I cleaned up some junk i left behind too.  Right now i'm adding zone controls & a volume visualizer.  I added a screenshot of that. 

Paste this into VC:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.8-->
<commandGroup open="False" name="iTunes Mini Player" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="521" name="Get iTunes currently playing info" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>iTunes.GetArtist</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>Artist</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>iTunes.GetAlbum</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>Album</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>iTunes.GetSongTitle</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>Title</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>iTunes.GetYear</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>year</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>iTunes.GetGenre</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>genre</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>iTunes.playing</param>
        <param>{var.Artist}</param>
        <param>{var.Album}</param>
        <param>{var.Title}</param>
        <param>{var.year}</param>
        <param>{var.genre}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>iTunes.Play</event>
  </command>
  <command id="559" name="iTunes Now Playing Pop-up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Enable last action if you want the forecast read aloud as well.&#xD;&#xA;">
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>ip</param>
        <param>192.168.1.11:1313</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>iTunes</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>{Path.VC}\Plugins\TCP\html\iTunes.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(&lt;span id="Name"&gt;)Artist(&lt;/span&gt;)</param>
        <param>&lt;span id="Name"&gt;{var.Artist}&lt;/span&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(&lt;img src=)"kw.gif" (name="CD")</param>
        <param>&lt;img src="F:\Music\Mp3 Official Release\{var.genre}\{var.Artist}\{var.Artist} - {var.Album}\{var.Artist} - {var.Album}.jpg" name="CD"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(id="Track"&gt;)Song title(&lt;/div&gt;)</param>
        <param>id="Track"&gt;{var.Title}&lt;/div&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(vc.triggerevent&amp;amp;&amp;amp;iTunes_)Pause(" onMouseOut=")</param>
        <param>vc.triggerevent&amp;amp;&amp;amp;iTunes_Pause" onMouseOut="</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>ip:port</param>
        <param>{var.ip}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <params>
        <param>{Path.VC}\Plugins\TCP\html\iTunes2.html</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Navigate</cmdType>
      <params>
        <param>{Path.VC}\Plugins\TCP\html\iTunes2.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Wait</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Show</cmdType>
      <params>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ShowFrame</cmdType>
      <params>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.SetWinSize</cmdType>
      <params>
        <param>300</param>
        <param>360</param>
        <param>0</param>
        <param>0</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>InputKeys.Send</cmdType>
      <params>
        <param>{F5}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>iTunes.playing</event>
  </command>
  <command id="575" name="iTunes Now Paused Pop-up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Enable last action if you want the forecast read aloud as well.&#xD;&#xA;">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>iTunes_pause</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>{Path.VC}\Plugins\TCP\html\iTunes.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(&lt;span id="Name"&gt;)Artist(&lt;/span&gt;)</param>
        <param>&lt;span id="Name"&gt;{var.Artist}&lt;/span&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(&lt;img src=)"kw.gif" (name="CD")</param>
        <param>&lt;img src="F:\Music\Mp3 Official Release\{var.genre}\{var.Artist}\{var.Artist} - {var.Album}\{var.Artist} - {var.Album}.jpg" name="CD"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(&lt;img src=)"Play.png" alt="Pause" (name="Pause")</param>
        <param>&lt;img src="Pause.png" alt="Play" name="Pause"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(id="Track"&gt;)Song title(&lt;/div&gt;)</param>
        <param>id="Track"&gt;{var.Title}&lt;/div&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(id="a3"&gt;&lt;a href="ip:port/api/vc.triggerevent&amp;amp;&amp;amp;iTunes_)Pause" (onMouseOut="MM_swapIm)</param>
        <param>id="a3"&gt;&lt;a href="ip:port/api/vc.triggerevent&amp;amp;&amp;amp;iTunes_Play "onMouseOut="MM_swapIm</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>('Pause','',')pause(_roll.png')</param>
        <param>'Pause','','play_roll.png'</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>ip:port</param>
        <param>{var.ip}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <params>
        <param>{Path.VC}\Plugins\TCP\html\iTunes2.html</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Navigate</cmdType>
      <params>
        <param>{Path.VC}\Plugins\TCP\html\iTunes2.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Wait</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Show</cmdType>
      <params>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ShowFrame</cmdType>
      <params>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.SetWinSize</cmdType>
      <params>
        <param>300</param>
        <param>360</param>
        <param>0</param>
        <param>0</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>InputKeys.Send</cmdType>
      <params>
        <param>{F5}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>iTunes.Stop</event>
  </command>
  <command id="48" name="raise/lower Volume in 10% steps from current level" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>iTunes.GetVolume</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>iTunesCurrentVol1</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PY.ExecString</cmdType>
      <params>
        <param>result={Var.iTunesCurrentVol1}*{1}/100</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)&lt;(B)</ifType>
      <ifParams>{LastResult}&amp;&amp;1</ifParams>
      <then>
        <action>
          <cmdType>Results.SetLastResult</cmdType>
          <params>
            <param>1</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType />
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{1}&amp;&amp;minus</ifParams>
      <then>
        <action>
          <cmdType>PY.ExecString</cmdType>
          <params>
            <param>result={Var.iTunesCurrentVol1}-10</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>PY.ExecString</cmdType>
          <params>
            <param>result={Var.iTunesCurrentVol1}+10</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)&lt;(B)</ifType>
      <ifParams>100&amp;&amp;{LastResult}</ifParams>
      <then>
        <action>
          <cmdType>Results.SetLastResult</cmdType>
          <params>
            <param>100</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Volume has reached the highest level.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>{LastResult}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>iTunes.SetVolume</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>iTunes.playing</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>iTunes_vol</event>
  </command>
  <command id="478" name="Play" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>iTunes.Play</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>iTunes_Play</event>
  </command>
  <command id="495" name="Pause" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>iTunes.Pause</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>iTunes_Pause</event>
  </command>
  <command id="459" name="Next track" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>iTunes.Next</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>iTunes_Next</event>
  </command>
  <command id="471" name="Last track" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>iTunes.Previous</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>iTunes_Last</event>
  </command>
</commandGroup>

Screenshot:

In Progress:
« Last Edit: June 17, 2015, 06:27:59 AM by yokel »