SSブログ

OSX で CCDirectory みたいな事がしたい (3) [Mac]

続いて、CyberLink for Perl への差分。
これで、iTunes のライブラリ/TV番組にファイルが入ってくれる事を期待してるが、
まだ podcast としてはライブラリ登録させてないので、どうなるか不明。

--- ../Documents/download/Net-UPnP-1.1.3/lib/Net/UPnP/AV/Content.pm     2005-12-09 02:56:32.000000000 +0900
+++ /Library/Perl/5.8.6/Net/UPnP/AV/Content.pm  2007-02-27 02:20:27.000000000 +0900
@@ -7,11 +7,13 @@
 use strict;
 use warnings;
 
-use vars qw($_ID $_TITLE $_DATE);
+use vars qw($_ID $_TITLE $_DATE $_DATETIME $_CHANNELNAME);
 
 $_ID = '_id';
 $_TITLE = '_title';
 $_DATE = '_date';
+$_DATETIME = '_datetime';
+$_CHANNELNAME = '_channelname';
 
 #------------------------------
 # new
@@ -23,6 +25,8 @@
                $Net::UPnP::AV::Content::_ID => '',
                $Net::UPnP::AV::Content::_TITLE => '',
                $Net::UPnP::AV::Content::_DATE => '',
+               $Net::UPnP::AV::Content::_DATETIME => '',
+               $Net::UPnP::AV::Content::_CHANNELNAME => '',
        };
        bless $this, $class;
 }
@@ -75,6 +79,30 @@
        $this->{$Net::UPnP::AV::Content::_DATE};
 }
 
+sub setchannelName() {
+        my($this) = shift;
+        if (@_) {
+                $this->{$Net::UPnP::AV::Content::_CHANNELNAME} = $_[0];
+        }
+}
+
+sub getchannelName() {
+        my($this) = shift;
+        $this->{$Net::UPnP::AV::Content::_CHANNELNAME};
+}
+
+sub setdateTime() {
+        my($this) = shift;
+        if (@_) {
+                $this->{$Net::UPnP::AV::Content::_DATETIME} = $_[0];
+        }
+}
+
+sub getdateTime() {
+        my($this) = shift;
+        $this->{$Net::UPnP::AV::Content::_DATETIME};
+}
+
 #------------------------------
 # is*
 #------------------------------
diff -wuBr --exclude='*~' ../Documents/download/Net-UPnP-1.1.3/lib/Net/UPnP/AV/MediaServer.pm /Library/Perl/5.8.6/Net/UPnP/AV/MediaServer.pm
--- ../Documents/download/Net-UPnP-1.1.3/lib/Net/UPnP/AV/MediaServer.pm 2005-12-09 02:56:32.000000000 +0900
+++ /Library/Perl/5.8.6/Net/UPnP/AV/MediaServer.pm      2007-02-27 03:01:38.000000000 +0900
@@ -149,16 +149,27 @@
                $content,
                $container,
                $item,
+           $total_matches,
+           $number_returned,
+           $start_index,
+           $request_count,
        );
 
        @content_list = ();
+       $total_matches = 0;
+    $number_returned = 0;
+                   $request_count =$args{RequestedCount};
+                   $start_index = $args{StartingIndex};
+
+do {
        $action_res = $this->browsedirectchildren(
                        ObjectID => $args{ObjectID},
                        Filter => $args{Filter},
-                       StartingIndex => $args{StartingIndex},
-                       RequestedCount => $args{RequestedCount},
+                       StartingIndex => $start_index,
+                       RequestedCount => $request_count,
                        SortCriteria => $args{SortCriteria}
                        );
+#print $action_res;
        if ($action_res->getstatuscode() != 200) {
                return @content_list;
        }
@@ -168,6 +179,10 @@
        }
        $result = $arg_list->{'Result'};
 
+                   $number_returned = $arg_list->{'NumberReturned'};
+                   $total_matches = $arg_list->{'TotalMatches'};
+#print $result;
+
        while ($result =~ m//sgi) {
                $content = $1;
                $container = Net::UPnP::AV::Container->new();
@@ -181,7 +196,7 @@
                        $container->setdate($1);
                }
                push (@content_list, $container);
-               #print "container(" . $container->getid() . ") = " . $container->gettitle() . "\n";
+               print "container(" . $container->getid() . ") = " . $container->gettitle() . "\n";
                #print $1;
        }
 
@@ -197,6 +212,12 @@
                if ($content =~ m/(.*)<\/dc:date>/si) {
                        $item->setdate($1);
                }
+               if ($content =~ m/(.*)<\/av:dateTime>/si) {
+                       $item->setdateTime($1);
+               }
+               if ($content =~ m/(.*)<\/upnp:channelName>/si) {
+                       $item->setchannelName($1);
+               }
                if ($content =~ m/]*>(.*?)<\/res>/si) {
                        $item->seturl(Net::UPnP::HTTP::xmldecode($1));
                }
@@ -207,8 +228,14 @@
                        $item->setcontenttype($1);
                }
                push (@content_list, $item);
+               #print $item;
        }
 
+$start_index += $number_returned;
+       if ($request_count > 0) {
+       $request_count -= $number_returned;
+    }
+} while ($start_index < $total_matches);
        @content_list;
 }
 
次は、いよいよビデオポッドキャストとして登録するとどうなるかにチャレンジ。
nice!(0)  コメント(0)  トラックバック(0) 
共通テーマ:パソコン・インターネット

nice! 0

コメント 0

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

トラックバック 0

OSX で CCDirectory みた..tbl2swf ブログトップ

この広告は前回の更新から一定期間経過したブログに表示されています。更新すると自動で解除されます。