緑のボタンを押せ! Press the green button

緑のボタンを押せ! Press the green button

PR

×

Keyword Search

▼キーワード検索

Archives

2026.10
2026.09
2026.08
2026.07
2026.06

Comments

effelpist@ kilovermek.es effelpist &lt;a href=&quot; <small> <a href="http…
Jun@ Re:「いっちゅう」さんのiEPG用ソフト入れてみた(09/15) TVdeIEPG Ver.1.2.1.0がリンク切れしてい…
スター@ Re:hauppauge HD PVR 速報(08/25) スタービーチ <small> <a href="http://c…
ASOBO@ Re:hauppauge HD PVR 速報 ASOBO攻略 <small> <a href="http:/…
ハッピーメール@ Re:hauppauge HD PVR 速報 ハッピーメール <small> <a href="http:/…

Freepage List

Favorite Blog

まだ登録されていません
2009.05.09
XML
テーマ: 私のPC生活(7590)
カテゴリ: PVR
読んだあとのデータの処理についてですが、データベースの作り方にも関連しますが、開始時間順に取り出す必要があるのは、明らかです。開始時間でソートとかは必須でしょうね。iEPGDデータの中には開始・終了時間の情報は入っていますが、このままでは扱いにくいので、Rubyの標準の時間オブジェクトをキャッシュデータみたいな形で持つことにし、これを管理するために、::UptoDateメソッドを定義します。終了時間は年月日を含まず、開始時間より前の場合は次の日を意味するようなので、24時間プラスします。つまり、iEPG/iEPGDでは24時間を越える録画時間はサポートできないのですね。
ついでにソート用に<=>も定義しておきます。
class IEPG < Hash
  # keywords
  attr_reader :timeStart, :timeEnd
  # member method
  def initialize
    self.default = ""
    @timeStart = Time.now
    @timeEnd = Time.now
  end #def initialize
  def <=>( other )
    self.timeStart <=> other.timeStart
  end #def <=>( other )
  # ----------------------
  # gopher member functions
  # ----------------------
  # make @timeStart, @timeEnd upto-date
  def UptoDate
    timeNow = Time.now
    year = (self[ "year:" ] == "" ) ?  timeNow.year : self[ "year:" ].to_i
    month = (self[ "month:" ] == "" ) ?  timeNow.month : self[ "month:" ]
    day = (self[ "date:" ] == "" ) ?  timeNow.month : self[ "date:" ]
    _start = self["start:"].split(":")
    _end = self["end:"].split(":")
    @timeStart = Time.local( year, month, day, _start[0], _start[1] )
    @timeEnd = Time.local( year, month, day, _end[0], _end[1] )
    if @timeEnd <= @timeStart
        @timeEnd += 24*60*60
    end
  end #def UptoDate
  #
  # class methods
  #
end #class IEPG < Hash






お気に入りの記事を「いいね!」で応援しよう

Last updated  2009.05.09 12:42:35
コメント(0) | コメントを書く


【毎日開催】
15記事にいいね!で1ポイント
10秒滞在
いいね! -- / --
おめでとうございます!
ミッションを達成しました。
※「ポイントを獲得する」ボタンを押すと広告が表示されます。
x
X

© Rakuten Group, Inc.
X
Design a Mobile Site
スマートフォン版を閲覧 | PC版を閲覧
Share by: