~davewalker/xmltv/544522

« back to all changes in this revision

Viewing changes to lib/Options.pm

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Lesicnik
  • Date: 2008-08-07 07:25:45 UTC
  • mfrom: (1.2.10 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080807072545-ttu7eljrarkzon1p
Tags: 0.5.52-1ubuntu1
* Merge from debian unstable, remaining changes: (LP: #255450)
  - Fixes multiple broken grabbers (LP: #193703)
  - Update 06_grab_no.dpatch
* Deleted 07_grab_pt.patch from debian/patches as it is now in Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
                    },
111
111
                    );
112
112
 
 
113
=head1 USAGE
113
114
 
114
 
=item ParseOptions
 
115
=item B<ParseOptions>
115
116
 
116
117
ParseOptions shall be called by a grabber to parse the command-line
117
118
options supplied by the user. It takes a single hashref as a parameter.
119
120
 
120
121
  my( $opt, $conf ) = ParseOptions( {
121
122
    grabber_name => 'tv_grab_test',
122
 
    version => '$Id: Options.pm,v 1.14 2007/10/28 06:25:16 mattiasholmlund Exp $',
 
123
    version => '$Id: Options.pm,v 1.15 2008/06/01 01:48:00 knowledgejunkie Exp $',
123
124
    description => 'Sweden (tv.swedb.se)',
124
125
    capabilities => [qw/baseline manualconfig apiconfig/],
125
126
    stage_sub => \&config_stage,
158
159
 
159
160
=item --preferredmethod 
160
161
 
161
 
Handled automaticall if the preferredmethod capability has been set and
 
162
Handled automatically if the preferredmethod capability has been set and
162
163
the preferredmethod option has been specified in the call to ParseOptions.
163
164
 
164
165
=back
186
187
the specified file.
187
188
 
188
189
The grabber must check the following options on its own:
189
 
--days
190
 
--offset
191
 
--quiet
192
 
--debug
 
190
 
 
191
=over
 
192
 
 
193
=item --days
 
194
 
 
195
=item --offset
 
196
 
 
197
=item --quiet
 
198
 
 
199
=item --debug
 
200
 
 
201
=back
193
202
 
194
203
and any other options that are grabber specific. This can be done by reading
195
204
$opt->{days} etc.
196
205
 
197
 
Changing the behaviour of ParseOptions
 
206
=item B<Changing the behaviour of ParseOptions>
 
207
 
198
208
 
199
209
The behaviour of ParseOptions can be influenced by passing named arguments
200
210
in the hashref. The following arguments are supported:
210
220
 
211
221
Required. The description for the grabber. This is returned in response to
212
222
the --description option and shall say which region the grabber returns data
213
 
for (e.g. "Sweden" or "Sweden (tv.swedb.se)" if there are several grabbers
214
 
for a country).
 
223
for. Examples: "Sweden", or "Sweden (tv.swedb.se)" if there are several grabbers
 
224
for a region or country).
215
225
 
216
226
=item version
217
227
 
220
230
=item capabilities
221
231
 
222
232
Required. The capabilities that the grabber shall support. Only capabilities
223
 
that XMLTV::Options know how to handle can be specified. Example:
 
233
that XMLTV::Options knows how to handle can be specified. Example:
224
234
 
225
235
  capabilities => [qw/baseline manualconfig apiconfig/],
226
236
 
227
 
Note that XMLTV::Options guarantee that the grabber supports the manualconfig
 
237
Note that XMLTV::Options guarantees that the grabber supports the manualconfig
228
238
and apiconfig capabilities. The capabilities share and cache can be
229
239
specified if the grabber supports them. XMLTV::Options will then automatically
230
240
accept the command-line parameters --share and --cache respectively.
238
248
 
239
249
=item listchannels_sub
240
250
 
241
 
Required. listchannels_sub shall be a coderef that takes a configuration
 
251
Required. A coderef that takes a configuration
242
252
hash as returned by XMLTV::Configure::LoadConfig as the first parameter
243
253
and an option hash as returned by
244
 
ParseOptions as the second parameter and returns an xml-string
 
254
ParseOptions as the second parameter, and returns an xml-string
245
255
containing a list of all the channels that the grabber can deliver
246
256
data for using the supplied configuration. Note that the listsub
247
257
shall not use any channel-configuration from the hashref.
257
267
 
258
268
=item preferredmethod
259
269
 
260
 
A value to return when the grabber is called with the --preferredmethod
261
 
parameter. Example:
 
270
Optional. A value to return when the grabber is called with the 
 
271
--preferredmethod parameter. Example:
262
272
 
263
273
  my( $opt, $conf ) = ParseOptions( {
264
274
    grabber_name => 'tv_grab_test',
265
 
    version => '$Id: Options.pm,v 1.14 2007/10/28 06:25:16 mattiasholmlund Exp $',
 
275
    version => '$Id: Options.pm,v 1.15 2008/06/01 01:48:00 knowledgejunkie Exp $',
266
276
    description => 'Sweden (tv.swedb.se)',
267
277
    capabilities => [qw/baseline manualconfig apiconfig preferredmethod/],
268
278
    stage_sub => \&config_stage,