diff --git a/README.markdown b/README.markdown index 399f9df..22be645 100644 --- a/README.markdown +++ b/README.markdown @@ -5,6 +5,8 @@ Class for you peeps to get your fav. shows upcoming showtime as an iCal-formatte Uses the awesome [simplehtmldom](http://simplehtmldom.sourceforge.net/) as basic scraping tool, you should too check it out. +Please create your cache-dir before using in production and please do chmod it as writable. + Usage ----- To get, for example the awesome Alas-show's broadcast times you @@ -18,5 +20,4 @@ To get, for example the awesome Alas-show's broadcast times you $basso_alas = new BassoFeed('alas'); echo $basso_alas->get_ical(); - - \ No newline at end of file +The "new BassoFeed(_showname_)" comes from the url, in Alas' case it's http://www.basso.fi/radio/*alas* \ No newline at end of file diff --git a/bassofeed.php b/bassofeed.php index 4d4d114..87c81e2 100644 --- a/bassofeed.php +++ b/bassofeed.php @@ -238,24 +238,25 @@ class BassoFeed **/ function get_ical() { - echo "BEGIN:VCALENDAR\n" - ."VERSION:2.0\n" - ."PRODID:-//basso/feed//NONSGML v1.0//EN\n"; + $cal = "BEGIN:VCALENDAR\n" + ."VERSION:2.0\n" + ."PRODID:-//basso/feed//NONSGML v1.0//EN\n"; foreach( $this->showtimes as $i ) { - - echo "BEGIN:VEVENT\n" - ."UID:".md5($this->show . $i["date_f"])."@basso.fi\n" - ."DTSTAMP:{$i["date_f"]}\n" - ."DTSTART:{$i["date_f"]}\n" - ."DTEND:{$i["date_t"]}\n" - ."SUMMARY:{$this->showinfo["title"]}\n" - ."DESCRIPTION:{$this->showinfo["desc"]}\n" - ."END:VEVENT\n"; + $cal .= "BEGIN:VEVENT\n" + ."UID:".md5($this->show . $i["date_f"])."@basso.fi\n" + ."DTSTAMP:{$i["date_f"]}\n" + ."DTSTART:{$i["date_f"]}\n" + ."DTEND:{$i["date_t"]}\n" + ."SUMMARY:{$this->showinfo["title"]}\n" + ."DESCRIPTION:{$this->showinfo["desc"]}\n" + ."END:VEVENT\n"; } - echo "END:VCALENDAR\n"; + $cal .= "END:VCALENDAR\n"; + + return $cal; } /** diff --git a/example.php b/example.php index fa674b1..8298bbc 100644 --- a/example.php +++ b/example.php @@ -2,11 +2,9 @@ header('Content-Type: text/html; charset=utf-8'); date_default_timezone_set('Europe/Helsinki'); -echo "
";
+require_once("simple_html_dom.php");
 require_once("bassofeed.php");
 
-// http://simplehtmldom.sourceforge.net/manual.htm
-require_once("simple_html_dom.php");
-
+echo "
";
 $basso_alas = new BassoFeed('alas');
-#print_r($basso_alas);
+echo $basso_alas->get_ical();