MCPcopy Create free account
hub / github.com/KDE/kid3 / getInformation

Method getInformation

src/core/model/scriptinterface.cpp:566–604  ·  view source on GitHub ↗

* Get technical information about file. * Properties are Format, Bitrate, Samplerate, Channels, Duration, * Channel Mode, VBR, Tag 1, Tag 2. * Properties which are not available are omitted. * * @return list with alternating property names and values. */

Source from the content-addressed store, hash-verified

564 * @return list with alternating property names and values.
565 */
566QStringList ScriptInterface::getInformation()
567{
568 QStringList lst;
569 QModelIndex index = m_app->getFileSelectionModel()->currentIndex();
570 if (TaggedFile* taggedFile = FileProxyModel::getTaggedFileOfIndex(index)) {
571 TaggedFile::DetailInfo info;
572 taggedFile->getDetailInfo(info);
573 if (info.valid) {
574 lst << QLatin1String("Format") << info.format;
575 if (info.bitrate > 0 && info.bitrate < 16384) {
576 lst << QLatin1String("Bitrate") << QString::number(info.bitrate);
577 }
578 if (info.sampleRate > 0) {
579 lst << QLatin1String("Samplerate") << QString::number(info.sampleRate);
580 }
581 if (info.channels > 0) {
582 lst << QLatin1String("Channels") << QString::number(info.channels);
583 }
584 if (info.duration > 0) {
585 lst << QLatin1String("Duration") << QString::number(info.duration);
586 }
587 if (info.channelMode == TaggedFile::DetailInfo::CM_Stereo ||
588 info.channelMode == TaggedFile::DetailInfo::CM_JointStereo) {
589 lst << QLatin1String("Channel Mode") <<
590 (info.channelMode == TaggedFile::DetailInfo::CM_Stereo ?
591 QLatin1String("Stereo") : QLatin1String("Joint Stereo"));
592 }
593 if (info.vbr) {
594 lst << QLatin1String("VBR") << QLatin1String("1");
595 }
596 }
597 FOR_ALL_TAGS(tagNr) {
598 if (QString tag = taggedFile->getTagFormat(tagNr); !tag.isEmpty()) {
599 lst << QLatin1String("Tag ") + Frame::tagNumberToString(tagNr) << tag; // clazy:exclude=reserve-candidates
600 }
601 }
602 }
603 return lst;
604}
605
606/**
607 * Set tag from file name.

Callers

nothing calls this directly

Calls 2

currentIndexMethod · 0.80
getDetailInfoMethod · 0.45

Tested by

no test coverage detected