@@ -415,23 +415,34 @@ def _decode_lines(fid, l_0, platform, only_first, open_is_dummy=False):
415415 designator = "1 " + SATELLITES .get (platform , "" )
416416 tle = ""
417417 l_0 = _decode (l_0 )
418- if l_0 .strip () == platform :
419- l_1 = _decode (next (fid ))
420- l_2 = _decode (next (fid ))
421- tle = _merge_tle_from_two_lines (l_1 , l_2 )
418+ if l_0 .strip () == platform and platform != "" :
419+ tle = _decode_lines_with_platform_header (fid )
422420 elif l_0 .strip ().startswith (designator ):
423- if (platform in SATELLITES or not only_first ) or open_is_dummy :
424- l_1 = l_0
425- l_2 = _decode (next (fid ))
426- tle = _merge_tle_from_two_lines (l_1 , l_2 )
427- if platform :
428- LOGGER .debug ("Found platform %s, ID: %s" , platform , SATELLITES [platform ])
421+ tle = _decode_lines_without_platform_header (fid , l_0 , platform , only_first , open_is_dummy )
429422 elif l_0 .startswith (platform ) and platform not in SATELLITES :
430423 LOGGER .debug ("Found a possible match: %s?" , str (l_0 .strip ()))
431424
432425 return tle
433426
434427
428+ def _decode_lines_with_platform_header (fid ):
429+ l_1 = _decode (next (fid ))
430+ l_2 = _decode (next (fid ))
431+ tle = _merge_tle_from_two_lines (l_1 , l_2 )
432+ return tle
433+
434+
435+ def _decode_lines_without_platform_header (fid , l_0 , platform , only_first , open_is_dummy ):
436+ tle = ""
437+ if (platform in SATELLITES or not only_first ) or open_is_dummy :
438+ l_1 = l_0
439+ l_2 = _decode (next (fid ))
440+ tle = _merge_tle_from_two_lines (l_1 , l_2 )
441+ if platform :
442+ LOGGER .debug ("Found platform %s, ID: %s" , platform , SATELLITES [platform ])
443+ return tle
444+
445+
435446def _merge_tle_from_two_lines (l_1 , l_2 ):
436447 """Merge line1 and line2 to fulle TLE string."""
437448 return l_1 .strip () + "\n " + l_2 .strip ()
0 commit comments