From: <ze...@us...> - 2008-05-16 22:05:34
|
Revision: 1779 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1779&view=rev Author: zebons Date: 2008-05-16 15:05:31 -0700 (Fri, 16 May 2008) Log Message: ----------- amcupdater v 0.6.2 Added Paths: ----------- trunk/plugins/amcupdater/ trunk/plugins/amcupdater/AMCUpdater/ trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.config trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.ico trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.vbproj trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.vbproj.user trunk/plugins/amcupdater/AMCUpdater/AntProcessor.vb trunk/plugins/amcupdater/AMCUpdater/AntProcessor.vb.bak trunk/plugins/amcupdater/AMCUpdater/AntRecord.vb trunk/plugins/amcupdater/AMCUpdater/AntRecord.vb.bak trunk/plugins/amcupdater/AMCUpdater/ApplicationEvents.vb trunk/plugins/amcupdater/AMCUpdater/FileFolderEnum.vb trunk/plugins/amcupdater/AMCUpdater/Form1.Designer.vb trunk/plugins/amcupdater/AMCUpdater/Form1.Designer.vb.bak trunk/plugins/amcupdater/AMCUpdater/Form1.resx trunk/plugins/amcupdater/AMCUpdater/Form1.vb trunk/plugins/amcupdater/AMCUpdater/MediaInfo.dll trunk/plugins/amcupdater/AMCUpdater/MediaInfoDLL.vb trunk/plugins/amcupdater/AMCUpdater/Module1.vb trunk/plugins/amcupdater/AMCUpdater/My Project/ trunk/plugins/amcupdater/AMCUpdater/My Project/Application.Designer.vb trunk/plugins/amcupdater/AMCUpdater/My Project/Application.myapp trunk/plugins/amcupdater/AMCUpdater/My Project/AssemblyInfo.vb trunk/plugins/amcupdater/AMCUpdater/My Project/Resources.Designer.vb trunk/plugins/amcupdater/AMCUpdater/My Project/Resources.resx trunk/plugins/amcupdater/AMCUpdater/My Project/Settings.Designer.vb trunk/plugins/amcupdater/AMCUpdater/My Project/Settings.settings trunk/plugins/amcupdater/AMCUpdater/MyFilmsAlloCine.xml trunk/plugins/amcupdater/AMCUpdater/Settings.vb trunk/plugins/amcupdater/AMCUpdater/app.config trunk/plugins/amcupdater/AMCUpdater/dgLogWindow.Designer.vb trunk/plugins/amcupdater/AMCUpdater/dgLogWindow.resx trunk/plugins/amcupdater/AMCUpdater/dgLogWindow.vb trunk/plugins/amcupdater/AMCUpdater/frmAbout.Designer.vb trunk/plugins/amcupdater/AMCUpdater/frmAbout.resx trunk/plugins/amcupdater/AMCUpdater/frmAbout.vb trunk/plugins/amcupdater/AMCUpdater/frmList.Designer.vb trunk/plugins/amcupdater/AMCUpdater/frmList.resx trunk/plugins/amcupdater/AMCUpdater/frmList.vb trunk/plugins/amcupdater/AMCUpdater/frmOptions.Designer.vb trunk/plugins/amcupdater/AMCUpdater/frmOptions.resx trunk/plugins/amcupdater/AMCUpdater/frmOptions.vb trunk/plugins/amcupdater/AMCUpdater.sln trunk/plugins/amcupdater/AMCUpdater.suo trunk/plugins/amcupdater/Core.dll trunk/plugins/amcupdater/MediaInfo.dll trunk/plugins/amcupdater/Utils.dll trunk/plugins/amcupdater/grabber.dll Added: trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.config =================================================================== --- trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.config (rev 0) +++ trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.config 2008-05-16 22:05:31 UTC (rev 1779) @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <system.diagnostics> + <sources> + <!-- This section defines the logging configuration for My.Application.Log --> + <source name="DefaultSource" switchName="DefaultSwitch"> + <listeners> + <add name="FileLog"/> + <!-- Uncomment the below section to write to the Application Event Log --> + <!--<add name="EventLog"/>--> + </listeners> + </source> + </sources> + <switches> + <add name="DefaultSwitch" value="Information" /> + </switches> + <sharedListeners> + <add name="FileLog" + type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + initializeData="FileLogWriter"/> + <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log --> + <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> --> + </sharedListeners> + </system.diagnostics> +</configuration> Added: trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.ico =================================================================== (Binary files differ) Property changes on: trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.ico ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.vbproj =================================================================== --- trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.vbproj (rev 0) +++ trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.vbproj 2008-05-16 22:05:31 UTC (rev 1779) @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{6B6B4D52-6F95-4ACD-9F65-9AB06D8F9DF4}</ProjectGuid> + <OutputType>WinExe</OutputType> + <StartupObject>AMCUpdater.My.MyApplication</StartupObject> + <RootNamespace>AMCUpdater</RootNamespace> + <AssemblyName>AMCUpdater</AssemblyName> + <MyType>WindowsForms</MyType> + <ApplicationIcon>AMCUpdater.ico</ApplicationIcon> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <DefineDebug>true</DefineDebug> + <DefineTrace>true</DefineTrace> + <OutputPath>bin\Any CPU\Debug\</OutputPath> + <DocumentationFile> + </DocumentationFile> + <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <DefineDebug>false</DefineDebug> + <DefineTrace>true</DefineTrace> + <Optimize>true</Optimize> + <OutputPath>bin\Any CPU\Release\</OutputPath> + <DocumentationFile> + </DocumentationFile> + <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> + <UseVSHostingProcess>false</UseVSHostingProcess> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> + <DebugSymbols>true</DebugSymbols> + <DefineDebug>true</DefineDebug> + <DefineTrace>true</DefineTrace> + <OutputPath>bin\x64\Debug\</OutputPath> + <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> + <DefineTrace>true</DefineTrace> + <OutputPath>bin\x64\Release\</OutputPath> + <Optimize>true</Optimize> + <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x64</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <DebugSymbols>true</DebugSymbols> + <DefineDebug>true</DefineDebug> + <DefineTrace>true</DefineTrace> + <OutputPath>bin\x86\Debug\</OutputPath> + <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <DefineTrace>true</DefineTrace> + <OutputPath>bin\x86\Release\</OutputPath> + <Optimize>true</Optimize> + <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x86</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + </PropertyGroup> + <ItemGroup> + <Reference Include="Core, Version=0.2.3.17991, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\Core.dll</HintPath> + </Reference> + <Reference Include="grabber, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\grabber.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Deployment" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="Utils, Version=0.2.3.17991, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\Utils.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Import Include="Microsoft.VisualBasic" /> + <Import Include="System" /> + <Import Include="System.Collections" /> + <Import Include="System.Collections.Generic" /> + <Import Include="System.Data" /> + <Import Include="System.Diagnostics" /> + <Import Include="System.IO" /> + <Import Include="System.Text.RegularExpressions" /> + <Import Include="System.Threading" /> + </ItemGroup> + <ItemGroup> + <Compile Include="AntProcessor.vb" /> + <Compile Include="AntRecord.vb" /> + <Compile Include="ApplicationEvents.vb" /> + <Compile Include="dgLogWindow.Designer.vb"> + <DependentUpon>dgLogWindow.vb</DependentUpon> + </Compile> + <Compile Include="dgLogWindow.vb"> + <SubType>Form</SubType> + </Compile> + <Compile Include="FileFolderEnum.vb" /> + <Compile Include="frmAbout.Designer.vb"> + <DependentUpon>frmAbout.vb</DependentUpon> + </Compile> + <Compile Include="frmAbout.vb"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Form1.Designer.vb"> + <DependentUpon>Form1.vb</DependentUpon> + </Compile> + <Compile Include="Form1.vb"> + <SubType>Form</SubType> + </Compile> + <Compile Include="frmList.Designer.vb"> + <DependentUpon>frmList.vb</DependentUpon> + </Compile> + <Compile Include="frmList.vb"> + <SubType>Form</SubType> + </Compile> + <Compile Include="frmOptions.Designer.vb"> + <DependentUpon>frmOptions.vb</DependentUpon> + </Compile> + <Compile Include="frmOptions.vb"> + <SubType>Form</SubType> + </Compile> + <Compile Include="MediaInfoDLL.vb" /> + <Compile Include="Module1.vb" /> + <Compile Include="My Project\AssemblyInfo.vb" /> + <Compile Include="My Project\Application.Designer.vb"> + <AutoGen>True</AutoGen> + <DependentUpon>Application.myapp</DependentUpon> + </Compile> + <Compile Include="My Project\Resources.Designer.vb"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="My Project\Settings.Designer.vb"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="Settings.vb" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="dgLogWindow.resx"> + <SubType>Designer</SubType> + <DependentUpon>dgLogWindow.vb</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="frmAbout.resx"> + <SubType>Designer</SubType> + <DependentUpon>frmAbout.vb</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="Form1.resx"> + <SubType>Designer</SubType> + <DependentUpon>Form1.vb</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="frmList.resx"> + <SubType>Designer</SubType> + <DependentUpon>frmList.vb</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="frmOptions.resx"> + <SubType>Designer</SubType> + <DependentUpon>frmOptions.vb</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="My Project\Resources.resx"> + <Generator>VbMyResourcesResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.vb</LastGenOutput> + <CustomToolNamespace>My.Resources</CustomToolNamespace> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <None Include="AMCUpdater.config" /> + <None Include="app.config" /> + <None Include="My Project\Application.myapp"> + <Generator>MyApplicationCodeGenerator</Generator> + <LastGenOutput>Application.Designer.vb</LastGenOutput> + </None> + <None Include="My Project\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <CustomToolNamespace>My</CustomToolNamespace> + <LastGenOutput>Settings.Designer.vb</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <Content Include="AMCUpdater.ico" /> + <Content Include="Symbol New.png" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file Added: trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.vbproj.user =================================================================== --- trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.vbproj.user (rev 0) +++ trunk/plugins/amcupdater/AMCUpdater/AMCUpdater.vbproj.user 2008-05-16 22:05:31 UTC (rev 1779) @@ -0,0 +1,26 @@ +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <PublishUrlHistory>http://localhost/AMCUpdater/|http://localhost/AMCRobot/|http://localhost/AMC_Robot/</PublishUrlHistory> + <InstallUrlHistory> + </InstallUrlHistory> + <SupportUrlHistory> + </SupportUrlHistory> + <UpdateUrlHistory> + </UpdateUrlHistory> + <BootstrapperUrlHistory> + </BootstrapperUrlHistory> + <ApplicationRevision>0</ApplicationRevision> + <FallbackCulture>en-US</FallbackCulture> + <VerifyUploadedFiles>true</VerifyUploadedFiles> + <ProjectView>ShowAllFiles</ProjectView> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <StartArguments> + </StartArguments> + <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <StartArguments> + </StartArguments> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/amcupdater/AMCUpdater/AntProcessor.vb =================================================================== --- trunk/plugins/amcupdater/AMCUpdater/AntProcessor.vb (rev 0) +++ trunk/plugins/amcupdater/AMCUpdater/AntProcessor.vb 2008-05-16 22:05:31 UTC (rev 1779) @@ -0,0 +1,1783 @@ +Imports System.Threading +Imports System.Xml +Imports System.ComponentModel + +Public Class AntProcessor + + Private Shared WithEvents backgroundWorker1 As New System.ComponentModel.BackgroundWorker + + Private Shared ds As DataSet + + Private Shared XMLDoc As Xml.XmlDocument = New Xml.XmlDocument + + Private Shared _XMLFilePath As String + Private Shared _OverridePath As String + Private Shared _AntSourceField As String = "Source" + Private Shared _FoldersToScan As String + Private Shared _CheckForDVDFolders As Boolean + Private Shared _CountXMLRecords As Integer + Private Shared _CountOrphanFiles As Integer = 0 + Private Shared _CountOrphanRecords As Integer = 0 + Private Shared _CountRecordsAdded As Integer = 0 + Private Shared _CountRecordsDeleted As Integer = 0 + Private Shared _CountMultiPartFiles As Integer = 0 + Private Shared _CountMultiPartFilesMerged As Integer = 0 + + Private Shared _IsMultiFolderScan As Boolean + + Private Shared _OverwriteXMLFile As Boolean = False + Private Shared _PurgeOrphanRecords As Boolean + Private Shared _AntMediaLabel As String = "" + Private Shared _AntMediaType As String = "" + Private Shared _BackupXMLFile As Boolean = True + Private Shared _NextAntID As Integer + + Private Shared _ManualFieldName As String + Private Shared _ManualFieldValue As String + Private Shared _ManualOperation As String + Private Shared _ManualParameterField As String + Private Shared _ManualParameterOperator As String + Private Shared _ManualParameterValue As String + Private Shared _ManualParameterMatchAll As Boolean + + Private Shared _blShortNames As Boolean + Private Shared _ExcludePath As String + Private Shared _MultiPath As String + Private Shared _ParserPath As String + + Public ReadOnly Property CountXMLRecords() As Integer + Get + _CountXMLRecords = 0 + _CountXMLRecords = ds.Tables("tblXML").Rows.Count + Return _CountXMLRecords + End Get + End Property + Public ReadOnly Property CountFilesFound() As Integer + Get + Dim FileCount As Integer = 0 + If ds.Tables("tblFoundMediaFiles") IsNot Nothing Then + FileCount += ds.Tables("tblFoundMediaFiles").Rows.Count + End If + If ds.Tables("tblFoundNonMediaFiles") IsNot Nothing Then + FileCount += ds.Tables("tblFoundNonMediaFiles").Rows.Count + End If + Return FileCount + End Get + End Property + Public ReadOnly Property CountOrphanFiles() As Integer + Get + _CountOrphanFiles = 0 + If ds.Tables("tblOrphanedMediaFiles") IsNot Nothing Then + _CountOrphanFiles += ds.Tables("tblOrphanedMediaFiles").Rows.Count + End If + If ds.Tables("tblOrphanedNonMediaFiles") IsNot Nothing Then + _CountOrphanFiles += ds.Tables("tblOrphanedNonMediaFiles").Rows.Count + End If + + Return _CountOrphanFiles + End Get + End Property + Public ReadOnly Property CountOrphanRecords() As Integer + Get + _CountOrphanRecords = 0 + If ds.Tables("tblOrphanedAntRecords").Rows.Count > 0 Then + _CountOrphanRecords = ds.Tables("tblOrphanedAntRecords").Rows.Count + End If + + Return _CountOrphanRecords + End Get + End Property + Public ReadOnly Property CountRecordsAdded() As Integer + Get + Return _CountRecordsAdded + End Get + End Property + Public ReadOnly Property CountRecordsDeleted() As Integer + Get + Return _CountRecordsDeleted + End Get + End Property + Public ReadOnly Property CountMultiPartFiles() As Integer + Get + If ds.Tables("tblMultiPartFiles") IsNot Nothing Then + _CountMultiPartFiles = ds.Tables("tblMultiPartFiles").Rows.Count + End If + + Return _CountMultiPartFiles + End Get + End Property + Public ReadOnly Property CountMultiPartFilesMerged() As Integer + Get + Return _CountMultiPartFilesMerged + End Get + End Property + + Public ReadOnly Property GetAntFieldNames() As DataTable + Get + 'If ds.Tables("tblAntFields") IsNot Nothing Then + Dim dt As DataTable = ds.Tables("tblAntFields") + 'Return ds.Tables("tblAntFields") + Return dt + 'End If + End Get + End Property + + Public Property CheckForDVDFolders() As Boolean + Get + Return _CheckForDVDFolders + End Get + Set(ByVal value As Boolean) + _CheckForDVDFolders = value + End Set + End Property + Public Property XMLFilePath() As String + Get + Return _XMLFilePath + End Get + Set(ByVal Value As String) + _XMLFilePath = Value + End Set + End Property + Public Property OverridePath() As String + Get + Return _OverridePath + End Get + Set(ByVal Value As String) + _OverridePath = Value + End Set + End Property + Public Property AntSourceField() As String + Get + Return _AntSourceField + End Get + Set(ByVal Value As String) + _AntSourceField = Value + End Set + End Property + Public Property FoldersToScan() As String + Get + Return _FoldersToScan + End Get + Set(ByVal Value As String) + _FoldersToScan = Value + If _FoldersToScan.IndexOf(";") >= 0 Then + _IsMultiFolderScan = True + Else + _IsMultiFolderScan = False + End If + End Set + End Property + Public Property OverwriteXMLFile() As Boolean + Get + Return _OverwriteXMLFile + End Get + Set(ByVal value As Boolean) + _OverwriteXMLFile = value + End Set + End Property + Public Property PurgeOrphanRecords() As Boolean + Get + Return _PurgeOrphanRecords + End Get + Set(ByVal value As Boolean) + _PurgeOrphanRecords = value + End Set + End Property + Public Property AntMediaType() As String + Get + Return _AntMediaType + End Get + Set(ByVal value As String) + _AntMediaType = value + End Set + End Property + Public Property AntMediaLabel() As String + Get + Return _AntMediaLabel + End Get + Set(ByVal value As String) + _AntMediaLabel = value + End Set + End Property + Public Property BackupXMLFile() As Boolean + Get + Return _BackupXMLFile + End Get + Set(ByVal value As Boolean) + _BackupXMLFile = value + End Set + End Property + + Public Property ManualFieldName() As String + Get + Return _ManualFieldName + End Get + Set(ByVal value As String) + _ManualFieldName = value + End Set + End Property + Public Property ManualFieldValue() As String + Get + Return _ManualFieldValue + End Get + Set(ByVal value As String) + _ManualFieldValue = value + End Set + End Property + Public Property ManualOperation() As String + Get + Return _ManualOperation + End Get + Set(ByVal value As String) + _ManualOperation = value + End Set + End Property + Public Property ManualParameterField() As String + Get + Return _ManualParameterField + End Get + Set(ByVal value As String) + _ManualParameterField = value + End Set + End Property + Public Property ManualParameterOperator() As String + Get + Return _ManualParameterOperator + End Get + Set(ByVal value As String) + _ManualParameterOperator = value + End Set + End Property + Public Property ManualParameterValue() As String + Get + Return _ManualParameterValue + End Get + Set(ByVal value As String) + _ManualParameterValue = value + End Set + End Property + Public Property ManualParameterMatchAll() As Boolean + Get + Return _ManualParameterMatchAll + End Get + Set(ByVal value As Boolean) + _ManualParameterMatchAll = value + End Set + End Property + Public ReadOnly Property ManualTestResultCount() As Integer + Get + If ds.Tables("tblNodesToProcess") Is Nothing Then + Return 0 + Else + Return ds.Tables("tblNodesToProcess").Rows.Count + End If + End Get + End Property + + Public Property blShortNames() As Boolean + Get + Return _blShortNames + End Get + Set(ByVal value As Boolean) + _blShortNames = value + End Set + End Property + Public Property ExcludePath() As String + Get + Return _ExcludePath + End Get + Set(ByVal value As String) + _ExcludePath = value + End Set + End Property + Public Property MultiPath() As String + Get + Return _MultiPath + End Get + Set(ByVal value As String) + _MultiPath = value + End Set + End Property + Public Property ParserPath() As String + Get + Return _ParserPath + End Get + Set(ByVal value As String) + _ParserPath = value + End Set + End Property + + Public Sub ManualTestOperation() + + '_ManualOperation = 'Update Value', 'Delete Record', 'Delete Value', 'Scan Media Data' + '_ManualFieldName = For Update or Delete Value + '_ManualFieldValue = as above + '_ManualParameterField = ant field to check + '_ManualParameterOperator = '=', '!=', 'EXISTS', 'NOT EXISTS' + '_ManualParameterValue = value to set. + '_ManualParameterMatchAll = ignore params and match all + + 'Dim NodesToProcess As New ArrayList() + Dim TextReader As Xml.XmlTextReader + TextReader = New Xml.XmlTextReader(_XMLFilePath) + Dim CurrentNode As Xml.XmlNode + + 'Update a value = check if attribute exists and update it - + 'Delete a record - check the parameter and delete if match. - + 'Delete Value = check if attribute exists and delete it - + + fnLogEvent("Manual Database Operation Starting", 3) + fnLogEvent(" - Operation : " & _ManualOperation.ToString, 3) + fnLogEvent(" - Field to Update : " & _ManualFieldName.ToString, 3) + fnLogEvent(" - Value to Set : " & _ManualFieldValue.ToString, 3) + If _ManualParameterMatchAll = True Then + fnLogEvent(" - Parameters - Match All Records : True", 3) + Else + fnLogEvent(" - Parameters - Field to Check : " & _ManualParameterField.ToString, 3) + fnLogEvent(" - Parameters - Operator : " & _ManualParameterOperator.ToString, 3) + fnLogEvent(" - Parameters - Value to Find : " & _ManualParameterValue.ToString, 3) + End If + + Dim XmlDoc As New XmlDocument + XmlDoc.Load(_XMLFilePath) + Dim CurrentMovieNumber As Integer + + While TextReader.Read() + If TextReader.Name = "Movie" Then + CurrentMovieNumber = TextReader.GetAttribute("Number") + + If _ManualParameterMatchAll = True Then + 'We're matching all records - proceed with editing + CurrentNode = XmlDoc.SelectSingleNode("//AntMovieCatalog/Catalog/Contents/Movie[@Number='" & CurrentMovieNumber.ToString & "']") + ds.Tables("tblNodesToProcess").Rows.Add(New Object() {CurrentMovieNumber, CurrentNode.Attributes("OriginalTitle").Value}) + fnLogEvent(" - Entry to process : " & CurrentMovieNumber.ToString & " | " & CurrentNode.Attributes("OriginalTitle").Value, 3) + Else + 'Parameters in use - check first then proceed + CurrentNode = XmlDoc.SelectSingleNode("//AntMovieCatalog/Catalog/Contents/Movie[@Number='" & CurrentMovieNumber.ToString & "']") + If CurrentNode IsNot Nothing Then + Select Case _ManualParameterOperator + Case "LIKE" + If CurrentNode.Attributes(_ManualParameterField) IsNot Nothing Then + 'Dim str As String = "kkk" + 'Console.WriteLine(str.CompareTo(str1)) + Dim str1 As String = CurrentNode.Attributes(_ManualParameterField).Value.ToString + Dim str2 As String = _ManualParameterValue + + 'Console.WriteLine(str1) + 'Console.WriteLine(str1.CompareTo(str2)) + + 'If str1.CompareTo(str2) > 0 Then + If str1.ToLower.IndexOf(str2.ToLower) >= 0 Then + ds.Tables("tblNodesToProcess").Rows.Add(New Object() {CurrentMovieNumber, CurrentNode.Attributes("OriginalTitle").Value}) + fnLogEvent(" - Entry to process : " & CurrentMovieNumber.ToString & " | " & CurrentNode.Attributes("OriginalTitle").Value, 3) + End If + End If + Case "=" + If CurrentNode.Attributes(_ManualParameterField) IsNot Nothing Then + 'Console.WriteLine(CurrentNode.Attributes(_ManualParameterField.ToString)) + If CurrentNode.Attributes(_ManualParameterField).Value.ToString = _ManualParameterValue Then + ds.Tables("tblNodesToProcess").Rows.Add(New Object() {CurrentMovieNumber, CurrentNode.Attributes("OriginalTitle").Value}) + fnLogEvent(" - Entry to process : " & CurrentMovieNumber.ToString & " | " & CurrentNode.Attributes("OriginalTitle").Value, 3) + End If + End If + Case "!=" + If CurrentNode.Attributes(_ManualParameterField) IsNot Nothing Then + 'Attribute exists, check it's not a match: + If CurrentNode.Attributes(_ManualParameterField).Value.ToString <> _ManualParameterValue Then + ds.Tables("tblNodesToProcess").Rows.Add(New Object() {CurrentMovieNumber, CurrentNode.Attributes("OriginalTitle").Value}) + fnLogEvent(" - Entry to process : " & CurrentMovieNumber.ToString & " | " & CurrentNode.Attributes("OriginalTitle").Value, 3) + End If + Else + 'Not there, so obviously not equal to our parameter! + ds.Tables("tblNodesToProcess").Rows.Add(New Object() {CurrentMovieNumber, CurrentNode.Attributes("OriginalTitle").Value}) + fnLogEvent(" - Entry to process : " & CurrentMovieNumber.ToString & " | " & CurrentNode.Attributes("OriginalTitle").Value, 3) + End If + Case "EXISTS" + If CurrentNode.Attributes(_ManualParameterField) IsNot Nothing Then + ds.Tables("tblNodesToProcess").Rows.Add(New Object() {CurrentMovieNumber, CurrentNode.Attributes("OriginalTitle").Value}) + fnLogEvent(" - Entry to process : " & CurrentMovieNumber.ToString & " | " & CurrentNode.Attributes("OriginalTitle").Value, 3) + End If + Case "NOT EXISTS" + If CurrentNode.Attributes(_ManualParameterField) Is Nothing Then + ds.Tables("tblNodesToProcess").Rows.Add(New Object() {CurrentMovieNumber, CurrentNode.Attributes("OriginalTitle").Value}) + fnLogEvent(" - Entry to process : " & CurrentMovieNumber.ToString & " | " & CurrentNode.Attributes("OriginalTitle").Value, 3) + End If + End Select + End If + End If + + End If + End While + + fnLogEvent("Ready to Proceed. " & ds.Tables("tblNodesToProcess").Rows.Count.ToString & " Records Matched.", 3) + + + If Not (TextReader Is Nothing) Then + TextReader.Close() + End If + + + + End Sub + Public Sub ManualRunOperation() + + If ds.Tables("tblNodesToProcess") IsNot Nothing Then + fnLogEvent("Performing Manual Update Process", 2) + + Dim XmlDoc As New XmlDocument + Dim CurrentNode As Xml.XmlNode + Dim newAttr As Xml.XmlAttribute + XmlDoc.Load(_XMLFilePath) + Dim MovieRootNode As Xml.XmlNode = XmlDoc.SelectSingleNode("//AntMovieCatalog/Catalog/Contents") + + For Each row As DataRow In ds.Tables("tblNodesToProcess").Rows + CurrentNode = XmlDoc.SelectSingleNode("//AntMovieCatalog/Catalog/Contents/Movie[@Number='" & row("AntID") & "']") + Select Case _ManualOperation + Case "Update Value" + If CurrentNode.Attributes(_ManualFieldName) Is Nothing Then + newAttr = XmlDoc.CreateAttribute("Number") + newAttr.Value = _ManualFieldValue + CurrentNode.Attributes.Append(newAttr) + fnLogEvent("Value Updated (Added too) : " & CurrentNode.Attributes("Number").Value & " | " & CurrentNode.Attributes("OriginalTitle").Value, 1) + Else + CurrentNode.Attributes(_ManualFieldName).Value = _ManualFieldValue + fnLogEvent("Value Updated : " & CurrentNode.Attributes("Number").Value & " | " & CurrentNode.Attributes("OriginalTitle").Value, 1) + End If + Case "Delete Record" + If Not CurrentNode Is Nothing Then + MovieRootNode.RemoveChild(CurrentNode) + fnLogEvent("Record Deleted : " & CurrentNode.Attributes("Number").Value & " | " & CurrentNode.Attributes("OriginalTitle").Value, 1) + End If + Case "Delete Value" + If Not CurrentNode.Attributes(_ManualFieldName) Is Nothing Then + CurrentNode.Attributes.Remove(CurrentNode.Attributes.GetNamedItem(_ManualFieldName)) + fnLogEvent("Value Deleted : " & CurrentNode.Attributes("Number").Value & " | " & CurrentNode.Attributes("OriginalTitle").Value, 1) + End If + Case "Scan Media Data" + Dim FileToScan As String = CurrentNode.Attributes("Source").Value + If FileToScan.IndexOf(";") < 0 Then 'Ignore multi-part files for now + Dim f As New IO.FileInfo(FileToScan) + If f.Exists Then + Dim blah As New AntRecord + With blah + .XMLDoc = XmlDoc + .XMLElement = CurrentNode + .FilePath = FileToScan + .UpdateMediaData() + End With + 'CurrentNode.Attributes. + Else + fnLogEvent("File Not Scanned (File Not Found) : " & CurrentNode.Attributes("Number").Value & " | " & CurrentNode.Attributes("OriginalTitle").Value, 1) + End If + End If + + End Select + Next + + XmlDoc.Save(_XMLFilePath) + fnLogEvent("Manual Update Process Complete.", 2) + + End If + + End Sub + + Public Sub New() + BuildTables() + End Sub + + Public Sub Reset() + If ds.Tables("tblXML") IsNot Nothing Then + ds.Tables("tblXML").Clear() + End If + If ds.Tables("tblFoundMediaFiles") IsNot Nothing Then + ds.Tables("tblFoundMediaFiles").Clear() + End If + If ds.Tables("tblFoundNonMediaFiles") IsNot Nothing Then + ds.Tables("tblFoundNonMediaFiles").Clear() + End If + If ds.Tables("tblOrphanedMediaFiles") IsNot Nothing Then + ds.Tables("tblOrphanedMediaFiles").Clear() + End If + If ds.Tables("tblOrphanedNonMediaFiles") IsNot Nothing Then + ds.Tables("tblOrphanedNonMediaFiles").Clear() + End If + If ds.Tables("tblOrphanedAntRecords") IsNot Nothing Then + ds.Tables("tblOrphanedAntRecords").Clear() + End If + If ds.Tables("tblMultiPartFiles") IsNot Nothing Then + ds.Tables("tblMultiPartFiles").Clear() + End If + End Sub + + Public Sub TEST_ListTable(ByVal TableName As String) + Dim row As DataRow + + If TableName.ToLower = "tblxml" Then + fnLogEvent("tblXML : " & ds.Tables("tblXML").Rows.Count.ToString, 3) + If ds.Tables("tblXML").Rows.Count > 0 Then + fnLogEvent("AntID | AntPath", 3) + For Each row In ds.Tables("tblXML").Rows + fnLogEvent(row("AntID") & " | " & row("AntPath"), 3) + Next + End If + ElseIf TableName.ToLower = "tblfoundmediafiles" Then + fnLogEvent("tblFoundMediaFiles : " & ds.Tables("tblFoundMediaFiles").Rows.Count.ToString, 3) + If ds.Tables("tblFoundMediaFiles").Rows.Count > 0 Then + fnLogEvent("FileName | FilePath", 3) + For Each row In ds.Tables("tblFoundMediaFiles").Rows + fnLogEvent(row("FileName") & " | " & row("FilePath"), 3) + Next + End If + ElseIf TableName.ToLower = "tblfoundnonmediafiles" Then + fnLogEvent("tblFoundNonMediaFiles : " & ds.Tables("tblFoundNonMediaFiles").Rows.Count.ToString, 3) + If ds.Tables("tblFoundNonMediaFiles").Rows.Count > 0 Then + fnLogEvent("FileName | FilePath", 3) + For Each row In ds.Tables("tblFoundNonMediaFiles").Rows + fnLogEvent(row("FileName") & " | " & row("FilePath"), 3) + Next + End If + ElseIf TableName.ToLower = "tblorphanedmediafiles" Then + fnLogEvent("tblOrphanedMediaFiles : " & ds.Tables("tblOrphanedMediaFiles").Rows.Count.ToString, 3) + If ds.Tables("tblOrphanedMediaFiles").Rows.Count > 0 Then + fnLogEvent("AntID | PhysicalPath | VirtualPath | FileName", 3) + For Each row In ds.Tables("tblOrphanedMediaFiles").Rows + fnLogEvent(row("AntID") & " | " & row("PhysicalPath") & " | " & row("VirtualPath") & " | " & row("FileName"), 3) + Next + End If + ElseIf TableName.ToLower = "tblorphanednonmediafiles" Then + fnLogEvent("tblOrphanedNonMediaFiles : " & ds.Tables("tblOrphanedNonMediaFiles").Rows.Count.ToString, 3) + If ds.Tables("tblOrphanedNonMediaFiles").Rows.Count > 0 Then + fnLogEvent("AntID | PhysicalPath | VirtualPath | FileName", 3) + For Each row In ds.Tables("tblOrphanedNonMediaFiles").Rows + fnLogEvent(row("AntID") & " | " & row("PhysicalPath") & " | " & row("VirtualPath") & " | " & row("FileName"), 3) + Next + End If + ElseIf TableName.ToLower = "tblorphanedantrecords" Then + fnLogEvent("tblOrphanedAntRecords : " & ds.Tables("tblOrphanedAntRecords").Rows.Count.ToString, 3) + If ds.Tables("tblOrphanedAntRecords").Rows.Count > 0 Then + fnLogEvent("AntID | PhysicalPath | FileName", 3) + For Each row In ds.Tables("tblOrphanedAntRecords").Rows + fnLogEvent(row("AntID") & " | " & row("PhysicalPath") & " | " & row("FileName"), 3) + Next + End If + ElseIf TableName.ToLower = "tblmultipartfiles" Then + fnLogEvent("tblMultiPartFiles : " & ds.Tables("tblMultiPartFiles").Rows.Count.ToString, 3) + If ds.Tables("tblMultiPartFiles").Rows.Count > 0 Then + fnLogEvent("AntID | PhysicalPath | VirtualPath | FileName", 3) + For Each row In ds.Tables("tblMultiPartFiles").Rows + fnLogEvent(row("AntID") & " | " & row("PhysicalPath") & " | " & row("VirtualPath") & " | " & row("FileName"), 3) + Next + End If + + End If + + + End Sub + + Private Sub BuildTables() + + Dim table As DataTable + Dim column As DataColumn + ds = New DataSet + + 'XML Table + table = New DataTable("tblXML") + column = New DataColumn() + column.DataType = System.Type.GetType("System.Int32") + column.ColumnName = "AntID" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "AntPath" + table.Columns.Add(column) + ds.Tables.Add(table) + + 'Found Media Files Table + table = New DataTable("tblFoundMediaFiles") + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "FileName" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "FilePath" + table.Columns.Add(column) + ds.Tables.Add(table) + + 'Found Non-Media Files Table + table = New DataTable("tblFoundNonMediaFiles") + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "FileName" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "FilePath" + table.Columns.Add(column) + ds.Tables.Add(table) + + table = New DataTable("tblOrphanedMediaFiles") + column = New DataColumn() + column.DataType = System.Type.GetType("System.Int32") + column.ColumnName = "AntID" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "PhysicalPath" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "VirtualPath" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "FileName" + table.Columns.Add(column) + ds.Tables.Add(table) + + table = New DataTable("tblOrphanedNonMediaFiles") + column = New DataColumn() + column.DataType = System.Type.GetType("System.Int32") + column.ColumnName = "AntID" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "PhysicalPath" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "VirtualPath" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "FileName" + table.Columns.Add(column) + ds.Tables.Add(table) + + table = New DataTable("tblOrphanedAntRecords") + column = New DataColumn() + column.DataType = System.Type.GetType("System.Int32") + column.ColumnName = "AntID" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "PhysicalPath" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "FileName" + table.Columns.Add(column) + ds.Tables.Add(table) + + table = New DataTable("tblMultiPartFiles") + column = New DataColumn() + column.DataType = System.Type.GetType("System.Int32") + column.ColumnName = "AntID" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "PhysicalPath" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "VirtualPath" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "FileName" + table.Columns.Add(column) + Dim PrimaryKeyColumns(0) As DataColumn + PrimaryKeyColumns(0) = table.Columns("FileName") + table.PrimaryKey = PrimaryKeyColumns + ds.Tables.Add(table) + + table = New DataTable("tblAntFields") + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "FieldName" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "FieldDataType" + table.Columns.Add(column) + ds.Tables.Add(table) + + 'XML Table + table = New DataTable("tblNodesToProcess") + column = New DataColumn() + column.DataType = System.Type.GetType("System.Int32") + column.ColumnName = "AntID" + table.Columns.Add(column) + column = New DataColumn() + column.DataType = System.Type.GetType("System.String") + column.ColumnName = "AntTitle" + table.Columns.Add(column) + ds.Tables.Add(table) + + table = New DataTable("dtNone") + 'Dim dtnone As DataTable + 'dtnone = New DataTable("File") + 'dtnone.Columns.Add("FileName") + table.Columns.Add(New DataColumn("FileName")) + ds.Tables.Add(table) + + table = New DataTable("dtDone") + table.Columns.Add(New DataColumn("FileName")) + ds.Tables.Add(table) + + 'Dim dtdone As DataTable + 'dtdone = New DataTable("File") + 'dtdone.Columns.Add("FileName") + + + PopulateReferenceTables() + + End Sub + + Private Sub PopulateReferenceTables() + If ds.Tables("tblAntFields") IsNot Nothing Then + ds.Tables("tblAntFields").Rows.Add(New Object() {"Number", "Int"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Date", "Date"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Rating", "Int"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Year", "Int"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Length", "Int"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"VideoBitrate", "Int"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"AudioBitrate", "Int"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Disks", "Int"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Checked", "Boolean"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"MediaLabel", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"MediaType", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Source", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Borrower", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"OriginalTitle", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"TranslatedTitle", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Director", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Producer", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Country", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Category", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Actors", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"URL", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Description", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Comments", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"VideoFormat", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"AudioFormat", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Resolution", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Framerate", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Languages", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Subtitles", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"Size", "Int"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"PictureName", "String"}) + ds.Tables("tblAntFields").Rows.Add(New Object() {"PictureSize", "Int"}) + End If + + End Sub + + Public Sub ProcessXML(Optional ByVal XMLFilePath As String = "") + Dim textReader As Xml.XmlTextReader + Dim CurrentMovieTitle As String = "" + Dim CurrentMovieNumber As Integer + 'Dim FoundEntries As Integer = 0 + 'Dim row As System.Data.DataRow + + Try + If ds.Tables("tblXML") IsNot Nothing Then + ds.Tables("tblXML").Clear() + End If + + If XMLFilePath = "" Then + textReader = New Xml.XmlTextReader(_XMLFilePath) + Else + textReader = New Xml.XmlTextReader(XMLFilePath) + End If + While textReader.Read() + If textReader.Name = "Movie" Then + CurrentMovieTitle = textReader.GetAttribute(AntSourceField) + CurrentMovieNumber = textReader.GetAttribute("Number") + If Not CurrentMovieTitle Is Nothing Then + 'Check for multi-valued entries: + If CurrentMovieTitle.IndexOf(";") > -1 Then + Dim TitleList() As String + TitleList = CurrentMovieTitle.Split(";") + Dim myEnumerator As System.Collections.IEnumerator = TitleList.GetEnumerator() + While myEnumerator.MoveNext() + If _IsMultiFolderScan = True Then + CurrentMovieTitle = myEnumerator.Current + Else + CurrentMovieTitle = fnStripPathFromFile(myEnumerator.Current, _FoldersToScan, _OverridePath) + End If + 'CurrentMovieTitle = myEnumerator.Current + ds.Tables("tblXML").Rows.Add(New Object() {CurrentMovieNumber, CurrentMovieTitle}) + fnLogEvent(" Entry Found - " & CurrentMovieTitle, 1) + End While + TitleList = Nothing + Else + If _IsMultiFolderScan = True Then + CurrentMovieTitle = CurrentMovieTitle + Else + CurrentMovieTitle = fnStripPathFromFile(CurrentMovieTitle, _FoldersToScan, _OverridePath) + End If + ds.Tables("tblXML").Rows.Add(New Object() {CurrentMovieNumber, CurrentMovieTitle}) + fnLogEvent(" Entry Found - " & CurrentMovieTitle.ToString, 1) + End If + End If + End If + End While + + If Not (textReader Is Nothing) Then + textReader.Close() + End If + + + fnLogEvent("Parsing XML File - Complete - " & ds.Tables("tblXML").Rows.Count.ToString & " entries found.", 2) + Catch ex As Exception + fnLogEvent("ERROR : Cannot parse XML file", 3) + End Try + + End Sub + + Public Sub ProcessMovieFolder() + 'Sub to enumerate all files in the given MoviePath location. + + If ds.Tables("tblFoundNonMediaFiles") IsNot Nothing Then + ds.Tables("tblFoundNonMediaFiles").Clear() + End If + If ds.Tables("tblFoundMediaFiles") IsNot Nothing Then + ds.Tables("tblFoundMediaFiles").Clear() + End If + + 'Dim dtnone As DataTable + 'dtnone = New DataTable("File") + 'dtnone.Columns.Add("FileName") + Dim XMLExclTable As New Hashtable + If (IO.File.Exists(_ExcludePath)) Then + Dim sr As StreamReader = File.OpenText(_ExcludePath) + Dim i As Integer = 0 + Do While sr.Peek() >= 0 + XMLExclTable.Add(i, sr.ReadLine) + i += 1 + Loop + End If + + + 'Dim MovieCounter As Integer = 0 + Dim FoundFileName As String + Dim ValidMediaExtensions As String() = My.Settings.FileTypesToCheck.Split(";") + Dim ValidNonMediaExtensions As String() = My.Settings.FileTypesNonMedia.Split(";") + Dim row As DataRow + + Dim CurrentMoviePath As String + For Each CurrentMoviePath In _FoldersToScan.Split(";") + + Dim dir As New DirectoryInfo(CurrentMoviePath) + 'If dir.Name <> "System Volume Information" Then + If Not dir.Exists Then + fnLogEvent("ERROR : Cannot access folder '" + CurrentMoviePath.ToString + "'", 3) + Else + If Not CurrentMoviePath.EndsWith("\") = True Then + CurrentMoviePath = CurrentMoviePath & "\" + End If + + fnLogEvent("Processing Movie Folder : " & CurrentMoviePath.ToString, 2) + 'fnLogEvent(" MoviePath : " + CurrentMoviePath.ToString, 2) + + Dim blah As New FileFolderEnum(CurrentMoviePath) + For Each foundFile As String In blah.Files + + If (XMLExclTable.ContainsValue(foundFile.ToLower) = False) Then + 'Check for match against movie file types: + Try + FoundFileName = fnStripPathFromFile(foundFile, CurrentMoviePath, "") + + 'File Handling - compare extension to known media filetypes + If Array.IndexOf(ValidMediaExtensions, foundFile.Substring(InStrRev(foundFile, "."))) >= 0 Then + fnLogEvent(" File Found - " & FoundFileName, 1) + + row = ds.Tables("tblFoundMediaFiles").NewRow() + row("FileName") = FoundFileName + row("FilePath") = CurrentMoviePath + ds.Tables("tblFoundMediaFiles").Rows.Add(row) + + ElseIf Array.IndexOf(ValidNonMediaExtensions, foundFile.Substring(InStrRev(foundFile, "."))) >= 0 Then + 'Check for match against non-movie file types: + fnLogEvent(" File Found - " & FoundFileName, 1) + + row = ds.Tables("tblFoundNonMediaFiles").NewRow() + row("FileName") = FoundFileName + row("FilePath") = CurrentMoviePath + ds.Tables("tblFoundNonMediaFiles").Rows.Add(row) + + ElseIf _CheckForDVDFolders = True Then + 'Finally special handling to check for DVD images in folders. + If Right(FoundFileName, 12).ToLower = "video_ts.ifo" Then + fnLogEvent(" File Found - " & FoundFileName, 1) + + row = ds.Tables("tblFoundNonMediaFiles").NewRow() + row("FileName") = FoundFileName + row("FilePath") = CurrentMoviePath + ds.Tables("tblFoundNonMediaFiles").Rows.Add(row) + End If + End If + Catch ex As Exception + fnLogEvent("ERROR : " & ex.Message, 3) + End Try + End If + + Next + + End If + Next + fnLogEvent("Processing Movie Folder - Done - " & CountFilesFound.ToString & " files found.", 2) + + 'If (_MultiPath = "") Then + ' Exit Sub + 'End If + + 'Dim dtmulti As DataTable + 'dtmulti = New DataTable("File") + 'dtmulti.Columns.Add("FileName") + 'dtmulti.ReadXml(MultiPath) + 'For i As Integer = 0 To dtmulti.Rows.Count - 1 + ' 'FoundFileName = fnStripPathFromFile(dtmulti.Rows.Item(i).ItemArray(0), CurrentMoviePath, "") + ' 'Console.WriteLine(FoundFileName) + + ' 'Not sure here - we're outside of the multi-folder loop so this may need to move, or we store the full path and filename separately for Re-Scans: + ' FoundFileName = dtmulti.Rows.Item(i).ItemArray(0) + ' CurrentMoviePath = _FoldersToScan + + ' If Array.IndexOf(ValidMediaExtensions, dtmulti.Rows.Item(i).ItemArray(0).Substring(InStrRev(dtmulti.Rows.Item(i).ItemArray(0), "."))) >= 0 Then + ' fnLogEvent(" Reprocessing File Found - " & FoundFileName, 1) + + ' row = ds.Tables("tblFoundMediaFiles").NewRow() + ' row("FileName") = FoundFileName + ' row("FilePath") = CurrentMoviePath + ' ds.Tables("tblFoundMediaFiles").Rows.Add(row) + + ' 'MovieCounter += 1 + ' 'fnLogEvent(" Reprocessing File Found - " & FoundFileName, 1) + ' 'PhysicalMovies.Add(FoundFileName) + + ' 'Check for match against non-movie file types: + ' ElseIf Array.IndexOf(ValidNonMediaExtensions, dtmulti.Rows.Item(i).ItemArray(0).Substring(InStrRev(dtmulti.Rows.Item(i).ItemArray(0), "."))) >= 0 Then + ' fnLogEvent(" Reprocessing File Found - " & FoundFileName, 1) + + ' row = ds.Tables("tblFoundNonMediaFiles").NewRow() + ' row("FileName") = FoundFileName + ' row("FilePath") = CurrentMoviePath + ' ds.Tables("tblFoundNonMediaFiles").Rows.Add(row) + + ' 'MovieCounter += 1 + ' 'FoundFileName = fnStripPathFromFile(foundFile, MoviePath, "", False) + ' 'fnLogEvent(" Reprocessing File Found - " & FoundFileName, 1) + ' 'PhysicalNonMovies.Add(FoundFileName) + + ' ElseIf _CheckForDVDFolders = True Then + ' 'Finally special handling to check for DVD images in folders. + ' If Right(FoundFileName, 12).ToLower = "video_ts.ifo" Then + ' fnLogEvent(" Reprocessing File Found - " & FoundFileName, 1) + + ' row = ds.Tables("tblFoundNonMediaFiles").NewRow() + ' row("FileName") = FoundFileName + ' row("FilePath") = CurrentMoviePath + ' ds.Tables("tblFoundNonMediaFiles").Rows.Add(row) + ' End If + + 'If Right(FoundFileName, 12).ToLower = "video_ts.ifo" Then + ' MovieCounter += 1 + ' fnLogEvent(" Reprocessing File Found - " & FoundFileName,... [truncated message content] |