[Slim-Checkins] r12823 - in /trunk/server: HTML/EN/xmlbrowser.html Slim/Plugin/OPMLBased.pm Slim/Web/XMLBrowser.pm
andy at svn.slimdevices.com
andy at svn.slimdevices.com
Fri Aug 31 12:48:20 PDT 2007
Author: andy
Date: Fri Aug 31 12:48:20 2007
New Revision: 12823
URL: http://svn.slimdevices.com?rev=12823&view=rev
Log:
Added type=search support to web XMLBrowser. Increased timeout for web OPML requests
Modified:
trunk/server/HTML/EN/xmlbrowser.html
trunk/server/Slim/Plugin/OPMLBased.pm
trunk/server/Slim/Web/XMLBrowser.pm
Modified: trunk/server/HTML/EN/xmlbrowser.html
URL: http://svn.slimdevices.com/trunk/server/HTML/EN/xmlbrowser.html?rev=12823&r1=12822&r2=12823&view=diff
==============================================================================
--- trunk/server/HTML/EN/xmlbrowser.html (original)
+++ trunk/server/HTML/EN/xmlbrowser.html Fri Aug 31 12:48:20 2007
@@ -197,20 +197,31 @@
[% PROCESS dummylink %]
[% END %]
[%- END %]
- [% IF useAJAX %]<span style="margin: 0px; padding: 0px; border: 0px;"
- onMouseOver="showElements(['controls[% index _ (start + loop.index) %]'], 'inline');"
- onMouseOut="hideElements(['controls[% index _ (start + loop.index) %]'])">
- [% END %]
- [%- WRAPPER contentitem leftcontrols = 'gencontrol' rightcontrols = 'favoritescontrol' %]
- [% IF item.type != 'text' %]
- <a href="index.html?[% searchquery %]index=[% index _ (start + loop.index) %]&player=[% player | uri %]">
+
+ [% IF item.type == 'search' %]
+ <form id="searchForm[% index _ (start + loop.index) %]" method="GET">
+ [% item.name || item.title %]
+ <input type="text" name="q" value=""/>
+ <input name="submit" type="submit" class="stdclick" value="[% "SEARCH" | string %]"><p>
+ <input type="hidden" value="[% player %]" name="player" />
+ <input type="hidden" value="[% index _ (start + loop.index) %]" name="index" />
+ </form>
+ [% ELSE %]
+ [% IF useAJAX %]<span style="margin: 0px; padding: 0px; border: 0px;"
+ onMouseOver="showElements(['controls[% index _ (start + loop.index) %]'], 'inline');"
+ onMouseOut="hideElements(['controls[% index _ (start + loop.index) %]'])">
[% END %]
- [% item.name || item.title %]
- [% IF item.type != 'text' %]
- </a>
- [% END %]
- [%- END %]
- [% IF useAJAX %]</span>[% END %]
+ [%- WRAPPER contentitem leftcontrols = 'gencontrol' rightcontrols = 'favoritescontrol' %]
+ [% IF item.type != 'text' %]
+ <a href="index.html?[% searchquery %]index=[% index _ (start + loop.index) %]&player=[% player | uri %]">
+ [% END %]
+ [% item.name || item.title %]
+ [% IF item.type != 'text' %]
+ </a>
+ [% END %]
+ [%- END %]
+ [% IF useAJAX %]</span>[% END %]
+ [%- END %]
[%- odd = (not odd) %]
[%- END %]
Modified: trunk/server/Slim/Plugin/OPMLBased.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/OPMLBased.pm?rev=12823&r1=12822&r2=12823&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/OPMLBased.pm (original)
+++ trunk/server/Slim/Plugin/OPMLBased.pm Fri Aug 31 12:48:20 2007
@@ -117,9 +117,10 @@
Slim::Web::HTTP::addPageFunction( $url, sub {
Slim::Web::XMLBrowser->handleWebIndex( {
- feed => $class->feed(),
- title => $title,
- args => \@_
+ feed => $class->feed(),
+ title => $title,
+ timeout => 35,
+ args => \@_
} );
} );
}
Modified: trunk/server/Slim/Web/XMLBrowser.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/XMLBrowser.pm?rev=12823&r1=12822&r2=12823&view=diff
==============================================================================
--- trunk/server/Slim/Web/XMLBrowser.pm (original)
+++ trunk/server/Slim/Web/XMLBrowser.pm Fri Aug 31 12:48:20 2007
@@ -30,6 +30,7 @@
my $title = $args->{'title'};
my $search = $args->{'search'};
my $expires = $args->{'expires'};
+ my $timeout = $args->{'timeout'};
my $asyncArgs = $args->{'args'};
my $item = $args->{'item'} || {};
@@ -89,6 +90,7 @@
'title' => $title,
'search' => $search,
'expires' => $expires,
+ 'timeout' => $timeout,
'args' => $asyncArgs,
},
);
@@ -134,7 +136,8 @@
my @crumbIndex = ();
# descend to the selected item
- my $depth = 0;
+ my $depth = 0;
+
my $subFeed = $feed;
for my $i ( @index ) {
$depth++;
@@ -142,11 +145,18 @@
$subFeed = $subFeed->{'items'}->[$i];
push @crumbIndex, $i;
+ my $crumbText = join '.', @crumbIndex;
+
+ # Add search query to crumb list
+ if ( $subFeed->{'type'} && $subFeed->{'type'} eq 'search' && $stash->{'q'} ) {
+ $crumbText .= '_' . $stash->{'q'};
+ }
+
push @crumb, {
'name' => $subFeed->{'name'} || $subFeed->{'title'},
- 'index' => join '.', @crumbIndex,
+ 'index' => $crumbText,
};
-
+
# Change type to audio if it's an action request and we have a play attribute
if ( $subFeed->{'play'} && $stash->{'action'} =~ /^(?:play|add)$/ ) {
$subFeed->{'type'} = 'audio';
@@ -167,6 +177,19 @@
$subFeed->{'type'} ||= '';
if ( $subFeed->{'type'} ne 'audio' && defined $subFeed->{'url'} && !$subFeed->{'fetched'}) {
+ my $searchQuery;
+ if ( $i =~ /\d+_(.+)/ ) {
+ $searchQuery = $1;
+ warn "*** searchQuery for $i = $searchQuery\n";
+ }
+
+ # Rewrite the URL if it was a search request
+ if ( $subFeed->{'type'} eq 'search' && ( $stash->{'q'} || $searchQuery ) ) {
+ my $search = $stash->{'q'} || $searchQuery;
+ $subFeed->{'url'} =~ s/{QUERY}/$search/g;
+ warn "*** Rewrote index $i search URL to " . $subFeed->{'url'} . "\n";
+ }
+
# Setup passthrough args
my $args = {
'item' => $subFeed,
@@ -174,6 +197,7 @@
'feedTitle' => $subFeed->{'name'} || $subFeed->{'title'},
'parser' => $subFeed->{'parser'},
'expires' => $params->{'expires'},
+ 'timeout' => $params->{'timeout'},
'parent' => $feed,
'parentURL' => $params->{'parentURL'} || $params->{'url'},
'currentIndex' => \@crumbIndex,
@@ -207,10 +231,17 @@
};
}
+ # Construct index param for each item in the list
+ my $itemIndex = join( '.', @index );
+ if ( $stash->{'q'} ) {
+ $itemIndex .= '_' . $stash->{'q'};
+ }
+ $itemIndex .= '.';
+
$stash->{'pagetitle'} = $subFeed->{'name'};
$stash->{'crumb'} = \@crumb;
$stash->{'items'} = $subFeed->{'items'};
- $stash->{'index'} = join( '.', @index ) . '.';
+ $stash->{'index'} = $itemIndex;
$stash->{'image'} = $subFeed->{'image'};
}
else {
More information about the checkins
mailing list