Compare commits

..

9 Commits

Author SHA1 Message Date
Christopher Snowhill ed38e4f8d0
Info Window: Reorder header imports
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2023-02-23 17:46:22 -08:00
Christopher Snowhill 799299df3a
Lyrics: Implement Lyrics window display and hotkey
Implement Lyrics window display into main app as a popup window panel,
with a main menu hotkey.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2023-02-23 17:45:59 -08:00
Christopher Snowhill 57a0ea6e87
Tags: Implement unsynced lyrics in Vorbis plugin
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2023-02-23 17:45:05 -08:00
Christopher Snowhill de974548de
Tags: Implement unsynced lyrics in Opus plugin
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2023-02-23 17:44:45 -08:00
Christopher Snowhill b0c718003b
Tags: Implement unsynced lyrics in Flac plugin
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2023-02-23 17:44:19 -08:00
Christopher Snowhill 593d7d155a
Tags: Implement unsynced lyrics in FFmpeg plugin
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2023-02-23 17:44:01 -08:00
Christopher Snowhill 190d6959fd
Tags: Implement unsynced lyrics into TagLib plugin
Implement unsynced lyrics reading into TagLib frontend plugin.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2023-02-23 17:41:50 -08:00
Christopher Snowhill 790eb5508b
TagLib: Implement unsynced lyrics tag support
Implement unsynced lyrics tag reading and writing into TagLib.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2023-02-23 17:41:12 -08:00
Christopher Snowhill c34d869b99
Tags: Added unsynced lyrics tag interface
Added an unsynced lyrics tag interface to the PlaylistEntry class

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2023-02-23 17:39:52 -08:00
31 changed files with 408 additions and 11 deletions

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="LyricsWindowController">
<connections>
<outlet property="window" destination="QvC-M9-y7g" id="eSJ-Nv-PBE"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Lyrics" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" visibleAtLaunch="NO" frameAutosaveName="LyricsWindow" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" id="O8B-8Z-Mxc">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" drawsBackground="NO" id="O6S-QV-ThM">
<rect key="frame" x="0.0" y="0.0" width="465" height="270"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView wantsLayer="YES" editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" findStyle="bar" incrementalSearchingEnabled="YES" id="DKA-ld-0Sh">
<rect key="frame" x="0.0" y="0.0" width="465" height="270"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="465" height="270"/>
<size key="maxSize" width="476" height="10000000"/>
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
<connections>
<binding destination="-2" name="value" keyPath="valueToDisplay.unsyncedlyrics" id="tSj-CA-G4Q">
<dictionary key="options">
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>
<bool key="NSConditionallySetsEditable" value="NO"/>
</dictionary>
</binding>
</connections>
</textView>
</subviews>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="f77-wI-xOz">
<rect key="frame" x="-100" y="-100" width="225" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" verticalHuggingPriority="750" horizontal="NO" id="XfW-du-B6L">
<rect key="frame" x="465" y="0.0" width="15" height="270"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
</subviews>
</view>
<point key="canvasLocation" x="126" y="104"/>
</window>
<userDefaultsController representsSharedInstance="YES" id="t5R-DO-d90"/>
</objects>
</document>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@ -25,17 +25,17 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<splitView dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2123">
<rect key="frame" x="0.0" y="372" width="1135" height="28"/>
<rect key="frame" x="0.0" y="339" width="1135" height="61"/>
<subviews>
<scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="24" horizontalPageScroll="0.0" verticalLineScroll="24" verticalPageScroll="0.0" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="206" userLabel="Scroll View - Playlist View">
<rect key="frame" x="0.0" y="0.0" width="1135" height="28"/>
<rect key="frame" x="0.0" y="0.0" width="1135" height="61"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="KWC-Ti-8KY">
<rect key="frame" x="0.0" y="0.0" width="1135" height="28"/>
<rect key="frame" x="0.0" y="0.0" width="1135" height="61"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" autosaveName="Playlist" rowHeight="18" headerView="1517" viewBased="YES" id="207" customClass="PlaylistView">
<rect key="frame" x="0.0" y="0.0" width="1135" height="11"/>
<rect key="frame" x="0.0" y="0.0" width="1135" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="6"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -680,12 +680,12 @@
</tableCellView>
</prototypeCellViews>
<connections>
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="36z-Tr-B4G"/>
<binding destination="218" name="value" keyPath="arrangedObjects.sampleRate" id="5lo-d8-LCy">
<dictionary key="options">
<bool key="NSConditionallySetsEditable" value="YES"/>
</dictionary>
</binding>
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="36z-Tr-B4G"/>
</connections>
</tableColumn>
<tableColumn identifier="bitspersample" editable="NO" width="64" minWidth="32" maxWidth="1024" hidden="YES" id="3no-xo-TpJ" userLabel="Bits Per Sample">
@ -724,12 +724,12 @@
</tableCellView>
</prototypeCellViews>
<connections>
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="OsB-l4-dFb"/>
<binding destination="218" name="value" keyPath="arrangedObjects.bitsPerSample" id="qVg-Ph-8TQ">
<dictionary key="options">
<bool key="NSConditionallySetsEditable" value="YES"/>
</dictionary>
</binding>
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="OsB-l4-dFb"/>
</connections>
</tableColumn>
</tableColumns>
@ -1575,6 +1575,11 @@
<action selector="toggleWindow:" target="2422" id="2454"/>
</connections>
</menuItem>
<menuItem title="Show Lyrics" keyEquivalent="L" id="Tkb-7M-OiA">
<connections>
<action selector="toggleWindow:" target="3y4-Q0-Kkl" id="0kv-17-aS6"/>
</connections>
</menuItem>
<menuItem title="Show Spotlight Panel" keyEquivalent="F" id="1853">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections>
@ -2548,6 +2553,13 @@ Gw
</connections>
</customObject>
<customObject id="Hd4-Wy-Rfl" customClass="AboutWindowController" customModule="Cog" customModuleProvider="target"/>
<customObject id="3y4-Q0-Kkl" customClass="LyricsWindowController">
<connections>
<outlet property="appController" destination="226" id="tbl-VH-JHF"/>
<outlet property="currentEntryController" destination="1897" id="5k1-yb-UNo"/>
<outlet property="playlistSelectionController" destination="2020" id="eLM-rx-mpe"/>
</connections>
</customObject>
</objects>
<resources>
<image name="deadItemsTemplate" width="20" height="20"/>

