Legend:
- Unmodified
- Added
- Removed
-
shepherd
r129 r130 3 3 # "Shepherd" 4 4 5 my $version = '0.2.2 2';5 my $version = '0.2.23'; 6 6 7 7 # A wrapper for various Aussie TV guide data grabbers … … 895 895 $seen_channels_with_data, $this_plugin->{programmes}, 896 896 int($this_plugin->{total_duration} / 3600), 897 (defined $this_plugin->{earliest_data_seen} ? (strftime "%a%d%b%H :%M", localtime($this_plugin->{earliest_data_seen})) : 'no'),898 (defined $this_plugin->{latest_data_seen} ? (strftime "%a%d%b%H :%M", localtime($this_plugin->{latest_data_seen})) : 'data');897 (defined $this_plugin->{earliest_data_seen} ? (strftime "%a%d%b%Hh", localtime($this_plugin->{earliest_data_seen})) : 'no'), 898 (defined $this_plugin->{latest_data_seen} ? (strftime "%a%d%b%Hh", localtime($this_plugin->{latest_data_seen})) : 'data'); 899 899 900 900 $plugin_data->{$plugin} = $this_plugin; … … 1402 1402 return unless (fetch_file($rfile, $newfile)); 1403 1403 1404 if ($progtype eq "grabber") { 1405 # Fetch grabber config file 1406 $rfile .= ".conf"; 1407 $config = fetch_file($rfile); 1408 return unless ($config); 1409 1404 # Fetch grabber config file 1405 $rfile .= ".conf"; 1406 $config = fetch_file($rfile); 1407 1408 if (!$config) { 1409 return if ($progtype eq "grabber"); # grabbers MUST have config files 1410 } else { 1410 1411 eval $config; 1411 1412 } … … 1922 1923 } 1923 1924 1925 sub pretty_print 1926 { 1927 my ($p, $len) = @_; 1928 my $spaces = ' ' x (79-$len); 1929 my $ret = ""; 1930 1931 while (length($p) > 0) { 1932 if (length($p) <= $len) { 1933 $ret .= $p; 1934 $p = ""; 1935 } else { 1936 # find a space to the left of cutoff 1937 my $len2 = $len; 1938 while ((substr($p,$len2,1) ne ' ') && ($len2 > 0)) { 1939 $len2--; 1940 } 1941 if ($len2 == 0) { 1942 # no space - just print it with cutoff 1943 $ret .= substr($p,0,$len); 1944 $p = substr($p,$len,(length($p)-$len)); 1945 } else { 1946 # print up to space 1947 $ret .= substr($p,0,$len2); 1948 $p = substr($p,($len2+1),(length($p)-$len2+1)); 1949 } 1950 # print whitespace 1951 $ret .= "\n".$spaces; 1952 } 1953 } 1954 return $ret; 1955 } 1956 1924 1957 sub status 1925 1958 { 1926 my %qual_table = ( 3 => "Best", 2 => "Good", 1 => "Unkn" );1927 1928 1959 print "\nThe following plugins are known:\n", 1929 " Type Name Description\n". 1930 " -------- ---------------- ------------------------------------------------------\n"; 1960 " Type Name Version Description\n". 1961 " -------- -------------- ------- ----------------------------------------------\n"; 1962 1931 1963 foreach (sort { $components->{$a}->{type} cmp $components->{$b}->{type} } keys %{$components}) { 1932 printf " %-8s %-1 6s %54s\n",1964 printf " %-8s %-15s%7s %46s\n", 1933 1965 substr($components->{$_}->{type},0,8), 1934 length($_) > 14 ? substr($_,0,14).".." : $_, 1966 length($_) > 15 ? substr($_,0,13).".." : $_, 1967 ($components->{$_}->{ver} ? substr($components->{$_}->{ver},0,7) : "unknown"), 1935 1968 (defined $components->{$_}->{config}->{desc} ? 1936 (length($components->{$_}->{config}->{desc}) > 52 ? 1937 substr($components->{$_}->{config}->{desc},0,52).".." : $components->{$_}->{config}->{desc}) : ""); 1969 pretty_print($components->{$_}->{config}->{desc},46) : ""); 1938 1970 } 1939 1971 printf "\n"; 1940 1972 1941 1973 print "Grabbers, listed in order of quality:\n". 1942 " Qual Grabber Version Enabled Ready Last Run Status\n" . 1943 " ---- ----------------- ------- ------- ----- ---------- ----------------------------\n"; 1974 " Enabled/\n". 1975 " Grabber Qual Ready Last Run Status\n" . 1976 " -------------- ---- ----- ---------- -----------------------------------------\n"; 1977 my %qual_table = ( 3 => "Best", 2 => "Good", 1 => "Avg" ); 1944 1978 foreach (sort { $components->{$b}->{config}->{quality} <=> $components->{$a}->{config}->{quality} } query_grabbers()) { 1945 1979 my $h = $components->{$_}; 1946 printf " %-4s %-16s %8s %4s %6s %11s %s\n", 1980 printf " %-15s%-4s %1s/%1s %11s %s\n", 1981 length($_) > 15 ? substr($_,0,13).".." : $_, 1947 1982 $qual_table{($h->{config}->{quality})}, 1948 length($_) > 14 ? substr($_,0,14).".." : $_, 1949 ($h->{ver} ? substr($h->{ver},0,8) : "unknown"), 1950 $h->{disabled} ? '' : 'Y', 1951 $h->{ready} ? 'Y' : '', 1983 $h->{disabled} ? 'N' : 'Y', 1984 $h->{ready} ? 'Y' : 'N', 1952 1985 $h->{lastdata} ? (strftime "%a%d%b%y", localtime($h->{lastdata})) : 'never', 1953 $h->{laststatus} ? $h->{laststatus}: '';1986 $h->{laststatus} ? pretty_print($h->{laststatus},41) : ''; 1954 1987 } 1955 1988 1956 1989 print "\n". 1957 " Reconciler Version Enabled Ready Last Run Status\n" . 1958 " ---------------- -------- ------- ----- ---------- ---------------------------\n"; 1990 " Enabled/\n". 1991 " Reconciler Ready Last Run Status\n" . 1992 " -------------- ----- ---------- ----------------------------------------------\n"; 1959 1993 foreach (sort { $components->{$a} <=> $components->{$b} } query_reconcilers()) { 1960 1994 my $h = $components->{$_}; 1961 printf " %-16s %8s %4s %6s %11s %s\n", 1962 length($_) > 14 ? substr($_,0,14).".." : $_,, 1963 ($h->{ver} ? $h->{ver} : "unknown"), 1964 $h->{disabled} ? '' : 'Y', 1965 $h->{ready} ? 'Y' : '', 1966 $h->{lastdata} ? (strftime "%a%d%b%y", localtime($h->{lastdata})) : 'never', 1967 $h->{laststatus} ? $h->{laststatus} : ''; 1995 printf " %-15s %1s/%1s %11s %s\n", 1996 length($_) > 15 ? substr($_,0,13).".." : $_, 1997 $h->{disabled} ? 'N' : 'Y', 1998 $h->{ready} ? 'Y' : 'N', 1999 $h->{lastdata} ? (strftime "%a%d%b%y", localtime($h->{lastdata})) : 'never', 2000 $h->{laststatus} ? pretty_print($h->{laststatus},46) : ''; 1968 2001 } 1969 2002 1970 2003 print "\n". 1971 " Postprocessor Version Enabled Ready Last Run Status\n" . 1972 " ---------------- -------- ------- ----- ---------- ---------------------------\n"; 2004 " Enabled/\n". 2005 " Postprocessor Ready Last Run Status\n" . 2006 " -------------- ----- ---------- ----------------------------------------------\n"; 1973 2007 foreach (sort { $components->{$a} <=> $components->{$b} } query_postprocessors()) { 1974 2008 my $h = $components->{$_}; 1975 printf " %-16s %8s %4s %6s %11s %s\n", 1976 length($_) > 14 ? substr($_,0,14).".." : $_, 1977 ($h->{ver} ? $h->{ver} : "unknown"), 1978 $h->{disabled} ? '' : 'Y', 1979 $h->{ready} ? 'Y' : '', 1980 $h->{lastdata} ? (strftime "%a%d%b%y", localtime($h->{lastdata})) : 'never', 1981 $h->{laststatus} ? $h->{laststatus} : ''; 2009 printf " %-15s %1s/%1s %11s %s\n", 2010 length($_) > 15 ? substr($_,0,13).".." : $_, 2011 $h->{disabled} ? 'N' : 'Y', 2012 $h->{ready} ? 'Y' : 'N', 2013 $h->{lastdata} ? (strftime "%a%d%b%y", localtime($h->{lastdata})) : 'never', 2014 $h->{laststatus} ? pretty_print($h->{laststatus},46) : ''; 1982 2015 } 1983 2016 printf "\nPreferred titles from grabber '%s'\n",$pref_title_source if ($pref_title_source);
