mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-02 12:26:48 +01:00
- Fixed decoding of non-ASCII lyric texts
- Lyrics can now be viewed/edited in the metadata-editor Squashed commit of the following: commit 0851f619c27348e3ceeaf31a8edc3a567ccee99c Author: Martin Babutzka <martin.babutzka@online.de> Date: Wed Jun 10 21:21:50 2015 +0200 'make format' and brackets in a condition clause. commit bab7a1d07af3bc53034e3883d352ae6d4dd33e2a Author: Martin Babutzka <martin.babutzka@online.de> Date: Sun Jun 7 01:51:31 2015 +0200 Added capability to SAVE lyrics frames to mp3 files in tagreader. Improved scaling properties of edittags dialog. commit 4bd71a2d6a4479a664bf8b5b3ead05c23c86e15d Author: Martin Babutzka <martin.babutzka@online.de> Date: Sat Jun 6 23:33:22 2015 +0200 Updated lyrics tag buddy to lyrics commit 2ceb8967f67e76a0f78b25a7a128c4429a93bcd9 Author: Martin Babutzka <martin.babutzka@online.de> Date: Sun May 17 18:52:33 2015 +0200 Add lyrics field to tag editor commit 04b65e33a83e449055659a72a283954311a12fb7 Author: Martin Babutzka <martin.babutzka@online.de> Date: Fri May 8 23:24:02 2015 +0200 Using decode method to fix non-ASCII letters.
This commit is contained in:
parent
88bce5115f
commit
0b16dad50f
@ -48,6 +48,7 @@
|
||||
#include <textidentificationframe.h>
|
||||
#include <trueaudiofile.h>
|
||||
#include <tstring.h>
|
||||
#include <unsynchronizedlyricsframe.h>
|
||||
#include <vorbisfile.h>
|
||||
#include <wavfile.h>
|
||||
|
||||
@ -190,10 +191,12 @@ void TagReader::ReadFile(const QString& filename,
|
||||
TStringToQString(map["TCMP"].front()->toString()).trimmed();
|
||||
|
||||
if (!map["USLT"].isEmpty()) {
|
||||
lyrics = TStringToQString((map["USLT"].front())->toString()).trimmed();
|
||||
qLog(Debug) << "Read ULST lyrics " << lyrics;
|
||||
} else if (!map["SYLT"].isEmpty())
|
||||
lyrics = TStringToQString((map["SYLT"].front())->toString()).trimmed();
|
||||
Decode(map["USLT"].front()->toString(), nullptr,
|
||||
song->mutable_lyrics());
|
||||
} else if (!map["SYLT"].isEmpty()) {
|
||||
Decode(map["SYLT"].front()->toString(), nullptr,
|
||||
song->mutable_lyrics());
|
||||
}
|
||||
|
||||
if (!map["APIC"].isEmpty()) song->set_art_automatic(kEmbeddedCover);
|
||||
|
||||
@ -628,7 +631,7 @@ bool TagReader::SaveFile(const QString& filename,
|
||||
SetTextFrame("TCOM", song.composer(), tag);
|
||||
SetTextFrame("TIT1", song.grouping(), tag);
|
||||
SetTextFrame("TOPE", song.performer(), tag);
|
||||
SetTextFrame("USLT", song.lyrics(), tag);
|
||||
SetUnsyncLyricsFrame(song.lyrics(), tag);
|
||||
// Skip TPE1 (which is the artist) here because we already set it
|
||||
SetTextFrame("TPE2", song.albumartist(), tag);
|
||||
SetTextFrame("TCMP", std::string(song.compilation() ? "1" : "0"), tag);
|
||||
@ -857,6 +860,23 @@ void TagReader::SetTextFrame(const char* id, const std::string& value,
|
||||
tag->addFrame(frame);
|
||||
}
|
||||
|
||||
void TagReader::SetUnsyncLyricsFrame(const std::string& value,
|
||||
TagLib::ID3v2::Tag* tag) const {
|
||||
TagLib::ByteVector id_vector("USLT");
|
||||
|
||||
// Remove the frame if it already exists
|
||||
while (tag->frameListMap().contains(id_vector) &&
|
||||
tag->frameListMap()[id_vector].size() != 0) {
|
||||
tag->removeFrame(tag->frameListMap()[id_vector].front());
|
||||
}
|
||||
|
||||
// Create and add a new frame
|
||||
TagLib::ID3v2::UnsynchronizedLyricsFrame* frame =
|
||||
new TagLib::ID3v2::UnsynchronizedLyricsFrame(TagLib::String::UTF8);
|
||||
frame->setText(StdStringToTaglibString(value));
|
||||
tag->addFrame(frame);
|
||||
}
|
||||
|
||||
bool TagReader::IsMediaFile(const QString& filename) const {
|
||||
qLog(Debug) << "Checking for valid file" << filename;
|
||||
|
||||
|
@ -87,12 +87,12 @@ class TagReader {
|
||||
void SetFMPSStatisticsVorbisComments(
|
||||
TagLib::Ogg::XiphComment* vorbis_comments,
|
||||
const pb::tagreader::SongMetadata& song) const;
|
||||
void SetFMPSRatingVorbisComments(TagLib::Ogg::XiphComment* vorbis_comments,
|
||||
const pb::tagreader::SongMetadata& song)
|
||||
const;
|
||||
void SetFMPSRatingVorbisComments(
|
||||
TagLib::Ogg::XiphComment* vorbis_comments,
|
||||
const pb::tagreader::SongMetadata& song) const;
|
||||
|
||||
pb::tagreader::SongMetadata_Type GuessFileType(TagLib::FileRef* fileref)
|
||||
const;
|
||||
pb::tagreader::SongMetadata_Type GuessFileType(
|
||||
TagLib::FileRef* fileref) const;
|
||||
|
||||
void SetUserTextFrame(const QString& description, const QString& value,
|
||||
TagLib::ID3v2::Tag* tag) const;
|
||||
@ -104,6 +104,8 @@ class TagReader {
|
||||
TagLib::ID3v2::Tag* tag) const;
|
||||
void SetTextFrame(const char* id, const std::string& value,
|
||||
TagLib::ID3v2::Tag* tag) const;
|
||||
void SetUnsyncLyricsFrame(const std::string& value,
|
||||
TagLib::ID3v2::Tag* tag) const;
|
||||
|
||||
private:
|
||||
static const char* kMP4_FMPS_Rating_ID;
|
||||
|
@ -304,6 +304,7 @@ QVariant EditTagDialog::Data::value(const Song& song, const QString& id) {
|
||||
if (id == "grouping") return song.grouping();
|
||||
if (id == "genre") return song.genre();
|
||||
if (id == "comment") return song.comment();
|
||||
if (id == "lyrics") return song.lyrics();
|
||||
if (id == "track") return song.track();
|
||||
if (id == "disc") return song.disc();
|
||||
if (id == "year") return song.year();
|
||||
@ -330,6 +331,8 @@ void EditTagDialog::Data::set_value(const QString& id, const QVariant& value) {
|
||||
current_.set_genre(value.toString());
|
||||
else if (id == "comment")
|
||||
current_.set_comment(value.toString());
|
||||
else if (id == "lyrics")
|
||||
current_.set_lyrics(value.toString());
|
||||
else if (id == "track")
|
||||
current_.set_track(value.toInt());
|
||||
else if (id == "disc")
|
||||
|
@ -30,7 +30,7 @@
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tab_widget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="summary_tab">
|
||||
<attribute name="title">
|
||||
@ -605,9 +605,25 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tags_tab">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>528</width>
|
||||
<height>514</height>
|
||||
</size>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Edit tags</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="title_label">
|
||||
@ -847,7 +863,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QPushButton" name="fetch_tag">
|
||||
<property name="text">
|
||||
<string>Complete tags automatically</string>
|
||||
@ -864,8 +880,54 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="lyrics_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lyrics</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lyrics</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="TextEdit" name="lyrics">
|
||||
<property name="has_reset_button" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="has_clear_button" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="comment_label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
@ -874,7 +936,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="3">
|
||||
<item>
|
||||
<widget class="TextEdit" name="comment">
|
||||
<property name="has_reset_button" stdset="0">
|
||||
<bool>true</bool>
|
||||
@ -885,12 +947,16 @@
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BusyIndicator" name="loading_label"/>
|
||||
<widget class="BusyIndicator" name="loading_label" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="button_box">
|
||||
|
@ -99,8 +99,8 @@ NowPlayingWidget::NowPlayingWidget(QWidget* parent)
|
||||
CreateModeAction(LargeSongDetailsBelow,
|
||||
tr("Large album cover (details below)"), mode_group,
|
||||
mode_mapper);
|
||||
CreateModeAction(LargeNoSongDetails, tr("Large album cover (no details)"), mode_group,
|
||||
mode_mapper);
|
||||
CreateModeAction(LargeNoSongDetails, tr("Large album cover (no details)"),
|
||||
mode_group, mode_mapper);
|
||||
|
||||
menu_->addActions(mode_group->actions());
|
||||
|
||||
@ -528,7 +528,8 @@ void NowPlayingWidget::SetMode(int mode) {
|
||||
|
||||
void NowPlayingWidget::resizeEvent(QResizeEvent* e) {
|
||||
if (visible_ && e->oldSize() != e->size()) {
|
||||
if (mode_ == LargeSongDetails || mode_ == LargeNoSongDetails || mode_ == LargeSongDetailsBelow) {
|
||||
if (mode_ == LargeSongDetails || mode_ == LargeNoSongDetails ||
|
||||
mode_ == LargeSongDetailsBelow) {
|
||||
UpdateHeight();
|
||||
UpdateDetailsText();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user