NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums General General Discussion v
« Previous 1 … 57 58 59 60 61 … 159 Next »
Calling all batch files pro's

 
  • 0 Vote(s) - 0 Average
Calling all batch files pro's
Elmo Putney
Offline

Senior Member

Posts: 615
Threads: 119
Joined: Feb 2008
#1
2008-11-20, 05:59 PM
For the main part I use Radio Times for my freeview XML guide data, but I also have a few French channels via DVB-S that come from some french tv guide web site.

The French website can be a bit flakey and sometimes produces an empty xml tv guide file. My update epg batch file grabs the data then copies the new data over the top of the old data.

so its something like:
Code:
"C:\epg\xmltv535\xmltv.exe" tv_grab_fr -slow --config-file C:\epg\sat.con --output C:\epg\sat0.xml
copy C:\epg\sat0.xml C:\epg\sat.xml

I want to stop the final copy if the filesize is less than say 20kb, because this means there is no guide data in the file and I end up with no EPG data and I'd rather have the previous days download in the guide than nothing at all.

So how do I do that in a batch file?
[SIZE="4"]Elmo Putney[/SIZE]
garymeds
Offline

Senior Member

Posts: 361
Threads: 82
Joined: Apr 2007
#2
2008-11-20, 06:34 PM
do a directory listing to a text file (dir > dir.txt), then use a for loop to scan through each line (using delims to seperate the variables) and check for your file name, the size.

if it helps, i'd install powershell and use that - it's brilliant at doing stuff like this and isn't hard to get to grips with.

check here for a quick 1 liner which arranges a directory by size so you're on the right track with get-childitem <dir> (get-help get-childitem gives details..)

http://www.microsoft.com/technet/scriptc...bject.mspx
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,583
Threads: 384
Joined: Dec 2004
#3
2008-11-20, 06:53 PM
I haven't tried this...

Code:
"C:\epg\xmltv535\xmltv.exe" tv_grab_fr -slow --config-file C:\epg\sat.con --output C:\epg\sat0.xml
for %%R in (C:\epg\sat0.xml) do if %%~zR lss 20000 goto :EOF
copy C:\epg\sat0.xml C:\epg\sat.xml
Actually I knicked it from a batch file posted by gEd here...

http://forums.nextpvr.com/showthread.php?t=25695

Cheers,
Brian
Elmo Putney
Offline

Senior Member

Posts: 615
Threads: 119
Joined: Feb 2008
#4
2008-11-20, 08:46 PM
Quote:do a directory listing to a text file (dir > dir.txt), then use a for loop to scan through each line (using delims to seperate the variables) and check for your file name, the size.

Good lord, this is worse than being at work writing MatLab m files..Smile

Quote:for %%R in (C:\epg\sat0.xml) do if %%~zR lss 20000 goto :EOF


Thats what I need when I get home, someone to think for me....now if you fancy coming over to cook my dinner....
[SIZE="4"]Elmo Putney[/SIZE]
Gedanken
Offline

Member

Posts: 70
Threads: 11
Joined: Nov 2005
#5
2008-11-21, 06:07 AM
Lots of useful macros in there.

From 'help for'

Quote:In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file
%~$PATH:I - searches the directories listed in the PATH
environment variable and expands %I to the
fully qualified name of the first one found.
If the environment variable name is not
defined or the file is not found by the
search, then this modifier expands to the
empty string
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with MCEBuddy moving files to nas bighick 1 1,755 2018-10-27, 10:33 AM
Last Post: p37307
  get working/batch/file dirs from one line[any dir of it's path too!] pBS 17 12,362 2013-11-05, 12:03 PM
Last Post: pBS
  Android application for watching TS files over Wifi ? XJW 1 4,708 2011-11-13, 02:41 AM
Last Post: XJW
  tool to combine movie files elbryyan 6 2,450 2011-02-17, 05:31 PM
Last Post: elbryyan
  Converting .ts files to DVD [OT] build 8 3,485 2010-09-03, 01:33 AM
Last Post: InVermont
  Can I create FLV/SWF files from dvr-ms recordings Graham 1 1,726 2010-03-08, 10:33 PM
Last Post: luttrell1962
  Batch file help imilne 2 1,606 2010-03-07, 07:12 PM
Last Post: speising
  Video editor for TS files TonyM 4 2,939 2009-12-10, 11:47 AM
Last Post: martint123
  Simple app to merge 2 avi files into one McBainUK 5 3,098 2009-10-20, 01:24 PM
Last Post: imagn
  Where to save data files? mvallevand 21 5,984 2009-09-17, 12:36 PM
Last Post: CornStopper

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode