Ticket #1582: myth.rebuilddatabase.pl.diff
| File myth.rebuilddatabase.pl.diff, 2.5 KB (added by , 20 years ago) |
|---|
-
myth.rebuilddatabase.pl
49 49 ## - changed all the DB calls to use parameters (avoids escape issues, 50 50 ## and it looks better) 51 51 52 ## 23-03-2006: (red321) 53 ## Swapped the rename stage and the DB fill stage, script was adding the old basename 54 ## to the database, and then renaming the file, leaving 55 ## a dead link in 0.19 56 52 57 use strict; 53 58 use DBI; 54 59 use Getopt::Long; … … 330 335 print "Enter description: "; 331 336 chomp(my $tmp_description = <STDIN>); 332 337 if ($tmp_description) {$description = $tmp_description;} 338 339 ## rename file to proper format 340 341 if ($starttime =~ m/$db_date_regx/) { 342 ($syear, $smonth, $sday, $shour, $sminute, $ssecond) = 343 ($1, $2, $3, $4, $5, $6); 344 } 333 345 346 if ($endtime =~ m/$db_date_regx/) { 347 ($eyear, $emonth, $eday, $ehour, $eminute, $esecond) = 348 ($1, $2, $3, $4, $5, $6); 349 } 350 351 my $new_file = "$dir/$channel"."_$syear$smonth$sday$shour$sminute$ssecond"."_$eyear$emonth$eday$ehour$eminute$esecond.nuv"; 352 my $basename = $new_file; 353 $basename =~ s/$dir\/(.*)/$1/s; 354 if (!$test_mode) { 355 rename("$show", "$new_file"); 356 } else { 357 print("Test mode: rename would have done\n"); 358 print(" From: '$show'\n"); 359 print(" To: '$new_file'\n"); 360 } 361 362 334 363 ## add records to db 335 364 my $i = "insert into recorded (chanid, starttime, endtime, title, subtitle, description, hostname, basename, progstart, progend) values ((?), (?), (?), (?), (?), (?), (?), (?), (?), (?))"; 336 365 … … 349 378 350 379 } 351 380 352 ## rename file to proper format353 354 if ($starttime =~ m/$db_date_regx/) {355 ($syear, $smonth, $sday, $shour, $sminute, $ssecond) =356 ($1, $2, $3, $4, $5, $6);357 }358 381 359 if ($endtime =~ m/$db_date_regx/) {360 ($eyear, $emonth, $eday, $ehour, $eminute, $esecond) =361 ($1, $2, $3, $4, $5, $6);362 }363 364 my $new_file = "$dir/$channel"."_$syear$smonth$sday$shour$sminute$ssecond"."_$eyear$emonth$eday$ehour$eminute$esecond.nuv";365 if (!$test_mode) {366 rename("$show", "$new_file");367 } else {368 print("Test mode: rename would have done\n");369 print(" From: '$show'\n");370 print(" To: '$new_file'\n");371 }372 373 382 ## commercial flag 374 383 375 384 print("Building a seek table should improve FF/RW and JUMP functions when watching this video\n");
