App-YTDL

 view release on metacpan or  search on metacpan

bin/getvideo  view on Meta::CPAN

#!/usr/bin/env perl
use warnings;
use strict;
use 5.010000;
use utf8;

our $VERSION = '0.417';

use Encode                qw( encode decode );
use File::Path            qw( make_path );
use File::Spec::Functions qw( catdir catfile curdir );
use Getopt::Long          qw( GetOptions );
use Pod::Usage            qw( pod2usage );

use Encode::Locale   qw( decode_argv );
use File::HomeDir    qw();
use File::Which      qw( which );
use Term::ANSIScreen qw( :cursor :screen );
use Term::Choose     qw( choose );
use Term::Form       qw();

use App::YTDL::Arguments  qw( from_arguments_to_choices );
use App::YTDL::Download   qw( download );
use App::YTDL::Helper     qw( uni_capture );
use App::YTDL::History    qw( add_uploaders_to_history read_history_files choose_videos_from_saved_uploaders edit_sticky_file );
use App::YTDL::Video_Info qw( print_video_infos );
use App::YTDL::Options    qw( read_config_file set_options get_defaults );

binmode STDIN,  ':encoding(utf-8)';
binmode STDOUT, ':encoding(utf-8)';
binmode STDERR, ':encoding(utf-8)';

my $old_out_codepage;

BEGIN {
    if ( $^O eq "MSWin32" ) {
        require Win32::Console;
        require Win32::Console::ANSI;
        $old_out_codepage = Win32::Console::OutputCP();
        Win32::Console::OutputCP( 65001 );
        print "\e(U";
    }
}

END {
    if ( $^O eq "MSWin32" ) {
        Win32::Console::OutputCP( $old_out_codepage ) if $old_out_codepage;
    }
}


my ( $arg_file, $help, $version );
GetOptions( 'f|file=s@' => \$arg_file, 'h|?|help' => \$help, 'v|version' => \$version )
or pod2usage( -message => $!, -verbose => 99, -sections => "SYNOPSIS" );

if ( $version ) {
    say 'App::YTDL, version ' . $main::VERSION;
    exit;
}

my $my_videos = File::HomeDir->my_videos || curdir; ##
if ( ! -d $my_videos ) {
    say "Could not find the video directory '$my_videos'!";
    exit 1;
}

my $config_home;
if ( which( 'xdg-user-dir' ) ) {
    $config_home = File::HomeDir::FreeDesktop->my_config(); ##
}
else {
    $config_home = File::HomeDir->my_data();
}
my $config_dir = catdir $config_home, 'getvideo';
make_path $config_dir;


my $set = {



( run in 0.455 second using v1.01-cache-2.11-cpan-39bf76dae61 )