Relicensed to GPLv2. Previous revisions should not be downloaded as they do not contain copies of appropriate licenses, which will be added in a later commit. Completed interface for mobile devices.
--- a/ajax.php Sun Mar 23 22:03:57 2008 -0400
+++ b/ajax.php Sun Mar 23 22:44:52 2008 -0400
@@ -4,9 +4,13 @@
* Action servlet (play, pause, etc.)
*
* Web control interface script for Amarok
- * Written by Dan Fuhry - 2008
+ * Copyright (C) 2008 Dan Fuhry
*
- * This script is in the public domain. Use it for good, not evil.
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*/
status('initializing Services_JSON');
@@ -53,7 +57,7 @@
case 'prev':
if ( !$allowcontrol )
return false;
- echo dcop_action('player', 'stop');
+ echo dcop_action('player', $action);
break;
case 'play':
if ( !$allowcontrol )
--- a/functions.php Sun Mar 23 22:03:57 2008 -0400
+++ b/functions.php Sun Mar 23 22:44:52 2008 -0400
@@ -4,9 +4,13 @@
* Utility functions
*
* Web control interface script for Amarok
- * Written by Dan Fuhry - 2008
+ * Copyright (C) 2008 Dan Fuhry
*
- * This script is in the public domain. Use it for good, not evil.
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*/
/**
@@ -78,11 +82,12 @@
$playlist_file = dcop_action('playlist', 'saveCurrentPlaylist');
// check MD5 - if it's not changed, exit to save CPU cycles
global $playlist_last_md5;
- if ( $playlist_last_md5 == @md5_file($playlist_file) )
+ $effective_md5 = md5_playlist_file($playlist_file);
+ if ( $playlist_last_md5 == $effective_md5 )
{
return true;
}
- $playlist_last_md5 = @md5_file($playlist_file);
+ $playlist_last_md5 = $effective_md5;
// start XML parser
try
{
@@ -114,6 +119,23 @@
}
/**
+ * Builds the correct MD5 check for the specified playlist XML file. This is designed to base on the list of actual tracks, disregarding
+ * the rest of the text in the XML file.
+ * @param string Path to playlist
+ * @return string hash
+ */
+
+function md5_playlist_file($file)
+{
+ $contents = @file_get_contents($file);
+ if ( empty($contents) )
+ return false;
+ $count = preg_match_all('/uniqueid="([a-fA-F0-9]+?)"/', $contents, $matches);
+ $matches = implode("", $matches[1]);
+ return md5($matches);
+}
+
+/**
* Converts a number to minute:second format
* @param int Seconds
* @return string format: mm:ss
--- a/playlist.php Sun Mar 23 22:03:57 2008 -0400
+++ b/playlist.php Sun Mar 23 22:44:52 2008 -0400
@@ -4,9 +4,13 @@
* Playlist displayer
*
* Web control interface script for Amarok
- * Written by Dan Fuhry - 2008
+ * Copyright (C) 2008 Dan Fuhry
*
- * This script is in the public domain. Use it for good, not evil.
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*/
function amarok_playlist($server)
--- a/scripts/ajax.js Sun Mar 23 22:03:57 2008 -0400
+++ b/scripts/ajax.js Sun Mar 23 22:44:52 2008 -0400
@@ -2,13 +2,17 @@
* AJAX functions
*
* Web control interface script for Amarok
- * Written by Dan Fuhry - 2008
+ * Copyright (C) 2008 Dan Fuhry
*
- * This script is in the public domain. Use it for good, not evil.
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*/
var ajax;
-var is_playing = false, current_track = -1, current_track_length, current_track_pos, ct_advance_timeout = false, ct_counter = false, playlist_md5 = false;
+var is_playing = false, current_track = -1, current_track_length, current_track_pos, ct_advance_timeout = false, ct_counter = false, playlist_md5 = false, first_load = true;
function ajaxGet(uri, f)
{
@@ -148,6 +152,12 @@
ct_advance_timeout = setTimeout(refresh_playlist, ( 1000 * time_remaining ));
ct_counter = setInterval(update_clock, 1000);
}
+ if ( first_load )
+ {
+ first_load = false;
+ var top = $('track_' + current_track).Top() - 138;
+ window.scroll(0, top);
+ }
}
});
}
--- a/scripts/volume.js Sun Mar 23 22:03:57 2008 -0400
+++ b/scripts/volume.js Sun Mar 23 22:44:52 2008 -0400
@@ -2,9 +2,13 @@
* Volume widget presentation code
*
* Web control interface script for Amarok
- * Written by Dan Fuhry - 2008
+ * Copyright (C) 2008 Dan Fuhry
*
- * This script is in the public domain. Use it for good, not evil.
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*/
var current_volume = 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/themes/iphone/expand.js Sun Mar 23 22:44:52 2008 -0400
@@ -0,0 +1,13 @@
+function expand_track(tid)
+{
+ var div = document.getElementById('track_inner_' + tid);
+ if ( div.style.display == 'block' )
+ {
+ div.style.display = 'none';
+ }
+ else
+ {
+ div.style.display = 'block';
+ }
+}
+
--- a/themes/iphone/playlist.tpl Sun Mar 23 22:03:57 2008 -0400
+++ b/themes/iphone/playlist.tpl Sun Mar 23 22:44:52 2008 -0400
@@ -26,6 +26,7 @@
<script type="text/javascript" src="/scripts/{$script}"></script>
{/foreach}
<script type="text/javascript" src="/themes/{$theme|escape}/scrollfix.js"></script>
+ <script type="text/javascript" src="/themes/{$theme|escape}/expand.js"></script>
</head>
<body>
<div id="playbar">
@@ -65,9 +66,17 @@
{strip}
<tr class="{cycle values="row1,row2"}{if $active == $tid} current{/if}" id="track_{$tid}" amarok:length_sec="{$track.length_int}">
<td>
- <a class="tracklink" href="#action:jump;tid:{$tid}" onclick="jump_to_song({$tid}); return false;">
+ <a class="tracklink" href="#action:jump;tid:{$tid}" onclick="expand_track({$tid}); return false;">
{$track.title|escape}
</a>
+ <div id="track_inner_{$tid}" class="track_inner">
+ <small>
+ <b>Artist:</b> {$track.artist|escape}<br />
+ <b>Album:</b> {$track.album|escape}<br />
+ <b>Length:</b> {$track.length|escape}<br />
+ </small>
+ <a class="tracklink" href="#action:jump;tid:{$tid}" onclick="jump_to_song({$tid}); return false;">» Play track</a>
+ </div>
</td>
</tr>
{/strip}
@@ -78,7 +87,7 @@
<img alt="AmaroK web control" src="/themes/{$theme|escape}/images/amarok.gif" /><br />
</div>
<script type="text/javascript">
- fix_scroll();
+ setTimeout('fix_scroll();', 2000);
</script>
</body>
</html>
--- a/themes/iphone/style.css Sun Mar 23 22:03:57 2008 -0400
+++ b/themes/iphone/style.css Sun Mar 23 22:44:52 2008 -0400
@@ -73,6 +73,10 @@
color: white;
}
+div.track_inner {
+ display: none;
+}
+
div#playlist tr.current a.tracklink {
color: #ffff00;
}
--- a/webcontrol.php Sun Mar 23 22:03:57 2008 -0400
+++ b/webcontrol.php Sun Mar 23 22:44:52 2008 -0400
@@ -2,9 +2,13 @@
/**
* Web control interface script for Amarok
- * Written by Dan Fuhry - 2008
+ * Copyright (C) 2008 Dan Fuhry
*
- * This script is in the public domain. Use it for good, not evil.
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*/
$public = true;
--- a/webserver.php Sun Mar 23 22:03:57 2008 -0400
+++ b/webserver.php Sun Mar 23 22:44:52 2008 -0400
@@ -4,9 +4,13 @@
* Webserver class
*
* Web control interface script for Amarok
- * Written by Dan Fuhry - 2008
+ * Copyright (C) 2008 Dan Fuhry
*
- * This script is in the public domain. Use it for good, not evil.
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*/
/**