# HG changeset patch # User Dan # Date 1206326692 14400 # Node ID 9b96265b5918b5bdc1ecad5c7bf07a4eb130725b # Parent cde92f6ec29f3b15a2f6e31765c5cb86572cd373 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. diff -r cde92f6ec29f -r 9b96265b5918 ajax.php --- 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 ) diff -r cde92f6ec29f -r 9b96265b5918 functions.php --- 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 diff -r cde92f6ec29f -r 9b96265b5918 playlist.php --- 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) diff -r cde92f6ec29f -r 9b96265b5918 scripts/ajax.js --- 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); + } } }); } diff -r cde92f6ec29f -r 9b96265b5918 scripts/volume.js --- 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; diff -r cde92f6ec29f -r 9b96265b5918 themes/iphone/expand.js --- /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'; + } +} + diff -r cde92f6ec29f -r 9b96265b5918 themes/iphone/playlist.tpl --- 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 @@ {/foreach} +