aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gtk-straw-viewer14
-rwxr-xr-xbin/straw-viewer16
2 files changed, 15 insertions, 15 deletions
diff --git a/bin/gtk-straw-viewer b/bin/gtk-straw-viewer
index 432f31f..b244978 100755
--- a/bin/gtk-straw-viewer
+++ b/bin/gtk-straw-viewer
@@ -218,10 +218,10 @@ my %CONFIG = (
# Subtitle options
srt_languages => ['en', 'es'],
- captions_dir => tmpdir(),
get_captions => 1,
auto_captions => 0,
- cache_dir => undef, # will be defined later
+ captions_dir => catdir(tmpdir(), 'straw-viewer'),
+ cache_dir => catdir(tmpdir(), 'straw-viewer'),
# Others
env_proxy => 1,
@@ -464,11 +464,11 @@ if (not defined $CONFIG{cache_dir}) {
$CONFIG{cache_dir} = catdir($cache_dir, 'straw-viewer');
}
-# Create the cache directory (if needed)
-if (not -d $CONFIG{cache_dir}) {
+foreach my $path($CONFIG{cache_dir}, $CONFIG{captions_dir}) {
+ next if -d $path;
require File::Path;
- File::Path::make_path($CONFIG{cache_dir})
- or warn "[!] Can't create dir `$CONFIG{cache_dir}': $!";
+ File::Path::make_path($path)
+ or warn "[!] Can't create path <<$path>>: $!";
}
{
@@ -2524,7 +2524,7 @@ sub display_results {
#use Data::Dump qw(pp);
#pp $items;
- if (ref($items) eq 'HASH' and $items->{type} eq 'playlist') {
+ if (ref($items) eq 'HASH') {
$items = $items->{videos};
}
diff --git a/bin/straw-viewer b/bin/straw-viewer
index 147e16e..9ee0dea 100755
--- a/bin/straw-viewer
+++ b/bin/straw-viewer
@@ -211,11 +211,11 @@ my %CONFIG = (
# Subtitle options
srt_languages => ['en', 'es'],
- captions_dir => tmpdir(),
get_captions => 1,
auto_captions => 0,
copy_caption => 0,
- cache_dir => undef, # auto-defined
+ captions_dir => catdir(tmpdir(), 'straw-viewer'),
+ cache_dir => catdir(tmpdir(), 'straw-viewer'),
# API
api_host => "https://invidio.us",
@@ -552,12 +552,12 @@ sub load_config {
dump_configuration($config_file) if $update_config;
- # Create the cache directory (if needed)
- if (not -d $CONFIG{cache_dir}) {
- require File::Path;
- File::Path::make_path($CONFIG{cache_dir})
- or warn "[!] Can't create dir `$CONFIG{cache_dir}': $!";
- }
+foreach my $path($CONFIG{cache_dir}, $CONFIG{captions_dir}) {
+ next if -d $path;
+ require File::Path;
+ File::Path::make_path($path)
+ or warn "[!] Can't create path <<$path>>: $!";
+}
@opt{keys %CONFIG} = values(%CONFIG);
}