root/trunk/install/perl/updatem2pfiletable.pl

リビジョン 94, 1.5 kB (コミッタ: sorshi, コミット時期: 14 年 前)

SQLite採用

  • svn:executable 属性の設定値:
Line 
1 #!/usr/bin/perl
2 #
3 # Anime recording system foltia
4 # http://www.dcc-jpl.com/soft/foltia/
5 #
6 # usage :updatem2pfiletable.pl
7 #
8 # m2pfileのリストをテーブルに入れる
9 # 全deleteして更新する
10 # おもにメンテナンス用
11 # または一日一回ぐらいcronで実行させてもいいかも
12 #
13 # DCC-JPL Japan/foltia project
14 #
15
16 use DBI;
17 use DBD::Pg;
18 use DBD::SQLite;
19
20 $path = $0;
21 $path =~ s/updatem2pfiletable.pl$//i;
22 if ($path ne "./"){
23 push( @INC, "$path");
24 }
25
26 require "foltialib.pl";
27 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;;
28
29 $dbh->{AutoCommit} = 0;
30 # ひとまず消す
31 $sth = $dbh->prepare($stmt{'updatem2pfiletable.1'});
32         $sth->execute();
33
34 while ($file = glob("$recfolderpath/*.m2?")) {
35 $file =~ s/$recfolderpath\///;
36     $sth = $dbh->prepare($stmt{'updatem2pfiletable.2'});
37     $sth->execute($file);
38 # print "$file\n";
39 }#while
40 $oserr = $dbh->commit;
41
42 # foltia_mp4files
43 @mp4filelist = `find ${recfolderpath}/ | grep MP4`;#by foltia dev ticket #5 http://www.dcc-jpl.com/foltia/ticket/5
44
45 # ひとまず消す
46 $sth = $dbh->prepare($stmt{'updatem2pfiletable.3'});
47         $sth->execute();
48
49
50 foreach (@mp4filelist) {
51 chomp();
52 s/$recfolderpath\///;
53 @fileline = split (/\//);
54 $filetid = $fileline[0];
55 $filetid =~ s/[^0-9]//g;
56 if (($filetid ne "" )&& ($fileline[2] ne "" )){
57         $sth = $dbh->prepare($stmt{'updatem2pfiletable.4'});
58         $oserr = $sth->execute($filetid, $fileline[2]);
59 #print "$filetid;$fileline[2];$query\n"
60 # http://www.atmarkit.co.jp/fnetwork/rensai/sql03/sql1.html
61 }#end if
62 }# end foreach
63 $oserr = $dbh->commit;
64
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed