Ticket #2318: xmltv_parsing_improv.diff

File xmltv_parsing_improv.diff, 2.9 KB (added by stuartm, 19 years ago)
  • programs/mythfilldatabase/filldata.cpp

     
    13181322    }
    13191323}
    13201324
     1325void parseVideo(QDomElement &element, ProgInfo *pginfo)
     1326{
     1327    for (QDomNode child = element.firstChild(); !child.isNull();
     1328         child = child.nextSibling())
     1329    {
     1330        QDomElement info = child.toElement();
     1331        if (!info.isNull())
     1332        {
     1333            if (info.tagName() == "present")
     1334            {
     1335            }
     1336            else if (info.tagName() == "aspect")
     1337            {
     1338            }
     1339            else if (info.tagName() == "colour")
     1340            {
     1341            }
     1342            else if (info.tagName() == "quality")
     1343            {
     1344                if (getFirstText(info) == "HDTV")
     1345                        pginfo->hdtv = true;
     1346            }
     1347        }
     1348    }
     1349}
     1350
     1351void parseAudio(QDomElement &element, ProgInfo *pginfo)
     1352{
     1353    for (QDomNode child = element.firstChild(); !child.isNull();
     1354         child = child.nextSibling())
     1355    {
     1356        QDomElement info = child.toElement();
     1357        if (!info.isNull())
     1358        {
     1359            if (info.tagName() == "stereo")
     1360            {
     1361                if (getFirstText(info) == "mono")
     1362                {
     1363                    pginfo->stereo = false;
     1364                }
     1365                else if (getFirstText(info) == "stereo")
     1366                {
     1367                    pginfo->stereo = true;
     1368                }
     1369                else if (getFirstText(info) == "dolby")
     1370                {
     1371                    pginfo->stereo = true;
     1372                }
     1373                else if (getFirstText(info) == "dolby digital")
     1374                {
     1375                    pginfo->stereo = true;
     1376                }
     1377                else if (getFirstText(info) == "surround")
     1378                {
     1379                    pginfo->stereo = true;
     1380                }
     1381            }
     1382        }
     1383    }
     1384}
     1385
    13211386ProgInfo *parseProgram(QDomElement &element, int localTimezoneOffset)
    13221387{
    13231388    QString uniqueid, seriesid, season, episode;
     
    14641529            {
    14651530                parseCredits(info, pginfo);
    14661531            }
     1532            else if (info.tagName() == "subtitles" && info.attribute("type") == "teletext")
     1533            {
     1534                pginfo->closecaptioned = true;
     1535            }
     1536            else if (info.tagName() == "subtitles" && info.attribute("type") == "onscreen")
     1537            {
     1538                pginfo->subtitled = true;
     1539            }
     1540            else if (info.tagName() == "audio")
     1541            {
     1542                parseAudio(info, pginfo);
     1543            }
     1544            else if (info.tagName() == "video")
     1545            {
     1546                parseVideo(info, pginfo);
     1547            }
    14671548            else if (info.tagName() == "episode-num" &&
    14681549                     info.attribute("system") == "xmltv_ns")
    14691550            {