Skip to content

Commit e1a35fc

Browse files
committed
Fixed channel icon conflict when populating the database from a XMLTV source
Based on the remote filenames of the icons, conflicts can arise, causing a mess: <icon src="https://static.te.../stations/308/icon320_light.png?v2023_48_0"/> <icon src="https://static.te.../stations/58/icon320_light.png?v2023_48_0"/> <icon src="https://static.te.../stations/383/icon320_light.png?v2023_48_0"/> These cases generate the same icon filename 'icon320_light.png?v2023_48_0'. The proposed solution no longer uses the original filename; it now generates a user-friendly name from the source identifier of channel (sourceId + xmltvId), followed by the remote name. This way, the generated name can no longer conflict with that of another channel, and it is easily identifiable by the user. <source_id>_<xmltv_id>_<remotename> Now downloaded icon names from xmltv source look like the following. 1_TF1SeriesFilms.fr_icon320_light.png?v2023_48_0 1_LEquipe21.fr_icon320_light.png?v2023_48_0 1_6ter.fr_icon320_light.png?v2023_48_0
1 parent c77c014 commit e1a35fc

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

mythtv/programs/mythfilldatabase/channeldata.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,13 @@ void ChannelData::handleChannels(int id, ChannelInfoList *chanlist) const
211211

212212
if (!(*i).m_icon.isEmpty())
213213
{
214-
QDir remotefile = QDir((*i).m_icon);
215-
QString filename = remotefile.dirName();
214+
QString remotename = QDir((*i).m_icon).dirName();
215+
// Define an unique icon filename for this channel and xmltv source
216+
// The most obvious format is <source_id>_<xmltv_id>_<remotename>
217+
QString filename(QString::number(id));
218+
filename.append("_").append((*i).m_xmltvId);
219+
filename.append("_").append(remotename);
220+
filename.remove(QRegularExpression("[ \\\\/\\:\\*\\[\\]\\(\\)]"));
216221

217222
localfile = fileprefix + filename;
218223
QFile actualfile(localfile);

0 commit comments

Comments
 (0)