aboutsummaryrefslogtreecommitdiffstats
path: root/lib/WWW/FairViewer/VideoCategories.pm
diff options
context:
space:
mode:
authortrizen <trizen@protonmail.com>2020-10-05 22:00:21 +0300
committerJesús <heckyel@hyperbola.info>2020-11-09 16:07:10 -0500
commit9838963cf2aab02241a37cee7d305025dc694d90 (patch)
tree3241214473b1295ffd3c28829814e04210309bfa /lib/WWW/FairViewer/VideoCategories.pm
parentbe00b89005ffc38f257848b47d2e4a0b2a536c44 (diff)
downloadfair-viewer-9838963cf2aab02241a37cee7d305025dc694d90.tar.lz
fair-viewer-9838963cf2aab02241a37cee7d305025dc694d90.tar.xz
fair-viewer-9838963cf2aab02241a37cee7d305025dc694d90.zip
- Implemented support for trending categories.
Example: fair-viewer --trending # trending videos fair-viewer --trending=music # trending music videos fair-viewer -c # list trending categories In the Gtk version, the trending categories are listed in the "Categories" tab. - Several internal code tweaks and improvements. Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'lib/WWW/FairViewer/VideoCategories.pm')
-rw-r--r--lib/WWW/FairViewer/VideoCategories.pm48
1 files changed, 7 insertions, 41 deletions
diff --git a/lib/WWW/FairViewer/VideoCategories.pm b/lib/WWW/FairViewer/VideoCategories.pm
index 85045fd..4dfc125 100644
--- a/lib/WWW/FairViewer/VideoCategories.pm
+++ b/lib/WWW/FairViewer/VideoCategories.pm
@@ -18,16 +18,6 @@ WWW::FairViewer::VideoCategories - videoCategory resource handler.
=cut
-sub _make_videoCategories_url {
- my ($self, %opts) = @_;
-
- $self->_make_feed_url(
- 'videoCategories',
- hl => $self->get_hl,
- %opts,
- );
-}
-
=head2 video_categories()
Return video categories for a specific region ID.
@@ -37,37 +27,13 @@ Return video categories for a specific region ID.
sub video_categories {
my ($self) = @_;
- require File::Spec;
-
- my $region = $self->get_region() // 'US';
- my $url = $self->_make_videoCategories_url(region => $region);
- my $file = File::Spec->catfile($self->get_config_dir, "categories-$region-" . $self->get_hl() . ".json");
-
- my $json;
- if (open(my $fh, '<:utf8', $file)) {
- local $/;
- $json = <$fh>;
- close $fh;
- }
- else {
- $json = $self->lwp_get($url, simple => 1);
- open my $fh, '>:utf8', $file;
- print {$fh} $json;
- close $fh;
- }
-
- return $self->parse_json_string($json);
-}
-
-=head2 video_category_id_info($cagegory_id)
-
-Return info for the comma-separated specified category ID(s).
-
-=cut
-
-sub video_category_id_info {
- my ($self, $id) = @_;
- return $self->_get_results($self->_make_videoCategories_url(id => $id));
+ return [{id => "music", title => "Music"},
+ {id => "gaming", title => "Gaming"},
+ {id => "news", title => "News"},
+ {id => "movies", title => "Movies"},
+ {id => "trending", title => "Trending"},
+ {id => "popular", title => "Popular"},
+ ];
}
=head1 AUTHOR