xmltv/grab/sd_json tv_grab_sd_json,1.5,1.6

Kevin Groeneveld <[email protected]> Thu, 26 May 2016 23:32:29 +0000
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/sd_json
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3707

Modified Files:
	tv_grab_sd_json 
Log Message:
tv_grab_sd_json: remove File::HomeDir dependency (alternate implementation)
    
The get_default_cache_file sub is now used to get the default cache
file name. This function is based on similar get_default_cachedir sub
which is present in several of the other xmltv grabbers.


Index: tv_grab_sd_json
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/sd_json/tv_grab_sd_json,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** tv_grab_sd_json	22 May 2016 15:50:28 -0000	1.5
--- tv_grab_sd_json	26 May 2016 23:32:27 -0000	1.6
***************
*** 54,58 ****
  use XMLTV::Configure::Writer;
  use XMLTV::Ask;
! #use File::HomeDir qw(my_home);
  use Storable;
  use LWP::UserAgent;
--- 54,58 ----
  use XMLTV::Configure::Writer;
  use XMLTV::Ask;
! use Cwd;
  use Storable;
  use LWP::UserAgent;
***************
*** 168,171 ****
--- 168,181 ----
  my $cache_file = $conf->{'cache'}->[0];
  
+ sub get_default_cache_file {
+ 	my $winhome;
+ 	if(defined $ENV{HOMEDRIVE} && defined $ENV{HOMEPATH}) {
+ 		$winhome = $ENV{HOMEDRIVE} . $ENV{HOMEPATH};
+ 	}
+ 	my $home = $ENV{HOME} || $winhome || getcwd();
+ 
+ 	return "$home/.xmltv/$grabber_name.cache";
+ }
+ 
  sub retry {
  	my ($action) = @_;
***************
*** 346,357 ****
  
  	if($stage eq 'start') {
- 	    my $cache_file=XMLTV::Config_file::filename(undef, "$grabber_name.cache" , $quiet);
- 		   $cache_file=~ s/.conf$//;   
  		$w->write_string({
  			id => 'cache',
  			description => [ [ 'Cache file for lineups, schedules and programs.', 'en' ] ],
  			title => [ [ 'Cache file', 'en' ] ],
! #			default => my_home() . "/.xmltv/$grabber_name.cache",
! 			default => $cache_file,
  		});
  
--- 356,364 ----
  
  	if($stage eq 'start') {
  		$w->write_string({
  			id => 'cache',
  			description => [ [ 'Cache file for lineups, schedules and programs.', 'en' ] ],
  			title => [ [ 'Cache file', 'en' ] ],
! 			default => get_default_cache_file(),
  		});
  


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e