~ubuntu-branches/ubuntu/feisty/gnupod-tools/feisty

« back to all changes in this revision

Viewing changes to src/gnupod_INIT.pl

  • Committer: Bazaar Package Importer
  • Author(s): Brian Nelson
  • Date: 2005-04-05 09:10:01 UTC
  • mto: (2.1.1 sarge)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20050405091001-vjtr9oktjemr6mn6
Tags: upstream-0.98
ImportĀ upstreamĀ versionĀ 0.98

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
###__PERLBIN__###
1
2
#  Copyright (C) 2002-2004 Adrian Ulrich <pab at blinkenlights.ch>
2
3
#  Part of the gnupod-tools collection
3
4
#
28
29
use vars qw(%opts);
29
30
 
30
31
 
31
 
print "gnupod_addsong.pl Version 0.94rc1 (C) 2002-2004 Adrian Ulrich\n";
 
32
print "gnupod_INIT.pl ###__VERSION__### (C) Adrian Ulrich\n";
32
33
 
33
34
$opts{mount} = $ENV{IPOD_MOUNTPOINT};
34
35
#Don't add xml and itunes opts.. we *NEED* the mount opt to be set..
35
 
GetOptions(\%opts, "help|h", "mount|m=s", "disable-convert|d", "france|f");
 
36
GetOptions(\%opts, "version", "help|h", "mount|m=s", "disable-convert|d", "france|f");
 
37
#gnupod_INIT does not read configuration files!
36
38
 
37
39
usage() if $opts{help};
 
40
version() if $opts{version};
38
41
 
39
42
go();
40
43
 
48
51
## Ask the user, if he still knows what he/she's doing..
49
52
print << "EOF";
50
53
 
51
 
Your iPod it mounted at $opts{mount}, ok ?
 
54
Your iPod is mounted at $opts{mount}, ok ?
52
55
*********************************************************
53
56
This tool creates the default directory tree on your iPod
54
57
and creates an *empty* GNUtunesDB (..or convert your old
55
58
iTunesDB to a new GNUtunesDB).
56
59
 
57
60
You only have to use this command if
58
 
 a) You never used GNUpod with this iPod
59
 
 b) You did an 'rm -rf' on your iPod
 
61
    -> You never used GNUpod with this iPod
 
62
 or -> You did an 'rm -rf' on your iPod
60
63
 
61
64
btw: use 'gnupod_addsong -m $opts{mount} --restore'
62
65
     if you lost your songs on the iPod after using
90
93
   print "+$path\n";
91
94
 }
92
95
 
93
 
if($opts{france}) {
94
 
 print "> Creating 'Limit' file (because you used --france)\n";
95
 
 mkdir("$opts{mount}/iPod_Control/Device");
96
 
 open(LIMIT, ">$opts{mount}/iPod_Control/Device/Limit") or die "Failed: $!\n";
97
 
  print LIMIT "216\n"; #Why?
98
 
 close(LIMIT);
99
 
}
100
 
elsif(-e "$opts{mount}/iPod_Control/Device/Limit") {
101
 
 print "> Removing 'Limit' file (because you didn't use --france)\n";
102
 
 unlink("$opts{mount}/iPod_Control/Device/Limit");
103
 
}
104
 
else {
105
 
 print "> No 'Limit' file created or deleted..\n";
106
 
}
 
96
 if($opts{france}) {
 
97
  print "> Creating 'Limit' file (because you used --france)\n";
 
98
  mkdir("$opts{mount}/iPod_Control/Device");
 
99
  open(LIMIT, ">$opts{mount}/iPod_Control/Device/Limit") or die "Failed: $!\n";
 
100
   print LIMIT "216\n"; #Why?
 
101
  close(LIMIT);
 
102
 }
 
103
 elsif(-e "$opts{mount}/iPod_Control/Device/Limit") {
 
104
  print "> Removing 'Limit' file (because you didn't use --france)\n";
 
105
  unlink("$opts{mount}/iPod_Control/Device/Limit");
 
106
 }
 
107
 else {
 
108
  print "> No 'Limit' file created or deleted..\n";
 
109
 }
107
110
 
108
111
 print "> Creating dummy files\n";
109
112
 
110
 
  GNUpod::XMLhelper::writexml($con->{xml});
 
113
 GNUpod::XMLhelper::writexml($con);
111
114
 
112
115
 
113
116
 if(-e $con->{itunesdb} && !$opts{'disable-convert'}) {
134
137
$rtxt
135
138
Usage: gnupod_INIT.pl [-h] [-m directory]
136
139
 
137
 
   -h, --help             : This ;)
138
 
   -m, --mount=directory  : iPod mountpoint, default is \$IPOD_MOUNTPOINT
139
 
   -d, --disable-convert  : Don't try to convert an exiting iTunesDB
140
 
   -f, --france           : Limit volume to 100dB (For French-People)
141
 
                            Maximal-volume without this is ~104dB (VERY LOUD)
142
 
                            *WARNING* This works only for iPods running
143
 
                            Firmware 1.x (1st & 2nd generation)
144
 
                You can also use mktunes.pl '--volume PERCENT'
145
 
                to adjust the volume (Works with Firmware 1.x AND 2.x)
146
 
 
147
 
EOF
148
 
}
149
 
 
 
140
   -h, --help              display this help and exit
 
141
       --version           output version information and exit
 
142
   -m, --mount=directory   iPod mountpoint, default is \$IPOD_MOUNTPOINT
 
143
   -d, --disable-convert   Don't try to convert an existing iTunesDB
 
144
   -f, --france            Limit volume to 100dB (For French-Law/People)
 
145
                           Maximal-volume without this is ~104dB (VERY LOUD)
 
146
                           *WARNING* This works only for iPods running
 
147
                           Firmware 1.x (1st & 2nd generation)
 
148
                           You can also use mktunes.pl '--volume PERCENT'
 
149
                           to adjust the volume (Works with Firmware 1.x AND 2.x)
 
150
 
 
151
Report bugs to <bug-gnupod\@nongnu.org>
 
152
EOF
 
153
}
 
154
 
 
155
sub version {
 
156
die << "EOF";
 
157
gnupod_INIT.pl (gnupod) ###__VERSION__###
 
158
Copyright (C) Adrian Ulrich 2002-2004
 
159
 
 
160
This is free software; see the source for copying conditions.  There is NO
 
161
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
162
 
 
163
EOF
 
164
}