3588899625acb87bc7a7387bf98256c9629f0fd0
[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, 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>: 
109         A standalone program run from the command-line or as a scheduled task.</li>
110         <li><strong>web application</strong>: A web application running on a java application
111           server. With this type of use, the crawler also features an automatic retry mechanism in
112           case of failures, as well as a simple web interface. </li>
113       </ul>
114     </section>
115
116     <section>
117       <title>Downloading</title>
118
119       <p> At this moment, no formal releases have been made and only the latest version can be
120         downloaded. </p>
121       <p> The easy way to start is the <a
122           href="installs/crawler/target/wamblee-crawler-0.2-SNAPSHOT-kissbin.zip">standalone program
123           binary version</a> or using the <a
124           href="installs/crawler/kissweb/target/wamblee-crawler-kissweb.war">web application</a>. </p>
125       <p> The latest source can be obtained from subversion with the URL
126           <code>https://wamblee.org/svn/public/utils</code>. The subversion repository allows
127         read-only access to anyone. </p>
128       <p> The application was developed and tested on SuSE linux 10.1 with 
129         JBoss 4.0.4 application
130         server (only required for the web application). It requires at least a Java Virtual Machine
131         1.5 or greater to run. </p>
132     </section>
133
134     <section>
135       <title>Configuring the crawler</title>
136
137       <p> The crawler comes with three configuration files: </p>
138       <ul>
139         <li><code>crawler.xml</code>: basic crawler configuration tailored to the KiSS electronic
140           programme guide.</li>
141         <li><code>programs.xml</code>: containing a description of which programs must be recorded
142           and which programs are interesting.</li>
143         <li><code>org.wamblee.crawler.properties</code>: Containing a configuration </li>
144       </ul>
145       <p> For the standalone program, all configuration files are in the <code>conf</code>
146         directory. For the web application, the properties files is located in the
147           <code>WEB-INF/classes</code> directory of the web application, and
148         <code>crawler.xml</code> and <code>programs.xml</code> are located outside of the web
149         application at a location configured in the properties file. </p>
150
151
152       <section>
153         <title>Crawler configuration <code>crawler.xml</code></title>
154
155         <p> First of all, copy the <code>config.xml.example</code> file to <code>config.xml</code>.
156           After that, edit the first entry of that file and replace <code>user</code> and
157             <code>passwd</code> with your personal user id and password for the KiSS Electronic
158           Programme Guide. </p>
159       </section>
160
161       <section>
162         <title>Program configuration</title>
163         <p> Interesting TV shows are described using <code>program</code> elements. Each
164             <code>program</code> element contains one or more <code>match</code> elements that
165           describe a condition that the interesting program must match. </p>
166         <p> Matching can be done on the following properties of a program: </p>
167         <table>
168           <tr>
169             <th>Field name</th>
170             <th>Description</th>
171           </tr>
172           <tr>
173             <td>name</td>
174             <td>Program name</td>
175           </tr>
176           <tr>
177             <td>description</td>
178             <td>Program description</td>
179           </tr>
180           <tr>
181             <td>channel</td>
182             <td>Channel name</td>
183           </tr>
184           <tr>
185             <td>keywords</td>
186             <td>Keywords/classification of the program.</td>
187           </tr>
188         </table>
189         <p> The field to match is specified using the <code>field</code> attribute of the
190             <code>match</code> element. If no field name is specified then the program name is
191           matched. Matching is done by converting the field value to lowercase and then doing a
192           perl-like regular expression match of the provided value. As a result, the content of the
193           match element should be specified in lower case otherwise the pattern will never match. If
194           multiple <code>match</code> elements are specified for a given <code>program</code>
195           element, then all matches must apply for a program to be interesting. </p>
196         <p> Example patterns: </p>
197         <table>
198           <tr>
199             <th>Pattern</th>
200             <th>Examples of matching field values</th>
201           </tr>
202           <tr>
203             <td>the.*x.*files</td>
204             <td>"The X files", "The X-Files: the making of"</td>
205           </tr>
206           <tr>
207             <td>star trek</td>
208             <td>"Star Trek Voyager", "Star Trek: The next generation"</td>
209           </tr>
210         </table>
211
212         <p> It is possible that different programs cannot be recorded since they overlap. To deal
213           with such conflicts, it is possible to specify a priority using the <code>priority</code>
214           element. Higher values of the priority value mean a higher priority. If two programs have
215           the same priority, then it is (more or less) unspecified which of the two will be
216           recorded, but it will at least record one program. If no priority is specified, then the
217           priority is 1 (one). </p>
218
219         <p> Since it is not always desirable to try to record every program that matches the
220           criteria, it is also possible to generate notifications for interesting programs only
221           without recording them. This is done by specifying the <code>action</code> alement with
222           the content <code>notify</code>. By default, the <code>action</code> is
223           <code>record</code>. To make the mail reports more readable it is possible to also assign
224           a category to a program for grouping interesting programs. This can be done using the
225             <code>category</code> element. Note that if the <code>action</code> is
226           <code>notify</code>. then the <code>priority</code> element is not used. </p>
227
228       </section>
229
230       <section>
231         <title>Notification configuration</title>
232         <p> Edit the configuration file <code>org.wamblee.crawler.properties</code>. The properties
233           file is self-explanatory. </p>
234       </section>
235     </section>
236
237
238
239
240     <section>
241       <title>Installing and running the crawler</title>
242
243       <section>
244         <title>Standalone application</title>
245         <p> In the binary distribution, execute the <code>run</code> script for your operating
246           system (<code>run.bat</code> for windows, and <code>run.sh</code> for unix). </p>
247       </section>
248
249       <section>
250         <title>Web application</title>
251         <p> After deploying the web application, navigate to the application in your browser (e.g.
252             <code>http://localhost:8080/wamblee-crawler-kissweb</code>). The screen should show an
253           overview of the last time it ran (if it ran before) as well as a button to run the crawler
254           immediately. Also, the result of the last run can be viewed. The crawler will run
255           automatically starting after 19:00, 
256           and will retry at 1 hour intervals in case
257           of failure to retrieve programme information. 
258           </p> 
259           
260           <p>
261           Since the crawler checks the status at 
262           1 hour intervals it can run for the first time anytime between 19:00 and 20:00. This is done
263           on purpose since it means that crawlers run by different people will not all start running 
264           simultaneously and is thus more friendly to the KiSS servers.  </p>
265       </section>
266
267       <section>
268         <title>Source distribution</title>
269         <p> With the source code, build everything with maven2 as follows:</p>
270         <source>
271            mvn -Dmaven.test.skip=true install
272            cd crawler
273            mvn package assembly:assembly
274         </source> 
275         <p>
276           After this, locate the
277           binary distribution in the <code>target</code> subdirectory of the <code>crawler</code>
278           directory. Then
279           proceed as for the binary distribution.</p>
280          
281       </section>
282
283       <section>
284         <title>General usage</title>
285         <p> When the crawler runs, it retrieves the programs for tomorrow. 
286         </p>
287         <note> If you deploy the web application today, it will run automatically on the next (!)
288           day. This even holds if you deploy the application before the normal scheduled time. </note>
289       </section>
290
291
292     </section>
293
294     <section id="examples">
295       <title>Examples</title>
296
297       <p> The best example is in the distribution itself. It is my personal
298         <code>programs.xml</code> file. </p>
299     </section>
300
301     <section>
302       <title>Contributing</title>
303
304       <p> You are always welcome to contribute. If you find a problem just tell me about it and if
305         you have ideas am I always interested to hear about them. </p>
306       <p> If you are a programmer and have a fix for a bug, just send me a patch and if you are
307         fanatic enough and have ideas, I can also give you write access to the repository. </p>
308     </section>
309
310
311   </body>
312 </document>