Skip to content

Commit

Permalink
Merge pull request #15 from aviwad/appleMusic
Browse files Browse the repository at this point in the history
 Apple Music support (bridges ID with Spotify ID and calls custom apple music lyric updater)
  • Loading branch information
aviwad authored Apr 9, 2024
2 parents 225a787 + ad29867 commit c561df5
Show file tree
Hide file tree
Showing 13 changed files with 980 additions and 57 deletions.
24 changes: 14 additions & 10 deletions Lyric Fever.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
8F6BD2952A8A61C9008BBF88 /* AmplitudeSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 8F6BD2942A8A61C9008BBF88 /* AmplitudeSwift */; };
8F6BD2972A8A6278008BBF88 /* amplitudeKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F6BD2962A8A6278008BBF88 /* amplitudeKey.swift */; };
8F6BD2992A8A6B7D008BBF88 /* viewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F6BD2982A8A6B7D008BBF88 /* viewModel.swift */; };
8F85A8222BBFD9F6004A774D /* AppleMusicScripting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F85A8212BBFD9F6004A774D /* AppleMusicScripting.swift */; };
8FA436AE2BC49D480072016C /* newPermissionMac.gif in Resources */ = {isa = PBXBuildFile; fileRef = 8FA436AD2BC49D480072016C /* newPermissionMac.gif */; };
8FC8E9492A704EEB00F69915 /* SpotifyLyricsInMenubarApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FC8E9482A704EEB00F69915 /* SpotifyLyricsInMenubarApp.swift */; };
8FC8E94D2A704EED00F69915 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8FC8E94C2A704EED00F69915 /* Assets.xcassets */; };
8FCFD1C32AE35DEA00B22023 /* spotifylogin.gif in Resources */ = {isa = PBXBuildFile; fileRef = 8FCFD1C22AE35DEA00B22023 /* spotifylogin.gif */; };
8FE454282A8916C30039EFA7 /* SpotifyScripting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FE454272A8916C30039EFA7 /* SpotifyScripting.swift */; };
8FF59E2E2A798D2B00F0A382 /* Lyrics.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 8FF59E2C2A798D2B00F0A382 /* Lyrics.xcdatamodeld */; };
8FFA9F312AA1B1E600BAEC5C /* OnboardingWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FFA9F302AA1B1E600BAEC5C /* OnboardingWindow.swift */; };
8FFA9F342AA1B3CB00BAEC5C /* SDWebImageSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 8FFA9F332AA1B3CB00BAEC5C /* SDWebImageSwiftUI */; };
8FFA9F372AA1B63500BAEC5C /* spotifyPermissionMac.gif in Resources */ = {isa = PBXBuildFile; fileRef = 8FFA9F352AA1B63500BAEC5C /* spotifyPermissionMac.gif */; };
8FFA9F382AA1B63500BAEC5C /* crossfade.gif in Resources */ = {isa = PBXBuildFile; fileRef = 8FFA9F362AA1B63500BAEC5C /* crossfade.gif */; };
/* End PBXBuildFile section */

