iOS fix local episode duration and playback session title, version bump 0.9.63

This commit is contained in:
advplyr 2023-03-06 16:47:38 -06:00
parent 87ca6018d3
commit 53c9109534
4 changed files with 17 additions and 9 deletions

View file

@ -173,7 +173,6 @@
BE96D57E131924D520D57057 /* Pods-Audiobookshelf.debug.xcconfig */,
D2F7F575384A63F1C47DE984 /* Pods-Audiobookshelf.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
@ -721,12 +720,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = Icons;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 19;
CURRENT_PROJECT_VERSION = 20;
DEVELOPMENT_TEAM = 7UFJ7D8V6A;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.9.62;
MARKETING_VERSION = 0.9.63;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.audiobookshelf.app.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -745,12 +744,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = Icons;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 19;
CURRENT_PROJECT_VERSION = 20;
DEVELOPMENT_TEAM = 7UFJ7D8V6A;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.9.62;
MARKETING_VERSION = 0.9.63;
PRODUCT_BUNDLE_IDENTIFIER = com.audiobookshelf.app;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";

View file

@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Override point for customization after application launch.
let configuration = Realm.Configuration(
schemaVersion: 7,
schemaVersion: 8,
migrationBlock: { [weak self] migration, oldSchemaVersion in
if (oldSchemaVersion < 1) {
self?.logger.log("Realm schema version was \(oldSchemaVersion)")

View file

@ -169,9 +169,14 @@ extension LocalLibraryItem {
self.media?.chapters.forEach { chapter in chapters.append(Chapter.detachCopy(of: chapter)!) }
let authorName = mediaMetadata?.authorDisplayName
var duration = getDuration()
var displayTitle = mediaMetadata?.title
let audioTracks = List<AudioTrack>()
if let episode = episode, let track = episode.audioTrack {
audioTracks.append(AudioTrack.detachCopy(of: track)!)
duration = track.duration
displayTitle = episode.title
} else if let tracks = self.media?.tracks {
tracks.forEach { t in audioTracks.append(AudioTrack.detachCopy(of: t)!) }
}
@ -185,10 +190,10 @@ extension LocalLibraryItem {
mediaType: self.mediaType,
mediaMetadata: mediaMetadata,
chapters: chapters,
displayTitle: mediaMetadata?.title,
displayTitle: displayTitle,
displayAuthor: authorName,
coverPath: self.coverContentUrl,
duration: self.getDuration(),
duration: duration,
playMethod: PlayMethod.local.rawValue,
startedAt: dateNow,
updatedAt: dateNow,

View file

@ -12,6 +12,7 @@ class Metadata: EmbeddedObject, Codable {
@Persisted var title: String = "Unknown"
@Persisted var subtitle: String?
@Persisted var authors = List<Author>()
@Persisted var author: String? // Podcast author
@Persisted var narrators = List<String>()
@Persisted var genres = List<String>()
@Persisted var publishedYear: String?
@ -28,12 +29,13 @@ class Metadata: EmbeddedObject, Codable {
@Persisted var seriesName: String?
@Persisted var feedUrl: String?
var authorDisplayName: String { self.authorName ?? "Unknown" }
var authorDisplayName: String { self.authorName ?? self.author ?? "Unknown" }
private enum CodingKeys : String, CodingKey {
case title,
subtitle,
authors,
author, // Podcast author
narrators,
genres,
publishedYear,
@ -60,6 +62,7 @@ class Metadata: EmbeddedObject, Codable {
let values = try decoder.container(keyedBy: CodingKeys.self)
title = try values.decode(String.self, forKey: .title)
subtitle = try? values.decode(String.self, forKey: .subtitle)
author = try? values.decode(String.self, forKey: .author) // Podcast author
if let authorList = try? values.decode([Author].self, forKey: .authors) {
authors.append(objectsIn: authorList)
}
@ -88,6 +91,7 @@ class Metadata: EmbeddedObject, Codable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(title, forKey: .title)
try container.encode(subtitle, forKey: .subtitle)
try container.encode(author, forKey: .author) // Podcast author
try container.encode(Array(authors), forKey: .authors)
try container.encode(Array(narrators), forKey: .narrators)
try container.encode(Array(genres), forKey: .genres)