 |
Entropy.ch Discussion Forums Discussion forums about Mac OS X software development.
|
| View previous topic :: View next topic |
| Author |
Message |
john
Joined: 02 Oct 2008 Posts: 4
|
Posted: Sat Oct 04, 2008 11:50 Post subject: Z10 & iTunes 8,01.. |
|
|
Hy,
I'm on OSX 10,4,11.
When my Z10 are USB plugged to my iMac Intel Core Duo, the sound of iTunes doesn't come thru....
But the tactile command on the speaker command (more or less) iTunes so, in a way, one can say they recognize each other..
But the sound doesn't come thru those Z10...
Why ?
Re-star and RAM emptied are vain...
Thanks for your help .
_________________ john |
|
| Back to top |
|
 |
jedirock
Joined: 17 Sep 2008 Posts: 6 Location: Canada
|
Posted: Sat Oct 04, 2008 12:21 Post subject: |
|
|
| I don't have the Z10's myself (I'm using the tool for a G15 keyboard), but I would think that's a Mac problem. I remember reading that the speakers will work by default in OS X as USB speakers, and it was just the button functionality that needed the external application. Check in the Sound pane in System Preferences, see what it says. It should say something like "USB Speakers". Don't hold me to that though, because it could be something much different. |
|
| Back to top |
|
 |
john
Joined: 02 Oct 2008 Posts: 4
|
Posted: Sat Oct 04, 2008 13:20 Post subject: |
|
|
Many thanks jedirock, you've got the thing : it works perfectly.......
But another little problem : the display on the speaker doesn't show the iTunes informations : it remains only with the two squares and the triangle index, but nothing else....
Would you have another idea ?
Many thanks. _________________ john |
|
| Back to top |
|
 |
jedirock
Joined: 17 Sep 2008 Posts: 6 Location: Canada
|
Posted: Sat Oct 04, 2008 19:28 Post subject: |
|
|
Ah, that's because the default iTunes script is faulty. ichris posted another iTunes script in this thread, and I've made my own script, below. I know mine works with the G15, which should mean it works with the Z10s because it's the program (LogitechLCDTool) that sends it to the appropriate device. I haven't tried ichris's script, but you're welcome to try both and experiment.
| Code: | <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>iTunes Now Playing</title>
<script type="text/javascript">
<!--
var timer, volumeTimer, stopped = true, firstRun = true, volumeLevel, volumeTimeout = null, progressWidth = 90.0;
var itunes, currentSongID, newSongID, songDuration = 0, positionStrLengths = [0, 0];
var pos = new Date(), duration = new Date();
function stop(str) {
alert("Stopped at '" + str + "'!");
clearInterval(timer);
clearInterval(volumeTimer);
}
function setText(id, value) {document.getElementById(id).innerHTML = value;}
function formatTime(date) {
// Todo: see if a native application (system or self-written in C or Obj-C) is faster than the Date obj.
var hours = date.getUTCHours(), mins = date.getUTCMinutes(), secs = date.getUTCSeconds();
if(mins < 10) {mins = "0" + mins;}
if(secs < 10) {secs = "0" + secs;}
if(hours === 0) {return mins + ":" + secs;}
return hours + ":" + mins + ":" + secs;
}
function update() {
var status = window.application.runUserScript('iTunesStatus');
// iTunes is not running.
if(status == "notRunning") {
document.getElementById('stopped').style.display = 'none';
document.getElementById('songStatus').style.display = 'none';
document.getElementById('notrunning').style.display = 'block';
if(!window.application.updateDisplay()) {stop("update: notRunning");}
return;
}
// iTunes is stopped, but was not before (checks the position string because if it's paused at the beginning of a song, iTunes
// returns "stopped" for the state, but 0 for the position. If it is truly stopped, the position returns "missing value".)
else if(status == "stopped" && window.application.runUserScript('iTunesPositionStr') == "missing value" && (!stopped || firstRun)) {
document.getElementById('stopped').style.display = 'block';
document.getElementById('songStatus').style.display = 'none';
document.getElementById('notrunning').style.display = 'none';
stopped = true;
if(!window.application.updateDisplay()) {stop("update: stopped");}
return;
}
// iTunes was stopped, but is not anymore.
else if(stopped && status != "stopped" && window.application.runUserScript('iTunesPositionStr') != "missing value") {
document.getElementById('stopped').style.display = 'none';
document.getElementById('songStatus').style.display = 'block';
document.getElementById('notrunning').style.display = 'none';
stopped = false;
}
// iTunes is stopped, panel is already shown. No need to do anything.
else if(stopped) {return;}
if(window.application.runUserScript('iTunesStatus') == "notRunning") {return;}
newSongID = window.application.runUserScript('iTunesDBID');
// If the song ID has changed, reload all data
if(newSongID != currentSongID) {
itunes = eval('(' + window.application.runUserScript('iTunesTrackInfo').replace(/'\\''/g, "\\'") + ')');
songDuration = itunes.duration;
pos.setTime(itunes.position * 1000);
duration.setTime((songDuration - itunes.position) * 1000);
setText('pos', formatTime(pos));
setText('duration', '-' + formatTime(duration));
setText('textWidth', "<span style='font-size: 12.0px;'>" + itunes.name + "<\/span>");
if(document.getElementById('textWidth').offsetWidth > 154)
{setText('top', '<marquee scrolldelay="2000" scrollamount="20" behavior="alternate" style="width: 154px; margin-left: 1px;">' + document.getElementById('textWidth').innerHTML + '<\/marquee>');}
else
{setText('top', document.getElementById('textWidth').innerHTML);}
setText('textWidth', (itunes.artist === '' ? '(No Artist)' : itunes.artist) + " - " + (itunes.album === '' ? '(No Album)' : itunes.album));
if(document.getElementById('textWidth').offsetWidth > 154)
{setText('artistScroll', '<marquee scrolldelay="2000" scrollamount="20" behavior="alternate" style="width: 154px; margin-left: 1px;">' + document.getElementById('textWidth').innerHTML + '<\/marquee>');}
else
{setText('artistScroll', document.getElementById('textWidth').innerHTML);}
/*if($('textWidth').innerWidth > 153)
setText('artistScroll', '<marquee scrolldelay="1000" scrollamount="15" style="width: 153px; margin-left: 1px;">' + $('textWidth').innerHTML + '<\/marquee>');
else
setText('artistScroll', $('textWidth').innerHTML);*/
currentSongID = newSongID;
}
// If the song hasn't changed since last time, all the data is loaded,
// and we only need to update the times. Saves CPU usage.
else {
itunes.position = window.application.runUserScript('iTunesPlayerPosition');
pos.setTime(itunes.position * 1000);
duration.setTime((songDuration - itunes.position) * 1000);
setText('pos', formatTime(pos));
setText('duration', '-' + formatTime(duration));
}
// If the volume bar isn't over it, calculate the width and position of the progress bar and diamond
if(volumeTimeout === null) {
var posLength = document.getElementById('pos').innerHTML.length, durationLength = document.getElementById('duration').innerHTML.length;
if(positionStrLengths[0] != posLength || positionStrLengths[1] != durationLength) {
progressWidth = 141 - (posLength + durationLength) * 6;
document.getElementById('progress').style.width = progressWidth + "px";
positionStrLengths = [posLength, durationLength];
}
document.getElementById('diamond').style.left = Math.round(progressWidth / songDuration * itunes.position, 10) + 'px';
}
if(firstRun) {firstRun = false;}
// Update the display. Returns a boolean saying if the the refresh was successful.
window.application.updateDisplay();
}
function updateVolume() {
var currVolume = window.application.runUserScript('getVolume');
if(currVolume != -1 && volumeLevel != currVolume) {
if(volumeTimeout !== null) {clearTimeout(volumeTimeout);}
document.getElementById('volumediamond').style.left = (5 * currVolume) + 'px';
document.getElementById('volume').style.display = "block";
document.getElementById('time').style.display = "none";
setText('vollevel', currVolume);
volumeLevel = currVolume;
volumeTimeout = setTimeout(function() {document.getElementById('volume').style.display = 'none';document.getElementById('time').style.display = 'block';volumeTimeout = null;}, 2000);
if(!window.application.updateDisplay()) {stop("updateVolume");}
}
}
function showOverlay() {
var data = window.application.runUserScript('doShellScript');
setText('overlay', data);
document.getElementById('overlay').style.display = 'block';
setTimeout("document.getElementById('overlay').style.display = 'none';", 4000);
}
function handleButton(button, upDown) {
if (upDown == "down") return;
if (button == "Softkey1") window.application.runUserScript('iTunesActivate');
if (button == "Softkey4") window.application.runSystemScript('visitEntropyWebsite');
if (button == "Display") showOverlay();
}
function start() {
timer = setInterval(function() {update();}, 1000);
// In normal use, the volume update just checks the system volume.
// Not concerned too much about the higher refresh rate.
volumeTimer = setInterval(function() {updateVolume();}, 200);
volumeLevel = window.application.runUserScript('getVolume');
// Call update, because setInterval() won't call it first until the first time period is up.
update();
}
function init() {
// I'll set my own scripts so I can depend on them not changing with different versions.
window.application.registerUserScript('iTunesStatus', 'tell application "System Events"\nif not exists process "iTunes" then\nreturn "notRunning"\nend if\nend tell\ntell application "iTunes"\ntry\n"" & player state\non error\nreturn "notRunning"\nend try\nend tell');
window.application.registerUserScript('iTunesTrackInfo', 'tell application "iTunes"\nset pos to player position\nif kind of current track contains "stream" then\nset dur to 0\nset trackname to quoted form of (current stream title as text)\nset trackartist to quoted form of (name of current track as text)\nset trackalbum to "\'Internet Radio\'"\nelse\ntell current track\nset dur to duration\nset trackname to quoted form of (name as text)\nset trackartist to quoted form of (artist as text)\nset trackalbum to quoted form of (album as text)\nend tell\nend if\n"{\'position\': \'" & pos & "\', \'duration\': \'" & dur & "\', \'name\': " & trackname & ", \'artist\': " & trackartist & ", \'album\': " & trackalbum & "}"\nend tell');
window.application.registerUserScript('iTunesPlayerPosition', 'tell application "iTunes" to player position');
window.application.registerUserScript('iTunesPositionStr', 'tell application "iTunes" to "" & player position');
window.application.registerUserScript('iTunesDBID', 'tell application "iTunes"\n"" & database ID of current track\nend tell');
window.application.registerUserScript('iTunesActivate', 'tell application "iTunes" to activate');
window.application.registerUserScript('getVolume', 'try\nround ((output volume of (get volume settings)) * 0.16)\non error\n-1\nend try');
window.application.registerUserScript('doShellScript', 'do shell script "uptime"');
start();
}
-->
</script>
<style type="text/css">
#top {height: 14px; margin-left: 0px;}
#artistScroll {height: 12px; margin-left: -1px;}
#top, #artistScroll {overflow: hidden; text-align: center; width: 154px;}
#songStatus {margin-left: 1px; display: none; margin-top: 1px;}
#time, #volume {width: 160px; margin-left: -1px; margin-top: -4px;}
#progress, #volumelevel {width: 80px; height: 7px; border: 1px solid black; position: relative; overflow: hidden;}
#diamond, #volumediamond {position: absolute; z-index: -1; margin-left: -3px;}
#duration, #vollevel {padding-right: 0px; text-align: right;}
#notrunning, #stopped {position: absolute; top: 5px; width: 153px; text-align: center;};
#overlay {position: absolute; top: 0; left: 0; background-color: white; width: 160; height: 43; padding: 2px; display: none; z-index: 100;}
</style>
<link rel="stylesheet" href="css/default.css" />
</head>
<body class="border" onload="init();" style="font-family: sans-serif;">
<div id="notrunning" style="display: block;"><p>iTunes isn't Running</p></div>
<div id="stopped" style="display: none;"><p>iTunes is Stopped</p></div>
<div id="overlay"></div>
<div id="songStatus">
<div id="top" style="font-size: 12px;"></div>
<div id="artistScroll"></div>
<table id="time" style="display: block;">
<tr>
<td id="pos"></td>
<td>
<div id="progress">
<img id="diamond" src="data:image/gif;base64,R0lGODlhBwAHAIAAAP///wAAACH5BAAAAAAALAAAAAAHAAcAAAIMhGMZq8sOAUSHJZkKADs=" alt="diamond" />
</div>
</td>
<td id="duration"></td>
</tr>
</table>
<table id="volume" style="display: none;">
<tr>
<td>Volume:</td>
<td>
<div id="volumelevel">
<img id="volumediamond" src="data:image/gif;base64,R0lGODlhBwAHAIAAAP///wAAACH5BAAAAAAALAAAAAAHAAcAAAIMhGMZq8sOAUSHJZkKADs=" alt="diamond" />
</div>
</td>
<td id="vollevel"></td>
</tr>
</table>
</div>
<div style="width: 161;">
<span style="white-space: nowrap;" id="textWidth"></span>
</div>
</body>
</html> |
|
|
| Back to top |
|
 |
john
Joined: 02 Oct 2008 Posts: 4
|
Posted: Sun Oct 05, 2008 9:54 Post subject: |
|
|
Thanks you again,
But, on that time, I'm not clever enough to use your script.....
I guess it must come in the Terminal mode ?
In a few lines could you help me to get the best use of your script ???
Many Thanks !  _________________ john |
|
| Back to top |
|
 |
jedirock
Joined: 17 Sep 2008 Posts: 6 Location: Canada
|
Posted: Sun Oct 05, 2008 19:00 Post subject: |
|
|
| You should just be able to copy and paste it into the application. When you start it up, you have two tabs on top: Image URL and HTML Code. In HTML Code, you have a text box with some code in it. Just delete everything in there, copy and paste one of the scripts into the box, then click Display. That should be all you have to do. |
|
| Back to top |
|
 |
john
Joined: 02 Oct 2008 Posts: 4
|
Posted: Sun Oct 05, 2008 21:05 Post subject: |
|
|
Wonderful ! All that is so new for me but so fascinating !
I've copy/pasted your script as recommended and it works perfectly.
I wonder why there were no explanation at all for Mac users in the Logitech manual : i was on the point to ship them back to the sender !
Many many thanks to you  _________________ john |
|
| Back to top |
|
 |
kayanat
Joined: 09 Mar 2009 Posts: 1
|
Posted: Thu Mar 12, 2009 5:48 Post subject: |
|
|
Itunes help. Is there a faster way to download itunes or like a lower version of itunes? I don't want anything else from itunes. I already know other websites but they dont work for me either because my computer is really really slow and wont download like ANYTHING without a problem.
_________________
yahoo keyword tool ~ overture ~ traffic estimator ~ adwords traffic estimator |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|