1 # -*- coding: ascii -*-
2 ###########################################################################
3 # clive, command line video extraction utility.
5 # Copyright 2009 Toni Gundogdu.
7 # This file is part of clive.
9 # clive is free software: you can redistribute it and/or modify it under
10 # the terms of the GNU General Public License as published by the Free
11 # Software Foundation, either version 3 of the License, or (at your option)
14 # clive is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 # You should have received a copy of the GNU General Public License along
20 # with this program. If not, see <http://www.gnu.org/licenses/>.
21 ###########################################################################
22 package clive
::Compat
;
27 use clive
::Error
qw(CLIVE_OK CLIVE_READ);
30 # Upgrades clive 2.0/2.1 config to 2.2+ format.
34 = File
::Spec
->catfile( $ENV{HOME
}, ".config", "clive", "config" );
37 print("Verify $path.\n");
38 my $c = Config
::Tiny
->read($path);
41 log->errn( "$path: " . Config
::Tiny
->errstr );
46 connect_timeout
=> $c->{http
}->{connect_timeout
},
47 connect_timeout_socks
=> $c->{http
}->{connect_timeout_socks
},
48 agent
=> $c->{http
}->{agent
},
49 proxy
=> $c->{http
}->{proxy
},
50 limit_rate
=> $c->{http
}->{limit_rate
},
51 format
=> $c->{output
}->{format
},
52 save_dir
=> $c->{output
}->{savedir
},
53 cclass
=> $c->{output
}->{cclass
},
54 filename_format
=> $c->{output
}->{filename_format
},
55 format
=> $c->{output
}->{format
},
56 cache_dump_format
=> $c->{output
}->{show
},
57 exec => $c->{commands
}->{exec},
58 stream_exec
=> $c->{commands
}->{stream
},
61 #progress => $c->{_}->{progress},
62 #ytuser => $c->{youtube}->{user},
63 #ytpass => $c->{youtube}->{pass },
64 #clivepass => $c->{commands}->{clivepass},
68 while ( ( my $i ) = each(%opts) ) {
69 $data .= qq/--$i="$opts{$i}"\n/
74 my $a = clive
::Util
::prompt
(
75 "error: Nothing to upgrade -- View file? (Y/n):");
81 open my $fh, ">", "$path.new"
82 or print( STDERR
"error: $path.new: $!" )
88 my $a = clive
::Util
::prompt
("View differences? (Y/n):");
89 system("diff -u $path $path.new | less")
92 $a = clive
::Util
::prompt
("Overwrite with new config? (y/N):");
96 print("Backup -> $path.old\n");
97 $c->write("$path.old");
101 File
::Copy
::move
( "$path.new", "$path" )
102 or print( STDERR
"error: move: $!" )
103 and exit(CLIVE_READ
);
111 # A wildcat did growl.