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