summaryrefslogtreecommitdiffstats
path: root/lib/class/update.class.php
diff options
context:
space:
mode:
authorPaul Arthur <flowerysong00@yahoo.com>2013-01-15 00:56:42 -0500
committerPaul Arthur <flowerysong00@yahoo.com>2013-01-15 11:30:47 -0500
commite2ca05d5b419944adb3723ab0253c7c35418a0e4 (patch)
treef4d0635b3690cd6c060acf69c3afebc8a7e67284 /lib/class/update.class.php
parente2484ee9a0e7f7de16fe2b3d015af59f0c9111c0 (diff)
downloadampache-e2ca05d5b419944adb3723ab0253c7c35418a0e4.tar.gz
ampache-e2ca05d5b419944adb3723ab0253c7c35418a0e4.tar.bz2
ampache-e2ca05d5b419944adb3723ab0253c7c35418a0e4.zip
Make playlist downloads idempotent
Should fix the VLC plugin, as well as allow direct use of an Ampache site on Android devices. First, split the Stream class into an instantiable class that does the playlist wrangling and a static class that handles the streaming stuff. How does this work? Well, stream.php does its fancy stuff like gathering the media IDs and clearing the playlist, but instead of generating the playlist file there we use the Stream_Playlist class to store the list of URLs in the database, then redirect to play/index.php to create the actual download (there are some magic playlist types like localplay that don't need to redirect.) The playlist will be cached as long as that stream session is active, so it can be downloaded multiple times and by clients that don't share the browser's cookie cache. Clean up the playlist generation by reducing copypasta.
Diffstat (limited to 'lib/class/update.class.php')
-rw-r--r--lib/class/update.class.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index 31446e76..7a32c776 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -377,6 +377,9 @@ class Update {
$update_string = '- Allow compound MBIDs in the artist table.<br />';
$version[] = array('version' => '360010', 'description' => $update_string);
+ $update_string = '- Add table to store stream session playlist.<br />';
+ $version[] = array('version' => '360011', 'description' => $update_string);
+
return $version;
} // populate_version
@@ -2089,5 +2092,27 @@ class Update {
self::set_version('db_version', '360010');
}
+ /**
+ * update_380011
+ * We need a place to store actual playlist data for downloadable
+ * playlist files.
+ */
+ public static function update_360011() {
+ $sql = 'CREATE TABLE `stream_playlist` (' .
+ '`id` int(11) unsigned NOT NULL AUTO_INCREMENT,' .
+ '`sid` varchar(64) COLLATE utf8_unicode_ci NOT NULL,' .
+ '`url` text COLLATE utf8_unicode_ci NOT NULL,' .
+ '`info_url` text COLLATE utf8_unicode_ci DEFAULT NULL,' .
+ '`image_url` text COLLATE utf8_unicode_ci DEFAULT NULL,' .
+ '`title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,' .
+ '`author` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,' .
+ '`album` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,' .
+ '`type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,' .
+ '`time` smallint(5) DEFAULT NULL,' .
+ 'PRIMARY KEY (`id`), KEY `sid` (`sid`))';
+ $db_results = Dba::write($sql);
+ self::set_version('db_version', '360011');
+ }
+
} // end update class
?>