Expand All @@ -32,6 +33,8 @@
8F4F495C2A7FB3D400097888 /* SongObject+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SongObject+CoreDataProperties.swift"; sourceTree = "<group>"; };
8F6BD2962A8A6278008BBF88 /* amplitudeKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = amplitudeKey.swift; sourceTree = "<group>"; };
8F6BD2982A8A6B7D008BBF88 /* viewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = viewModel.swift; sourceTree = "<group>"; };
8F85A8212BBFD9F6004A774D /* AppleMusicScripting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleMusicScripting.swift; sourceTree = "<group>"; };
8FA436AD2BC49D480072016C /* newPermissionMac.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = newPermissionMac.gif; sourceTree = "<group>"; };
8FC8E9452A704EEB00F69915 /* Lyric Fever.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Lyric Fever.app"; sourceTree = BUILT_PRODUCTS_DIR; };
8FC8E9482A704EEB00F69915 /* SpotifyLyricsInMenubarApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpotifyLyricsInMenubarApp.swift; sourceTree = "<group>"; };
8FC8E94C2A704EED00F69915 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand All @@ -41,7 +44,6 @@
8FE454292A891EBD0039EFA7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8FF59E2D2A798D2B00F0A382 /* Lyrics.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Lyrics.xcdatamodel; sourceTree = "<group>"; };
8FFA9F302AA1B1E600BAEC5C /* OnboardingWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingWindow.swift; sourceTree = "<group>"; };
8FFA9F352AA1B63500BAEC5C /* spotifyPermissionMac.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = spotifyPermissionMac.gif; sourceTree = "<group>"; };
8FFA9F362AA1B63500BAEC5C /* crossfade.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = crossfade.gif; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -72,7 +74,7 @@
8F4F495B2A7FB3D400097888 /* SongObject+CoreDataClass.swift */,
8FCFD1C22AE35DEA00B22023 /* spotifylogin.gif */,
8FFA9F362AA1B63500BAEC5C /* crossfade.gif */,
8FFA9F352AA1B63500BAEC5C /* spotifyPermissionMac.gif */,
8FA436AD2BC49D480072016C /* newPermissionMac.gif */,
8F4F495C2A7FB3D400097888 /* SongObject+CoreDataProperties.swift */,
8FC8E9472A704EEB00F69915 /* SpotifyLyricsInMenubar */,
8FC8E9462A704EEB00F69915 /* Products */,
Expand Down Expand Up @@ -101,6 +103,7 @@
8FC8E94C2A704EED00F69915 /* Assets.xcassets */,
8FC8E9512A704EED00F69915 /* SpotifyLyricsInMenubar.entitlements */,
8FE454272A8916C30039EFA7 /* SpotifyScripting.swift */,
8F85A8212BBFD9F6004A774D /* AppleMusicScripting.swift */,
);
path = SpotifyLyricsInMenubar;
sourceTree = "<group>";
Expand Down Expand Up @@ -173,7 +176,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8FFA9F372AA1B63500BAEC5C /* spotifyPermissionMac.gif in Resources */,
8FA436AE2BC49D480072016C /* newPermissionMac.gif in Resources */,
8FC8E94D2A704EED00F69915 /* Assets.xcassets in Resources */,
8FFA9F382AA1B63500BAEC5C /* crossfade.gif in Resources */,
8FCFD1C32AE35DEA00B22023 /* spotifylogin.gif in Resources */,
Expand All @@ -194,6 +197,7 @@
8F39ED8E2A78EB5900574203 /* lyricJsonStruct.swift in Sources */,
8F6BD2992A8A6B7D008BBF88 /* viewModel.swift in Sources */,
8FC8E9492A704EEB00F69915 /* SpotifyLyricsInMenubarApp.swift in Sources */,
8F85A8222BBFD9F6004A774D /* AppleMusicScripting.swift in Sources */,
8FE454282A8916C30039EFA7 /* SpotifyScripting.swift in Sources */,
8FFA9F312AA1B1E600BAEC5C /* OnboardingWindow.swift in Sources */,
8F4F495E2A7FB3D400097888 /* SongObject+CoreDataProperties.swift in Sources */,
Expand Down Expand Up @@ -332,7 +336,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.6;
CURRENT_PROJECT_VERSION = 1.7;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 38TP6LZLJ5;
ENABLE_APP_SANDBOX = YES;
Expand All @@ -344,14 +348,14 @@
INFOPLIST_KEY_CFBundleDisplayName = "Lyric Fever";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music";
INFOPLIST_KEY_LSUIElement = YES;
INFOPLIST_KEY_NSAppleEventsUsageDescription = "I need to access Spotify to play the lyrics properly!";
INFOPLIST_KEY_NSAppleEventsUsageDescription = "I need to access Spotify / Apple Music to play the lyrics properly.";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.6;
MARKETING_VERSION = 1.7;
PRODUCT_BUNDLE_IDENTIFIER = com.aviwadhwa.SpotifyLyricsInMenubar;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -368,7 +372,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.6;
CURRENT_PROJECT_VERSION = 1.7;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 38TP6LZLJ5;
ENABLE_APP_SANDBOX = YES;
Expand All @@ -380,14 +384,14 @@
INFOPLIST_KEY_CFBundleDisplayName = "Lyric Fever";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music";
INFOPLIST_KEY_LSUIElement = YES;
INFOPLIST_KEY_NSAppleEventsUsageDescription = "I need to access Spotify to play the lyrics properly!";
INFOPLIST_KEY_NSAppleEventsUsageDescription = "I need to access Spotify / Apple Music to play the lyrics properly.";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.6;
MARKETING_VERSION = 1.7;
PRODUCT_BUNDLE_IDENTIFIER = com.aviwadhwa.SpotifyLyricsInMenubar;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
2 changes: 1 addition & 1 deletion SongObject+CoreDataClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class SongObject: NSManagedObject, Decodable {
let container = try decoder.container(keyedBy: CodingKeys.self)
if let syncType = try? container.decode(String.self, forKey: .syncType), syncType == "LINE_SYNCED", var lyrics = try? container.decode([LyricLine].self, forKey: .lines) {
if !lyrics.isEmpty {
lyrics.append(LyricLine(startTime: duration, words: "Now Playing: \(title)"))
lyrics.append(LyricLine(startTime: duration-1400, words: "Now Playing: \(title)"))
}
self.lyricsTimestamps = lyrics.map {$0.startTimeMS}
self.lyricsWords = lyrics.map {$0.words}
Expand Down
Loading

0 comments on commit c561df5

Please sign in to comment.