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