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