Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Now, the access token is updated before the application exits. This r…

…educes the time spent on the first GET request after the applicaiton starts again.
  • Loading branch information...
commit d957b6b714a84bb2594d7f749a3bd207a14df16f 1 parent de4a73e
@trizen authored
View
1  WWW-YoutubeViewer/MANIFEST
@@ -16,7 +16,6 @@ META.json
META.yml
README
share/gtk-youtube-viewer-icons/default_thumb.jpg
-share/gtk-youtube-viewer-icons/donate.png
share/gtk-youtube-viewer-icons/feed_icon.png
share/gtk-youtube-viewer-icons/gtk-youtube-viewer.png
share/gtk-youtube-viewer-icons/spinner.gif
View
4 WWW-YoutubeViewer/META.json
@@ -51,6 +51,10 @@
"file" : "lib/WWW/YoutubeViewer.pm",
"version" : "0.05"
},
+ "WWW::YoutubeViewer::AuthToken" : {
+ "file" : "lib/WWW/YoutubeViewer/AuthToken.pm",
+ "version" : "0.01"
+ },
"WWW::YoutubeViewer::GetCaption" : {
"file" : "lib/WWW/YoutubeViewer/GetCaption.pm",
"version" : "0.01"
View
3  WWW-YoutubeViewer/META.yml
@@ -17,6 +17,9 @@ provides:
WWW::YoutubeViewer:
file: lib/WWW/YoutubeViewer.pm
version: 0.05
+ WWW::YoutubeViewer::AuthToken:
+ file: lib/WWW/YoutubeViewer/AuthToken.pm
+ version: 0.01
WWW::YoutubeViewer::GetCaption:
file: lib/WWW/YoutubeViewer/GetCaption.pm
version: 0.01
View
7 WWW-YoutubeViewer/bin/gtk-youtube-viewer
@@ -2135,6 +2135,13 @@ sub on_mainw_destroy {
# Save hpaned position
$CONFIG{hpaned_position} = $hbox2->get_position;
+ my $new_token = $yv_obj->get_access_token();
+
+ if (defined($new_token) && (!defined($access_token) || (defined($access_token) && $new_token ne $access_token))) {
+ say "** Updating the access token...\n";
+ $yv_token->to_file($new_token, $yv_obj->get_refresh_token(), $auth_tokens_file);
+ }
+
get_main_window_size();
dump_configuration();
save_usernames_to_file();
View
17 WWW-YoutubeViewer/bin/youtube-viewer
@@ -659,6 +659,10 @@ NOTE: Categories and region IDs are case sensitive!
But, what if we'd want to play the videos from the next pages too?
In this case, ':anp' is your friend. Use it wisely!
+8. It is recommended to close the application with the ':q' keyword.
+ This option will update the access token (if needed) and closes
+ the application with an appropriate exit-code.
+
** Closed-Captions
To get the closed-captions (subtitles) for videos, you need to install
the 'gcap' program. See: http://gcap.googlecode.com
@@ -3044,4 +3048,15 @@ sub press_enter_to_continue {
scalar $term->readline(colored("\n=>> Press ENTER to continue...", 'bold'));
}
-sub main_quit { exit $_[0] }
+sub main_quit {
+ my $new_token = $yv_obj->get_access_token();
+
+ if (defined($new_token) && (!defined($access_token) || (defined($access_token) && $new_token ne $access_token))) {
+ say "** Updating the access token...\n";
+ $yv_token->to_file($new_token, $yv_obj->get_refresh_token(), $auth_tokens_file);
+ }
+
+ exit $_[0];
+}
+
+main_quit(0);
View
2  WWW-YoutubeViewer/share/gtk-youtube-viewer.desktop
@@ -1,7 +1,7 @@
[Desktop Entry]
Name=GTK Youtube Viewer
Version=1.0
-Comment=A Gtk2 application to search and play Youtube videos with MPlayer.
+Comment=Search and play YouTube videos with MPlayer.
Exec=gtk-youtube-viewer
Icon=gtk-youtube-viewer
StartupNotify=false
Please sign in to comment.
Something went wrong with that request. Please try again.