| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
header('Content-Type: application/rss+xml'); |
|---|
| 22 |
header('Content-Disposition: attachment; filename="folcast.xml"'); |
|---|
| 23 |
|
|---|
| 24 |
include("./foltialib.php"); |
|---|
| 25 |
$con = m_connect(); |
|---|
| 26 |
|
|---|
| 27 |
$now = date("YmdHi"); |
|---|
| 28 |
$nowrfc822 = date("r"); |
|---|
| 29 |
|
|---|
| 30 |
$max = getgetnumform(max); |
|---|
| 31 |
|
|---|
| 32 |
if ($max > 0 ){ |
|---|
| 33 |
|
|---|
| 34 |
}else{ |
|---|
| 35 |
$max = 45; |
|---|
| 36 |
} |
|---|
| 37 |
$tid = getgetnumform(tid); |
|---|
| 38 |
if (($tid >= 0 ) && ($tid != "")){ |
|---|
| 39 |
|
|---|
| 40 |
$query = " |
|---|
| 41 |
SELECT foltia_program.tid,foltia_program.title, |
|---|
| 42 |
foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" ~~ 'M%%' AND foltia_program.tid = foltia_subtitle.tid AND foltia_program.tid = $tid |
|---|
| 43 |
ORDER BY \"enddatetime\" DESC |
|---|
| 44 |
offset 0 limit $max |
|---|
| 45 |
"; |
|---|
| 46 |
|
|---|
| 47 |
$titlequery = " |
|---|
| 48 |
SELECT foltia_program.tid,foltia_program.title |
|---|
| 49 |
FROM foltia_program |
|---|
| 50 |
WHERE foltia_program.tid = $tid |
|---|
| 51 |
"; |
|---|
| 52 |
$titlers = m_query($con, $query, "DBクエリに失敗しました"); |
|---|
| 53 |
$rowdata = pg_fetch_row($titlers, 0); |
|---|
| 54 |
$rsstitle = $rowdata[1]; |
|---|
| 55 |
}else{ |
|---|
| 56 |
|
|---|
| 57 |
$query = " |
|---|
| 58 |
SELECT foltia_program.tid,foltia_program.title, |
|---|
| 59 |
foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" ~~ 'M%%' AND foltia_program.tid = foltia_subtitle.tid ORDER BY \"enddatetime\" DESC |
|---|
| 60 |
offset 0 limit $max |
|---|
| 61 |
"; |
|---|
| 62 |
$rsstitle = "新規録画"; |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
$header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> |
|---|
| 66 |
<rss xmlns:itunes=\"http://www.itunes.com/DTDs/Podcast-1.0.dtd\" version=\"2.0\"> |
|---|
| 67 |
<channel> |
|---|
| 68 |
<title>Folcast ($rsstitle)</title> |
|---|
| 69 |
<itunes:author>DCC-JPL Japan/foltia project</itunes:author> |
|---|
| 70 |
<link>http://www.dcc-jpl.com/soft/foltia/</link> |
|---|
| 71 |
<description>フォルティアが未読処理をお助けしちゃいます</description> |
|---|
| 72 |
<itunes:subtitle>foltia video podcast :Folcast ($rsstitle)</itunes:subtitle> |
|---|
| 73 |
<itunes:summary>フォルティアが未読処理をお助けしちゃいます</itunes:summary> |
|---|
| 74 |
<language>ja</language> |
|---|
| 75 |
<copyright>foltia</copyright> |
|---|
| 76 |
<itunes:owner> |
|---|
| 77 |
<itunes:name>Folcast ($rsstitle)</itunes:name> |
|---|
| 78 |
<itunes:email>foltia@dcc-jpl.com</itunes:email> |
|---|
| 79 |
</itunes:owner> |
|---|
| 80 |
<category>Technology</category> |
|---|
| 81 |
<itunes:category text=\"Technology\"></itunes:category> |
|---|
| 82 |
|
|---|
| 83 |
"; |
|---|
| 84 |
$header = mb_convert_encoding($header,"UTF-8", "EUC-JP"); |
|---|
| 85 |
print $header; |
|---|
| 86 |
|
|---|
| 87 |
$rs = m_query($con, $query, "DBクエリに失敗しました"); |
|---|
| 88 |
$maxrows = pg_num_rows($rs); |
|---|
| 89 |
|
|---|
| 90 |
if ($maxrows == 0) { |
|---|
| 91 |
|
|---|
| 92 |
}else{ |
|---|
| 93 |
|
|---|
| 94 |
for ($row = 0; $row < $maxrows; $row++) { |
|---|
| 95 |
$rowdata = pg_fetch_row($rs, $row); |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
$tid = $rowdata[0]; |
|---|
| 99 |
$title = $rowdata[1]; |
|---|
| 100 |
$title = htmlspecialchars($title); |
|---|
| 101 |
$countno = $rowdata[2]; |
|---|
| 102 |
if ($countno > 0 ){ |
|---|
| 103 |
$countprint = "第".$countno."回"; |
|---|
| 104 |
}else{ |
|---|
| 105 |
$countprint=""; |
|---|
| 106 |
} |
|---|
| 107 |
$subtitle = $rowdata[3]; |
|---|
| 108 |
$subtitle = htmlspecialchars($subtitle); |
|---|
| 109 |
$onairdate = $rowdata[4]; |
|---|
| 110 |
$day = substr($onairdate,0,4)."/".substr($onairdate,4,2)."/".substr($onairdate,6,2); |
|---|
| 111 |
$time = substr($onairdate,8,2).":".substr($onairdate,10,2); |
|---|
| 112 |
$onairdate = "$day $time"; |
|---|
| 113 |
|
|---|
| 114 |
$starttimerfc822 = foldate2rfc822($rowdata[4]); |
|---|
| 115 |
|
|---|
| 116 |
$mp4filename = $rowdata[5]; |
|---|
| 117 |
$mp4uri = "http://". getserverfqdn() .$httpmediamappath ."/$tid.localized/mp4/$mp4filename"; |
|---|
| 118 |
$mp4thmname = $rowdata[5]; |
|---|
| 119 |
$mp4thmname = ereg_replace(".MP4", ".THM", $mp4thmname); |
|---|
| 120 |
$mp4thmnameuri = "http://". getserverfqdn() . $httpmediamappath ."/$tid.localized/mp4/$mp4thmname"; |
|---|
| 121 |
|
|---|
| 122 |
if (file_exists("$recfolderpath/$tid.localized/mp4/$mp4filename")) { |
|---|
| 123 |
$mp4filestat = stat("$recfolderpath/$tid.localized/mp4/$mp4filename"); |
|---|
| 124 |
$mp4filesize = $mp4filestat[7]; |
|---|
| 125 |
} else { |
|---|
| 126 |
$mp4filesize = 0; |
|---|
| 127 |
} |
|---|
| 128 |
|
|---|
| 129 |
if ($rowdata[0] == 0 ){ |
|---|
| 130 |
$showntitle = "$title $subtitle"; |
|---|
| 131 |
}else{ |
|---|
| 132 |
$showntitle = "$title $countprint"; |
|---|
| 133 |
} |
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
$item =" <item> |
|---|
| 137 |
<title>$showntitle</title> |
|---|
| 138 |
<itunes:author>foltia</itunes:author> |
|---|
| 139 |
<description>$title $countprint $subtitle</description> |
|---|
| 140 |
<itunes:subtitle>$title $countprint $subtitle</itunes:subtitle> |
|---|
| 141 |
<itunes:summary>$title $countprint $subtitle</itunes:summary> |
|---|
| 142 |
<enclosure url=\"$mp4uri\" length=\"$mp4filesize\" type=\"video/mov\" /> |
|---|
| 143 |
<guid isPermaLink=\"true\">$mp4thmnameuri</guid> |
|---|
| 144 |
<pubDate>$starttimerfc822</pubDate> |
|---|
| 145 |
<itunes:explicit>no</itunes:explicit> |
|---|
| 146 |
<itunes:keywords>foltia,Folcast,DCC-JPL Japan,$title,$subtitle</itunes:keywords> |
|---|
| 147 |
<itunes:image href=\"$mp4thmnameuri\" /> |
|---|
| 148 |
</item> |
|---|
| 149 |
"; |
|---|
| 150 |
|
|---|
| 151 |
$item = mb_convert_encoding($item,"UTF-8", "EUC-JP"); |
|---|
| 152 |
print $item ; |
|---|
| 153 |
|
|---|
| 154 |
} |
|---|
| 155 |
|
|---|
| 156 |
} |
|---|
| 157 |
?> |
|---|
| 158 |
|
|---|
| 159 |
</channel> |
|---|
| 160 |
</rss> |
|---|
| 161 |
|
|---|