Skip to content

Commit

Permalink
Merge pull request #1129 from TortugaPower/lpf-support
Browse files Browse the repository at this point in the history
  • Loading branch information
GianniCarlo authored Apr 14, 2024
2 parents af7c973 + fb0a942 commit ac54a5a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
6 changes: 5 additions & 1 deletion BookPlayer/Import/Models/ImportOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public class ImportOperation: Operation {

NotificationCenter.default.post(name: .processingFile, object: nil, userInfo: ["filename": currentFile.lastPathComponent])

guard currentFile.pathExtension != "zip" else {
if shouldUnzip(currentFile) {
self.handleZip(file: currentFile, remainingFiles: mutableFiles)
return
}
Expand All @@ -231,4 +231,8 @@ public class ImportOperation: Operation {
self.processedFiles.append(destinationURL)
self.processFile(from: mutableFiles)
}

func shouldUnzip(_ file: URL) -> Bool {
return file.pathExtension == "zip" || file.pathExtension == "lpf"
}
}
22 changes: 22 additions & 0 deletions BookPlayer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.pkware.zip-archive</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.pkware.lpf-zip-archive</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.mime-type</key>
<array>
<string>application/lpf+zip</string>
</array>
<key>public.filename-extension</key>
<array>
<string>lpf</string>
</array>
</dict>
</dict>
</array>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>$(BP_BUNDLE_IDENTIFIER).background</string>
Expand Down
8 changes: 7 additions & 1 deletion BookPlayer/Player/PlayerManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,13 @@ final class PlayerManager: NSObject, PlayerManagerProtocol {
guard let currentItem = self.currentItem else { return }

self.nowPlayingInfo[MPMediaItemPropertyTitle] = chapter.title
self.nowPlayingInfo[MPMediaItemPropertyArtist] = currentItem.title

/// If the chapter title is the same as the current item, show the author instead
if chapter.title == currentItem.title {
self.nowPlayingInfo[MPMediaItemPropertyArtist] = currentItem.author
} else {
self.nowPlayingInfo[MPMediaItemPropertyArtist] = currentItem.title
}
self.nowPlayingInfo[MPMediaItemPropertyAlbumTitle] = currentItem.author
}

Expand Down
2 changes: 1 addition & 1 deletion BookPlayer/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"download_from_url_title" = "Scarica dall'URL";
"done_title" = "Fatto";
"select_title" = "Selezionare";
"sort_button_title" = "Sorta";
"sort_button_title" = "Ordina";
"search_title" = "Ricerca";
"books_title" = "Libri";
"folders_title" = "Cartelle";
Expand Down

0 comments on commit ac54a5a

Please sign in to comment.