Skip to content

Commit

Permalink
removed '&' handling in XMLPlaylistParser
Browse files Browse the repository at this point in the history
  • Loading branch information
geo-martino committed Jul 25, 2024
1 parent 8792a19 commit ecebd90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 9 additions & 0 deletions docs/info/release-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ The format is based on `Keep a Changelog <https://keepachangelog.com/en>`_,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_


1.1.6
=====

Fixed
-----
* Remove '&' character handling in :py:class:`.XMLPlaylistParser`. Was being handled twice as it is already
handled by the ``xmltodict`` package.


1.1.5
=====

Expand Down
6 changes: 2 additions & 4 deletions musify/libraries/local/playlist/xautopf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
The XAutoPF implementation of a :py:class:`LocalPlaylist`.
"""
import re
from collections.abc import Collection, Mapping, Sequence
from copy import deepcopy
from dataclasses import dataclass
Expand Down Expand Up @@ -519,13 +518,12 @@ def parse_exception_paths(
include_items = tuple(items_mapped[path] for path in matcher.include if path in items_mapped)
exclude_items = tuple(matched_mapped[path] for path in matcher.exclude if path in matched_mapped)

amp_pattern = re.compile('&(?!amp;)')
if len(include_items) > 0:
include_paths = self.path_mapper.unmap_many(include_items, check_existence=False)
self.xml_source["ExceptionsInclude"] = amp_pattern.sub("&amp;", "|".join(include_paths))
self.xml_source["ExceptionsInclude"] = "|".join(include_paths)
if len(exclude_items) > 0:
exclude_paths = self.path_mapper.unmap_many(exclude_items, check_existence=False)
self.xml_source["Exceptions"] = amp_pattern.sub("&amp;", "|".join(exclude_paths))
self.xml_source["Exceptions"] = "|".join(exclude_paths)

def get_limiter(self) -> ItemLimiter | None:
"""Initialise and return a :py:class:`ItemLimiter` object from loaded XML playlist data."""
Expand Down

0 comments on commit ecebd90

Please sign in to comment.