Closed djmattyg007 closed 3 years ago
As per my notes from the mopidy core PR:
Note that it isn't enough to simply catch configparser.DuplicateSectionError or configparser.DuplicateOptionError and keep moving, as the config object ends up in a weird half-finished state that doesn't match its state when it has finished parsing without throwing.
Consideration should also be given switching away from configparser.RawConfigParser, as the official python documentation recommends moving to configparser.ConfigParser. I'd be happy to update this PR to switch this at the same time.
Merging #42 into master will not change coverage. The diff coverage is
0.00%
.
@@ Coverage Diff @@
## master #42 +/- ##
=======================================
Coverage 15.58% 15.58%
=======================================
Files 3 3
Lines 494 494
=======================================
Hits 77 77
Misses 417 417
Impacted Files | Coverage Δ | |
---|---|---|
mopidy_tunein/tunein.py | 27.79% <0.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 241a277...062f7ee. Read the comment docs.
strict, default value: True
When set to True, the parser will not allow for any section or option duplicates while reading from a single source (using read_file(), read_string() or read_dict()). It is recommended to use strict parsers in new applications.
Changed in version 3.2: In previous versions of configparser behaviour matched strict=False.
Hmm was this actually a regression introduced when moving from Python 2?
It definitely seems like it. That said, as an Aussie I will probably try to find some way to contact the ABC and ask them to fix their PLS files :P
Some PLS files contain one 'Version' key for each file in the playlist. This ultimately has no impact on how mopidy parses files in the playlist, and therefore it should be as tolerant as possible of real-world playlist files.
This matches a similar change request submitted to the mopidy core:
https://github.com/mopidy/mopidy/pull/1923
This change is primarily designed to resolve an issue where playing back certain TuneIn radio streams. For example, the following stream does not work due to having multiple
Version
keys:URI: tunein:station:s10113 TuneIn request URL: http://opml.radiotime.com/Tune.ashx?render=json&id=s10113 Playlist URL: http://www.abc.net.au/res/streaming/audio-live/shout-mp3/local-melbourne.pls
The above playlist file is successfully parsed after turning of strict parsing.