daniel-widrick / zap2it-GuideScraping

MIT License
61 stars 22 forks source link

Ampersand in 'display-name' element value results in xml not parsable by jellyfin. #13

Closed jeremyjjbrown closed 3 years ago

jeremyjjbrown commented 3 years ago

xml with

    <channel id="81302">
        <display-name>49.3 WMLWDT3</display-name>
        <display-name>49.3</display-name>
        <display-name>WMLWDT3</display-name>
        <display-name>Heroes & Icons Network</display-name>
        <icon src="http://zap2it.tmsimg.com/h3/NowShowing/81302/s90401_h3_aa.png" />
    </channel>

results in a stack trace and no guide date in Jellyfin:10.7.6

[21:24:39] [ERR] [21] Emby.Server.Implementations.LiveTv.EmbyTV.EmbyTV: Error adding metadata
System.Xml.XmlException: An error occurred while parsing EntityName. Line 499, position 25.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, Int32 lineNo, Int32 linePos)
   at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
   at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
   at System.Xml.XmlTextReaderImpl.FinishPartialValue()
   at System.Xml.XmlTextReaderImpl.get_Value()
   at System.Xml.XmlReader.InternalReadContentAsString()
   at System.Xml.XmlSubtreeReader.ReadContentAsString()
   at System.Xml.XmlReader.ReadElementContentAsString()
   at Jellyfin.XmlTv.XmlTvReader.ProcessNode(XmlReader reader, Action`1 setter, String languageRequired, Action`1 allOccurrencesSetter)
   at Jellyfin.XmlTv.XmlTvReader.GetChannel(XmlReader reader)
   at Jellyfin.XmlTv.XmlTvReader.GetChannels()
   at Emby.Server.Implementations.LiveTv.Listings.XmlTvListingsProvider.GetChannels(ListingsProviderInfo info, CancellationToken cancellationToken)
   at Emby.Server.Implementations.LiveTv.EmbyTV.EmbyTV.GetEpgChannels(IListingsProvider provider, ListingsProviderInfo info, Boolean enableCache, CancellationToken cancellationToken)
   at Emby.Server.Implementations.LiveTv.EmbyTV.EmbyTV.AddMetadata(IListingsProvider provider, ListingsProviderInfo info, IEnumerable`1 tunerChannels, Boolean enableCache, CancellationToken cancellationToken)
   at Emby.Server.Implementations.LiveTv.EmbyTV.EmbyTV.GetChannelsAsync(Boolean enableCache, CancellationToken cancellationToken)
[21:24:39] [INF] [21] Emby.Server.Implementations.LiveTv.LiveTvManager: Refreshing guide with 7 days of guide data

I can test fixing this but escaping or removing the & and submit a patch.

daniel-widrick commented 3 years ago

I will accept the pull request if you do submit a fix. I would expect replacing '&' in names with &amp; to work well in this instance.

jeremyjjbrown commented 3 years ago

https://github.com/daniel-widrick/zap2it-GuideScraping/pull/14