From 934c9e23ba985f076fa01f4b45d593032f17d0cb Mon Sep 17 00:00:00 2001 From: Andrey Prygunkov Date: Thu, 21 May 2015 18:42:33 +0000 Subject: [PATCH] refactor: new directory "extension" to hold all extension script related modules --- Makefile.am | 19 +- Makefile.in | 201 +++++++++++------ daemon/extension/NzbScript.cpp | 125 +++++++++++ daemon/extension/NzbScript.h | 42 ++++ .../{postprocess => extension}/PostScript.cpp | 0 .../{postprocess => extension}/PostScript.h | 7 +- daemon/{queue => extension}/QueueScript.cpp | 82 +------ daemon/{queue => extension}/QueueScript.h | 13 +- daemon/extension/ScanScript.cpp | 211 ++++++++++++++++++ daemon/extension/ScanScript.h | 61 +++++ daemon/extension/SchedulerScript.cpp | 143 ++++++++++++ daemon/extension/SchedulerScript.h | 50 +++++ daemon/{main => extension}/ScriptConfig.cpp | 0 daemon/{main => extension}/ScriptConfig.h | 0 daemon/main/Scheduler.cpp | 117 +--------- daemon/queue/Scanner.cpp | 194 +--------------- nzbget.vcproj | 76 +++++-- 17 files changed, 833 insertions(+), 508 deletions(-) create mode 100644 daemon/extension/NzbScript.cpp create mode 100644 daemon/extension/NzbScript.h rename daemon/{postprocess => extension}/PostScript.cpp (100%) rename daemon/{postprocess => extension}/PostScript.h (90%) rename daemon/{queue => extension}/QueueScript.cpp (84%) rename daemon/{queue => extension}/QueueScript.h (79%) create mode 100644 daemon/extension/ScanScript.cpp create mode 100644 daemon/extension/ScanScript.h create mode 100644 daemon/extension/SchedulerScript.cpp create mode 100644 daemon/extension/SchedulerScript.h rename daemon/{main => extension}/ScriptConfig.cpp (100%) rename daemon/{main => extension}/ScriptConfig.h (100%) diff --git a/Makefile.am b/Makefile.am index 46904bf3..580a7425 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,6 +28,18 @@ nzbget_SOURCES = \ daemon/connect/TLS.h \ daemon/connect/WebDownloader.cpp \ daemon/connect/WebDownloader.h \ + daemon/extension/NzbScript.cpp \ + daemon/extension/NzbScript.h \ + daemon/extension/PostScript.cpp \ + daemon/extension/PostScript.h \ + daemon/extension/QueueScript.cpp \ + daemon/extension/QueueScript.h \ + daemon/extension/ScanScript.cpp \ + daemon/extension/ScanScript.h \ + daemon/extension/SchedulerScript.cpp \ + daemon/extension/SchedulerScript.h \ + daemon/extension/ScriptConfig.cpp \ + daemon/extension/ScriptConfig.h \ daemon/feed/FeedCoordinator.cpp \ daemon/feed/FeedCoordinator.h \ daemon/feed/FeedFile.cpp \ @@ -54,8 +66,6 @@ nzbget_SOURCES = \ daemon/main/Options.h \ daemon/main/Scheduler.cpp \ daemon/main/Scheduler.h \ - daemon/main/ScriptConfig.cpp \ - daemon/main/ScriptConfig.h \ daemon/main/StackTrace.cpp \ daemon/main/StackTrace.h \ daemon/nntp/ArticleDownloader.cpp \ @@ -80,8 +90,6 @@ nzbget_SOURCES = \ daemon/postprocess/ParParser.h \ daemon/postprocess/ParRenamer.cpp \ daemon/postprocess/ParRenamer.h \ - daemon/postprocess/PostScript.cpp \ - daemon/postprocess/PostScript.h \ daemon/postprocess/PrePostProcessor.cpp \ daemon/postprocess/PrePostProcessor.h \ daemon/postprocess/Unpack.cpp \ @@ -100,8 +108,6 @@ nzbget_SOURCES = \ daemon/queue/QueueCoordinator.h \ daemon/queue/QueueEditor.cpp \ daemon/queue/QueueEditor.h \ - daemon/queue/QueueScript.cpp \ - daemon/queue/QueueScript.h \ daemon/queue/Scanner.cpp \ daemon/queue/Scanner.h \ daemon/queue/UrlCoordinator.cpp \ @@ -177,6 +183,7 @@ endif AM_CPPFLAGS = \ -I$(srcdir)/daemon/connect \ + -I$(srcdir)/daemon/extension \ -I$(srcdir)/daemon/feed \ -I$(srcdir)/daemon/frontend \ -I$(srcdir)/daemon/main \ diff --git a/Makefile.in b/Makefile.in index 64d5edf0..dc8b3d33 100644 --- a/Makefile.in +++ b/Makefile.in @@ -129,11 +129,20 @@ PROGRAMS = $(bin_PROGRAMS) am__nzbget_SOURCES_DIST = daemon/connect/Connection.cpp \ daemon/connect/Connection.h daemon/connect/TLS.cpp \ daemon/connect/TLS.h daemon/connect/WebDownloader.cpp \ - daemon/connect/WebDownloader.h daemon/feed/FeedCoordinator.cpp \ - daemon/feed/FeedCoordinator.h daemon/feed/FeedFile.cpp \ - daemon/feed/FeedFile.h daemon/feed/FeedFilter.cpp \ - daemon/feed/FeedFilter.h daemon/feed/FeedInfo.cpp \ - daemon/feed/FeedInfo.h daemon/frontend/ColoredFrontend.cpp \ + daemon/connect/WebDownloader.h daemon/extension/NzbScript.cpp \ + daemon/extension/NzbScript.h daemon/extension/PostScript.cpp \ + daemon/extension/PostScript.h daemon/extension/QueueScript.cpp \ + daemon/extension/QueueScript.h daemon/extension/ScanScript.cpp \ + daemon/extension/ScanScript.h \ + daemon/extension/SchedulerScript.cpp \ + daemon/extension/SchedulerScript.h \ + daemon/extension/ScriptConfig.cpp \ + daemon/extension/ScriptConfig.h \ + daemon/feed/FeedCoordinator.cpp daemon/feed/FeedCoordinator.h \ + daemon/feed/FeedFile.cpp daemon/feed/FeedFile.h \ + daemon/feed/FeedFilter.cpp daemon/feed/FeedFilter.h \ + daemon/feed/FeedInfo.cpp daemon/feed/FeedInfo.h \ + daemon/frontend/ColoredFrontend.cpp \ daemon/frontend/ColoredFrontend.h daemon/frontend/Frontend.cpp \ daemon/frontend/Frontend.h \ daemon/frontend/LoggableFrontend.cpp \ @@ -145,8 +154,7 @@ am__nzbget_SOURCES_DIST = daemon/connect/Connection.cpp \ daemon/main/Maintenance.h daemon/main/nzbget.cpp \ daemon/main/nzbget.h daemon/main/Options.cpp \ daemon/main/Options.h daemon/main/Scheduler.cpp \ - daemon/main/Scheduler.h daemon/main/ScriptConfig.cpp \ - daemon/main/ScriptConfig.h daemon/main/StackTrace.cpp \ + daemon/main/Scheduler.h daemon/main/StackTrace.cpp \ daemon/main/StackTrace.h daemon/nntp/ArticleDownloader.cpp \ daemon/nntp/ArticleDownloader.h daemon/nntp/ArticleWriter.cpp \ daemon/nntp/ArticleWriter.h daemon/nntp/Decoder.cpp \ @@ -162,8 +170,6 @@ am__nzbget_SOURCES_DIST = daemon/connect/Connection.cpp \ daemon/postprocess/ParParser.h \ daemon/postprocess/ParRenamer.cpp \ daemon/postprocess/ParRenamer.h \ - daemon/postprocess/PostScript.cpp \ - daemon/postprocess/PostScript.h \ daemon/postprocess/PrePostProcessor.cpp \ daemon/postprocess/PrePostProcessor.h \ daemon/postprocess/Unpack.cpp daemon/postprocess/Unpack.h \ @@ -175,8 +181,7 @@ am__nzbget_SOURCES_DIST = daemon/connect/Connection.cpp \ daemon/queue/HistoryCoordinator.h daemon/queue/NZBFile.cpp \ daemon/queue/NZBFile.h daemon/queue/QueueCoordinator.cpp \ daemon/queue/QueueCoordinator.h daemon/queue/QueueEditor.cpp \ - daemon/queue/QueueEditor.h daemon/queue/QueueScript.cpp \ - daemon/queue/QueueScript.h daemon/queue/Scanner.cpp \ + daemon/queue/QueueEditor.h daemon/queue/Scanner.cpp \ daemon/queue/Scanner.h daemon/queue/UrlCoordinator.cpp \ daemon/queue/UrlCoordinator.h daemon/remote/BinRpc.cpp \ daemon/remote/BinRpc.h daemon/remote/MessageBase.h \ @@ -224,24 +229,25 @@ am__nzbget_SOURCES_DIST = daemon/connect/Connection.cpp \ @WITH_PAR2_TRUE@ verificationhashtable.$(OBJEXT) \ @WITH_PAR2_TRUE@ verificationpacket.$(OBJEXT) am_nzbget_OBJECTS = Connection.$(OBJEXT) TLS.$(OBJEXT) \ - WebDownloader.$(OBJEXT) FeedCoordinator.$(OBJEXT) \ + WebDownloader.$(OBJEXT) NzbScript.$(OBJEXT) \ + PostScript.$(OBJEXT) QueueScript.$(OBJEXT) \ + ScanScript.$(OBJEXT) SchedulerScript.$(OBJEXT) \ + ScriptConfig.$(OBJEXT) FeedCoordinator.$(OBJEXT) \ FeedFile.$(OBJEXT) FeedFilter.$(OBJEXT) FeedInfo.$(OBJEXT) \ ColoredFrontend.$(OBJEXT) Frontend.$(OBJEXT) \ LoggableFrontend.$(OBJEXT) NCursesFrontend.$(OBJEXT) \ CommandLineParser.$(OBJEXT) Maintenance.$(OBJEXT) \ nzbget.$(OBJEXT) Options.$(OBJEXT) Scheduler.$(OBJEXT) \ - ScriptConfig.$(OBJEXT) StackTrace.$(OBJEXT) \ - ArticleDownloader.$(OBJEXT) ArticleWriter.$(OBJEXT) \ - Decoder.$(OBJEXT) NewsServer.$(OBJEXT) \ + StackTrace.$(OBJEXT) ArticleDownloader.$(OBJEXT) \ + ArticleWriter.$(OBJEXT) Decoder.$(OBJEXT) NewsServer.$(OBJEXT) \ NNTPConnection.$(OBJEXT) ServerPool.$(OBJEXT) \ StatMeter.$(OBJEXT) ParChecker.$(OBJEXT) \ ParCoordinator.$(OBJEXT) ParParser.$(OBJEXT) \ - ParRenamer.$(OBJEXT) PostScript.$(OBJEXT) \ - PrePostProcessor.$(OBJEXT) Unpack.$(OBJEXT) \ - DiskState.$(OBJEXT) DownloadInfo.$(OBJEXT) \ + ParRenamer.$(OBJEXT) PrePostProcessor.$(OBJEXT) \ + Unpack.$(OBJEXT) DiskState.$(OBJEXT) DownloadInfo.$(OBJEXT) \ DupeCoordinator.$(OBJEXT) HistoryCoordinator.$(OBJEXT) \ NZBFile.$(OBJEXT) QueueCoordinator.$(OBJEXT) \ - QueueEditor.$(OBJEXT) QueueScript.$(OBJEXT) Scanner.$(OBJEXT) \ + QueueEditor.$(OBJEXT) Scanner.$(OBJEXT) \ UrlCoordinator.$(OBJEXT) BinRpc.$(OBJEXT) \ RemoteClient.$(OBJEXT) RemoteServer.$(OBJEXT) \ WebServer.$(OBJEXT) XmlRpc.$(OBJEXT) Log.$(OBJEXT) \ @@ -390,11 +396,20 @@ target_vendor = @target_vendor@ nzbget_SOURCES = daemon/connect/Connection.cpp \ daemon/connect/Connection.h daemon/connect/TLS.cpp \ daemon/connect/TLS.h daemon/connect/WebDownloader.cpp \ - daemon/connect/WebDownloader.h daemon/feed/FeedCoordinator.cpp \ - daemon/feed/FeedCoordinator.h daemon/feed/FeedFile.cpp \ - daemon/feed/FeedFile.h daemon/feed/FeedFilter.cpp \ - daemon/feed/FeedFilter.h daemon/feed/FeedInfo.cpp \ - daemon/feed/FeedInfo.h daemon/frontend/ColoredFrontend.cpp \ + daemon/connect/WebDownloader.h daemon/extension/NzbScript.cpp \ + daemon/extension/NzbScript.h daemon/extension/PostScript.cpp \ + daemon/extension/PostScript.h daemon/extension/QueueScript.cpp \ + daemon/extension/QueueScript.h daemon/extension/ScanScript.cpp \ + daemon/extension/ScanScript.h \ + daemon/extension/SchedulerScript.cpp \ + daemon/extension/SchedulerScript.h \ + daemon/extension/ScriptConfig.cpp \ + daemon/extension/ScriptConfig.h \ + daemon/feed/FeedCoordinator.cpp daemon/feed/FeedCoordinator.h \ + daemon/feed/FeedFile.cpp daemon/feed/FeedFile.h \ + daemon/feed/FeedFilter.cpp daemon/feed/FeedFilter.h \ + daemon/feed/FeedInfo.cpp daemon/feed/FeedInfo.h \ + daemon/frontend/ColoredFrontend.cpp \ daemon/frontend/ColoredFrontend.h daemon/frontend/Frontend.cpp \ daemon/frontend/Frontend.h \ daemon/frontend/LoggableFrontend.cpp \ @@ -406,8 +421,7 @@ nzbget_SOURCES = daemon/connect/Connection.cpp \ daemon/main/Maintenance.h daemon/main/nzbget.cpp \ daemon/main/nzbget.h daemon/main/Options.cpp \ daemon/main/Options.h daemon/main/Scheduler.cpp \ - daemon/main/Scheduler.h daemon/main/ScriptConfig.cpp \ - daemon/main/ScriptConfig.h daemon/main/StackTrace.cpp \ + daemon/main/Scheduler.h daemon/main/StackTrace.cpp \ daemon/main/StackTrace.h daemon/nntp/ArticleDownloader.cpp \ daemon/nntp/ArticleDownloader.h daemon/nntp/ArticleWriter.cpp \ daemon/nntp/ArticleWriter.h daemon/nntp/Decoder.cpp \ @@ -423,8 +437,6 @@ nzbget_SOURCES = daemon/connect/Connection.cpp \ daemon/postprocess/ParParser.h \ daemon/postprocess/ParRenamer.cpp \ daemon/postprocess/ParRenamer.h \ - daemon/postprocess/PostScript.cpp \ - daemon/postprocess/PostScript.h \ daemon/postprocess/PrePostProcessor.cpp \ daemon/postprocess/PrePostProcessor.h \ daemon/postprocess/Unpack.cpp daemon/postprocess/Unpack.h \ @@ -436,8 +448,7 @@ nzbget_SOURCES = daemon/connect/Connection.cpp \ daemon/queue/HistoryCoordinator.h daemon/queue/NZBFile.cpp \ daemon/queue/NZBFile.h daemon/queue/QueueCoordinator.cpp \ daemon/queue/QueueCoordinator.h daemon/queue/QueueEditor.cpp \ - daemon/queue/QueueEditor.h daemon/queue/QueueScript.cpp \ - daemon/queue/QueueScript.h daemon/queue/Scanner.cpp \ + daemon/queue/QueueEditor.h daemon/queue/Scanner.cpp \ daemon/queue/Scanner.h daemon/queue/UrlCoordinator.cpp \ daemon/queue/UrlCoordinator.h daemon/remote/BinRpc.cpp \ daemon/remote/BinRpc.h daemon/remote/MessageBase.h \ @@ -452,6 +463,7 @@ nzbget_SOURCES = daemon/connect/Connection.cpp \ svn_version.cpp $(am__append_1) AM_CPPFLAGS = \ -I$(srcdir)/daemon/connect \ + -I$(srcdir)/daemon/extension \ -I$(srcdir)/daemon/feed \ -I$(srcdir)/daemon/frontend \ -I$(srcdir)/daemon/main \ @@ -727,6 +739,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NNTPConnection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NZBFile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NewsServer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NzbScript.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Observer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ParChecker.Po@am__quote@ @@ -740,8 +753,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/QueueScript.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RemoteClient.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RemoteServer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScanScript.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Scanner.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Scheduler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SchedulerScript.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Script.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScriptConfig.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ServerPool.Po@am__quote@ @@ -834,6 +849,90 @@ WebDownloader.obj: daemon/connect/WebDownloader.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o WebDownloader.obj `if test -f 'daemon/connect/WebDownloader.cpp'; then $(CYGPATH_W) 'daemon/connect/WebDownloader.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/connect/WebDownloader.cpp'; fi` +NzbScript.o: daemon/extension/NzbScript.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT NzbScript.o -MD -MP -MF "$(DEPDIR)/NzbScript.Tpo" -c -o NzbScript.o `test -f 'daemon/extension/NzbScript.cpp' || echo '$(srcdir)/'`daemon/extension/NzbScript.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/NzbScript.Tpo" "$(DEPDIR)/NzbScript.Po"; else rm -f "$(DEPDIR)/NzbScript.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/NzbScript.cpp' object='NzbScript.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o NzbScript.o `test -f 'daemon/extension/NzbScript.cpp' || echo '$(srcdir)/'`daemon/extension/NzbScript.cpp + +NzbScript.obj: daemon/extension/NzbScript.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT NzbScript.obj -MD -MP -MF "$(DEPDIR)/NzbScript.Tpo" -c -o NzbScript.obj `if test -f 'daemon/extension/NzbScript.cpp'; then $(CYGPATH_W) 'daemon/extension/NzbScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/NzbScript.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/NzbScript.Tpo" "$(DEPDIR)/NzbScript.Po"; else rm -f "$(DEPDIR)/NzbScript.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/NzbScript.cpp' object='NzbScript.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o NzbScript.obj `if test -f 'daemon/extension/NzbScript.cpp'; then $(CYGPATH_W) 'daemon/extension/NzbScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/NzbScript.cpp'; fi` + +PostScript.o: daemon/extension/PostScript.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT PostScript.o -MD -MP -MF "$(DEPDIR)/PostScript.Tpo" -c -o PostScript.o `test -f 'daemon/extension/PostScript.cpp' || echo '$(srcdir)/'`daemon/extension/PostScript.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/PostScript.Tpo" "$(DEPDIR)/PostScript.Po"; else rm -f "$(DEPDIR)/PostScript.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/PostScript.cpp' object='PostScript.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o PostScript.o `test -f 'daemon/extension/PostScript.cpp' || echo '$(srcdir)/'`daemon/extension/PostScript.cpp + +PostScript.obj: daemon/extension/PostScript.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT PostScript.obj -MD -MP -MF "$(DEPDIR)/PostScript.Tpo" -c -o PostScript.obj `if test -f 'daemon/extension/PostScript.cpp'; then $(CYGPATH_W) 'daemon/extension/PostScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/PostScript.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/PostScript.Tpo" "$(DEPDIR)/PostScript.Po"; else rm -f "$(DEPDIR)/PostScript.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/PostScript.cpp' object='PostScript.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o PostScript.obj `if test -f 'daemon/extension/PostScript.cpp'; then $(CYGPATH_W) 'daemon/extension/PostScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/PostScript.cpp'; fi` + +QueueScript.o: daemon/extension/QueueScript.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT QueueScript.o -MD -MP -MF "$(DEPDIR)/QueueScript.Tpo" -c -o QueueScript.o `test -f 'daemon/extension/QueueScript.cpp' || echo '$(srcdir)/'`daemon/extension/QueueScript.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/QueueScript.Tpo" "$(DEPDIR)/QueueScript.Po"; else rm -f "$(DEPDIR)/QueueScript.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/QueueScript.cpp' object='QueueScript.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o QueueScript.o `test -f 'daemon/extension/QueueScript.cpp' || echo '$(srcdir)/'`daemon/extension/QueueScript.cpp + +QueueScript.obj: daemon/extension/QueueScript.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT QueueScript.obj -MD -MP -MF "$(DEPDIR)/QueueScript.Tpo" -c -o QueueScript.obj `if test -f 'daemon/extension/QueueScript.cpp'; then $(CYGPATH_W) 'daemon/extension/QueueScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/QueueScript.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/QueueScript.Tpo" "$(DEPDIR)/QueueScript.Po"; else rm -f "$(DEPDIR)/QueueScript.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/QueueScript.cpp' object='QueueScript.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o QueueScript.obj `if test -f 'daemon/extension/QueueScript.cpp'; then $(CYGPATH_W) 'daemon/extension/QueueScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/QueueScript.cpp'; fi` + +ScanScript.o: daemon/extension/ScanScript.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ScanScript.o -MD -MP -MF "$(DEPDIR)/ScanScript.Tpo" -c -o ScanScript.o `test -f 'daemon/extension/ScanScript.cpp' || echo '$(srcdir)/'`daemon/extension/ScanScript.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ScanScript.Tpo" "$(DEPDIR)/ScanScript.Po"; else rm -f "$(DEPDIR)/ScanScript.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/ScanScript.cpp' object='ScanScript.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ScanScript.o `test -f 'daemon/extension/ScanScript.cpp' || echo '$(srcdir)/'`daemon/extension/ScanScript.cpp + +ScanScript.obj: daemon/extension/ScanScript.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ScanScript.obj -MD -MP -MF "$(DEPDIR)/ScanScript.Tpo" -c -o ScanScript.obj `if test -f 'daemon/extension/ScanScript.cpp'; then $(CYGPATH_W) 'daemon/extension/ScanScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/ScanScript.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ScanScript.Tpo" "$(DEPDIR)/ScanScript.Po"; else rm -f "$(DEPDIR)/ScanScript.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/ScanScript.cpp' object='ScanScript.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ScanScript.obj `if test -f 'daemon/extension/ScanScript.cpp'; then $(CYGPATH_W) 'daemon/extension/ScanScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/ScanScript.cpp'; fi` + +SchedulerScript.o: daemon/extension/SchedulerScript.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SchedulerScript.o -MD -MP -MF "$(DEPDIR)/SchedulerScript.Tpo" -c -o SchedulerScript.o `test -f 'daemon/extension/SchedulerScript.cpp' || echo '$(srcdir)/'`daemon/extension/SchedulerScript.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/SchedulerScript.Tpo" "$(DEPDIR)/SchedulerScript.Po"; else rm -f "$(DEPDIR)/SchedulerScript.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/SchedulerScript.cpp' object='SchedulerScript.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SchedulerScript.o `test -f 'daemon/extension/SchedulerScript.cpp' || echo '$(srcdir)/'`daemon/extension/SchedulerScript.cpp + +SchedulerScript.obj: daemon/extension/SchedulerScript.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SchedulerScript.obj -MD -MP -MF "$(DEPDIR)/SchedulerScript.Tpo" -c -o SchedulerScript.obj `if test -f 'daemon/extension/SchedulerScript.cpp'; then $(CYGPATH_W) 'daemon/extension/SchedulerScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/SchedulerScript.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/SchedulerScript.Tpo" "$(DEPDIR)/SchedulerScript.Po"; else rm -f "$(DEPDIR)/SchedulerScript.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/SchedulerScript.cpp' object='SchedulerScript.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SchedulerScript.obj `if test -f 'daemon/extension/SchedulerScript.cpp'; then $(CYGPATH_W) 'daemon/extension/SchedulerScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/SchedulerScript.cpp'; fi` + +ScriptConfig.o: daemon/extension/ScriptConfig.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ScriptConfig.o -MD -MP -MF "$(DEPDIR)/ScriptConfig.Tpo" -c -o ScriptConfig.o `test -f 'daemon/extension/ScriptConfig.cpp' || echo '$(srcdir)/'`daemon/extension/ScriptConfig.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ScriptConfig.Tpo" "$(DEPDIR)/ScriptConfig.Po"; else rm -f "$(DEPDIR)/ScriptConfig.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/ScriptConfig.cpp' object='ScriptConfig.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ScriptConfig.o `test -f 'daemon/extension/ScriptConfig.cpp' || echo '$(srcdir)/'`daemon/extension/ScriptConfig.cpp + +ScriptConfig.obj: daemon/extension/ScriptConfig.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ScriptConfig.obj -MD -MP -MF "$(DEPDIR)/ScriptConfig.Tpo" -c -o ScriptConfig.obj `if test -f 'daemon/extension/ScriptConfig.cpp'; then $(CYGPATH_W) 'daemon/extension/ScriptConfig.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/ScriptConfig.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ScriptConfig.Tpo" "$(DEPDIR)/ScriptConfig.Po"; else rm -f "$(DEPDIR)/ScriptConfig.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/extension/ScriptConfig.cpp' object='ScriptConfig.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ScriptConfig.obj `if test -f 'daemon/extension/ScriptConfig.cpp'; then $(CYGPATH_W) 'daemon/extension/ScriptConfig.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/extension/ScriptConfig.cpp'; fi` + FeedCoordinator.o: daemon/feed/FeedCoordinator.cpp @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT FeedCoordinator.o -MD -MP -MF "$(DEPDIR)/FeedCoordinator.Tpo" -c -o FeedCoordinator.o `test -f 'daemon/feed/FeedCoordinator.cpp' || echo '$(srcdir)/'`daemon/feed/FeedCoordinator.cpp; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/FeedCoordinator.Tpo" "$(DEPDIR)/FeedCoordinator.Po"; else rm -f "$(DEPDIR)/FeedCoordinator.Tpo"; exit 1; fi @@ -1016,20 +1115,6 @@ Scheduler.obj: daemon/main/Scheduler.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Scheduler.obj `if test -f 'daemon/main/Scheduler.cpp'; then $(CYGPATH_W) 'daemon/main/Scheduler.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/main/Scheduler.cpp'; fi` -ScriptConfig.o: daemon/main/ScriptConfig.cpp -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ScriptConfig.o -MD -MP -MF "$(DEPDIR)/ScriptConfig.Tpo" -c -o ScriptConfig.o `test -f 'daemon/main/ScriptConfig.cpp' || echo '$(srcdir)/'`daemon/main/ScriptConfig.cpp; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ScriptConfig.Tpo" "$(DEPDIR)/ScriptConfig.Po"; else rm -f "$(DEPDIR)/ScriptConfig.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/main/ScriptConfig.cpp' object='ScriptConfig.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ScriptConfig.o `test -f 'daemon/main/ScriptConfig.cpp' || echo '$(srcdir)/'`daemon/main/ScriptConfig.cpp - -ScriptConfig.obj: daemon/main/ScriptConfig.cpp -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ScriptConfig.obj -MD -MP -MF "$(DEPDIR)/ScriptConfig.Tpo" -c -o ScriptConfig.obj `if test -f 'daemon/main/ScriptConfig.cpp'; then $(CYGPATH_W) 'daemon/main/ScriptConfig.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/main/ScriptConfig.cpp'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ScriptConfig.Tpo" "$(DEPDIR)/ScriptConfig.Po"; else rm -f "$(DEPDIR)/ScriptConfig.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/main/ScriptConfig.cpp' object='ScriptConfig.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ScriptConfig.obj `if test -f 'daemon/main/ScriptConfig.cpp'; then $(CYGPATH_W) 'daemon/main/ScriptConfig.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/main/ScriptConfig.cpp'; fi` - StackTrace.o: daemon/main/StackTrace.cpp @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT StackTrace.o -MD -MP -MF "$(DEPDIR)/StackTrace.Tpo" -c -o StackTrace.o `test -f 'daemon/main/StackTrace.cpp' || echo '$(srcdir)/'`daemon/main/StackTrace.cpp; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/StackTrace.Tpo" "$(DEPDIR)/StackTrace.Po"; else rm -f "$(DEPDIR)/StackTrace.Tpo"; exit 1; fi @@ -1198,20 +1283,6 @@ ParRenamer.obj: daemon/postprocess/ParRenamer.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ParRenamer.obj `if test -f 'daemon/postprocess/ParRenamer.cpp'; then $(CYGPATH_W) 'daemon/postprocess/ParRenamer.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/postprocess/ParRenamer.cpp'; fi` -PostScript.o: daemon/postprocess/PostScript.cpp -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT PostScript.o -MD -MP -MF "$(DEPDIR)/PostScript.Tpo" -c -o PostScript.o `test -f 'daemon/postprocess/PostScript.cpp' || echo '$(srcdir)/'`daemon/postprocess/PostScript.cpp; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/PostScript.Tpo" "$(DEPDIR)/PostScript.Po"; else rm -f "$(DEPDIR)/PostScript.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/postprocess/PostScript.cpp' object='PostScript.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o PostScript.o `test -f 'daemon/postprocess/PostScript.cpp' || echo '$(srcdir)/'`daemon/postprocess/PostScript.cpp - -PostScript.obj: daemon/postprocess/PostScript.cpp -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT PostScript.obj -MD -MP -MF "$(DEPDIR)/PostScript.Tpo" -c -o PostScript.obj `if test -f 'daemon/postprocess/PostScript.cpp'; then $(CYGPATH_W) 'daemon/postprocess/PostScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/postprocess/PostScript.cpp'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/PostScript.Tpo" "$(DEPDIR)/PostScript.Po"; else rm -f "$(DEPDIR)/PostScript.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/postprocess/PostScript.cpp' object='PostScript.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o PostScript.obj `if test -f 'daemon/postprocess/PostScript.cpp'; then $(CYGPATH_W) 'daemon/postprocess/PostScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/postprocess/PostScript.cpp'; fi` - PrePostProcessor.o: daemon/postprocess/PrePostProcessor.cpp @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT PrePostProcessor.o -MD -MP -MF "$(DEPDIR)/PrePostProcessor.Tpo" -c -o PrePostProcessor.o `test -f 'daemon/postprocess/PrePostProcessor.cpp' || echo '$(srcdir)/'`daemon/postprocess/PrePostProcessor.cpp; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/PrePostProcessor.Tpo" "$(DEPDIR)/PrePostProcessor.Po"; else rm -f "$(DEPDIR)/PrePostProcessor.Tpo"; exit 1; fi @@ -1338,20 +1409,6 @@ QueueEditor.obj: daemon/queue/QueueEditor.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o QueueEditor.obj `if test -f 'daemon/queue/QueueEditor.cpp'; then $(CYGPATH_W) 'daemon/queue/QueueEditor.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/queue/QueueEditor.cpp'; fi` -QueueScript.o: daemon/queue/QueueScript.cpp -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT QueueScript.o -MD -MP -MF "$(DEPDIR)/QueueScript.Tpo" -c -o QueueScript.o `test -f 'daemon/queue/QueueScript.cpp' || echo '$(srcdir)/'`daemon/queue/QueueScript.cpp; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/QueueScript.Tpo" "$(DEPDIR)/QueueScript.Po"; else rm -f "$(DEPDIR)/QueueScript.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/queue/QueueScript.cpp' object='QueueScript.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o QueueScript.o `test -f 'daemon/queue/QueueScript.cpp' || echo '$(srcdir)/'`daemon/queue/QueueScript.cpp - -QueueScript.obj: daemon/queue/QueueScript.cpp -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT QueueScript.obj -MD -MP -MF "$(DEPDIR)/QueueScript.Tpo" -c -o QueueScript.obj `if test -f 'daemon/queue/QueueScript.cpp'; then $(CYGPATH_W) 'daemon/queue/QueueScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/queue/QueueScript.cpp'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/QueueScript.Tpo" "$(DEPDIR)/QueueScript.Po"; else rm -f "$(DEPDIR)/QueueScript.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='daemon/queue/QueueScript.cpp' object='QueueScript.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o QueueScript.obj `if test -f 'daemon/queue/QueueScript.cpp'; then $(CYGPATH_W) 'daemon/queue/QueueScript.cpp'; else $(CYGPATH_W) '$(srcdir)/daemon/queue/QueueScript.cpp'; fi` - Scanner.o: daemon/queue/Scanner.cpp @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Scanner.o -MD -MP -MF "$(DEPDIR)/Scanner.Tpo" -c -o Scanner.o `test -f 'daemon/queue/Scanner.cpp' || echo '$(srcdir)/'`daemon/queue/Scanner.cpp; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/Scanner.Tpo" "$(DEPDIR)/Scanner.Po"; else rm -f "$(DEPDIR)/Scanner.Tpo"; exit 1; fi diff --git a/daemon/extension/NzbScript.cpp b/daemon/extension/NzbScript.cpp new file mode 100644 index 00000000..e2febfed --- /dev/null +++ b/daemon/extension/NzbScript.cpp @@ -0,0 +1,125 @@ +/* + * This file is part of nzbget + * + * Copyright (C) 2007-2015 Andrey Prygunkov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Revision$ + * $Date$ + * + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef WIN32 +#include "win32.h" +#endif + +#include +#include +#include +#ifndef WIN32 +#include +#endif +#include +#include +#include + +#include "nzbget.h" +#include "NzbScript.h" +#include "Options.h" +#include "Log.h" +#include "Util.h" + + +/** + * If szStripPrefix is not NULL, only pp-parameters, whose names start with the prefix + * are processed. The prefix is then stripped from the names. + * If szStripPrefix is NULL, all pp-parameters are processed; without stripping. + */ +void NZBScriptController::PrepareEnvParameters(NZBParameterList* pParameters, const char* szStripPrefix) +{ + int iPrefixLen = szStripPrefix ? strlen(szStripPrefix) : 0; + + for (NZBParameterList::iterator it = pParameters->begin(); it != pParameters->end(); it++) + { + NZBParameter* pParameter = *it; + const char* szValue = pParameter->GetValue(); + +#ifdef WIN32 + char* szAnsiValue = strdup(szValue); + WebUtil::Utf8ToAnsi(szAnsiValue, strlen(szAnsiValue) + 1); + szValue = szAnsiValue; +#endif + + if (szStripPrefix && !strncmp(pParameter->GetName(), szStripPrefix, iPrefixLen) && (int)strlen(pParameter->GetName()) > iPrefixLen) + { + SetEnvVarSpecial("NZBPR", pParameter->GetName() + iPrefixLen, szValue); + } + else if (!szStripPrefix) + { + SetEnvVarSpecial("NZBPR", pParameter->GetName(), szValue); + } + +#ifdef WIN32 + free(szAnsiValue); +#endif + } +} + +void NZBScriptController::PrepareEnvScript(NZBParameterList* pParameters, const char* szScriptName) +{ + if (pParameters) + { + PrepareEnvParameters(pParameters, NULL); + } + + char szParamPrefix[1024]; + snprintf(szParamPrefix, 1024, "%s:", szScriptName); + szParamPrefix[1024-1] = '\0'; + + if (pParameters) + { + PrepareEnvParameters(pParameters, szParamPrefix); + } + + PrepareEnvOptions(szParamPrefix); +} + +void NZBScriptController::ExecuteScriptList(const char* szScriptList) +{ + for (ScriptConfig::Scripts::iterator it = g_pScriptConfig->GetScripts()->begin(); it != g_pScriptConfig->GetScripts()->end(); it++) + { + ScriptConfig::Script* pScript = *it; + + if (szScriptList && *szScriptList) + { + // split szScriptList into tokens + Tokenizer tok(szScriptList, ",;"); + while (const char* szScriptName = tok.Next()) + { + if (Util::SameFilename(szScriptName, pScript->GetName())) + { + ExecuteScript(pScript); + break; + } + } + } + } +} diff --git a/daemon/extension/NzbScript.h b/daemon/extension/NzbScript.h new file mode 100644 index 00000000..d2a5757c --- /dev/null +++ b/daemon/extension/NzbScript.h @@ -0,0 +1,42 @@ +/* + * This file is part of nzbget + * + * Copyright (C) 2007-2015 Andrey Prygunkov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Revision$ + * $Date$ + * + */ + + +#ifndef NZBSCRIPT_H +#define NZBSCRIPT_H + +#include "Script.h" +#include "DownloadInfo.h" +#include "ScriptConfig.h" + +class NZBScriptController : public ScriptController +{ +protected: + void PrepareEnvParameters(NZBParameterList* pParameters, const char* szStripPrefix); + void PrepareEnvScript(NZBParameterList* pParameters, const char* szScriptName); + void ExecuteScriptList(const char* szScriptList); + virtual void ExecuteScript(ScriptConfig::Script* pScript) = 0; +}; + +#endif diff --git a/daemon/postprocess/PostScript.cpp b/daemon/extension/PostScript.cpp similarity index 100% rename from daemon/postprocess/PostScript.cpp rename to daemon/extension/PostScript.cpp diff --git a/daemon/postprocess/PostScript.h b/daemon/extension/PostScript.h similarity index 90% rename from daemon/postprocess/PostScript.h rename to daemon/extension/PostScript.h index dcd9d7e7..3a1f6db0 100644 --- a/daemon/postprocess/PostScript.h +++ b/daemon/extension/PostScript.h @@ -1,7 +1,7 @@ /* * This file is part of nzbget * - * Copyright (C) 2007-2014 Andrey Prygunkov + * Copyright (C) 2007-2015 Andrey Prygunkov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,10 +27,7 @@ #define POSTSCRIPT_H #include "Thread.h" -#include "Log.h" -#include "QueueScript.h" -#include "DownloadInfo.h" -#include "Options.h" +#include "NzbScript.h" class PostScriptController : public Thread, public NZBScriptController { diff --git a/daemon/queue/QueueScript.cpp b/daemon/extension/QueueScript.cpp similarity index 84% rename from daemon/queue/QueueScript.cpp rename to daemon/extension/QueueScript.cpp index 4754797a..1c94d502 100644 --- a/daemon/queue/QueueScript.cpp +++ b/daemon/extension/QueueScript.cpp @@ -1,7 +1,7 @@ /* * This file is part of nzbget * - * Copyright (C) 2007-2014 Andrey Prygunkov + * Copyright (C) 2007-2015 Andrey Prygunkov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,14 +39,13 @@ #endif #include #include -#include #include "nzbget.h" #include "QueueScript.h" +#include "NzbScript.h" #include "Options.h" #include "Log.h" #include "Util.h" -#include "ScriptConfig.h" extern Options* g_pOptions; extern QueueScriptCoordinator* g_pQueueScriptCoordinator; @@ -82,83 +81,6 @@ public: }; -/** - * If szStripPrefix is not NULL, only pp-parameters, whose names start with the prefix - * are processed. The prefix is then stripped from the names. - * If szStripPrefix is NULL, all pp-parameters are processed; without stripping. - */ -void NZBScriptController::PrepareEnvParameters(NZBParameterList* pParameters, const char* szStripPrefix) -{ - int iPrefixLen = szStripPrefix ? strlen(szStripPrefix) : 0; - - for (NZBParameterList::iterator it = pParameters->begin(); it != pParameters->end(); it++) - { - NZBParameter* pParameter = *it; - const char* szValue = pParameter->GetValue(); - -#ifdef WIN32 - char* szAnsiValue = strdup(szValue); - WebUtil::Utf8ToAnsi(szAnsiValue, strlen(szAnsiValue) + 1); - szValue = szAnsiValue; -#endif - - if (szStripPrefix && !strncmp(pParameter->GetName(), szStripPrefix, iPrefixLen) && (int)strlen(pParameter->GetName()) > iPrefixLen) - { - SetEnvVarSpecial("NZBPR", pParameter->GetName() + iPrefixLen, szValue); - } - else if (!szStripPrefix) - { - SetEnvVarSpecial("NZBPR", pParameter->GetName(), szValue); - } - -#ifdef WIN32 - free(szAnsiValue); -#endif - } -} - -void NZBScriptController::PrepareEnvScript(NZBParameterList* pParameters, const char* szScriptName) -{ - if (pParameters) - { - PrepareEnvParameters(pParameters, NULL); - } - - char szParamPrefix[1024]; - snprintf(szParamPrefix, 1024, "%s:", szScriptName); - szParamPrefix[1024-1] = '\0'; - - if (pParameters) - { - PrepareEnvParameters(pParameters, szParamPrefix); - } - - PrepareEnvOptions(szParamPrefix); -} - -void NZBScriptController::ExecuteScriptList(const char* szScriptList) -{ - for (ScriptConfig::Scripts::iterator it = g_pScriptConfig->GetScripts()->begin(); it != g_pScriptConfig->GetScripts()->end(); it++) - { - ScriptConfig::Script* pScript = *it; - - if (szScriptList && *szScriptList) - { - // split szScriptList into tokens - Tokenizer tok(szScriptList, ",;"); - while (const char* szScriptName = tok.Next()) - { - if (Util::SameFilename(szScriptName, pScript->GetName())) - { - ExecuteScript(pScript); - break; - } - } - } - } -} - - QueueScriptController::~QueueScriptController() { free(m_szNZBName); diff --git a/daemon/queue/QueueScript.h b/daemon/extension/QueueScript.h similarity index 79% rename from daemon/queue/QueueScript.h rename to daemon/extension/QueueScript.h index ebea7b5d..356e6dae 100644 --- a/daemon/queue/QueueScript.h +++ b/daemon/extension/QueueScript.h @@ -1,7 +1,7 @@ /* * This file is part of nzbget * - * Copyright (C) 2007-2014 Andrey Prygunkov + * Copyright (C) 2007-2015 Andrey Prygunkov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,20 +28,9 @@ #include -#include "Script.h" -#include "Thread.h" #include "DownloadInfo.h" #include "ScriptConfig.h" -class NZBScriptController : public ScriptController -{ -protected: - void PrepareEnvParameters(NZBParameterList* pParameters, const char* szStripPrefix); - void PrepareEnvScript(NZBParameterList* pParameters, const char* szScriptName); - void ExecuteScriptList(const char* szScriptList); - virtual void ExecuteScript(ScriptConfig::Script* pScript) = 0; -}; - class QueueScriptCoordinator { public: diff --git a/daemon/extension/ScanScript.cpp b/daemon/extension/ScanScript.cpp new file mode 100644 index 00000000..79265cec --- /dev/null +++ b/daemon/extension/ScanScript.cpp @@ -0,0 +1,211 @@ +/* + * This file is part of nzbget + * + * Copyright (C) 2007-2015 Andrey Prygunkov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Revision$ + * $Date$ + * + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef WIN32 +#include "win32.h" +#endif + +#include +#include +#include +#ifndef WIN32 +#include +#endif +#include +#include + +#include "nzbget.h" +#include "ScanScript.h" +#include "Scanner.h" +#include "Options.h" +#include "Log.h" +#include "Util.h" + + +extern Scanner* g_pScanner; + + +void ScanScriptController::ExecuteScripts(const char* szNZBFilename, + const char* szUrl, const char* szDirectory, char** pNZBName, char** pCategory, + int* iPriority, NZBParameterList* pParameters, bool* bAddTop, bool* bAddPaused, + char** pDupeKey, int* iDupeScore, EDupeMode* eDupeMode) +{ + ScanScriptController* pScriptController = new ScanScriptController(); + + pScriptController->m_szNZBFilename = szNZBFilename; + pScriptController->m_szUrl = szUrl; + pScriptController->m_szDirectory = szDirectory; + pScriptController->m_pNZBName = pNZBName; + pScriptController->m_pCategory = pCategory; + pScriptController->m_pParameters = pParameters; + pScriptController->m_iPriority = iPriority; + pScriptController->m_bAddTop = bAddTop; + pScriptController->m_bAddPaused = bAddPaused; + pScriptController->m_pDupeKey = pDupeKey; + pScriptController->m_iDupeScore = iDupeScore; + pScriptController->m_eDupeMode = eDupeMode; + pScriptController->m_iPrefixLen = 0; + + pScriptController->ExecuteScriptList(g_pOptions->GetScanScript()); + + delete pScriptController; +} + +void ScanScriptController::ExecuteScript(ScriptConfig::Script* pScript) +{ + if (!pScript->GetScanScript() || !Util::FileExists(m_szNZBFilename)) + { + return; + } + + PrintMessage(Message::mkInfo, "Executing scan-script %s for %s", pScript->GetName(), Util::BaseFileName(m_szNZBFilename)); + + SetScript(pScript->GetLocation()); + SetArgs(NULL, false); + + char szInfoName[1024]; + snprintf(szInfoName, 1024, "scan-script %s for %s", pScript->GetName(), Util::BaseFileName(m_szNZBFilename)); + szInfoName[1024-1] = '\0'; + SetInfoName(szInfoName); + + SetLogPrefix(pScript->GetDisplayName()); + m_iPrefixLen = strlen(pScript->GetDisplayName()) + 2; // 2 = strlen(": "); + PrepareParams(pScript->GetName()); + + Execute(); + + SetLogPrefix(NULL); +} + +void ScanScriptController::PrepareParams(const char* szScriptName) +{ + ResetEnv(); + + SetEnvVar("NZBNP_FILENAME", m_szNZBFilename); + SetEnvVar("NZBNP_URL", m_szUrl); + SetEnvVar("NZBNP_NZBNAME", strlen(*m_pNZBName) > 0 ? *m_pNZBName : Util::BaseFileName(m_szNZBFilename)); + SetEnvVar("NZBNP_CATEGORY", *m_pCategory); + SetIntEnvVar("NZBNP_PRIORITY", *m_iPriority); + SetIntEnvVar("NZBNP_TOP", *m_bAddTop ? 1 : 0); + SetIntEnvVar("NZBNP_PAUSED", *m_bAddPaused ? 1 : 0); + SetEnvVar("NZBNP_DUPEKEY", *m_pDupeKey); + SetIntEnvVar("NZBNP_DUPESCORE", *m_iDupeScore); + + const char* szDupeModeName[] = { "SCORE", "ALL", "FORCE" }; + SetEnvVar("NZBNP_DUPEMODE", szDupeModeName[*m_eDupeMode]); + + // remove trailing slash + char szDir[1024]; + strncpy(szDir, m_szDirectory, 1024); + szDir[1024-1] = '\0'; + int iLen = strlen(szDir); + if (szDir[iLen-1] == PATH_SEPARATOR) + { + szDir[iLen-1] = '\0'; + } + SetEnvVar("NZBNP_DIRECTORY", szDir); + + PrepareEnvScript(m_pParameters, szScriptName); +} + +void ScanScriptController::AddMessage(Message::EKind eKind, const char* szText) +{ + const char* szMsgText = szText + m_iPrefixLen; + + if (!strncmp(szMsgText, "[NZB] ", 6)) + { + debug("Command %s detected", szMsgText + 6); + if (!strncmp(szMsgText + 6, "NZBNAME=", 8)) + { + free(*m_pNZBName); + *m_pNZBName = strdup(szMsgText + 6 + 8); + } + else if (!strncmp(szMsgText + 6, "CATEGORY=", 9)) + { + free(*m_pCategory); + *m_pCategory = strdup(szMsgText + 6 + 9); + g_pScanner->InitPPParameters(*m_pCategory, m_pParameters, true); + } + else if (!strncmp(szMsgText + 6, "NZBPR_", 6)) + { + char* szParam = strdup(szMsgText + 6 + 6); + char* szValue = strchr(szParam, '='); + if (szValue) + { + *szValue = '\0'; + m_pParameters->SetParameter(szParam, szValue + 1); + } + else + { + error("Invalid command \"%s\" received from %s", szMsgText, GetInfoName()); + } + free(szParam); + } + else if (!strncmp(szMsgText + 6, "PRIORITY=", 9)) + { + *m_iPriority = atoi(szMsgText + 6 + 9); + } + else if (!strncmp(szMsgText + 6, "TOP=", 4)) + { + *m_bAddTop = atoi(szMsgText + 6 + 4) != 0; + } + else if (!strncmp(szMsgText + 6, "PAUSED=", 7)) + { + *m_bAddPaused = atoi(szMsgText + 6 + 7) != 0; + } + else if (!strncmp(szMsgText + 6, "DUPEKEY=", 8)) + { + free(*m_pDupeKey); + *m_pDupeKey = strdup(szMsgText + 6 + 8); + } + else if (!strncmp(szMsgText + 6, "DUPESCORE=", 10)) + { + *m_iDupeScore = atoi(szMsgText + 6 + 10); + } + else if (!strncmp(szMsgText + 6, "DUPEMODE=", 9)) + { + const char* szDupeMode = szMsgText + 6 + 9; + if (strcasecmp(szDupeMode, "score") && strcasecmp(szDupeMode, "all") && strcasecmp(szDupeMode, "force")) + { + error("Invalid value \"%s\" for command \"DUPEMODE\" received from %s", szDupeMode, GetInfoName()); + return; + } + *m_eDupeMode = !strcasecmp(szDupeMode, "all") ? dmAll : + !strcasecmp(szDupeMode, "force") ? dmForce : dmScore; + } + else + { + error("Invalid command \"%s\" received from %s", szMsgText, GetInfoName()); + } + } + else + { + ScriptController::AddMessage(eKind, szText); + } +} diff --git a/daemon/extension/ScanScript.h b/daemon/extension/ScanScript.h new file mode 100644 index 00000000..96c3374a --- /dev/null +++ b/daemon/extension/ScanScript.h @@ -0,0 +1,61 @@ +/* + * This file is part of nzbget + * + * Copyright (C) 2007-2015 Andrey Prygunkov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Revision$ + * $Date$ + * + */ + + +#ifndef SCANSCRIPT_H +#define SCANSCRIPT_H + +#include "NzbScript.h" + +class ScanScriptController : public NZBScriptController +{ +private: + const char* m_szNZBFilename; + const char* m_szUrl; + const char* m_szDirectory; + char** m_pNZBName; + char** m_pCategory; + int* m_iPriority; + NZBParameterList* m_pParameters; + bool* m_bAddTop; + bool* m_bAddPaused; + char** m_pDupeKey; + int* m_iDupeScore; + EDupeMode* m_eDupeMode; + int m_iPrefixLen; + + void PrepareParams(const char* szScriptName); + +protected: + virtual void ExecuteScript(ScriptConfig::Script* pScript); + virtual void AddMessage(Message::EKind eKind, const char* szText); + +public: + static void ExecuteScripts(const char* szNZBFilename, const char* szUrl, + const char* szDirectory, char** pNZBName, char** pCategory, int* iPriority, + NZBParameterList* pParameters, bool* bAddTop, bool* bAddPaused, + char** pDupeKey, int* iDupeScore, EDupeMode* eDupeMode); +}; + +#endif diff --git a/daemon/extension/SchedulerScript.cpp b/daemon/extension/SchedulerScript.cpp new file mode 100644 index 00000000..71ac8be8 --- /dev/null +++ b/daemon/extension/SchedulerScript.cpp @@ -0,0 +1,143 @@ +/* + * This file is part of nzbget + * + * Copyright (C) 2007-2015 Andrey Prygunkov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Revision$ + * $Date$ + * + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef WIN32 +#include "win32.h" +#endif + +#include +#include +#include +#ifndef WIN32 +#include +#endif +#include +#include + +#include "nzbget.h" +#include "SchedulerScript.h" +#include "Options.h" +#include "Log.h" +#include "Util.h" + + +SchedulerScriptController::~SchedulerScriptController() +{ + free(m_szScript); +} + +void SchedulerScriptController::StartScript(const char* szParam, bool bExternalProcess, int iTaskID) +{ + char** argv = NULL; + if (bExternalProcess && !Util::SplitCommandLine(szParam, &argv)) + { + error("Could not execute scheduled process-script, failed to parse command line: %s", szParam); + return; + } + + SchedulerScriptController* pScriptController = new SchedulerScriptController(); + + pScriptController->m_bExternalProcess = bExternalProcess; + pScriptController->m_szScript = strdup(szParam); + pScriptController->m_iTaskID = iTaskID; + + if (bExternalProcess) + { + pScriptController->SetScript(argv[0]); + pScriptController->SetArgs((const char**)argv, true); + } + + pScriptController->SetAutoDestroy(true); + + pScriptController->Start(); +} + +void SchedulerScriptController::Run() +{ + if (m_bExternalProcess) + { + ExecuteExternalProcess(); + } + else + { + ExecuteScriptList(m_szScript); + } +} + +void SchedulerScriptController::ExecuteScript(ScriptConfig::Script* pScript) +{ + if (!pScript->GetSchedulerScript()) + { + return; + } + + PrintMessage(Message::mkInfo, "Executing scheduler-script %s for Task%i", pScript->GetName(), m_iTaskID); + + SetScript(pScript->GetLocation()); + SetArgs(NULL, false); + + char szInfoName[1024]; + snprintf(szInfoName, 1024, "scheduler-script %s for Task%i", pScript->GetName(), m_iTaskID); + szInfoName[1024-1] = '\0'; + SetInfoName(szInfoName); + + SetLogPrefix(pScript->GetDisplayName()); + PrepareParams(pScript->GetName()); + + Execute(); + + SetLogPrefix(NULL); +} + +void SchedulerScriptController::PrepareParams(const char* szScriptName) +{ + ResetEnv(); + + SetIntEnvVar("NZBSP_TASKID", m_iTaskID); + + PrepareEnvScript(NULL, szScriptName); +} + +void SchedulerScriptController::ExecuteExternalProcess() +{ + info("Executing scheduled process-script %s for Task%i", Util::BaseFileName(GetScript()), m_iTaskID); + + char szInfoName[1024]; + snprintf(szInfoName, 1024, "scheduled process-script %s for Task%i", Util::BaseFileName(GetScript()), m_iTaskID); + szInfoName[1024-1] = '\0'; + SetInfoName(szInfoName); + + char szLogPrefix[1024]; + strncpy(szLogPrefix, Util::BaseFileName(GetScript()), 1024); + szLogPrefix[1024-1] = '\0'; + if (char* ext = strrchr(szLogPrefix, '.')) *ext = '\0'; // strip file extension + SetLogPrefix(szLogPrefix); + + Execute(); +} diff --git a/daemon/extension/SchedulerScript.h b/daemon/extension/SchedulerScript.h new file mode 100644 index 00000000..3a53ecb2 --- /dev/null +++ b/daemon/extension/SchedulerScript.h @@ -0,0 +1,50 @@ +/* + * This file is part of nzbget + * + * Copyright (C) 2007-2015 Andrey Prygunkov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Revision$ + * $Date$ + * + */ + + +#ifndef SCHEDULERSCRIPT_H +#define SCHEDULERSCRIPT_H + +#include "NzbScript.h" + +class SchedulerScriptController : public Thread, public NZBScriptController +{ +private: + char* m_szScript; + bool m_bExternalProcess; + int m_iTaskID; + + void PrepareParams(const char* szScriptName); + void ExecuteExternalProcess(); + +protected: + virtual void ExecuteScript(ScriptConfig::Script* pScript); + +public: + virtual ~SchedulerScriptController(); + virtual void Run(); + static void StartScript(const char* szParam, bool bExternalProcess, int iTaskID); +}; + +#endif diff --git a/daemon/main/ScriptConfig.cpp b/daemon/extension/ScriptConfig.cpp similarity index 100% rename from daemon/main/ScriptConfig.cpp rename to daemon/extension/ScriptConfig.cpp diff --git a/daemon/main/ScriptConfig.h b/daemon/extension/ScriptConfig.h similarity index 100% rename from daemon/main/ScriptConfig.h rename to daemon/extension/ScriptConfig.h diff --git a/daemon/main/Scheduler.cpp b/daemon/main/Scheduler.cpp index a0887e73..aff25473 100644 --- a/daemon/main/Scheduler.cpp +++ b/daemon/main/Scheduler.cpp @@ -45,31 +45,12 @@ #include "ServerPool.h" #include "FeedInfo.h" #include "FeedCoordinator.h" -#include "QueueScript.h" +#include "SchedulerScript.h" extern Options* g_pOptions; extern ServerPool* g_pServerPool; extern FeedCoordinator* g_pFeedCoordinator; -class SchedulerScriptController : public Thread, public NZBScriptController -{ -private: - char* m_szScript; - bool m_bExternalProcess; - int m_iTaskID; - - void PrepareParams(const char* szScriptName); - void ExecuteExternalProcess(); - -protected: - virtual void ExecuteScript(ScriptConfig::Script* pScript); - -public: - virtual ~SchedulerScriptController(); - virtual void Run(); - static void StartScript(const char* szParam, bool bExternalProcess, int iTaskID); -}; - Scheduler::Task::Task(int iID, int iHours, int iMinutes, int iWeekDaysBits, ECommand eCommand, const char* szParam) { m_iID = iID; @@ -385,99 +366,3 @@ void Scheduler::CheckScheduledResume() g_pOptions->SetPauseScan(false); } } - - -SchedulerScriptController::~SchedulerScriptController() -{ - free(m_szScript); -} - -void SchedulerScriptController::StartScript(const char* szParam, bool bExternalProcess, int iTaskID) -{ - char** argv = NULL; - if (bExternalProcess && !Util::SplitCommandLine(szParam, &argv)) - { - error("Could not execute scheduled process-script, failed to parse command line: %s", szParam); - return; - } - - SchedulerScriptController* pScriptController = new SchedulerScriptController(); - - pScriptController->m_bExternalProcess = bExternalProcess; - pScriptController->m_szScript = strdup(szParam); - pScriptController->m_iTaskID = iTaskID; - - if (bExternalProcess) - { - pScriptController->SetScript(argv[0]); - pScriptController->SetArgs((const char**)argv, true); - } - - pScriptController->SetAutoDestroy(true); - - pScriptController->Start(); -} - -void SchedulerScriptController::Run() -{ - if (m_bExternalProcess) - { - ExecuteExternalProcess(); - } - else - { - ExecuteScriptList(m_szScript); - } -} - -void SchedulerScriptController::ExecuteScript(ScriptConfig::Script* pScript) -{ - if (!pScript->GetSchedulerScript()) - { - return; - } - - PrintMessage(Message::mkInfo, "Executing scheduler-script %s for Task%i", pScript->GetName(), m_iTaskID); - - SetScript(pScript->GetLocation()); - SetArgs(NULL, false); - - char szInfoName[1024]; - snprintf(szInfoName, 1024, "scheduler-script %s for Task%i", pScript->GetName(), m_iTaskID); - szInfoName[1024-1] = '\0'; - SetInfoName(szInfoName); - - SetLogPrefix(pScript->GetDisplayName()); - PrepareParams(pScript->GetName()); - - Execute(); - - SetLogPrefix(NULL); -} - -void SchedulerScriptController::PrepareParams(const char* szScriptName) -{ - ResetEnv(); - - SetIntEnvVar("NZBSP_TASKID", m_iTaskID); - - PrepareEnvScript(NULL, szScriptName); -} - -void SchedulerScriptController::ExecuteExternalProcess() -{ - info("Executing scheduled process-script %s for Task%i", Util::BaseFileName(GetScript()), m_iTaskID); - - char szInfoName[1024]; - snprintf(szInfoName, 1024, "scheduled process-script %s for Task%i", Util::BaseFileName(GetScript()), m_iTaskID); - szInfoName[1024-1] = '\0'; - SetInfoName(szInfoName); - - char szLogPrefix[1024]; - strncpy(szLogPrefix, Util::BaseFileName(GetScript()), 1024); - szLogPrefix[1024-1] = '\0'; - if (char* ext = strrchr(szLogPrefix, '.')) *ext = '\0'; // strip file extension - SetLogPrefix(szLogPrefix); - - Execute(); -} diff --git a/daemon/queue/Scanner.cpp b/daemon/queue/Scanner.cpp index 9752cef9..408bb090 100644 --- a/daemon/queue/Scanner.cpp +++ b/daemon/queue/Scanner.cpp @@ -46,203 +46,11 @@ #include "Options.h" #include "Log.h" #include "QueueCoordinator.h" -#include "QueueScript.h" +#include "ScanScript.h" #include "Util.h" extern QueueCoordinator* g_pQueueCoordinator; extern Options* g_pOptions; -extern Scanner* g_pScanner; - -class ScanScriptController : public NZBScriptController -{ -private: - const char* m_szNZBFilename; - const char* m_szUrl; - const char* m_szDirectory; - char** m_pNZBName; - char** m_pCategory; - int* m_iPriority; - NZBParameterList* m_pParameters; - bool* m_bAddTop; - bool* m_bAddPaused; - char** m_pDupeKey; - int* m_iDupeScore; - EDupeMode* m_eDupeMode; - int m_iPrefixLen; - - void PrepareParams(const char* szScriptName); - -protected: - virtual void ExecuteScript(ScriptConfig::Script* pScript); - virtual void AddMessage(Message::EKind eKind, const char* szText); - -public: - static void ExecuteScripts(const char* szNZBFilename, const char* szUrl, - const char* szDirectory, char** pNZBName, char** pCategory, int* iPriority, - NZBParameterList* pParameters, bool* bAddTop, bool* bAddPaused, - char** pDupeKey, int* iDupeScore, EDupeMode* eDupeMode); -}; - - -void ScanScriptController::ExecuteScripts(const char* szNZBFilename, - const char* szUrl, const char* szDirectory, char** pNZBName, char** pCategory, - int* iPriority, NZBParameterList* pParameters, bool* bAddTop, bool* bAddPaused, - char** pDupeKey, int* iDupeScore, EDupeMode* eDupeMode) -{ - ScanScriptController* pScriptController = new ScanScriptController(); - - pScriptController->m_szNZBFilename = szNZBFilename; - pScriptController->m_szUrl = szUrl; - pScriptController->m_szDirectory = szDirectory; - pScriptController->m_pNZBName = pNZBName; - pScriptController->m_pCategory = pCategory; - pScriptController->m_pParameters = pParameters; - pScriptController->m_iPriority = iPriority; - pScriptController->m_bAddTop = bAddTop; - pScriptController->m_bAddPaused = bAddPaused; - pScriptController->m_pDupeKey = pDupeKey; - pScriptController->m_iDupeScore = iDupeScore; - pScriptController->m_eDupeMode = eDupeMode; - pScriptController->m_iPrefixLen = 0; - - pScriptController->ExecuteScriptList(g_pOptions->GetScanScript()); - - delete pScriptController; -} - -void ScanScriptController::ExecuteScript(ScriptConfig::Script* pScript) -{ - if (!pScript->GetScanScript() || !Util::FileExists(m_szNZBFilename)) - { - return; - } - - PrintMessage(Message::mkInfo, "Executing scan-script %s for %s", pScript->GetName(), Util::BaseFileName(m_szNZBFilename)); - - SetScript(pScript->GetLocation()); - SetArgs(NULL, false); - - char szInfoName[1024]; - snprintf(szInfoName, 1024, "scan-script %s for %s", pScript->GetName(), Util::BaseFileName(m_szNZBFilename)); - szInfoName[1024-1] = '\0'; - SetInfoName(szInfoName); - - SetLogPrefix(pScript->GetDisplayName()); - m_iPrefixLen = strlen(pScript->GetDisplayName()) + 2; // 2 = strlen(": "); - PrepareParams(pScript->GetName()); - - Execute(); - - SetLogPrefix(NULL); -} - -void ScanScriptController::PrepareParams(const char* szScriptName) -{ - ResetEnv(); - - SetEnvVar("NZBNP_FILENAME", m_szNZBFilename); - SetEnvVar("NZBNP_URL", m_szUrl); - SetEnvVar("NZBNP_NZBNAME", strlen(*m_pNZBName) > 0 ? *m_pNZBName : Util::BaseFileName(m_szNZBFilename)); - SetEnvVar("NZBNP_CATEGORY", *m_pCategory); - SetIntEnvVar("NZBNP_PRIORITY", *m_iPriority); - SetIntEnvVar("NZBNP_TOP", *m_bAddTop ? 1 : 0); - SetIntEnvVar("NZBNP_PAUSED", *m_bAddPaused ? 1 : 0); - SetEnvVar("NZBNP_DUPEKEY", *m_pDupeKey); - SetIntEnvVar("NZBNP_DUPESCORE", *m_iDupeScore); - - const char* szDupeModeName[] = { "SCORE", "ALL", "FORCE" }; - SetEnvVar("NZBNP_DUPEMODE", szDupeModeName[*m_eDupeMode]); - - // remove trailing slash - char szDir[1024]; - strncpy(szDir, m_szDirectory, 1024); - szDir[1024-1] = '\0'; - int iLen = strlen(szDir); - if (szDir[iLen-1] == PATH_SEPARATOR) - { - szDir[iLen-1] = '\0'; - } - SetEnvVar("NZBNP_DIRECTORY", szDir); - - PrepareEnvScript(m_pParameters, szScriptName); -} - -void ScanScriptController::AddMessage(Message::EKind eKind, const char* szText) -{ - const char* szMsgText = szText + m_iPrefixLen; - - if (!strncmp(szMsgText, "[NZB] ", 6)) - { - debug("Command %s detected", szMsgText + 6); - if (!strncmp(szMsgText + 6, "NZBNAME=", 8)) - { - free(*m_pNZBName); - *m_pNZBName = strdup(szMsgText + 6 + 8); - } - else if (!strncmp(szMsgText + 6, "CATEGORY=", 9)) - { - free(*m_pCategory); - *m_pCategory = strdup(szMsgText + 6 + 9); - g_pScanner->InitPPParameters(*m_pCategory, m_pParameters, true); - } - else if (!strncmp(szMsgText + 6, "NZBPR_", 6)) - { - char* szParam = strdup(szMsgText + 6 + 6); - char* szValue = strchr(szParam, '='); - if (szValue) - { - *szValue = '\0'; - m_pParameters->SetParameter(szParam, szValue + 1); - } - else - { - error("Invalid command \"%s\" received from %s", szMsgText, GetInfoName()); - } - free(szParam); - } - else if (!strncmp(szMsgText + 6, "PRIORITY=", 9)) - { - *m_iPriority = atoi(szMsgText + 6 + 9); - } - else if (!strncmp(szMsgText + 6, "TOP=", 4)) - { - *m_bAddTop = atoi(szMsgText + 6 + 4) != 0; - } - else if (!strncmp(szMsgText + 6, "PAUSED=", 7)) - { - *m_bAddPaused = atoi(szMsgText + 6 + 7) != 0; - } - else if (!strncmp(szMsgText + 6, "DUPEKEY=", 8)) - { - free(*m_pDupeKey); - *m_pDupeKey = strdup(szMsgText + 6 + 8); - } - else if (!strncmp(szMsgText + 6, "DUPESCORE=", 10)) - { - *m_iDupeScore = atoi(szMsgText + 6 + 10); - } - else if (!strncmp(szMsgText + 6, "DUPEMODE=", 9)) - { - const char* szDupeMode = szMsgText + 6 + 9; - if (strcasecmp(szDupeMode, "score") && strcasecmp(szDupeMode, "all") && strcasecmp(szDupeMode, "force")) - { - error("Invalid value \"%s\" for command \"DUPEMODE\" received from %s", szDupeMode, GetInfoName()); - return; - } - *m_eDupeMode = !strcasecmp(szDupeMode, "all") ? dmAll : - !strcasecmp(szDupeMode, "force") ? dmForce : dmScore; - } - else - { - error("Invalid command \"%s\" received from %s", szMsgText, GetInfoName()); - } - } - else - { - ScriptController::AddMessage(eKind, szText); - } -} - Scanner::FileData::FileData(const char* szFilename) { diff --git a/nzbget.vcproj b/nzbget.vcproj index 42e359c0..97ada6ab 100644 --- a/nzbget.vcproj +++ b/nzbget.vcproj @@ -281,6 +281,58 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -324,14 +376,6 @@ RelativePath=".\daemon\main\Scheduler.h" > - - - - @@ -540,14 +584,6 @@ RelativePath=".\daemon\postprocess\ParRenamer.h" > - - - - @@ -632,14 +668,6 @@ RelativePath=".\daemon\queue\QueueEditor.h" > - - - -