organo 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +23 -2
- data/doc/anime.md +28 -0
- data/doc/api.md +6 -0
- data/doc/readme.md +12 -0
- data/doc/remote.md +6 -0
- data/doc/schedule.md +3 -0
- data/lib/organo/animeschedule_api.rb +11 -0
- data/lib/organo/commands/anime/anime_search.rb +2 -0
- data/lib/organo/commands/api/api_get_schedule.rb +74 -0
- data/lib/organo/commands/schedule/schedule_create.rb +2 -2
- data/lib/organo/config.rb +3 -1
- data/lib/organo/jikan_api.rb +1 -1
- data/lib/organo/version.rb +1 -1
- data/lib/organo.rb +2 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16bba44699065f0d0afb4bd22c4c877243dbeeb11c5d3568d146a957f00cfb69
|
4
|
+
data.tar.gz: 4825637f9a142536d395f859d2309f5741f5fba336ad48eed68822c1c336f29e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6144b9c1d789c2618a18e1dcf2ce9eac84c25d5e534fdc3d444102db216657cb4bee82186170bee45f6b5346dd6d0ac0ed6a9781b3137947cd61d1eed3f2a66d
|
7
|
+
data.tar.gz: f3fc2a18ceb87932457bb11de19cdf3a88f15fa6a1b1665e5a19dbc8bc92459387e9fd293fa985efeabbb78909c40a4754a707c34519c4c889f40499aad2a023
|
data/README.md
CHANGED
@@ -2,6 +2,27 @@
|
|
2
2
|
|
3
3
|
Organo is named after the mafia group that runs the city of Lux in the anime [Texhnolyze](https://myanimelist.net/anime/26/Texhnolyze).
|
4
4
|
|
5
|
-
|
5
|
+
## Description
|
6
6
|
|
7
|
-
|
7
|
+
This tool has been made to manage data that is shown on the DKB Anime Community website. It uses to the [JikanAPI](https://jikan.moe), an unofficial MyAnimeList API, and [AnimeSchedule](https://animeschedule.net) to get data.
|
8
|
+
|
9
|
+
**This tool is still under construction.**
|
10
|
+
|
11
|
+
## Requirements
|
12
|
+
|
13
|
+
- Ruby 3.0+
|
14
|
+
|
15
|
+
Earlier versions of ruby might work, but the tool will not be tested against them.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
The tool is available through [Rubygems](https://rubygems.org)
|
20
|
+
```shell
|
21
|
+
gem install organo
|
22
|
+
```
|
23
|
+
|
24
|
+
## Documentation
|
25
|
+
|
26
|
+
**Documentation is still incomplete.**
|
27
|
+
|
28
|
+
The documentation is available in the `doc/` directory. Follow this [link](doc/readme.md).
|
data/doc/anime.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Anime
|
2
|
+
|
3
|
+
## add
|
4
|
+
|
5
|
+
Add anime entry to files.
|
6
|
+
```shell
|
7
|
+
organo anime add MAL_ID
|
8
|
+
```
|
9
|
+
|
10
|
+
## add sequel
|
11
|
+
|
12
|
+
Add anime sequel entry to anime in file.
|
13
|
+
```shell
|
14
|
+
organo anime add sequel ANIME_MAL_ID SEQUEL_MAL_ID
|
15
|
+
```
|
16
|
+
|
17
|
+
## get broken_links
|
18
|
+
|
19
|
+
Get list of anime IDs that have broken links.
|
20
|
+
```shell
|
21
|
+
organo anime get broken_links
|
22
|
+
```
|
23
|
+
|
24
|
+
## remove
|
25
|
+
## search
|
26
|
+
## show
|
27
|
+
## update image
|
28
|
+
## update query
|
data/doc/api.md
ADDED
data/doc/readme.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Organo documentation
|
2
|
+
|
3
|
+
The tool is broken into 4 main subcommands.
|
4
|
+
|
5
|
+
- [Anime](anime.md)
|
6
|
+
- Manage and browse the local data files.
|
7
|
+
- [API](api.md)
|
8
|
+
- Get data from Jikan API.
|
9
|
+
- [Remote](remote.md)
|
10
|
+
- Add FTP remote information to push the data to the website.
|
11
|
+
- [Schedule](schedule.md)
|
12
|
+
- Manage the weekly schedule.
|
data/doc/remote.md
ADDED
data/doc/schedule.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../config'
|
4
|
+
require_relative '../../animeschedule_api'
|
5
|
+
|
6
|
+
module Organo
|
7
|
+
module CLI
|
8
|
+
module Commands
|
9
|
+
module API
|
10
|
+
module Get
|
11
|
+
|
12
|
+
class Schedule < Dry::CLI::Command
|
13
|
+
desc 'Get anime release schedule of a specified season'
|
14
|
+
argument :season, type: :string, required: true, desc: 'Winter, Spring, Summer or Fall'
|
15
|
+
argument :year, type: :integer, required: true, desc: 'Year'
|
16
|
+
|
17
|
+
def call(season:, year:, **)
|
18
|
+
# Get the list of anime mal_id
|
19
|
+
# show_list = Reader.read_file("#{Config::DEFAULT_DIR}/#{year}-#{season.downcase}.json")
|
20
|
+
|
21
|
+
config = JSON.parse(File.read(Config::DEFAULT_FILE))
|
22
|
+
section = config.find { |option| option['section'] == 'api' }
|
23
|
+
key = (section['entries'].find { |entry| entry['name'] == 'AnimeSchedule' })['key']
|
24
|
+
|
25
|
+
count = 0
|
26
|
+
page = 1
|
27
|
+
total = 0
|
28
|
+
anime_list = []
|
29
|
+
loop do
|
30
|
+
data = JSON.parse(
|
31
|
+
RestClient.get(
|
32
|
+
"#{AnimeScheduleAPI.get_url('anime', 'v3')}?mt=all&years=#{year}&seasons=#{season}&media-types=tv&page=#{page}",
|
33
|
+
{ Authorization: "Bearer #{key}" }
|
34
|
+
)
|
35
|
+
)
|
36
|
+
total = data['totalAmount'].to_i
|
37
|
+
page += 1
|
38
|
+
count += data['anime'].size
|
39
|
+
anime_list.concat(data['anime'])
|
40
|
+
break if count >= total
|
41
|
+
end
|
42
|
+
|
43
|
+
draft_schedule = []
|
44
|
+
anime_list.each do |anime|
|
45
|
+
air_time = DateTime.parse(anime['premier'])
|
46
|
+
draft_schedule.push(
|
47
|
+
{
|
48
|
+
slug: anime['route'],
|
49
|
+
title: anime['title'],
|
50
|
+
weekday: air_time.strftime('%A').downcase
|
51
|
+
}
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
file = File.read('schedule.json')
|
56
|
+
schedule = JSON.parse(file)
|
57
|
+
schedule.each do |weekday|
|
58
|
+
draft_schedule.each do |anime|
|
59
|
+
next unless anime[:weekday].eql? weekday['weekday']
|
60
|
+
|
61
|
+
weekday['shows'].push(
|
62
|
+
{ slug: anime[:slug], title: anime[:title], time: '' }
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
Writer.to_file(schedule, 'schedule.json')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -6,10 +6,10 @@ module Organo
|
|
6
6
|
module Schedule
|
7
7
|
|
8
8
|
class Create < Dry::CLI::Command
|
9
|
-
desc
|
9
|
+
desc 'Initialize directory with default files and directories'
|
10
10
|
|
11
11
|
def call(*)
|
12
|
-
content =
|
12
|
+
content = []
|
13
13
|
Date::DAYNAMES.each do |dname|
|
14
14
|
content.push({ 'weekday' => dname.downcase, 'shows' => [] } )
|
15
15
|
end
|
data/lib/organo/config.rb
CHANGED
data/lib/organo/jikan_api.rb
CHANGED
data/lib/organo/version.rb
CHANGED
data/lib/organo.rb
CHANGED
@@ -13,6 +13,7 @@ require_relative 'organo/commands/api/api_get_anime'
|
|
13
13
|
require_relative 'organo/commands/api/api_get_sequels'
|
14
14
|
require_relative 'organo/commands/api/api_get_season'
|
15
15
|
require_relative 'organo/commands/api/api_search_anime'
|
16
|
+
require_relative 'organo/commands/api/api_get_schedule'
|
16
17
|
require_relative 'organo/commands/remote/remote_add'
|
17
18
|
require_relative 'organo/commands/remote/remote_remove'
|
18
19
|
require_relative 'organo/commands/remote/remote_download'
|
@@ -46,6 +47,7 @@ module Organo
|
|
46
47
|
prefix.register 'get season', API::Get::Season
|
47
48
|
prefix.register 'get sequels', API::Get::Sequels
|
48
49
|
prefix.register 'search anime', API::Search::Anime
|
50
|
+
prefix.register 'get schedule', API::Get::Schedule
|
49
51
|
end
|
50
52
|
register 'merge', Merge
|
51
53
|
register 'statistics', Statistics
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: organo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis-Philippe Fortin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -78,8 +78,14 @@ files:
|
|
78
78
|
- Gemfile
|
79
79
|
- LICENSE.txt
|
80
80
|
- README.md
|
81
|
+
- doc/anime.md
|
82
|
+
- doc/api.md
|
83
|
+
- doc/readme.md
|
84
|
+
- doc/remote.md
|
85
|
+
- doc/schedule.md
|
81
86
|
- exe/organo
|
82
87
|
- lib/organo.rb
|
88
|
+
- lib/organo/animeschedule_api.rb
|
83
89
|
- lib/organo/commands/anime/anime_add.rb
|
84
90
|
- lib/organo/commands/anime/anime_add_sequel.rb
|
85
91
|
- lib/organo/commands/anime/anime_get_broken_links.rb
|
@@ -89,6 +95,7 @@ files:
|
|
89
95
|
- lib/organo/commands/anime/anime_update_image.rb
|
90
96
|
- lib/organo/commands/anime/anime_update_query.rb
|
91
97
|
- lib/organo/commands/api/api_get_anime.rb
|
98
|
+
- lib/organo/commands/api/api_get_schedule.rb
|
92
99
|
- lib/organo/commands/api/api_get_season.rb
|
93
100
|
- lib/organo/commands/api/api_get_sequels.rb
|
94
101
|
- lib/organo/commands/api/api_search_anime.rb
|