From 198913db3e2774bc906908565a72cd62745b4bb2 Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Sat, 4 Sep 2021 02:31:05 +0000 Subject: [PATCH] Remove MangaDex files that are no longer needed --- src/subscription.cr | 83 ---------------- src/views/download.html.ecr | 162 -------------------------------- src/views/mangadex.html.ecr | 39 -------- src/views/subscription.html.ecr | 54 ----------- 4 files changed, 338 deletions(-) delete mode 100644 src/subscription.cr delete mode 100644 src/views/download.html.ecr delete mode 100644 src/views/mangadex.html.ecr delete mode 100644 src/views/subscription.html.ecr diff --git a/src/subscription.cr b/src/subscription.cr deleted file mode 100644 index e391360..0000000 --- a/src/subscription.cr +++ /dev/null @@ -1,83 +0,0 @@ -require "db" -require "json" - -struct Subscription - include DB::Serializable - include JSON::Serializable - - getter id : Int64 = 0 - getter username : String - getter manga_id : Int64 - property language : String? - property group_id : Int64? - property min_volume : Int64? - property max_volume : Int64? - property min_chapter : Int64? - property max_chapter : Int64? - @[DB::Field(key: "last_checked")] - @[JSON::Field(key: "last_checked")] - @raw_last_checked : Int64 - @[DB::Field(key: "created_at")] - @[JSON::Field(key: "created_at")] - @raw_created_at : Int64 - - def last_checked : Time - Time.unix @raw_last_checked - end - - def created_at : Time - Time.unix @raw_created_at - end - - def initialize(@manga_id, @username) - @raw_created_at = Time.utc.to_unix - @raw_last_checked = Time.utc.to_unix - end - - private def in_range?(value : String, lowerbound : Int64?, - upperbound : Int64?) : Bool - lb = lowerbound.try &.to_f64 - ub = upperbound.try &.to_f64 - - return true if lb.nil? && ub.nil? - - v = value.to_f64? - return false unless v - - if lb.nil? - v <= ub.not_nil! - elsif ub.nil? - v >= lb.not_nil! - else - v >= lb.not_nil! && v <= ub.not_nil! - end - end - - def match?(chapter : MangaDex::Chapter) : Bool - if chapter.manga_id != manga_id || - (language && chapter.language != language) || - (group_id && !chapter.groups.map(&.id).includes? group_id) - return false - end - - in_range?(chapter.volume, min_volume, max_volume) && - in_range?(chapter.chapter, min_chapter, max_chapter) - end - - def check_for_updates : Int32 - Logger.debug "Checking updates for subscription with ID #{id}" - jobs = [] of Queue::Job - get_client(username).user.updates_after last_checked do |chapter| - next unless match? chapter - jobs << chapter.to_job - end - Storage.default.update_subscription_last_checked id - count = Queue.default.push jobs - Logger.debug "#{count}/#{jobs.size} of updates added to queue" - count - rescue e - Logger.error "Error occurred when checking updates for " \ - "subscription with ID #{id}. #{e}" - 0 - end -end diff --git a/src/views/download.html.ecr b/src/views/download.html.ecr deleted file mode 100644 index 0ea8527..0000000 --- a/src/views/download.html.ecr +++ /dev/null @@ -1,162 +0,0 @@ -

Download from MangaDex

-
-
-
- -
-
-
- -
-
- - - -
-
-
- -
-
-

Title:

-

-

-
-
-

Filter Chapters

-

-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
-
- -
-
- - - -
-
-

Click on a table row to select the chapter. Drag your mouse over multiple rows to select them all. Hold Ctrl to make multiple non-adjacent selections.

-
-

- - - - - - - - - - - - - - -
IDTitleLanguageGroupVolumeChapterTimestamp
-
- - -
- -<% content_for "script" do %> - <%= render_component "moment" %> - <%= render_component "jquery-ui" %> - - -<% end %> diff --git a/src/views/mangadex.html.ecr b/src/views/mangadex.html.ecr deleted file mode 100644 index 764c4f4..0000000 --- a/src/views/mangadex.html.ecr +++ /dev/null @@ -1,39 +0,0 @@ -
-

Connect to MangaDex

-
-
-

This step is optional but highly recommended if you are using the MangaDex downloader. Connecting to MangaDex allows you to:

-
    -
  • Search MangaDex by search terms in addition to manga IDs
  • -
  • Automatically download new chapters when they are available (coming soon)
  • -
-
- -
-

- You have logged in to MangaDex! - You have logged in to MangaDex but the token has expired. - The expiration date of your token is . - If the integration is not working, you - You - can log in again and the token will be updated. -

-
- -
-
-
-
-
-
-
-
-
-
-
- -<% content_for "script" do %> - <%= render_component "moment" %> - - -<% end %> diff --git a/src/views/subscription.html.ecr b/src/views/subscription.html.ecr deleted file mode 100644 index cc96c47..0000000 --- a/src/views/subscription.html.ecr +++ /dev/null @@ -1,54 +0,0 @@ -

MangaDex Subscription Manager

- -
-

The subscription manager uses a MangaDex API that requires authentication. Please connect to MangaDex before using this feature.

- -

No subscription found. Go to the MangaDex download page and start subscribing.

- - -
- -<% content_for "script" do %> - <%= render_component "moment" %> - - -<% end %>