From 1b78001201d89389544cde7ddb5bc7d282ac190e Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Fri, 29 Mar 2019 16:30:02 -0500 Subject: [PATCH] Use struct for allocations --- src/invidious/channels.cr | 4 ++-- src/invidious/comments.cr | 4 ++-- src/invidious/helpers/helpers.cr | 2 +- src/invidious/mixes.cr | 4 ++-- src/invidious/playlists.cr | 4 ++-- src/invidious/search.cr | 8 ++++---- src/invidious/users.cr | 2 +- src/invidious/videos.cr | 6 +++--- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/invidious/channels.cr b/src/invidious/channels.cr index 126cc2b8..b24159db 100644 --- a/src/invidious/channels.cr +++ b/src/invidious/channels.cr @@ -1,4 +1,4 @@ -class InvidiousChannel +struct InvidiousChannel add_mapping({ id: String, author: String, @@ -8,7 +8,7 @@ class InvidiousChannel }) end -class ChannelVideo +struct ChannelVideo add_mapping({ id: String, title: String, diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index dc5db766..b5133cf2 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -29,7 +29,7 @@ class RedditComment }) end -class RedditLink +struct RedditLink JSON.mapping({ author: String, score: Int32, @@ -41,7 +41,7 @@ class RedditLink }) end -class RedditMore +struct RedditMore JSON.mapping({ children: Array(String), count: Int32, diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index 10ea7dcb..ad744c74 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -1,4 +1,4 @@ -class Config +struct Config YAML.mapping({ channel_threads: Int32, # Number of threads to use for crawling videos from channels (for updating subscriptions) feed_threads: Int32, # Number of threads to use for updating feeds diff --git a/src/invidious/mixes.cr b/src/invidious/mixes.cr index 011c5722..d290ac14 100644 --- a/src/invidious/mixes.cr +++ b/src/invidious/mixes.cr @@ -1,4 +1,4 @@ -class MixVideo +struct MixVideo add_mapping({ title: String, id: String, @@ -10,7 +10,7 @@ class MixVideo }) end -class Mix +struct Mix add_mapping({ title: String, id: String, diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index 88308686..027bcae5 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -1,4 +1,4 @@ -class PlaylistVideo +struct PlaylistVideo add_mapping({ title: String, id: String, @@ -12,7 +12,7 @@ class PlaylistVideo }) end -class Playlist +struct Playlist add_mapping({ title: String, id: String, diff --git a/src/invidious/search.cr b/src/invidious/search.cr index 6805f119..04eb63a2 100644 --- a/src/invidious/search.cr +++ b/src/invidious/search.cr @@ -1,4 +1,4 @@ -class SearchVideo +struct SearchVideo add_mapping({ title: String, id: String, @@ -16,7 +16,7 @@ class SearchVideo }) end -class SearchPlaylistVideo +struct SearchPlaylistVideo add_mapping({ title: String, id: String, @@ -24,7 +24,7 @@ class SearchPlaylistVideo }) end -class SearchPlaylist +struct SearchPlaylist add_mapping({ title: String, id: String, @@ -36,7 +36,7 @@ class SearchPlaylist }) end -class SearchChannel +struct SearchChannel add_mapping({ author: String, ucid: String, diff --git a/src/invidious/users.cr b/src/invidious/users.cr index 8a994795..9140378e 100644 --- a/src/invidious/users.cr +++ b/src/invidious/users.cr @@ -1,6 +1,6 @@ require "crypto/bcrypt/password" -class User +struct User module PreferencesConverter def self.from_rs(rs) begin diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index d9cd4d7b..0e9cf6c6 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -241,7 +241,7 @@ VIDEO_FORMATS = { "251" => {"ext" => "webm", "format" => "DASH audio", "acodec" => "opus", "abr" => 160}, } -class Video +struct Video property player_json : JSON::Any? module HTTPParamConverter @@ -549,7 +549,7 @@ class Video }) end -class Caption +struct Caption JSON.mapping( name: CaptionName, baseUrl: String, @@ -557,7 +557,7 @@ class Caption ) end -class CaptionName +struct CaptionName JSON.mapping( simpleText: String, )