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