diff --git a/src/library/entry.cr b/src/library/entry.cr
index 7e8d81d..ba4b84a 100644
--- a/src/library/entry.cr
+++ b/src/library/entry.cr
@@ -1,10 +1,9 @@
class Entry
property zip_path : String, book : Title, title : String,
- size : String, pages : Int32, id : String, title_id : String,
- encoded_path : String, encoded_title : String, mtime : Time,
- err_msg : String?
+ size : String, pages : Int32, id : String, encoded_path : String,
+ encoded_title : String, mtime : Time, err_msg : String?
- def initialize(@zip_path, @book, @title_id, storage)
+ def initialize(@zip_path, @book, storage)
@encoded_path = URI.encode @zip_path
@title = File.basename @zip_path, File.extname @zip_path
@encoded_title = URI.encode @title
@@ -46,10 +45,11 @@ class Entry
def to_json(json : JSON::Builder)
json.object do
- {% for str in ["zip_path", "title", "size", "id", "title_id",
+ {% for str in ["zip_path", "title", "size", "id",
"encoded_path", "encoded_title"] %}
json.field {{str}}, @{{str.id}}
{% end %}
+ json.field "title_id", @book.id
json.field "display_name", @book.display_name @title
json.field "cover_url", cover_url
json.field "pages" { json.number @pages }
@@ -67,7 +67,7 @@ class Entry
def cover_url
return "#{Config.current.base_url}img/icon.png" if @err_msg
- url = "#{Config.current.base_url}api/page/#{@title_id}/#{@id}/1"
+ url = "#{Config.current.base_url}api/page/#{@book.id}/#{@id}/1"
TitleInfo.new @book.dir do |info|
info_url = info.entry_cover_url[@title]?
unless info_url.nil? || info_url.empty?
diff --git a/src/library/library.cr b/src/library/library.cr
index 405b933..a062105 100644
--- a/src/library/library.cr
+++ b/src/library/library.cr
@@ -128,7 +128,7 @@ class Library
.each do |e|
break if recently_added.size > 12
last = recently_added.last?
- if last && e[:entry].title_id == last[:entry].title_id &&
+ if last && e[:entry].book.id == last[:entry].book.id &&
(e[:date_added] - last_date_added.not_nil!).duration < 1.day
# A NamedTuple is immutable, so we have to cast it to a Hash first
last_hash = last.to_h
diff --git a/src/library/title.cr b/src/library/title.cr
index f1e96dc..9ac8a72 100644
--- a/src/library/title.cr
+++ b/src/library/title.cr
@@ -34,7 +34,7 @@ class Title
next
end
if [".zip", ".cbz", ".rar", ".cbr"].includes? File.extname path
- entry = Entry.new path, self, @id, storage
+ entry = Entry.new path, self, storage
@entries << entry if entry.pages > 0 || entry.err_msg
end
end
diff --git a/src/views/opds/title.xml.ecr b/src/views/opds/title.xml.ecr
index f5a3311..16ff3d0 100644
--- a/src/views/opds/title.xml.ecr
+++ b/src/views/opds/title.xml.ecr
@@ -28,10 +28,10 @@
-
+
-
-
+
+
<% end %>