Unverified Commit cca75a42 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

HAFAS, hafas-m: Add descriptions for ÖBB MOT bits

See #11
parent f9b37e25
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -157,11 +157,14 @@ sub parse_mot_options {
			$service //= 'DB';
			my $desc = Travel::Status::DE::HAFAS::get_service($service);
			if ($desc) {
				my @mots = @{ $desc->{productbits} };
				@mots = grep { $_ ne 'x' } @mots;
				@mots = uniq @mots;
				@mots = sort @mots;
				say join( "\n", @mots );
				for my $mot ( @{ $desc->{productbits} } ) {
					if ( ref($mot) eq 'ARRAY' ) {
						printf( "%-10s %s\n", @{$mot} );
					}
					else {
						say $mot;
					}
				}
				exit 0;
			}
			else {
+30 −10
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ my %hafas_instance = (
		mgate         => 'https://reiseauskunft.bahn.de/bin/mgate.exe',
		name          => 'Deutsche Bahn',
		productbits   => [qw[ice ic_ec d regio s bus ferry u tram ondemand]],
		productgroups =>
		  [ [qw[ice ic_ec d]], [qw[regio s]], [qw[bus ferry u tram ondemand]] ],
		salt      => 'bdI8UVj4' . '0K5fvxwf',
		languages => [qw[de en fr es]],
		request   => {
@@ -116,8 +118,21 @@ my %hafas_instance = (
		mgate       => 'https://fahrplan.oebb.at/bin/mgate.exe',
		stopfinder  => 'https://fahrplan.oebb.at/bin/ajax-getstop.exe',
		name        => 'Österreichische Bundesbahnen',
		productbits =>
		  [qw[ice_rj sev ic_ec d_n regio s bus ferry u tram other]],
		productbits => [
			[ ice_rj => 'long distance trains' ],
			[ sev    => 'rail replacement service' ],
			[ ic_ec  => 'long distance trains' ],
			[ d_n    => 'night trains and rapid trains' ],
			[ regio  => 'regional trains' ],
			[ s      => 'suburban trains' ],
			[ bus    => 'busses' ],
			[ ferry  => 'maritime transit' ],
			[ u      => 'underground' ],
			[ tram   => 'trams' ],
			[ other  => 'other transit services' ]
		],
		productgroups =>
		  [ qw[ice_rj ic_ec d_n], qw[regio s sev], qw[bus ferry u tram other] ],
		request => {
			client => {
				id   => 'OEBB',
@@ -509,8 +524,13 @@ sub mot_mask {

	my %mot_pos;
	for my $i ( 0 .. $#{ $hafas_instance{$service}{productbits} } ) {
		if ( ref( $hafas_instance{$service}{productbits}[$i] ) eq 'ARRAY' ) {
			$mot_pos{ $hafas_instance{$service}{productbits}[$i][0] } = $i;
		}
		else {
			$mot_pos{ $hafas_instance{$service}{productbits}[$i] } = $i;
		}
	}

	if ( my @mots = @{ $self->{exclusive_mots} // [] } ) {
		$mot_mask = 0;