(no commit message)
[utils] / crawler / kiss / docs / content / xdocs / index.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3   Copyright 2002-2004 The Apache Software Foundation or its licensors,
4   as applicable.
5
6   Licensed under the Apache License, Version 2.0 (the "License");
7   you may not use this file except in compliance with the License.
8   You may obtain a copy of the License at
9
10       http://www.apache.org/licenses/LICENSE-2.0
11
12   Unless required by applicable law or agreed to in writing, software
13   distributed under the License is distributed on an "AS IS" BASIS,
14   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   See the License for the specific language governing permissions and
16   limitations under the License.
17 -->
18 <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
19 <document> 
20   <header> 
21     <title>Automatic Recording for KiSS Hard Disk Recorders</title> 
22   </header> 
23   <body>
24     <warning>
25       KiSS makes regular updates to their site that sometimes require adaptations
26       to the crawler. If it stops working, check out the most recent version here. 
27     </warning> 
28     <section id="changelog">
29       <title>Changelog</title>
30       
31           <section>
32         <title>7 September 2006</title>
33         <ul>
34           <li>KiSS modified the login procedure. It is now working again.</li>
35           <li>Generalized the startup scripts. They should now be insensitive to the specific libraries used. </li>
36         </ul>
37       </section>
38       <section>
39         <title>31 August 2006</title>
40         <ul>
41           <li>Added windows bat file for running the crawler under windows.
42               Very add-hoc, will be generalized. </li>
43         </ul>
44       </section>
45       <section>
46         <title>17 November 2006</title>
47         <ul>
48           <li>Corrected the packed distributions. The standalone distribution
49               had an error in the scripts and was missing libraries </li>
50
51         </ul>
52         <title>24 August 2006</title>
53         <ul>
54           <li>The crawler now uses desktop login for crawling. Also, it is much more efficient since
55           it no longer needs to crawl the individual programs. This is because the channel page
56             includes descriptions of programs in javascript popups which can be used by the crawler.
57           The result is a significant reduction of the load on the KiSS EPG site. Also, the delay
58             between requests has been increased to further reduce load on the KiSS EPG site. </li>
59           <li>
60             The crawler now crawls programs for tomorrow instead of for today.
61           </li>
62           <li>
63             The web based crawler is configured to run only between 7pm and 12pm. It used to run at
64             5am. 
65           </li>
66         </ul>
67       </section>
68       
69       <section>
70         <title>13-20 August 2006</title>
71         <p>
72           There were several changes to the login procedure, requiring modifications to the crawler.
73         </p>
74         <ul>
75           <li>The crawler now uses the 'Referer' header field correctly at login.</li>
76           <li>KiSS now uses hidden form fields in their login process which are now also handled correctly by the
77               crawler.</li>
78         </ul>
79       </section>
80     </section>
81     <section id="overview">
82       <title>Overview</title>
83    
84       <p>
85         In 2005,  <a href="site:links/kiss">KiSS</a> introduced the ability
86         to schedule recordings on KiSS hard disk recorder (such as the 
87         DP-558) through a web site on the internet. When a new recording is
88         scheduled through the web site, the KiSS recorder finds out about 
89         this new recording by polling a server on the internet. 
90         This is a really cool feature since it basically allows programming
91         the recorder when away from home. 
92       </p>
93       <p>
94         After using this feature for some time now, I started noticing regular
95         patterns. Often you are looking for the same programs and for certain
96         types of programs. So, wouldn't it be nice to have a program 
97         do this work for you and automatically record programs and notify you
98         of possibly interesting ones?
99       </p>
100       <p>
101         This is where the KiSS crawler comes in. This is a simple crawler which 
102         logs on to the KiSS electronic programme guide web site and gets
103         programme information from there. Then based on that it automatically
104         records programs for you or sends notifications about interesting ones.
105       </p>
106       <p>
107         In its current version, the crawler can be used in two ways:  
108       </p>
109       <ul>
110         <li><strong>standalone program</strong>: A standalone program run as a scheduled task.</li>
111         <li><strong>web application</strong>: A web application running on a java
112           application server. With this type of use, the crawler also features an automatic retry
113           mechanism in case of failures, as well as a simple web interface. </li>
114       </ul>
115     </section>
116     
117     <section>
118       <title>Downloading</title>
119       
120       <p>
121         At this moment, no formal releases have been made and only the latest
122         version can be downloaded. 
123       </p>
124       <p>
125         The easy way to start is the 
126         <a href="installs/crawler/target/wamblee-crawler-0.2-SNAPSHOT-kissbin.zip">standalone program binary version</a>
127         or using the <a href="installs/crawler/kissweb/target/wamblee-crawler-kissweb.war">web
128           application</a>.
129       </p>
130       <p>
131         The latest source can be obtained from subversion with the 
132         URL <code>https://wamblee.org/svn/public/utils</code>. The subversion 
133         repository allows read-only access to anyone. 
134       </p>
135       <p>
136         The application was developed and tested on SuSE linux 9.1 with JBoss 4.0.2 application
137         server (only required for the web application). It requires at least a Java Virtual Machine
138         1.5 or greater to run. 
139       </p>
140     </section>
141     
142     <section>
143       <title>Configuring the crawler</title>
144       
145       <p>
146         The crawler comes with three configuration files:
147       </p>
148       <ul>
149         <li><code>crawler.xml</code>: basic crawler configuration
150           tailored to the KiSS electronic programme guide.</li>
151         <li><code>programs.xml</code>: containing a description of which 
152           programs must be recorded and which programs are interesting.</li>
153         <li><code>org.wamblee.crawler.properties</code>: Containing a configuration  </li>
154       </ul>
155       <p>
156         For the standalone program, all configuration files are in the <code>conf</code> directory.
157         For the web application, the properties files is located in the <code>WEB-INF/classes</code>
158         directory of the web application, and <code>crawler.xml</code> and <code>programs.xml</code>
159         are located outside of the web application at a location configured in the properties file. 
160       </p>
161    
162       
163       <section>
164         <title>Crawler configuration <code>crawler.xml</code></title>
165         
166         <p>
167           First of all, copy the <code>config.xml.example</code> file 
168           to <code>config.xml</code>. After that, edit the first entry of 
169           that file and replace <code>user</code> and <code>passwd</code>
170           with your personal user id and password for the KiSS Electronic
171           Programme Guide. 
172         </p>
173       </section>
174
175         <section>
176           <title>Program configuration</title>
177           <p>
178             Interesting TV shows are described using <code>program</code>
179             elements. Each <code>program</code> element contains 
180             one or more <code>match</code> elements that describe 
181             a condition that the interesting program must match. 
182           </p>
183           <p>
184             Matching can be done on the following properties of a program:
185           </p>
186           <table>
187             <tr><th>Field name</th>
188             <th>Description</th></tr>
189             <tr>
190               <td>name</td>
191               <td>Program name</td>
192             </tr>
193             <tr>
194               <td>description</td>
195               <td>Program description</td>
196             </tr>
197             <tr>
198               <td>channel</td>
199               <td>Channel name</td>
200             </tr>
201             <tr>
202               <td>keywords</td>
203               <td>Keywords/classification of the program.</td>
204             </tr>
205           </table>
206           <p>
207             The field to match is specified using the <code>field</code>
208             attribute of the <code>match</code> element. If no field name 
209             is specified then the program name is matched. Matching is done
210             by converting the field value to lowercase and then doing a 
211             perl-like regular expression match of the provided value. As a
212             result, the content of the match element should be specified in 
213             lower case otherwise the pattern will never match.
214             If multiple <code>match</code> elements are specified for a 
215             given <code>program</code> element, then all matches must 
216             apply for a program to be interesting. 
217           </p>
218           <p>
219             Example patterns:
220           </p>
221           <table>
222             <tr>
223               <th>Pattern</th>
224               <th>Example of matching field values</th>
225             </tr>
226             <tr>
227               <td>the.*x.*files</td>
228               <td>"The X files", "The X-Files: the making of"</td>
229             </tr>
230             <tr>
231               <td>star trek</td>
232               <td>"Star Trek Voyager", "Star Trek: The next generation"</td>
233             </tr>
234           </table>
235           
236           <p>
237             It is possible that different programs cannot be recorded 
238             since they overlap. To deal with such conflicts, it is possible
239             to specify a priority using the <code>priority</code> element. 
240             Higher values of the priority value mean a higher priority. 
241             If two programs have the same priority, then it is (more or less)
242             unspecified which of the two will be recorded, but it will at least
243             record one program. If no priority is specified, then the
244             priority is 1 (one).
245           </p>
246           
247           <p>
248             Since it is not always desirable to try to record every
249             program that matches the criteria, it is also possible to 
250             generate notifications for interesting programs only without
251             recording them. This is done by specifying the 
252             <code>action</code> alement with the content <code>notify</code>.
253             By default, the <code>action</code> is <code>record</code>. 
254             To make the mail reports more readable it is possible to 
255             also assign a category to a program for grouping interesting
256             programs. This can be done using the <code>category</code>
257             element. Note that if the <code>action</code> is 
258             <code>notify</code>. then the <code>priority</code> element
259             is not used. 
260           </p>
261           
262         </section>
263       
264       <section>
265         <title>Notification configuration</title>
266         <p>
267            Edit the configuration file <code>org.wamblee.crawler.properties</code>. 
268           The properties file is self-explanatory. 
269         </p>
270       </section>
271     </section>
272     
273    
274     
275     
276     <section>
277       <title>Installing and running the crawler</title>
278       
279       <section>
280         <title>Standalone application</title>
281         <p>
282           In the binary distribution, execute the 
283           <code>run</code> script for your operating system
284           (<code>run.bat</code> for windows, and 
285           <code>run.sh</code> for unix). 
286         </p>
287       </section>
288       
289       <section>
290         <title>Web application</title>
291         <p>
292           After deploying the web application, navigate to the 
293           application in your browser (e.g. 
294           <code>http://localhost:8080/wamblee-crawler-kissweb</code>).
295           The screen should show an overview of the last time it ran (if
296           it ran before) as well as a button to run the crawler immediately.
297           Also, the result of the last run can be viewed.
298           The crawler will run automatically every morning at 5 AM local time, 
299           and will retry at 1 hour intervals in case of failure to retrieve
300           programme information. 
301         </p>
302       </section>
303       
304       <section>
305         <title>Source distribution</title>
306         <p>
307           With the source code, build everything with 
308           <code>ant dist-lite</code>, then locate the binary
309           distribution in <code>lib/wamblee/crawler/kiss/kiss-crawler-bin.zip</code>.
310           Then proceed as for the binary distribution. 
311         </p>
312       </section>
313       
314       <section>
315         <title>General usage</title>
316         <p>
317           When the crawler runs, it 
318           retrieves the programs for tomorrow. As a result, it is advisable 
319           to run the program at an early point of the day as a scheduled
320           task (e.g. cron on unix). For the web application this is 
321           preconfigured at 5AM. 
322         </p>
323         <note>
324           If you deploy the web application today, it will run automatically
325           on the next (!) day. This even holds if you deploy the application
326           before the normal scheduled time.  
327         </note>
328         
329         <p>
330           Modifying the program to allow it to investigate tomorrow's
331           programs instead is easy as well but not yet implemented. 
332         </p>
333       </section>
334       
335       
336     </section>
337
338     <section id="examples">
339       <title>Examples</title>
340     
341       <p>
342         The best example is in the distribution itself. It is my personal
343         <code>programs.xml</code> file.
344       </p>
345     </section>
346     
347     <section>
348       <title>Contributing</title>
349       
350       <p>
351         You are always welcome to contribute. If you find a problem just 
352         tell me about it and if you have ideas am I always interested to 
353         hear about them. 
354       </p>
355       <p>
356         If you are a programmer and have a fix for a bug, just send me a
357         patch and if you are fanatic enough and have ideas, I can also 
358         give you write access to the repository. 
359       </p>
360     </section>
361     
362     
363   </body>
364 </document>