View File

@ -195,6 +195,8 @@
83AA7D06279EBCAD00087AA4 /* libavutil.57.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83AA7D02279EBC8200087AA4 /* libavutil.57.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
83AA7D07279EBCAF00087AA4 /* libswresample.4.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83AA7D01279EBC8200087AA4 /* libswresample.4.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
83B06704180D579E008E3612 /* MIDI.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83B066A1180D5669008E3612 /* MIDI.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
83B61E2429A8296500CD0580 /* LyricsWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 83B61E2229A8296500CD0580 /* LyricsWindow.xib */; };
83B61E2829A82A0200CD0580 /* LyricsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83B61E2729A82A0200CD0580 /* LyricsWindowController.m */; };
83B72E3B279045B7006007A3 /* libfdk-aac.2.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83B72E2A279044F6006007A3 /* libfdk-aac.2.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
83BC5AB220E4C87100631CD4 /* DualWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BC5AB020E4C87100631CD4 /* DualWindow.m */; };
83BC5ABF20E4CE7A00631CD4 /* InfoInspector.xib in Resources */ = {isa = PBXBuildFile; fileRef = 17D1B0D00F6320EA00694C57 /* InfoInspector.xib */; };
@ -1074,6 +1076,9 @@
83AA7D03279EBC8300087AA4 /* libavformat.59.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavformat.59.dylib; path = ThirdParty/ffmpeg/lib/libavformat.59.dylib; sourceTree = "<group>"; };
83AB9031237CEFD300A433D5 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
83B0669C180D5668008E3612 /* MIDI.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MIDI.xcodeproj; path = Plugins/MIDI/MIDI.xcodeproj; sourceTree = "<group>"; };
83B61E2329A8296500CD0580 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LyricsWindow.xib; sourceTree = "<group>"; };
83B61E2629A82A0200CD0580 /* LyricsWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LyricsWindowController.h; sourceTree = "<group>"; };
83B61E2729A82A0200CD0580 /* LyricsWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LyricsWindowController.m; sourceTree = "<group>"; };
83B72E2A279044F6006007A3 /* libfdk-aac.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libfdk-aac.2.dylib"; path = "ThirdParty/fdk-aac/lib/libfdk-aac.2.dylib"; sourceTree = "<group>"; };
83BC5AB020E4C87100631CD4 /* DualWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DualWindow.m; path = Window/DualWindow.m; sourceTree = "<group>"; };
83BC5AB120E4C87100631CD4 /* DualWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DualWindow.h; path = Window/DualWindow.h; sourceTree = "<group>"; };
@ -1191,6 +1196,7 @@
17DDF6400E0CB6F100A2E4AD /* FileTree */,
830C37A227B95E6000E02BB0 /* Equalizer */,
17D1B0FE0F63252900694C57 /* InfoInspector */,
83B61E2529A8299A00CD0580 /* LyricsWindow */,
569C52C50D5F2BD500BDBDC9 /* Spotlight */,
17E0D5F60F520F42005B6FED /* Transformers */,
177EC0110B8BC2CF0000BC8C /* Utils */,
@ -1618,6 +1624,7 @@
178456C00F6320B5007E8021 /* SpotlightPanel.xib */,
17E41E060C130DFF00AC744D /* Credits.html */,
17D1B1DA0F6330D400694C57 /* Feedback.xib */,
83B61E2229A8296500CD0580 /* LyricsWindow.xib */,
836DF61D298F7F6E00CD0580 /* Scenes.scnassets */,
);
name = Resources;
@ -1916,6 +1923,15 @@
name = Products;
sourceTree = "<group>";
};
83B61E2529A8299A00CD0580 /* LyricsWindow */ = {
isa = PBXGroup;
children = (
83B61E2629A82A0200CD0580 /* LyricsWindowController.h */,
83B61E2729A82A0200CD0580 /* LyricsWindowController.m */,
);
path = LyricsWindow;
sourceTree = "<group>";
};
83BB13AE20E4E38E00723731 /* Products */ = {
isa = PBXGroup;
children = (
@ -2544,6 +2560,7 @@
83BC5AC320E4CE8D00631CD4 /* SpotlightPanel.xib in Resources */,
83BC5AC220E4CE8A00631CD4 /* FileTree.xib in Resources */,
83BC5AC120E4CE8700631CD4 /* OpenURLPanel.xib in Resources */,
83B61E2429A8296500CD0580 /* LyricsWindow.xib in Resources */,
0A1B412C286F6301008A6A44 /* Localizable.stringsdict in Resources */,
83BC5AC020E4CE7D00631CD4 /* MainMenu.xib in Resources */,
83BC5ABF20E4CE7A00631CD4 /* InfoInspector.xib in Resources */,
@ -2692,6 +2709,7 @@
56462EAF0D6341F6000AB68C /* SpotlightTransformers.m in Sources */,
830C37A527B95EB300E02BB0 /* EqualizerWindowController.m in Sources */,
832CFC562851AA8B002AC26F /* SpectrumViewCG.m in Sources */,
83B61E2829A82A0200CD0580 /* LyricsWindowController.m in Sources */,
56462EB20D634206000AB68C /* SpotlightPlaylistController.m in Sources */,
07E18DF30D62B38400BB0E11 /* NSArray+ShuffleUtils.m in Sources */,
56C63D910D647DF300EAE25A /* NSComparisonPredicate+CogPredicate.m in Sources */,
@ -3055,6 +3073,14 @@
name = SpectrumWindow.xib;
sourceTree = "<group>";
};
83B61E2229A8296500CD0580 /* LyricsWindow.xib */ = {
isa = PBXVariantGroup;
children = (
83B61E2329A8296500CD0580 /* Base */,
);
name = LyricsWindow.xib;
sourceTree = "<group>";
};
8E7575D909F31E930080F1EE /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (

View File

@ -146,6 +146,17 @@ String APE::Tag::album() const
return d->itemListMap["ALBUM"].values().toString();
}
String APE::Tag::unsyncedlyrics() const
{
if(!d->itemListMap["UNSYNCEDLYRICS"].isEmpty())
return d->itemListMap["UNSYNCEDLYRICS"].values().toString();
if(!d->itemListMap["UNSYNCED LYRICS"].isEmpty())
return d->itemListMap["UNSYNCED LYRICS"].values().toString();
if(!d->itemListMap["LYRICS"].isEmpty())
return d->itemListMap["LYRICS"].values().toString();
return String();
}
String APE::Tag::comment() const
{
if(d->itemListMap["COMMENT"].isEmpty())
@ -241,6 +252,11 @@ void APE::Tag::setAlbum(const String &s)
addValue("ALBUM", s, true);
}
void APE::Tag::setUnsyncedlyrics(const String &s)
{
addValue("UNSYNCED LYRICS", s);
}
void APE::Tag::setComment(const String &s)
{
addValue("COMMENT", s, true);

View File

@ -91,6 +91,7 @@ namespace TagLib {
virtual String albumartist() const;
virtual String artist() const;
virtual String album() const;
virtual String unsyncedlyrics() const;
virtual String comment() const;
virtual String genre() const;
virtual unsigned int year() const;
@ -107,6 +108,7 @@ namespace TagLib {
virtual void setAlbumArtist(const String &s);
virtual void setArtist(const String &s);
virtual void setAlbum(const String &s);
virtual void setUnsyncedlyrics(const String &s);
virtual void setComment(const String &s);
virtual void setGenre(const String &s);
virtual void setYear(unsigned int i);

View File

@ -72,6 +72,13 @@ String ASF::Tag::album() const
return String();
}
String ASF::Tag::unsyncedlyrics() const
{
if(d->attributeListMap.contains("WM/Lyrics"))
return d->attributeListMap["WM/Lyrics"][0].toString();
return String();
}
String ASF::Tag::copyright() const
{
return d->copyright;
@ -193,6 +200,11 @@ void ASF::Tag::setAlbum(const String &value)
setAttribute("WM/AlbumTitle", value);
}
void ASF::Tag::setUnsyncedlyrics(const String &value)
{
setAttribute("WM/Lyrics", value);
}
void ASF::Tag::setGenre(const String &value)
{
setAttribute("WM/Genre", value);

View File

@ -70,6 +70,12 @@ namespace TagLib {
*/
virtual String album() const;
/*!
* Returns the unsynchronized lyrics; if no unsynced lyrics are
* present in the tag String::null will be returned.
*/
virtual String unsyncedlyrics() const;
/*!
* Returns the track comment.
*/
@ -132,6 +138,12 @@ namespace TagLib {
* cleared.
*/
virtual void setAlbum(const String &s);
/*!
* Sets the unsynced lyrics to \a s. if \a s is String::null then this
* value will be cleared.
*/
virtual void setUnsyncedlyrics(const String &s);
/*!
* Sets the comment to \a s.

View File

@ -74,6 +74,11 @@ String Mod::Tag::album() const
return String();
}
String Mod::Tag::unsyncedlyrics() const
{
return String();
}
String Mod::Tag::comment() const
{
return d->comment;
@ -151,6 +156,10 @@ void Mod::Tag::setAlbum(const String &)
{
}
void Mod::Tag::setUnsyncedlyrics(const String &)
{
}
void Mod::Tag::setComment(const String &comment)
{
d->comment = comment;

View File

@ -72,6 +72,11 @@ namespace TagLib {
*/
virtual String album() const;
/*!
* Not supported by module files. Therefore always returns String::null.
*/
virtual String unsyncedlyrics() const;
/*!
* Returns the track comment derived from the instrument/sample/pattern
* names; if no comment is present in the tag String::null will be
@ -163,6 +168,11 @@ namespace TagLib {
*/
virtual void setAlbum(const String &album);
/*!
* Not supported by module files and therefore ignored.
*/
virtual void setUnsyncedlyrics(const String &unsyncedlyrics);
/*!
* Sets the comment to \a comment. If \a comment is String::null then
* this value will be cleared.

View File

@ -147,6 +147,11 @@ String ID3v1::Tag::album() const
return d->album;
}
String ID3v1::Tag::unsyncedlyrics() const
{
return String();
}
String ID3v1::Tag::comment() const
{
return d->comment;
@ -221,6 +226,10 @@ void ID3v1::Tag::setAlbum(const String &s)
d->album = s;
}
void ID3v1::Tag::setUnsyncedlyrics(const String &s)
{
}
void ID3v1::Tag::setComment(const String &s)
{
d->comment = s;

View File

@ -140,6 +140,7 @@ namespace TagLib {
virtual String artist() const;
virtual String album() const;
virtual String comment() const;
virtual String unsyncedlyrics() const;
virtual String genre() const;
virtual unsigned int year() const;
virtual unsigned int track() const;
@ -156,6 +157,7 @@ namespace TagLib {
virtual void setArtist(const String &s);
virtual void setAlbum(const String &s);
virtual void setComment(const String &s);
virtual void setUnsyncedlyrics(const String &s);
virtual void setGenre(const String &s);
virtual void setYear(unsigned int i);
virtual void setTrack(unsigned int i);

View File

@ -170,6 +170,13 @@ String ID3v2::Tag::album() const
return String();
}
String ID3v2::Tag::unsyncedlyrics() const
{
if(!d->frameListMap["USLT"].isEmpty())
return d->frameListMap["USLT"].front()->toString();
return String();
}
String ID3v2::Tag::comment() const
{
const FrameList &comments = d->frameListMap["COMM"];
@ -350,6 +357,31 @@ void ID3v2::Tag::setAlbum(const String &s)
setTextFrame("TALB", s);
}
void ID3v2::Tag::setUnsyncedlyrics(const String &s)
{
if(s.isEmpty()) {
removeFrames("USLT");
return;
}
const FrameList &unsyncedlyrics = d->frameListMap["USLT"];
if(!unsyncedlyrics.isEmpty()) {
for(FrameList::ConstIterator it = unsyncedlyrics.begin(); it != unsyncedlyrics.end(); ++it) {
UnsynchronizedLyricsFrame *frame = dynamic_cast<UnsynchronizedLyricsFrame *>(*it);
if(frame && (frame->description().isEmpty() || frame->description() == "LYRICS")) {
(*it)->setText(s);
return;
}
}
}
UnsynchronizedLyricsFrame *f = new UnsynchronizedLyricsFrame(d->factory->defaultTextEncoding());
addFrame(f);
f->setDescription("LYRICS");
f->setText(s);
}
void ID3v2::Tag::setComment(const String &s)
{
if(s.isEmpty()) {

View File

@ -161,6 +161,7 @@ namespace TagLib {
virtual String artist() const;
virtual String album() const;
virtual String comment() const;
virtual String unsyncedlyrics() const;
virtual String genre() const;
virtual unsigned int year() const;
virtual unsigned int track() const;
@ -180,6 +181,7 @@ namespace TagLib {
virtual void setArtist(const String &s);
virtual void setAlbum(const String &s);
virtual void setComment(const String &s);
virtual void setUnsyncedlyrics(const String &s);
virtual void setGenre(const String &s);
virtual void setYear(unsigned int i);
virtual void setTrack(unsigned int i);

View File

@ -108,6 +108,11 @@ String RIFF::Info::Tag::album() const
return fieldText("IPRD");
}
String RIFF::Info::Tag::unsyncedlyrics() const
{
return String();
}
String RIFF::Info::Tag::comment() const
{
return fieldText("ICMT");
@ -182,6 +187,10 @@ void RIFF::Info::Tag::setAlbum(const String &s)
setFieldText("IPRD", s);
}
void RIFF::Info::Tag::setUnsyncedlyrics(const String &)
{
}
void RIFF::Info::Tag::setComment(const String &s)
{
setFieldText("ICMT", s);

View File

@ -106,6 +106,7 @@ namespace TagLib {
virtual String albumartist() const;
virtual String artist() const;
virtual String album() const;
virtual String unsyncedlyrics() const;
virtual String comment() const;
virtual String genre() const;
virtual unsigned int year() const;
@ -122,6 +123,7 @@ namespace TagLib {
virtual void setAlbumArtist(const String &s);
virtual void setArtist(const String &s);
virtual void setAlbum(const String &s);
virtual void setUnsyncedlyrics(const String &s);
virtual void setComment(const String &s);
virtual void setGenre(const String &s);
virtual void setYear(unsigned int i);

View File

@ -50,6 +50,7 @@ bool Tag::isEmpty() const
albumartist().isEmpty() &&
artist().isEmpty() &&
album().isEmpty() &&
unsyncedlyrics().isEmpty() &&
comment().isEmpty() &&
genre().isEmpty() &&
year() == 0 &&
@ -68,6 +69,8 @@ PropertyMap Tag::properties() const
map["ARTIST"].append(artist());
if(!(album().isEmpty()))
map["ALBUM"].append(album());
if(!(unsyncedlyrics().isEmpty()))
map["UNSYNCEDLYRICS"].append(unsyncedlyrics());
if(!(comment().isEmpty()))
map["COMMENT"].append(comment());
if(!(genre().isEmpty()))
@ -119,6 +122,18 @@ PropertyMap Tag::setProperties(const PropertyMap &origProps)
} else
setAlbum(String());
if(properties.contains("UNSYNCEDLYRICS") ||
properties.contains("UNSYNCED LYRICS") ||
properties.contains("LYRICS")) {
if(properties.contains("UNSYNCEDLYRICS"))
setUnsyncedlyrics(properties["UNSYNCEDLYRICS"].front());
else if(properties.contains("UNSYNCED LYRICS"))
setUnsyncedlyrics(properties["UNSYNCED LYRICS"].front());
else
setUnsyncedlyrics(properties["LYRICS"].front());
oneValueSet.append("UNSYNCEDLYRICS");
}
if(properties.contains("COMMENT")) {
setComment(properties["COMMENT"].front());
oneValueSet.append("COMMENT");
@ -185,6 +200,7 @@ void Tag::duplicate(const Tag *source, Tag *target, bool overwrite) // static
target->setAlbumArtist(source->albumartist());
target->setArtist(source->artist());
target->setAlbum(source->album());
target->setUnsyncedlyrics(source->unsyncedlyrics());
target->setComment(source->comment());
target->setGenre(source->genre());
target->setYear(source->year());
@ -200,6 +216,8 @@ void Tag::duplicate(const Tag *source, Tag *target, bool overwrite) // static
target->setArtist(source->artist());
if(target->album().isEmpty())
target->setAlbum(source->album());
if(target->unsyncedlyrics().isEmpty())
target->setUnsyncedlyrics(source->unsyncedlyrics());
if(target->comment().isEmpty())
target->setComment(source->comment());
if(target->genre().isEmpty())

View File

@ -102,6 +102,12 @@ namespace TagLib {
*/
virtual String album() const = 0;
/*!
* Returns the unsynced lyrics; if no unsynced lyrics are present
* in the tag String::null will be returned.
*/
virtual String unsyncedlyrics() const = 0;
/*!
* Returns the track comment; if no comment is present in the tag
* String::null will be returned.
@ -191,6 +197,12 @@ namespace TagLib {
*/
virtual void setAlbum(const String &s) = 0;
/*!
* Sets the unsynced lyrics to \a s. If \a s is String::null then this
* value will be cleared.
*/
virtual void setUnsyncedlyrics(const String &s) = 0;
/*!
* Sets the comment to \a s. If \a s is String::null then this value will be
* cleared.

View File

@ -186,6 +186,11 @@ String TagUnion::album() const
stringUnion(album);
}
String TagUnion::unsyncedlyrics() const
{
stringUnion(unsyncedlyrics);
}
String TagUnion::comment() const
{
stringUnion(comment);
@ -261,6 +266,11 @@ void TagUnion::setAlbum(const String &s)
setUnion(Album, s);
}
void TagUnion::setUnsyncedlyrics(const String &s)
{
setUnion(Unsyncedlyrics, s);
}
void TagUnion::setComment(const String &s)
{
setUnion(Comment, s);

View File

@ -63,6 +63,7 @@ namespace TagLib {
virtual String albumartist() const;
virtual String artist() const;
virtual String album() const;
virtual String unsyncedlyrics() const;
virtual String comment() const;
virtual String genre() const;
virtual unsigned int year() const;
@ -79,6 +80,7 @@ namespace TagLib {
virtual void setAlbumArtist(const String &s);
virtual void setArtist(const String &s);
virtual void setAlbum(const String &s);
virtual void setUnsyncedlyrics(const String &s);
virtual void setComment(const String &s);
virtual void setGenre(const String &s);
virtual void setYear(unsigned int i);

View File

@ -61,6 +61,7 @@ namespace TagLib {
* - ORIGINALDATE
* - GENRE
* - COMMENT
* - UNSYNCEDLYRICS
*
* Sort names:
*

View File

@ -6,9 +6,10 @@
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "AppController.h"
#import <Cocoa/Cocoa.h>
#import "AppController.h"
@interface InfoWindowController : NSWindowController {
IBOutlet id playlistSelectionController;
IBOutlet id currentEntryController;

View File

@ -0,0 +1,28 @@
//
// LyricsWindowController.h
// Cog
//
// Created by Christopher Snowhill on 2/23/23.
//
#import <Cocoa/Cocoa.h>
#import "AppController.h"
NS_ASSUME_NONNULL_BEGIN
@interface LyricsWindowController : NSWindowController {
IBOutlet id playlistSelectionController;
IBOutlet id currentEntryController;
IBOutlet AppController *appController;
id __unsafe_unretained valueToDisplay;
}
@property(assign) id valueToDisplay;
- (IBAction)toggleWindow:(id)sender;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,63 @@
//
// LyricsWindowController.m
// Cog
//
// Created by Christopher Snowhill on 2/23/23.
//
#import "LyricsWindowController.h"
#import "AppController.h"
#import "PlaylistEntry.h"
@interface LyricsWindowController ()
@end
@implementation LyricsWindowController
static void *kLyricsWindowControllerContext = &kLyricsWindowControllerContext;
@synthesize valueToDisplay;
- (id)init {
return [super initWithWindowNibName:@"LyricsWindow"];
}
- (void)awakeFromNib {
[playlistSelectionController addObserver:self forKeyPath:@"selection" options:NSKeyValueObservingOptionNew context:kLyricsWindowControllerContext];
[currentEntryController addObserver:self forKeyPath:@"content" options:NSKeyValueObservingOptionNew context:kLyricsWindowControllerContext];
[appController addObserver:self forKeyPath:@"miniMode" options:NSKeyValueObservingOptionNew context:kLyricsWindowControllerContext];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if(context == kLyricsWindowControllerContext) {
// Avoid "selection" because it creates a proxy that's hard to reason with when we don't need to write.
PlaylistEntry *currentSelection = [[playlistSelectionController selectedObjects] firstObject];
if(currentSelection != NULL) {
[self setValueToDisplay:currentSelection];
} else {
[self setValueToDisplay:[currentEntryController content]];
}
} else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
- (IBAction)toggleWindow:(id)sender {
if([[self window] isVisible])
[[self window] orderOut:self];
else {
if([NSApp mainWindow]) {
NSRect rect = [[NSApp mainWindow] frame];
// Align Lyrics Window to the right of Main Window.
NSPoint point = NSMakePoint(NSMaxX(rect), NSMaxY(rect));
[[self window] setFrameTopLeftPoint:point];
}
[self showWindow:self];
}
}
@end

View File

@ -85,6 +85,8 @@
@property(nonatomic) NSString *_Nullable date;
@property(nonatomic) NSString *_Nullable unsyncedlyrics;
@property(nonatomic) NSString *_Nullable comment;
- (NSString *_Nullable)readAllValuesAsString:(NSString *_Nonnull)tagName;

View File

@ -777,6 +777,24 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path) {
[self setValue:@"year" fromString:nil];
}
@dynamic unsyncedlyrics;
- (NSString *)unsyncedlyrics {
NSString *value = [self readAllValuesAsString:@"unsyncedlyrics"];
if(!value) {
value = [self readAllValuesAsString:@"unsynced lyrics"];
}
if(!value) {
value = [self readAllValuesAsString:@"lyrics"];
}
return value;
}
- (void)setUnsyncedlyrics:(NSString *)unsyncedlyrics {
[self setValue:@"unsyncedlyrics" fromString:unsyncedlyrics];
[self setValue:@"unsynced lyrics" fromString:nil];
[self setValue:@"lyrics" fromString:nil];
}
@dynamic comment;
- (NSString *)comment {
return [self readAllValuesAsString:@"comment"];

View File

@ -575,6 +575,9 @@ static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *va
} else {
setDictionary(_metaDict, @"title", _title);
}
} else if(!strcasecmp(tag->key, "unsynced lyrics") ||
!strcasecmp(tag->key, "lyrics")) {
setDictionary(_metaDict, @"unsyncedlyrics", guess_encoding_of_string(tag->value));
} else if(!strcasecmp(tag->key, "icy-url")) {
setDictionary(_metaDict, @"album", guess_encoding_of_string(tag->value));
} else if(!strcasecmp(tag->key, "icy-genre")) {

View File

@ -255,6 +255,9 @@ void MetadataCallback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMeta
const char *_value = [value UTF8String] + 2;
flacDecoder->channelConfig = (uint32_t)strtoul(_value, &end, 16);
}
} else if([name isEqualToString:@"unsynced lyrics"] ||
[name isEqualToString:@"lyrics"]) {
setDictionary(_metaDict, @"unsyncedlyrics", value);
} else {
setDictionary(_metaDict, name, value);
}

View File

@ -170,6 +170,9 @@ static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *va
}
}
opus_picture_tag_clear(&_pic);
} else if([tagName isEqualToString:@"unsynced lyrics"] ||
[tagName isEqualToString:@"lyrics"]) {
setDictionary(_metaDict, @"unsyncedlyrics", guess_encoding_of_string(value));
} else {
setDictionary(_metaDict, tagName, guess_encoding_of_string(value));
}

View File

@ -60,7 +60,7 @@
const TagLib::Tag *tag = f.tag();
if(tag) {
TagLib::String artist, albumartist, title, album, genre, comment;
TagLib::String artist, albumartist, title, album, genre, comment, unsyncedlyrics;
int year, track, disc;
float rgAlbumGain, rgAlbumPeak, rgTrackGain, rgTrackPeak;
TagLib::String cuesheet;
@ -73,6 +73,7 @@
genre = tag->genre();
comment = tag->comment();
cuesheet = tag->cuesheet();
unsyncedlyrics = tag->unsyncedlyrics();
year = tag->year();
[dict setObject:@(year) forKey:@"year"];
@ -130,6 +131,9 @@
if(!comment.isEmpty())
[dict setObject:[NSString stringWithUTF8String:comment.toCString(true)] forKey:@"comment"];
if(!unsyncedlyrics.isEmpty())
[dict setObject:[NSString stringWithUTF8String:unsyncedlyrics.toCString(true)] forKey:@"unsyncedlyrics"];
// Try to load the image.
NSData *image = nil;

View File

@ -73,7 +73,7 @@
const TagLib::Tag *tag = f.tag();
if(tag) {
TagLib::String artist, albumartist, title, album, genre, comment;
TagLib::String artist, albumartist, title, album, genre, comment, unsyncedlyrics;
int year, track, disc;
float rgAlbumGain, rgAlbumPeak, rgTrackGain, rgTrackPeak;
TagLib::String cuesheet;
@ -87,6 +87,8 @@
genre = tag->genre();
comment = tag->comment();
cuesheet = tag->cuesheet();
unsyncedlyrics = tag->unsyncedlyrics();
year = tag->year();
[dict setObject:@(year) forKey:@"year"];
@ -144,6 +146,9 @@
if(!comment.isEmpty())
[dict setObject:[NSString stringWithUTF8String:comment.toCString(true)] forKey:@"comment"];
if(!unsyncedlyrics.isEmpty())
[dict setObject:[NSString stringWithUTF8String:unsyncedlyrics.toCString(true)] forKey:@"unsyncedlyrics"];
}
// Try to load the image.

View File

@ -147,6 +147,9 @@ static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *va
}
flac_picture_free(picture);
}
} else if([tagName isEqualToString:@"unsynced lyrics"] ||
[tagName isEqualToString:@"lyrics"]) {
setDictionary(_metaDict, @"unsyncedlyrics", guess_encoding_of_string(value));
} else {
setDictionary(_metaDict, tagName, guess_encoding_of_string(value));
}