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