/Forms/Form1/Form1.vb
Visual Basic | 10353 lines | 9774 code | 456 blank | 123 comment | 15 complexity | 40a1bfda00cc6a098c9293f61b2d26d8 MD5 | raw file
Possible License(s): GPL-2.0
- Option Explicit On
-
- Imports System.Net
- Imports System.IO
- Imports System.Text
- Imports System.Text.RegularExpressions
- Imports System.Threading
- Imports System.Runtime.InteropServices
- Imports System.Globalization
- Imports Microsoft.Win32
- Imports Media_Companion.Pref
- Imports System.Xml
- Imports System.Reflection
- Imports System.Windows.Forms
- Imports System.ComponentModel
- Imports System.Linq
- Imports XBMC.JsonRpc
-
- #Const SilentErrorScream = False
- #Const Refocus = False
-
-
- Public Class Form1
-
- Const HOME_PAGE = "http://mediacompanion.codeplex.com"
- Const TMDB_SITE = "www.themoviedb.org/"
- Const TMDB_SET_URL = TMDB_SITE & "collection/"
- Const TMDB_MOVIE_URL = TMDB_SITE & "movie/"
- Const NFO_INDEX As Integer = 7
- Public Const XBMC_Controller_full_log_file As String = "XBMC-Controller-full-log-file.txt"
- Public Const XBMC_Controller_brief_log_file As String = "XBMC-Controller-brief-log-file.txt"
- Public Const MCToolsCommands As Integer = 5 ' increment when adding MC functions to ToolsToolStripMenuItem
-
- Public Dim WithEvents BckWrkScnMovies As BackgroundWorker = New BackgroundWorker
- Public Dim WithEvents BckWrkCheckNewVersion As BackgroundWorker = New BackgroundWorker
- Public Dim WithEvents BckWrkXbmcController As BackgroundWorker = New BackgroundWorker
- Public Dim WithEvents Bw As BackgroundWorker = New BackgroundWorker
- Public Dim WithEvents ImgBw As BackgroundWorker = New BackgroundWorker
- Property BWs As New List(Of BackgroundWorker)
- Property NumActiveThreads As Integer
- Shared Public XbmcControllerQ As PriorityQueue = New PriorityQueue
- Shared Public XbmcControllerBufferQ As PriorityQueue = New PriorityQueue
- Shared Public Property MC_Only_Movies As List(Of ComboList)
- Public Shared Property MaxXbmcMovies As List(Of MaxXbmcMovie)
- Shared Public MyCulture As New System.Globalization.CultureInfo("en-US")
- Private Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As IntPtr
-
- Public Property XBMC_Controller_LogLastShownDt As Date = Now
- Private XBMC_Link_ErrorLog_Timer As Timers.Timer = New Timers.Timer()
- Private XBMC_Link_Idle_Timer As Timers.Timer = New Timers.Timer()
- Private XBMC_Link_Check_Timer As Timers.Timer = New Timers.Timer()
-
- Declare Function AttachConsole Lib "kernel32.dll" (ByVal dwProcessId As Int32) As Boolean
-
- Private WithEvents Tmr As New Windows.Forms.Timer With {.Interval = 200}
- Private fb As New FolderBrowserDialog
- Private Const WM_USER As Integer = &H400
- Private Const BFFM_SETEXPANDED As Integer = WM_USER + 106
-
- <DllImport("user32.dll", EntryPoint:="SendMessageW")> _
- Private Shared Function SendMessageW(ByVal hWnd As IntPtr, ByVal msg As UInteger, ByVal wParam As Integer, <MarshalAs(UnmanagedType.LPWStr)> ByVal lParam As String) As IntPtr
- End Function
-
- <DllImport("user32.dll", EntryPoint:="FindWindowW")> _
- Private Shared Function FindWindowW(<MarshalAs(UnmanagedType.LPWStr)> ByVal lpClassName As String, <MarshalAs(UnmanagedType.LPWStr)> ByVal lpWindowName As String) As IntPtr
- End Function
-
- Shared ReadOnly Property Link_TotalQCount
- Get
- Return XbmcControllerQ.Count + XbmcControllerBufferQ.Count
- End Get
- End Property
-
- Shared ReadOnly Property MC_Only_Movies_Nfos As List(Of String)
- Get
- If IsNothing(MC_Only_Movies) Then Return New List(Of String)
-
- Return (From M In MC_Only_Movies Select M.fullpathandfilename).ToList
- End Get
- End Property
-
- ReadOnly Shared Property NumOfScreens As Integer
- Get
- Return System.Windows.Forms.Screen.AllScreens.GetUpperBound(0)
- End Get
- End Property
-
- ReadOnly Shared Property CurrentScreen As Integer
- Get
- Try
- Dim display As String = System.Windows.Forms.Screen.FromControl(Form1).DeviceName
- Dim m As String = Regex.Match(display, "DISPLAY[0-9]").Value
- Return ToInt(m.Substring(m.Length - 1)) - 1
- Catch
- Return 0
- End Try
- End Get
- End Property
-
- Property frmXBMC_Progress As frmXBMC_Progress = New frmXBMC_Progress
-
- #Region "Movie scraping related objects"
- Public WithEvents oMovies As New Movies
-
- Public filteredList As New List(Of ComboList)
- Public rescrapeList As New RescrapeList
- Public workingMovieDetails As FullMovieDetails
- Public _rescrapeList As New RescrapeSpecificParams
- Public ChangeMovieId = ""
- Public droppedItems As New List(Of String)
- Public ControlsToDisableDuringMovieScrape As IEnumerable(Of Control)
-
- Public Shared blnAbortFileDownload As Boolean
- Public Shared ReadOnly countLock = New Object
- Public ScraperErrorDetected As Boolean
-
- #End Region 'Movie scraping objects
-
-
- Enum ProgramState
- ResettingFilters
- UpdatingFilteredList
- ResizingSplitterPanel
- MovieControlsDisabled
- Other
- End Enum
-
- Shared Public ProgState As ProgramState=ProgramState.Other
- Public StateBefore As ProgramState=ProgramState.Other
-
- Public DataDirty As Boolean
- Public _yield As Boolean
- Public LastMovieDisplayed As String=""
- Public MainFormLoadedStatus As Boolean = False
- Public tvRefreshNeeded As Boolean = True
- Public messbox As New frmMessageBox("blank", "", "")
- Public startup As Boolean = True
- Public SeriesXmlPath As String
- Public scraperFunction2 As New ScraperFunctions
- Public globalThreadStop As Boolean = False
- Public nfoFunction As New WorkingWithNfoFiles
- Public mediaInfoExp As New MediaInfoExport
- Shared Public langarray(300, 3) As String
- Public screen As Screen
- Public Shared genrelist As New List(Of String)
-
- Public Data_GridViewMovie As Data_GridViewMovie
- Public DataGridViewBindingSource As New BindingSource
-
- Public homemovielist As New List(Of str_BasicHomeMovie)
- Public WorkingHomeMovie As New HomeMovieDetails
- Public workingMovie As New ComboList
- Public tvBatchList As New str_TvShowBatchWizard(SetDefaults)
-
- Public moviefolderschanged As Boolean = False
- Public tvfolderschanged As Boolean = False
- Public hmfolderschanged As Boolean = False
- Public customTvfolderschanged As Boolean = False
- Public scraperLog As String = ""
- Public NewTagList As New List(Of String)
- Public MovieSearchEngine As String = "imdb"
- Dim mov_TableColumnName As String = ""
- Dim mov_TableRowNum As Integer = -1
- Dim MovFanartToggle As Boolean = False
- Dim MovPosterToggle As Boolean = False
- Private keypresstimer As Timers.Timer = New Timers.Timer()
- Private statusstripclear As Timers.Timer = New Timers.Timer()
- Private MovieKeyPress As String = ""
- Public cropMode As String = "movieposter"
-
- Dim WithEvents bigPictureBox As PictureBox
- Dim WithEvents fanartBoxes As PictureBox
- Dim WithEvents fanartCheckBoxes As RadioButton
- Dim WithEvents posterPicBoxes As PictureBox
- Dim WithEvents posterCheckBoxes As RadioButton
- Dim WithEvents posterLabels As Label
- Dim WithEvents resLabel As Label
- Dim WithEvents tvFanartBoxes As PictureBox
- Dim WithEvents tvFanartCheckBoxes As RadioButton
- Dim WithEvents resolutionLabels As Label
- Dim newTvFolders As New List(Of String)
- Dim tvprogresstxt As String = ""
- Dim maximised As Boolean = False
- Dim tootip5 As New ToolTip
- Dim MovpictureList As New List(Of PictureBox)
- Dim tvpictureList As New List(Of PictureBox)
- Dim screenshotTab As TabPage
- Dim filterOverride As Boolean = False
- Dim bigPanel As Panel
- Dim realTvPaths As New List(Of String)
- Public Shared profileStruct As New Profiles
- Dim frmSplash As New frmSplashscreen
- Dim frmSplash2 As New frmProgressScreen
- Public Shared multimonitor As Boolean = False
- Dim progressmode As Boolean
- Dim scrapeAndQuit As Boolean = False
- Dim refreshAndQuit As Boolean = False
- Dim sandq As Integer = 0
- Dim mouseDelta As Integer = 0
- Dim resLabels As Label
- Dim votelabels As Label
- Dim fanartArray As New List(Of McImage)
- Dim cropString As String
- Dim thumbedItsMade As Boolean = False
- Dim posterArray As New List(Of McImage)
- Dim pageCount As Integer = 0
- Dim currentPage As Integer = 0
- Dim actorflag As Boolean = False
- Dim listOfTvFanarts As New List(Of str_FanartList)
- Dim tableSets As New List(Of str_TableItems)
- Dim relativeFolderList As New List(Of str_RelativeFileList)
- Dim templanguage As String
- Dim WithEvents tvposterpicboxes As PictureBox
- Dim WithEvents tvpostercheckboxes As RadioButton
- Dim WithEvents tvposterlabels As Label
- Dim WithEvents tvreslabel As Label
- Dim tvposterpage As Integer = 1
- Public Shared WallPicWidth As Integer = 165
- Public Shared WallPicHeight As Integer = Math.Floor((WallPicWidth/3)*4)
- Dim MovMaxWallCount As Integer = 0
- Dim tvMaxWallCount As Integer = 0
- Dim moviecount_bak As Integer = 0
- Dim tvCount_bak As Integer = 0
- Dim lastSort As String = ""
- Dim lastinvert As String = ""
- Public displayRuntimeScraper As Boolean = True
- Dim tv_IMDbID_detected As Boolean = False
- Dim tv_IMDbID_warned As Boolean = False
- Dim tv_IMDbID_detectedMsg As String = String.Format("Media Companion has detected one or more TV Shows has an incorrect ID.{0}", vbCrLf) & _
- String.Format("To rectify, please select the following:{0}", vbCrLf) & _
- String.Format(" 1. TV Preferences -> Fix NFO id during cache refresh{0}", vbCrLf) & _
- String.Format(" 2. TV Shows -> Refresh Shows{0}", vbCrLf) & _
- String.Format("(This will only be reported once per session)", vbCrLf)
- Dim TVSearchALL As Boolean = False
- Private ClickedControl As String
- Private tvCurrentTabIndex As Integer = 0
- Private currentTabIndex As Integer = 0
- Private homeTabIndex As Integer = 0
- Private CustTvIndex As Integer = 0
- Public totalfilesize As Long = 0
- Public listoffilestomove As New List(Of String)
- Dim currenttitle As String
- Public singleshow As Boolean = False
- Public showslist As Object
- Public DGVMoviesColName As String = ""
- Dim CloseMC As Boolean = False
- Public Imageloading As Boolean = False
- Dim MoviesFiltersResizeCalled As Boolean = False
- Private tb_tagtxt_changed As Boolean = False
-
- 'TODO: (Form1_Load) Need to refactor
- #Region "Form1 Events"
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- PictureBoxAssignedMoviePoster.AllowDrop = True
- Try
- Pref.movie_filters.FilterPanel = SplitContainer5.Panel2
- Label73.Text = ""
-
- BckWrkScnMovies.WorkerReportsProgress = True
- BckWrkScnMovies.WorkerSupportsCancellation = True
- ImgBw.WorkerReportsProgress = True
- ImgBw.WorkerSupportsCancellation = True
- oMovies.Bw = BckWrkScnMovies
-
- For I = 0 To 20
- Common.Tasks.Add(New Tasks.BlankTask())
- Next
-
- Pref.applicationPath = Application.StartupPath
- Utilities.applicationPath = Application.StartupPath
- SeriesXmlPath = IO.Path.Combine(Utilities.applicationPath, "SeriesXml\")
- Utilities.EnsureFolderExists(Utilities.PosterCachePath)
- Utilities.EnsureFolderExists(Utilities.MissingPath)
- Utilities.EnsureFolderExists(Utilities.CacheFolderPath)
- If Not Utilities.GetFrameworkVersions().IndexOf("4.0") Then
- Dim RequiredNetURL As String = "http://www.microsoft.com/download/en/details.aspx?id=17718"
- If MsgBox("The Client version is available through Windows Updates." & vbCrLf & _
- "The Full version, while not required, is available from:" & vbCrLf & _
- RequiredNetURL & vbCrLf & vbCrLf & _
- "Do you wish to download the Full version?", _
- MsgBoxStyle.YesNo, "MC Requires .Net 4.0.") = MsgBoxResult.Yes Then
- OpenUrl(RequiredNetURL)
- End
- End If
- End If
-
- ForegroundWorkTimer.Interval = 500
- #If Not Debug Then
- AddHandler ForegroundWorkTimer.Tick, AddressOf ForegroundWorkPumper
- #End If
-
- Dim asm As Assembly = Assembly.GetExecutingAssembly
- Dim InternalResourceNames() As String = asm.GetManifestResourceNames
-
- For Each Temp In InternalResourceNames
- Dim Temp1 As ManifestResourceInfo = asm.GetManifestResourceInfo(Temp)
- Next
-
- TvTreeview.Sort()
-
- For Each arg As String In Environment.GetCommandLineArgs().Skip(1)
- Select Case arg.ToLower
- Case "sq"
- scrapeAndQuit = True
- sandq = 3
- Case "st"
- scrapeAndQuit = True
- sandq = 1
- Case "sm"
- scrapeAndQuit = True
- sandq = 2
- Case "r"
- refreshAndQuit = True
- Case "?"
- AttachConsole(-1)
- Console.WriteLine("")
- Console.WriteLine("")
- Console.WriteLine("Commandline options")
- Console.WriteLine("-------------------")
- Console.WriteLine("sq - Search for & scrape new movies & tv shows")
- Console.WriteLine("st - Search for & scrape newtv shows")
- Console.WriteLine("sm - Search for & scrape new movies")
- Console.WriteLine("r - Refresh movie & tv caches")
- Console.WriteLine("? - Show this page")
- Console.WriteLine("")
- Environment.Exit(1)
- 'Me.Close()
- Case Else
- AttachConsole(-1)
- Console.WriteLine("")
- Console.WriteLine("")
- Console.WriteLine("Unrecognised commandline option : [" & arg & "]. Type ? for help")
- Console.WriteLine("")
- Environment.Exit(1)
- 'Me.Close()
- End Select
- Next
-
- If scrapeAndQuit Or refreshAndQuit Then
- Me.WindowState = FormWindowState.Minimized
- Else
- Dim scrn As Integer = splashscreenread()
- If multimonitor Then
- frmSplash.Bounds = screen.AllScreens(scrn).Bounds
- frmSplash.StartPosition = FormStartPosition.Manual
- Dim x As Integer = screen.AllScreens(scrn).Bounds.X
- frmSplash.Location = New Point(x + 250, 250)
- frmSplash.TopMost = True
- End If
- frmSplash.Show()
- frmSplash.Label3.Text = "Status :- Initialising Program"
- frmSplash.Label3.Refresh()
- End If
- Me.Visible = False
-
- Me.Refresh()
- Application.DoEvents()
- Dim tempstring As String
- tempstring = applicationPath & "\enablemultiple.set"
- If Not File.Exists(tempstring) Then
- Dim tej As Integer = 0
- Dim processes() As Process
- Dim instance As Process
- Dim process As New Process()
- processes = process.GetProcesses
- For Each instance In processes
- If instance.ProcessName = "Media Companion" Then
- tej = tej + 1
- If tej >= 2 Then
- MsgBox("Media Companion is already running")
- End 'Close MC since another version of the program is running.
- End If
- End If
- Next
- End If
- CheckForIllegalCrossThreadCalls = False
-
- Pref.maximised = False
- Pref.SetUpPreferences() 'Set defaults to all userpreferences. We then load the preferences from config.xml this way any missing ones have a default already set
-
- GenreMasterLoad()
-
- tempstring = applicationPath & "\Settings\" 'read in the config.xml to set the stored preferences (if it exists)
- Dim hg As New IO.DirectoryInfo(tempstring)
- If hg.Exists Then
- Pref.configpath = tempstring & "config.xml"
- If Not IO.File.Exists(Pref.configpath) Then Pref.ConfigSave()
- Else
- IO.Directory.CreateDirectory(tempstring)
- workingProfile.Config = applicationPath & "\Settings\config.xml"
- Pref.ConfigSave()
- End If
-
- If Not IO.File.Exists(applicationPath & "\Settings\profile.xml") Then
- profileStruct.WorkingProfileName = "Default"
- profileStruct.DefaultProfile = "Default"
- profileStruct.StartupProfile = "Default"
- Dim currentprofile As New ListOfProfiles
- tempstring = applicationPath & "\Settings\"
- currentprofile.ActorCache = tempstring & "actorcache.xml"
- currentprofile.DirectorCache = tempstring & "directorcache.xml"
- currentprofile.Config = tempstring & "config.xml"
- currentprofile.RegExList = tempstring & "regex.xml"
- currentprofile.TvCache = tempstring & "tvcache.xml"
- currentprofile.MusicVideoCache = tempstring & "musicvideocache.xml"
- currentprofile.Genres = tempstring & "genres.txt"
- currentprofile.MovieCache = tempstring & "moviecache.xml"
- currentprofile.MovieSetCache = tempstring & "moviesetcache.xml"
- currentprofile.CustomTvCache = tempstring & "customtvcache.xml"
- currentprofile.ProfileName = "Default"
- profileStruct.ProfileList.Add(currentprofile)
- profileStruct.WorkingProfileName = "Default"
- Call util_ProfileSave()
- End If
-
- 'hide debug xml view tabs - unhiden (i.e. added) via debug tab
- TabLevel1.TabPages.Remove(Me.TabConfigXML)
- TabLevel1.TabPages.Remove(Me.TabMovieCacheXML)
- TabLevel1.TabPages.Remove(Me.TabTVCacheXML)
- TabLevel1.TabPages.Remove(Me.TabProfile)
- TabLevel1.TabPages.Remove(Me.TabActorCache)
- TabLevel1.TabPages.Remove(Me.TabRegex)
- TabLevel1.TabPages.Remove(Me.TabCustTv) 'Hide customtv tab while Work-In-Progress
- 'TabControl2.TabPages.Remove(Me.tpMovSets)
- TabControl2.TabPages.Remove(Me.tpMovTags)
-
- Call util_ProfilesLoad()
- For Each prof In profileStruct.ProfileList
- If prof.ProfileName = profileStruct.StartupProfile Then
- workingProfile.ActorCache = prof.ActorCache
- workingProfile.DirectorCache = prof.DirectorCache
- workingProfile.Config = prof.Config
- workingProfile.MovieCache = prof.MovieCache
- workingProfile.ProfileName = prof.ProfileName
- workingProfile.RegExList = prof.RegExList
- workingProfile.Genres = prof.Genres
- workingProfile.TvCache = prof.TvCache
- workingProfile.CustomTvCache = prof.CustomTvCache
- workingProfile.ProfileName = prof.ProfileName
- workingProfile.MusicVideoCache = prof.MusicVideoCache
- workingProfile.MovieSetCache = prof.MovieSetCache
- For Each item In ProfilesToolStripMenuItem.DropDownItems
- If item.text = workingProfile.ProfileName Then
- With item
- item.checked = True
- End With
- Else
- item.checked = False
- End If
- Next
- End If
- Next
-
- 'add musicvideocache to profile if it doesnt exist
- Dim counter As Int16 = 0
- tempstring = applicationPath & "\Settings\"
- For Each prof In profileStruct.ProfileList
- If counter = 0 Then
- If prof.MusicVideoCache = "" Then
- prof.MusicVideoCache = tempstring & "musicvideocache.xml"
- If prof.ProfileName = workingProfile.ProfileName Then
- workingProfile.MusicVideoCache = tempstring & "musicvideocache.xml"
- End If
- End If
- If prof.MovieSetCache = "" Then
- prof.MovieSetCache = tempstring & "moviesetcache.xml"
- If prof.ProfileName = workingProfile.ProfileName Then
- workingProfile.MovieSetCache = tempstring & "moviesetcache.xml"
- End If
- End If
- If prof.CustomTvCache = "" Then
- prof.CustomTvCache = tempstring & "customtvcache.xml"
- If prof.ProfileName = workingProfile.ProfileName Then
- workingProfile.CustomTvCache = tempstring & "customtvcache.xml"
- End If
- End If
- Else
- If prof.MusicVideoCache = "" Then
- prof.MusicVideoCache = tempstring & "musicvideocache" & counter.ToString & ".xml"
- End If
- If prof.ProfileName = workingProfile.ProfileName Then
- workingProfile.MusicVideoCache = tempstring & "musicvideocache" & counter.ToString & ".xml"
- End If
- If prof.MovieSetCache = "" Then
- prof.MovieSetCache = tempstring & "moviesetcache" & counter.ToString & ".xml"
- End If
- If prof.ProfileName = workingProfile.ProfileName Then
- workingProfile.MovieSetCache = tempstring & "moviesetcache" & counter.ToString & ".xml"
- End If
- If prof.CustomTvCache = "" Then
- prof.CustomTvCache = tempstring & "customtvcache" & counter.ToString & ".xml"
- End If
- If prof.ProfileName = workingProfile.ProfileName Then
- workingProfile.CustomTvCache = tempstring & "customtvcache" & counter.ToString & ".xml"
- End If
- End If
- counter += 1
- Next
-
- If workingProfile.HomeMovieCache = "" Then workingProfile.HomeMovieCache = tempstring & "homemoviecache.xml"
- 'Update Main Form Window Title to show Currrent Version - displays current profile so has to be done after profile is loaded
- util_MainFormTitleUpdate()
-
-
- Dim g As New IO.DirectoryInfo(Utilities.PosterCachePath)
- If Not g.Exists Then
- Try
- Directory.CreateDirectory(Utilities.PosterCachePath)
- Catch ex As Exception
- MsgBox(ex.Message.ToString)
- End
- End Try
- End If
-
- CheckForIllegalCrossThreadCalls = False
-
- Try
- If IO.File.Exists(IO.Path.Combine(applicationPath, "\error.log")) Then IO.File.Delete(IO.Path.Combine(applicationPath, "\error.log"))
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
-
- tempstring = applicationDatapath & "error.log"
- If IO.File.Exists(tempstring) = True Then IO.File.Delete(tempstring)
-
- Call util_RegexLoad()
-
- Call util_PrefsLoad()
- Statusstrip_Enable(False)
-
- 'These lines fixed the associated panel so that they don't automove when the Form1 is resized
- SplitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1 'Left Panel on Movie tab - Movie Listing
- SplitContainer5.FixedPanel = System.Windows.Forms.FixedPanel.Panel2 'Bottom Left Panel on Movie Tab - Filters
- SplitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel1 'Left Panel on TV Tab
-
- Movies.SpinUpDrives()
-
- If Not (scrapeAndQuit Or refreshAndQuit) Then
- Me.Visible = True
- Dim intX As Integer
- Dim intY As Integer
- If Pref.MultiMonitoEnabled Then
- Dim scrn As Integer = If(NumOfScreens > 0, Pref.preferredscreen, 0)
- intX = screen.AllScreens(scrn).Bounds.X ' + screen.AllScreens(scrn).Bounds.Width
- intY = screen.AllScreens(scrn).Bounds.Height
- Else
- intX = Screen.PrimaryScreen.Bounds.Width
- intY = Screen.PrimaryScreen.Bounds.Height
- End If
- SplitContainer1.IsSplitterFixed = True
- SplitContainer2.IsSplitterFixed = True
- SplitContainer3.IsSplitterFixed = True
- SplitContainer4.IsSplitterFixed = True
- SplitContainer5.IsSplitterFixed = True
-
- If intX >= 0 Then 'First check if screen is Centre or to the right of main screen.
- If Pref.locx < 0 Then Pref.locx = 0
- If Pref.locy < 0 Then Pref.locy = 0
- If Pref.formheight > intY Then Pref.formheight = intY
- If Pref.formwidth > intX Then Pref.formwidth = intX
- If Pref.locx >= intX Then Pref.locx = intX - Pref.formwidth
- If Pref.locy >= intY Then Pref.locy = intY - Pref.formheight
- Else 'Else screen could be to the left of Centre/Main screen so intX is a negative number.
- 'If Pref.locx < 0 Then Pref.locx = 0
- If Pref.locy < 0 Then Pref.locy = 0
- If Pref.formheight > intY Then Pref.formheight = intY
- If Pref.formwidth > Math.Abs(intX) Then Pref.formwidth = intX
- If Pref.locx <= intX Then Pref.locx = intX ' - Pref.formwidth
- If Pref.locy >= intY Then Pref.locy = intY - Pref.formheight
- End If
- If Pref.formheight <> 0 And Pref.formwidth <> 0 Then
- Me.Width = Pref.formwidth
- Me.Height = Pref.formheight
- Me.Location = New Point(Pref.locx, Pref.locy)
- End If
- If Pref.maximised Then Me.WindowState = FormWindowState.Maximized
-
- Dim dpi As Graphics = Me.CreateGraphics
-
- 'MessageBox.Show(String.Format("X={0}, Y={1}", dpi.DpiX, dpi.DpiY),
- '"DPI Settings", MessageBoxButtons.OK, MessageBoxIcon.Information)
-
- DebugSytemDPITextBox.Text = dpi.DpiX
-
- Me.Refresh()
- Application.DoEvents()
-
- Me.Refresh()
- Application.DoEvents()
-
- Application.DoEvents()
-
- screenshotTab = TabControl3.TabPages(1)
-
- TabControl3.TabPages.RemoveAt(1)
-
- If Pref.splt5 = 0 Then
- Dim tempint As Integer = SplitContainer1.Height
- tempint = tempint / 4
- tempint = tempint * 3
- If tempint > 275 Then
- Pref.splt5 = tempint
- Else
- Pref.splt5 = 275
- End If
- End If
-
- SplitContainer1.SplitterDistance = Pref.splt1
- SplitContainer2.SplitterDistance = Pref.splt2
- SplitContainer5.SplitterDistance = Pref.splt5
- SplitContainer3.SplitterDistance = Pref.splt3
- SplitContainer4.SplitterDistance = Pref.splt4
- TabLevel1.SelectedIndex = Pref.startuptab
-
- If Pref.startuptab = 0 Then
- If Not MoviesFiltersResizeCalled Then
- MoviesFiltersResizeCalled = True
- Pref.movie_filters.RemoveInvalidMovieFilters
- Pref.movie_filters.SetMovieFiltersVisibility
- UpdateMovieFiltersPanel
- End If
- End If
- btn_MPDB_posters.Enabled = False 'Disable MoviePoster button on Movie Poster Tab as now not available to us.
-
- SplitContainer1.IsSplitterFixed = False
- SplitContainer2.IsSplitterFixed = False
- SplitContainer3.IsSplitterFixed = False
- SplitContainer4.IsSplitterFixed = False
- SplitContainer5.IsSplitterFixed = False
- End If
-
- If scrapeAndQuit Or refreshAndQuit Then
- Do_ScrapeAndQuit()
- Me.Close()
- Else
- Try
- If cbMovieDisplay_MovieSet.Items.Count <> Pref.moviesets.Count Then
- cbMovieDisplay_MovieSet.Items.Clear()
- For Each mset In Pref.moviesets
- cbMovieDisplay_MovieSet.Items.Add(If(Pref.MovSetTitleIgnArticle, Pref.RemoveIgnoredArticles(mset), mset))
- Next
- End If
- If Not IsNothing(workingMovieDetails) AndAlso workingMovieDetails.fullmoviebody.MovieSet.MovieSetName <> "-None-" Then
- For Each mset In Pref.moviesets
- cbMovieDisplay_MovieSet.Items.Add(If(Pref.MovSetTitleIgnArticle, Pref.RemoveIgnoredArticles(mset), mset))
- Next
- For te = 0 To cbMovieDisplay_MovieSet.Items.Count - 1
- If cbMovieDisplay_MovieSet.Items(te) = workingMovieDetails.fullmoviebody.MovieSet.MovieSetDisplayName Then
- cbMovieDisplay_MovieSet.SelectedIndex = te
- Exit For
- End If
- Next
- End If
-
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- mov_VideoSourcePopulate()
- ep_VideoSourcePopulate()
- Call util_FontSetup()
- Call langarrsetup()
- Dim mediaDropdown As New SortedList(Of String, String)
- mediaInfoExp.addTemplates(mediaDropdown)
- For Each item In mediaDropdown
- If item.Value = MediaInfoExport.mediaType.Movie Then
- ExportMovieListInfoToolStripMenuItem.DropDownItems.Add(item.Key)
- ElseIf item.Value = MediaInfoExport.mediaType.TV Then
- ExportTVShowInfoToolStripMenuItem.DropDownItems.Add(item.Key)
- End If
- Next
-
- Call util_CommandListLoad()
- startup = False
-
- frmSplash.Label3.Text = "Status :- Cleaning Cache folder."
- frmSplash.Label3.Refresh()
-
- frmSplash.Close()
-
- mov_SplitContainerAutoPosition()
- tv_ShowSelectedCurrently(TvTreeview)
- tv_SplitContainerAutoPosition()
- End If
-
- 'Parameters to display the movie grid at startup
- Select Case Pref.moviedefaultlist
- Case 0
- rbTitleAndYear.Checked = True
- Case 1
- rbFileName.Checked = True
- Case 2
- rbFolder.Checked = True
- End Select
-
- Try
- cbSort.SelectedIndex = Pref.moviesortorder
- Catch
- cbSort.SelectedIndex = 0
- End Try
- btnreverse.Checked = Pref.movieinvertorder
- If btnreverse.Checked Then
- Mc.clsGridViewMovie.GridSort = "Desc"
- Else
- Mc.clsGridViewMovie.GridSort = "Asc"
- End If
-
- Read_XBMC_TMDB_Scraper_Config()
- Read_XBMC_TVDB_Scraper_Config()
- MainFormLoadedStatus = True
- UcFanartTv1.Form1MainFormLoadedStatus = True
- UcFanartTvTv1.Form1MainFormLoadedStatus = True
- ReloadMovieCacheToolStripMenuItem.Visible = False
- ToolStripSeparator9.Visible = False
-
- ResetFilters()
-
- UpdateFilteredList()
-
- If Not IsNothing(Pref.MovFiltLastSize) Then ResizeBottomLHSPanel(Pref.MovFiltLastSize, MovieFiltersPanelMaxHeight)
-
- Common.Tasks.StartTaskEngine()
- ForegroundWorkTimer.Start()
-
- BckWrkXbmcController.WorkerReportsProgress = True
- ' BckWrkXbmcController.WorkerSupportsCancellation = true
-
- oMovies.Bw = BckWrkScnMovies
-
- AddHandler XBMC_Link_ErrorLog_Timer.Elapsed, AddressOf XBMC_Controller_Log_TO_Timer_Elapsed
- Ini_Timer(XBMC_Link_ErrorLog_Timer, 3000)
-
- AddHandler XBMC_Link_Idle_Timer.Elapsed, AddressOf XBMC_Link_Idle_Timer_Elapsed
- Ini_Timer(XBMC_Link_Idle_Timer, 3000)
-
- AddHandler XBMC_Link_Check_Timer.Elapsed, AddressOf XBMC_Link_Check_Timer_Elapsed
- Ini_Timer(XBMC_Link_Check_Timer, 2000, True)
- 'XBMC_Link_Check_Timer.Start
-
- AddHandler keypresstimer.Elapsed, AddressOf keypresstimer_Elapsed
- Ini_Timer(keypresstimer, 1000)
-
- AddHandler statusstripclear.Elapsed, AddressOf statusstripclear_Elapsed
- Ini_Timer(statusstripclear, 2000)
-
-
- AddHandler BckWrkXbmcController.ProgressChanged, AddressOf BckWrkXbmcController_ReportProgress
- AddHandler BckWrkXbmcController.DoWork, AddressOf BckWrkXbmcController_DoWork
-
- BckWrkXbmcController.RunWorkerAsync(Me)
-
- For each pb As Control In TableLayoutPanel6.Controls
- If pb.Name.Contains("pbEpScrSht") Then
- AddHandler pb.Click, AddressOf pbepscrsht_click
- End If
- Next
-
- For each pb As Control In TableLayoutPanel27.Controls
- If pb.Name.Contains("pbHmScrSht") Then
- AddHandler pb.Click, AddressOf pbHmScrSht_click
- End If
- Next
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- #If Refocus Then
- Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
- Try
- If messbox.Visible = True Then
- messbox.Activate()
- messbox.BringToFront()
- messbox.Focus()
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
-
- End Sub
- #End If
-
- Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
- Try
- Me.Dispose()
- Me.Finalize()
- CleanCacheFolder(, cbClearCache.Checked) 'Limit cachefolder to max 300 files. Cleaned on startup and shutdown.
- 'If cbClearCache checked then completely empty
- If cbClearMissingFolder.Checked = True Then ClearMissingFolder() ' delete missing folder if option selected.
- End
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
-
- End Sub
-
- Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
-
- BckWrkScnMovies_Cancel()
- While BckWrkScnMovies.IsBusy
- Application.DoEvents()
- End While
-
- Try
- oMovies.SaveCaches()
-
- If Tv_CacheSave() Then
- e.Cancel = True
- Exit Sub
- End If
- Call HomeMovieCacheSave()
-
- Call UcMusicVideo1.MVCacheSave()
-
- 'if we say cancel to save nfo's & exit then we don't want to exit MC if e.cancel= true we abort the closing....
-
- 'Todo: Code a better way to serialize the data
-
- Pref.splt1 = SplitContainer1.SplitterDistance
- Pref.splt2 = SplitContainer2.SplitterDistance
- Pref.splt3 = SplitContainer3.SplitterDistance
- Pref.splt4 = SplitContainer4.SplitterDistance
- Pref.splt5 = SplitContainer5.SplitterDistance
- Pref.splt6 = _tv_SplitContainer.SplitterDistance
- Pref.tvbannersplit = Math.Round(_tv_SplitContainer.SplitterDistance / _tv_SplitContainer.Height, 2)
- Pref.MovFiltLastSize = SplitContainer5.Height - SplitContainer5.SplitterDistance
- Pref.preferredscreen = CurrentScreen
-
-
- If Me.WindowState = FormWindowState.Minimized Then
- Me.WindowState = FormWindowState.Normal
- Pref.formwidth = Me.Width
- Pref.formheight = Me.Height
- Pref.locx = Me.Location.X
- Pref.locy = Me.Location.Y
- Pref.maximised = False
- End If
-
- If Me.WindowState = FormWindowState.Normal Then
- Pref.formwidth = Me.Width
- Pref.formheight = Me.Height
- Pref.locx = Me.Location.X
- Pref.locy = Me.Location.Y
- Pref.maximised = False
- End If
-
- If Me.WindowState = FormWindowState.Maximized Then
- Me.WindowState = FormWindowState.Normal
- Pref.maximised = True
- End If
-
- If DataGridView1.Columns.Count > 0 Then
- Pref.tableview.Clear()
- For Each column In DataGridView1.Columns
- Dim tempstring As String = String.Format("{0}|{1}|{2}|{3}", column.name, column.width, column.displayindex, column.visible)
- Pref.tableview.Add(tempstring)
- Next
- End If
-
- Pref.startuptab = TabLevel1.SelectedIndex
-
- Pref.ConfigSave()
- SplashscreenWrite()
- Call util_ProfileSave()
- Dim errpath As String = IO.Path.Combine(applicationPath, "tvrefresh.log")
- Catch ex As Exception
- MessageBox.Show(ex.ToString, "Exception")
- Environment.Exit(1)
- 'ExceptionHandler.LogError(ex)
- End Try
-
- End Sub
-
- Private Sub Form1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.GotFocus
- Try
- If messbox.Visible = True Then
- messbox.Activate()
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
-
- End Sub
-
- Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
- Try
- If Me.WindowState = FormWindowState.Maximized Then
- mov_SplitContainerAutoPosition()
- tv_SplitContainerAutoPosition()
- End If
- If Not Me.WindowState = FormWindowState.Minimized Then
- tv_SplitContainerAutoPosition()
- End If
- If startup = False Then
- Pref.locx = Me.Location.X
- Pref.locy = Me.Location.Y
- End If
- If MainFormLoadedStatus = True Then
- doResizeRefresh()
- End If
- Catch ex As Exception
- Dim paramInfo As String = ""
- Try
- paramInfo = "PbMovieFanArt.Width:" & PbMovieFanArt.Width.ToString & " PbMovieFanArt.Height: " & PbMovieFanArt.Height.ToString & " Rating:" & ratingtxt.Text
- Catch ex2 As Exception
- ExceptionHandler.LogError(ex2)
- End Try
- ExceptionHandler.LogError(ex, paramInfo)
- End Try
- End Sub
-
- Private Sub Form1_ResizeEnd(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.ResizeEnd
- Try
- If Pref.formwidth <> Me.Width Or Pref.formheight <> Me.Height Then
- Pref.formwidth = Me.Width
- Pref.formheight = Me.Height
- End If
- mov_SplitContainerAutoPosition()
- tv_SplitContainerAutoPosition()
-
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
-
- End Sub
-
- Private Sub Form1_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
-
- If e.KeyCode = Keys.Escape Then bckgrndcancel()
- If e.KeyCode = Keys.F5 Then doRefresh()
- If e.KeyCode = Keys.F3 Then doSearchNew()
- If e.Control And e.KeyCode = Keys.C Then AbortFileDownload()
- End Sub
-
- #End Region
-
- Sub Ini_Timer(t As Timers.Timer, Optional Interval As Integer = 1000, Optional Repeating As Boolean = False)
- t.Stop()
- t.Interval = Interval
- t.AutoReset = Repeating
- End Sub
-
-
- #Region "XBMC Link"
- Private Sub BckWrkXbmcController_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
- Dim bw As BackgroundWorker = CType(sender, BackgroundWorker)
- Dim sm As New XbmcController(e.Argument, bw)
- sm.Go()
- End Sub
-
- Private Sub XBMC_Controller_Log_TO_Timer_Elapsed()
- If Not BckWrkScnMovies.IsBusy And XbmcControllerBufferQ.Count = 0 Then
- If DateDiff(DateInterval.Second, XBMC_Controller_LogLastShownDt, Now) > 30 Then
-
- Pref.OpenFileInAppPath(Form1.XBMC_Controller_full_log_file)
- Pref.OpenFileInAppPath(Form1.XBMC_Controller_brief_log_file)
-
- frmXBMC_Progress.Reset()
- Dim ce As New BaseEvent(XbmcController.E.ResetErrorCount, New BaseEventArgs())
- XbmcControllerQ.Write(ce)
- End If
- XBMC_Controller_LogLastShownDt = Now
- XBMC_Link_ErrorLog_Timer.Stop()
- End If
- End Sub
-
- Private Sub XBMC_Link_Idle_Timer_Elapsed()
- If Not BckWrkScnMovies.IsBusy And XbmcControllerBufferQ.Count = 0 Then
- frmXBMC_Progress.Visible = False
- XBMC_Link_ErrorLog_Timer.Stop()
- End If
- End Sub
-
- Sub Restart(tmr As Timers.Timer)
- tmr.Stop()
- tmr.Start()
- End Sub
-
- Private Sub BckWrkXbmcController_ReportProgress(ByVal sender As Object, ByVal e As ProgressChangedEventArgs)
- Dim oProgress As XBMC_Controller_Progress = CType(e.UserState, XBMC_Controller_Progress)
-
- If XBMC_Link_ErrorLog_Timer.Enabled Then
- Restart(XBMC_Link_ErrorLog_Timer)
- End If
-
- Restart(XBMC_Link_Idle_Timer)
- Restart(XBMC_Link_Check_Timer)
-
- frmXBMC_Progress.Visible = True
- If HandleEvents(oProgress) Then Return
- If oProgress.ErrorCount > 0 Then
- If Pref.ShowLogOnError Then
- XBMC_Link_ErrorLog_Timer.Start()
- End If
- End If
-
- frmXBMC_Progress.UpdateDetails(oProgress)
- End Sub
-
- Function HandleEvents(oProgress As XBMC_Controller_Progress) As Boolean
-
- Select Case oProgress.Evt
-
- Case XbmcController.E.MC_Only_Movies
- MC_Only_Movies = CType(oProgress.Args, ComboList_EventArgs).XbmcMovies
- Assign_FilterGeneral()
- Return True
-
- Case XbmcController.E.MC_XbmcMcMovies
- oMovies.XbmcMcMovies = CType(oProgress.Args, XBMC_MC_Movies_EventArgs).XbmcMcMovies
- Assign_FilterGeneral()
- Return True
-
- Case XbmcController.E.MC_XbmcOnlyMovies
- oMovies.XbmcOnlyMovies = CType(oProgress.Args, XBMC_Only_Movies_EventArgs).XbmcOnlyMovies
- Return True
-
- Case XbmcController.E.MC_XbmcQuit
- SetcbBtnLink()
- Return True
-
- End Select
- Return False
- End Function
-
- Const MaxConseqFailures As Integer = 3
-
- Dim ConnectSent As Boolean
- Dim XbmcLastLinkState As Boolean
- Dim ConseqFailures As Integer = 0
-
- Sub SetcbBtnLink(Optional sender As Object = Nothing)
- XBMC_Link_Check_Timer.Stop()
-
- 'Only check when link is idle
- If Not BckWrkScnMovies.IsBusy And XbmcControllerBufferQ.Count = 0 Then
- Dim passed As Boolean = XBMC_TestsPassed
-
- '
- ' Sometimes the link test fails. Don't know why yet, maybe XBMC is busy...but anyway this should reduce the number of phantom
- ' link disablings...
- '
- If Not IsNothing(sender) Then
- If cbBtnLink.Enabled And Not passed Then
- ConseqFailures += 1
- Else
- ConseqFailures = 0
- End If
- Else
- ConseqFailures = 0
- End If
-
- If IsNothing(sender) Or ConseqFailures <= MaxConseqFailures Then
- cbBtnLink.Enabled = passed
- If cbBtnLink.Enabled Then
- cbBtnLink.BackColor = IIf(cbBtnLink.Checked, Color.LightGreen, Color.Transparent)
- If Pref.XBMC_Link <> cbBtnLink.Checked Then
- Pref.XBMC_Link = cbBtnLink.Checked
- If Pref.XbmcLinkReady Then
- XbmcControllerQ.Write(XbmcController.E.ConnectReq, PriorityQueue.Priorities.low)
- End If
- Pref.ConfigSave()
- End If
- Else
- cbBtnLink.Checked = False
- cbBtnLink.BackColor = Color.Transparent
- End If
- tsmiMov_SyncToXBMC.Enabled = cbBtnLink.Enabled And cbBtnLink.Checked
- End If
- End If
- XBMC_Link_Check_Timer.Start()
- End Sub
-
- Private Sub XBMC_Link_Check_Timer_Elapsed()
- If ProgState = ProgramState.MovieControlsDisabled Then Return
- SetcbBtnLink(XBMC_Link_Check_Timer)
- End Sub
-
- Private Sub keypresstimer_Elapsed()
- MovieKeyPress = ""
- End Sub
-
- Private Sub statusstripclear_Elapsed()
- ToolStripStatusLabel2.Visible = False
- Statusstrip_Enable(False)
- ToolStripStatusLabel2.Text = "TV Show Episode Scan In Progress"
- End Sub
-
- Sub XbmcLink_UpdateArtwork()
- If Pref.XBMC_Delete_Cached_Images AndAlso Pref.XbmcLinkReady Then
- Dim m As Movie = oMovies.LoadMovie(workingMovieDetails.fileinfo.fullpathandfilename)
- m.SaveNFO()
- End If
- End Sub
- #End Region
-
- Private Sub BlinkTaskBar()
- If GetActiveWindow <> Me.Handle Then
- Dim res = WindowsApi.FlashWindow(Process.GetCurrentProcess().MainWindowHandle, True, True, 5)
- End If
- End Sub
-
- Private Function splashscreenread() As Integer
- Dim scrn As Integer = 0
- Dim checkpath As String = Pref.applicationPath & "\Settings\screen.xml"
- If File.Exists(checkpath) Then
- Try
- Dim document As XDocument = XDocument.Load(checkpath)
- Dim sc = From t In document.Descendants("screen") Select t.Value
- Dim mten = From t In document.Descendants("MultiEnabled") Select t.Value
- multimonitor = Convert.ToBoolean(mten.First())
- scrn = sc.First().ToInt
- If scrn > NumOfScreens Then scrn = 0
- Catch
- scrn = 0
- multimonitor = False
- End Try
- End If
- Return scrn
- End Function
-
- Private Sub SplashscreenWrite()
- Dim doc As New XmlDocument
- Dim thispref As XmlNode = Nothing
- Dim xmlproc As XmlDeclaration
- Dim root As XmlElement = Nothing
- Dim child As XmlElement = Nothing
- xmlproc = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes")
- doc.AppendChild(xmlproc)
- root = doc.CreateElement("root")
- child = doc.CreateElement("MultiEnabled")
- child.InnerXml = Pref.MultiMonitoEnabled
- root.AppendChild(child)
- child = doc.CreateElement("screen")
- child.InnerText = CurrentScreen.ToString
- root.AppendChild(child)
- doc.AppendChild(root)
- Dim screenpath As String = Pref.applicationPath & "\Settings\screen.xml"
- Try
- Dim output As New XmlTextWriter(screenpath, System.Text.Encoding.UTF8)
- output.Formatting = Formatting.Indented
- doc.WriteTo(output)
- output.Close()
- Catch
- End Try
- End Sub
-
- Private Sub Batch_Rewritenfo()
-
- rescrapeList.ResetFields()
- rescrapeList.rebuildnfo = True
-
- _rescrapeList.FullPathAndFilenames.Clear()
- For Each movie As ComboList In oMovies.MovieCache
- _rescrapeList.FullPathAndFilenames.Add(movie.fullpathandfilename)
- Next
- RunBackgroundMovieScrape("BatchRescrape")
-
- End Sub
-
- Sub CleanCacheFolder(Optional ByVal All As Boolean = False, Optional ByVal Total As Boolean = False)
- Dim cachefolder As String = applicationPath & "\cache\"
- If IO.Directory.Exists(cacheFolder) Then
- Dim Files As New IO.DirectoryInfo(cachefolder)
- Dim FileList() = Files.GetFiles().OrderByDescending(Function(f) f.LastWriteTime).ToArray
- Dim limit As Integer = If(Total, 0, 299)
- Dim i As Integer = FileList.Count
- Try
- If i > limit Then
- Do Until i = limit
- i-=1
- Dim filepath As String = FileList(i).FullName
- Utilities.SafeDeleteFile(filepath)
- Loop
- End If
- Catch
- End Try
- End If
- If All Then
- ClearSeriesFolder()
- ClearPosterFolder()
- End If
- End Sub
-
- Sub ClearSeriesFolder()
- If IO.Directory.Exists(SeriesXmlPath) Then
- Dim Files As New IO.DirectoryInfo(SeriesXmlPath)
- Dim Filelist() = Files.GetFiles()
- For Each f In Filelist
- Utilities.SafeDeleteFile(f.FullName)
- Next
- End If
- End Sub
-
- Sub ClearMissingFolder()
- Try
- If IO.Directory.Exists(Utilities.MissingPath)
- Dim Files As New IO.DirectoryInfo(Utilities.MissingPath)
- Dim Filelist() = Files.GetFiles()
- For Each f In Filelist
- Utilities.SafeDeleteFile(f.FullName)
- Next
- End If
- Catch ex As Exception
- End Try
- End Sub
-
- Sub ClearPosterFolder()
- If IO.Directory.Exists(Utilities.PosterCachePath) Then
- Dim Files As New IO.DirectoryInfo(Utilities.PosterCachePath)
- Dim Filelist() = Files.GetFiles()
- For Each f In Filelist
- Utilities.SafeDeleteFile(f.FullName)
- Next
- End If
- End Sub
-
- Sub util_MainFormTitleUpdate()
- 'Update Main Form Window Title to show Currrent Version
- Dim sAssemblyVersion As String = Trim(System.Reflection.Assembly.GetExecutingAssembly.FullName.Split(",")(1))
- sAssemblyVersion = Microsoft.VisualBasic.Right(sAssemblyVersion, 7) 'Cuts Version=3.4.0.2 down to just 3.4.0.2
- Dim codebase As String = If(Environment.Is64BitProcess, "64Bit", "32Bit")
- If workingProfile.profilename.ToLower = "default" Then
- Me.Text = "Media Companion - V" & sAssemblyVersion & " - " & codebase
- Else
- Me.Text = "Media Companion - V" & sAssemblyVersion & " - " & codebase & " - " & workingProfile.profilename
- End If
-
- End Sub
-
- Sub mov_SplitContainerAutoPosition()
- 'Set Movie Splitter Auto Position
- Dim pic1ratio As Decimal
- Dim pic2ratio As Decimal
- Try
- If Not IsNothing(PbMovieFanArt.Image) Then
- Dim pic1ImSzW = PbMovieFanArt.Image.Size.Width 'original picture sizes
- Dim pic1ImszH = PbMovieFanArt.Image.Size.Height
- Dim pic2ImSzW = PbMoviePoster.Image.Size.Width
- Dim pic2ImszH = PbMoviePoster.Image.Size.Height
- pic1ratio = pic1ImSzW / pic1ImszH
- pic2ratio = pic2ImSzW / pic2ImszH
- Dim width As Integer = SplitContainer2.Size.Width
- ' MsgBox(from & " = " & width & ":" & Int(SplitContainer2.Size.Width * (pic1ratio / (pic1ratio + pic2ratio))) - 5 & " - " & pic1ImSzW & "x" & pic1ImszH & " " & pic2ImszH & "x" & pic2ImSzW)
- Else
- pic1ratio = 2
- pic2ratio = 1
- End If
- Catch ex As Exception
- pic1ratio = 2
- pic2ratio = 1
- 'MsgBox("Movie Splitter Exception")
- End Try
- SplitContainer2.SplitterDistance = (SplitContainer2.Size.Width - 8) * (pic1ratio / (pic1ratio + pic2ratio))
- End Sub
-
- Sub tv_SplitContainerAutoPosition()
- 'Set TVShow Splitter Auto Position
- Dim pic3ratio As Decimal
- Dim pic4ratio As Decimal
- Dim HorizontalSplit As Decimal
- Try
- If (tv_PictureBoxLeft.Image IsNot Nothing AndAlso tv_PictureBoxRight.Image IsNot Nothing) Then
- Dim pic3ImSzW = tv_PictureBoxLeft.Image.Size.Width
- Dim pic3ImszH = tv_PictureBoxLeft.Image.Size.Height
- Dim pic4ImSzW = tv_PictureBoxRight.Image.Size.Width
- Dim pic4ImszH = tv_PictureBoxRight.Image.Size.Height
- pic3ratio = pic3ImSzW / pic3ImszH
- pic4ratio = pic4ImSzW / pic4ImszH
- HorizontalSplit = ((SplitContainer4.Size.Width - 8) * (pic3ratio / (pic3ratio + pic4ratio)) / pic3ratio)
- Else
- pic3ratio = 2
- pic4ratio = 1
- HorizontalSplit = 235
- End If
- Catch ex As Exception
- pic3ratio = 2
- pic4ratio = 1
- HorizontalSplit = 235
- End Try
- SplitContainer4.SplitterDistance = (SplitContainer4.Size.Width - 8) * (pic3ratio / (pic3ratio + pic4ratio))
- Try 'Try Catch for minimize of MC when Full-screen
- If _tv_SplitContainer.Height > 100 Then
- If Pref.tvbannersplit = 0 Then
- _tv_SplitContainer.SplitterDistance = HorizontalSplit
- Else
- _tv_SplitContainer.SplitterDistance = _tv_SplitContainer.Height * Pref.tvbannersplit
- End If
- End If
- Catch
- End Try
- End Sub
-
- Public Sub mov_CacheLoad()
- mov_PreferencesDisplay
- oMovies.LoadCaches
- If oMovies.MovieCache.Count = 0 Then
- mov_RebuildMovieCaches
- Return
- End If
- filteredList.Clear
- filteredList.AddRange(oMovies.MovieCache)
- Mc.clsGridViewMovie.mov_FiltersAndSortApply(Me)
- If DataGridViewMovies.Rows.Count > 0 then
- DataGridViewMovies.Rows(0).Selected = True
- End If
- mov_FormPopulate
- End Sub
-
- Public Sub util_RegexLoad()
- Dim tempstring As String
- tempstring = workingProfile.regexlist
- Pref.tv_RegexScraper.Clear()
- Pref.tv_RegexRename.Clear()
- Dim path As String = tempstring
- Dim createDefaultRegexScrape As Boolean = True
- Dim createDefaultRegexRename As Boolean = True
-
- If File.Exists(path) Then
- Try
- Dim regexList As New XmlDocument
- regexList.Load(path)
- If regexList.DocumentElement.Name = "regexlist" Then
- For Each result As XmlElement In regexList("regexlist")
- Select Case result.Name
- Case "tvregex" 'This is the old tag before custom renamer was introduced,
- Pref.tv_RegexScraper.Add(result.InnerText) 'so add it to the scraper regex list in case there are custom regexs.
- createDefaultRegexScrape = False 'The rename regex will not be flagged so regex.xml will be created as new format.
- Case "tvregexscrape"
- Pref.tv_RegexScraper.Add(result.InnerText)
- createDefaultRegexScrape = False
- Case "tvregexrename"
- Pref.tv_RegexRename.Add(result.InnerText)
- createDefaultRegexRename = False
- End Select
- Next
- End If
- Catch ex As Exception
- Call util_RegexSave(True, True)
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End If
- If createDefaultRegexScrape Or createDefaultRegexRename Then
- Call util_RegexSave(createDefaultRegexScrape, createDefaultRegexRename) 'Valid regex XML doc not available, so create default one.
- End If
- End Sub
-
- Public Sub util_RegexSave(Optional ByVal setScraperDefault As Boolean = False, Optional ByVal setRenameDefault As Boolean = False)
-
- Dim path As String = workingProfile.regexlist
- Dim doc As New XmlDocument
- Dim xmlProc As XmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes")
- Dim root As XmlElement
- Dim child As XmlElement
- If setScraperDefault = True Then Pref.util_RegexSetDefaultScraper()
- If setRenameDefault = True Then Pref.util_RegexSetDefaultRename()
- doc.AppendChild(xmlProc)
- root = doc.CreateElement("regexlist")
-
- For Each Regex In Pref.tv_RegexScraper
- child = doc.CreateElement("tvregexscrape")
- child.InnerText = Regex
- root.AppendChild(child)
- Next
-
- For Each Regex In Pref.tv_RegexRename
- child = doc.CreateElement("tvregexrename")
- child.InnerText = Regex
- root.AppendChild(child)
- Next
-
- doc.AppendChild(root)
-
- Try
- Using output As New XmlTextWriter(path, System.Text.Encoding.UTF8) With {.Formatting = Formatting.Indented}
- '"D:\Dados de Utilizador\Freddy Krueger\Ambiente de Trabalho\MediaCompanion-EVRSOEIRANAS\Settings\regex.xml"
- doc.WriteTo(output)
- output.Close()
- End Using
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End Sub
-
- Private Sub GenreMasterLoad()
- genrelist.Clear()
- genrelist = Utilities.loadGenre
- End Sub
-
- Private Sub util_GenreLoad()
- If Not File.Exists(workingProfile.Genres) Then Exit Sub
- Dim line As String = String.Empty
- Dim listof As New List(Of String)
- listof.Clear()
- genrelist.Sort()
- Try
- Dim userConfig As StreamReader = File.OpenText(workingProfile.Genres)
- Do
- Try
- line = userConfig.ReadLine
- If line = Nothing Then Continue Do
- Dim regexMatch As Match
- regexMatch = Regex.Match(line, "<([\d]{2,3})>")
- If regexMatch.Success = False AndAlso (genrelist.FindIndex(Function(x) x.Equals(line.trim, StringComparison.OrdinalIgnoreCase) ) = -1) Then
- listof.Add(line.trim)
- End If
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- Loop Until line = Nothing
- userConfig.Close()
- userConfig = Nothing
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- If listof.Count > 0 Then
- If Pref.GenreCustomBefore Then
- listof.Sort()
- genrelist.Sort()
- genrelist.InsertRange(0, listof)
- Else
- genrelist.AddRange(listof)
- genrelist.Sort()
- End If
- End If
- End Sub
-
- Private Sub util_PrefsLoad()
- Dim tempstring As String
- For Each prof In profileStruct.ProfileList
- If prof.profilename = workingProfile.profilename Then
- tempstring = prof.Config
- If IO.File.Exists(tempstring) Then Pref.configpath = tempstring
- Pref.configpath = tempstring
- Pref.SetUpPreferences()
- Pref.ConfigLoad()
- If Pref.CheckForNewVersion Then
- BckWrkCheckNewVersion.RunWorkerAsync(False)
- Do Until Not BckWrkCheckNewVersion.IsBusy
- Application.DoEvents()
- Loop
- If CloseMC AndAlso Pref.CloseMCForDLNewVersion Then
- frmSplash.Close()
- Process.GetCurrentProcess.Kill()
- Application.Exit()
- Me.Close()
- Else
- CloseMC = False
- End If
- End If
- Me.util_ConfigLoad()
- End If
- Next
- For Each item In Pref.moviesets
- cbMovieDisplay_MovieSet.Items.Add(If(Pref.MovSetTitleIgnArticle, Pref.RemoveIgnoredArticles(item), item))
- Next
- End Sub
-
- Private Sub util_ProfilesLoad()
- profileStruct.ProfileList.Clear()
- Dim profilepath As String = IO.Path.Combine(applicationPath, "Settings")
- profilepath = IO.Path.Combine(profilepath, "profile.xml")
-
- Dim notportable As Boolean = False
- Dim path As String = profilepath
- If IO.File.Exists(path) Then
- Try
- Dim profilelist As New XmlDocument
- profilelist.Load(path)
- If profilelist.DocumentElement.Name = "profile" Then
- For Each thisresult In profilelist("profile")
- Select Case thisresult.Name
- Case "default"
- profileStruct.DefaultProfile = thisresult.innertext
- Case "startup"
- profileStruct.StartupProfile = thisresult.innertext
- Case "profiledetails"
- Dim currentprofile As New ListOfProfiles
- Dim result As XmlNode
- For Each result In thisresult.childnodes
- Dim t As Integer = result.innertext.ToString.ToLower.IndexOf("\s")
- If t > 0 Then notportable = True
- Select Case result.name
- Case "actorcache"
- Dim s As String = result.innertext.ToString.Substring(t)
- currentprofile.ActorCache = applicationPath & s
- Case "directorcache"
- Dim s As String = result.innertext.ToString.Substring(t)
- currentprofile.DirectorCache = applicationPath & s
- Case "config"
- Dim s As String = result.innertext.ToString.Substring(t)
- currentprofile.Config = applicationPath & s
- Case "moviecache"
- Dim s As String = result.innertext.ToString.Substring(t)
- currentprofile.MovieCache = applicationPath & s
- Case "profilename"
- currentprofile.ProfileName = result.innertext
- Case "regex"
- Dim s As String = result.innertext.ToString.Substring(t)
- currentprofile.RegExList = applicationPath & s
- Case "genres"
- Dim s As String = ""
- If result.innertext = "" Then
- s = "\Settings\genres.txt" 'incase missing from existing profile.xml
- Else
- s = result.innertext.ToString.Substring(t)
- End If
- currentprofile.Genres = applicationPath & s
- Case "tvcache"
- Dim s As String = result.innertext.ToString.Substring(t)
- currentprofile.TvCache = applicationPath & s
- Case "musicvideocache"
- Dim s As String = result.innertext.ToString.Substring(t)
- currentprofile.MusicVideoCache = applicationPath & s
- Case "moviesetcache"
- Dim s As String = result.innertext.ToString.Substring(t)
- currentprofile.MovieSetCache = applicationPath & s
- Case "customtvcache"
- Dim s As String = result.InnerText.ToString.Substring(t)
- currentprofile.CustomTvCache = applicationPath & s
- End Select
- Next
- profileStruct.ProfileList.Add(currentprofile)
- End Select
- Next
- End If
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
-
- End Try
- Else
-
- End If
-
- If notportable Then util_ProfileSave()
-
- If profileStruct.ProfileList.Count > 1 Then
- ProfilesToolStripMenuItem.Visible = True
- ProfilesToolStripMenuItem.Enabled = True
- ProfilesToolStripMenuItem.DropDownItems.Clear()
-
- For Each prof In profileStruct.ProfileList
- If prof.ProfileName <> Nothing Then
- ProfilesToolStripMenuItem.DropDownItems.Add(prof.ProfileName)
- End If
- Next
- For Each item In ProfilesToolStripMenuItem.DropDownItems
- If item.text = workingProfile.profilename Then
- With item
- item.checked = True
- End With
- Else
- item.checked = False
- End If
- Next
- End If
- End Sub
-
- Public Sub util_ProfileSave()
- Dim profilepath As String = IO.Path.Combine(applicationPath, "Settings")
- profilepath = IO.Path.Combine(profilepath, "profile.xml")
-
- Dim doc As New XmlDocument
-
- Dim thispref As XmlNode = Nothing
- Dim xmlproc As XmlDeclaration
-
- xmlproc = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes")
- doc.AppendChild(xmlproc)
- Dim root As XmlElement
- Dim child As XmlElement
- Dim childchild As XmlElement
- root = doc.CreateElement("profile")
- child = doc.CreateElement("default")
- child.InnerText = profileStruct.DefaultProfile
- root.AppendChild(child)
- child = doc.CreateElement("startup")
- child.InnerText = profileStruct.StartupProfile
- root.AppendChild(child)
- doc.AppendChild(root)
-
-
- For Each prof In profileStruct.ProfileList
- child = doc.CreateElement("profiledetails")
-
- childchild = doc.CreateElement("actorcache") : childchild.InnerText = prof.ActorCache.Replace(applicationPath, "")
- child.AppendChild(childchild)
-
- childchild = doc.CreateElement("directorcache") : childchild.InnerText = prof.DirectorCache.Replace(applicationPath, "")
- child.AppendChild(childchild)
-
- childchild = doc.CreateElement("config") : childchild.InnerText = prof.Config.Replace(applicationPath, "")
- child.AppendChild(childchild)
-
- childchild = doc.CreateElement("moviecache") : childchild.InnerText = prof.MovieCache.Replace(applicationPath, "")
- child.AppendChild(childchild)
-
- childchild = doc.CreateElement("profilename") : childchild.InnerText = prof.ProfileName
- child.AppendChild(childchild)
-
- childchild = doc.CreateElement("regex") : childchild.InnerText = prof.RegExList.Replace(applicationPath, "")
- child.AppendChild(childchild)
-
- childchild = doc.CreateElement("genres") : childchild.InnerText = prof.Genres.Replace(applicationPath, "")
- child.AppendChild(childchild)
-
- childchild = doc.CreateElement("tvcache") : childchild.InnerText = prof.TvCache.Replace(applicationPath, "")
- child.AppendChild(childchild)
-
- childchild = doc.CreateElement("musicvideocache") : childchild.InnerText = prof.MusicVideoCache.Replace(applicationPath, "")
- child.AppendChild(childchild)
-
- childchild = doc.CreateElement("moviesetcache") : childchild.InnerText = prof.MovieSetCache.Replace(applicationPath, "")
- child.AppendChild(childchild)
-
- childchild = doc.CreateElement("customtvcache") : childchild.InnerText = prof.CustomTvCache.Replace(applicationPath, "")
- child.AppendChild(childchild)
-
- root.AppendChild(child)
- Next
-
- doc.AppendChild(root)
- Dim saveing As New XmlTextWriter(profilepath, System.Text.Encoding.UTF8)
- saveing.Formatting = Formatting.Indented
- doc.WriteTo(saveing)
- saveing.Close()
-
- If profileStruct.ProfileList.Count > 1 Then
- ProfilesToolStripMenuItem.Visible = True
- ProfilesToolStripMenuItem.Enabled = True
- ProfilesToolStripMenuItem.DropDownItems.Clear()
- For Each prof In profileStruct.ProfileList
- If prof.ProfileName <> Nothing Then
- ProfilesToolStripMenuItem.DropDownItems.Add(prof.ProfileName)
- End If
- Next
- For Each item In ProfilesToolStripMenuItem.DropDownItems
- If item.text = workingProfile.profilename Then
- With item
- item.checked = True
- End With
- Else
- item.checked = False
- End If
- Next
- End If
- End Sub
-
- Private Sub util_CommandListLoad()
- For Each com In Pref.commandlist
- ToolsToolStripMenuItem.DropDownItems.Add(com.title)
- Next
- End Sub
-
- Private Sub mov_ActorRebuild()
- oMovies.RebuildMoviePeopleCaches
- End Sub
-
- Private Sub MovToggleReset()
- MovFanartToggle = False
- MovPosterToggle = False
- btnMovFanartToggle.Text = "Show MovieSet Fanart"
- btnMovFanartToggle.BackColor = System.Drawing.Color.Lime
- btnMovPosterToggle.Text = "Show MovieSet Posters"
- btnMovPosterToggle.BackColor = System.Drawing.Color.Lime
- btn_IMPA_posters.Enabled = True
- btn_MPDB_posters.Enabled = True
- btn_IMDB_posters.Enabled = True
- End Sub
-
- Public Sub mov_FormPopulate(Optional yieldIng As Boolean=False)
-
- If Not IsNothing(workingMovieDetails) Then
- If workingMovie.fullpathandfilename <> workingMovieDetails.fileinfo.fullpathandfilename Then
- Try
- For i = panelAvailableMoviePosters.Controls.Count - 1 To 0 Step -1
- panelAvailableMoviePosters.Controls.RemoveAt(i)
- Next
- Catch
- End Try
- Try
- For i = Panel2.Controls.Count - 1 To 0 Step -1
- Panel2.Controls.RemoveAt(i)
- Next
- MovToggleReset()
- Catch
- End Try
- Try
- TextBox8.Text = ""
- Catch
- End Try
- End If
- End If
-
- If Yield(yieldIng) Then Return
-
- If workingMovie.fullpathandfilename <> Nothing And DataGridViewMovies.Rows.Count > 0 Then
- workingMovieDetails = WorkingWithNfoFiles.mov_NfoLoadFull(workingMovie.fullpathandfilename)
-
- If Yield(yieldIng) Then Return
-
- If IsNothing(workingMovieDetails) = False Then
- If workingMovieDetails.fullmoviebody.playcount = Nothing Then workingMovieDetails.fullmoviebody.playcount = "0"
- If workingMovieDetails.fullmoviebody.lastplayed = Nothing Then workingMovieDetails.fullmoviebody.lastplayed = ""
- If workingMovieDetails.fullmoviebody.credits = Nothing Then workingMovieDetails.fullmoviebody.credits = ""
- If workingMovieDetails.fullmoviebody.director = Nothing Then workingMovieDetails.fullmoviebody.director = ""
- If workingMovieDetails.fullmoviebody.stars = Nothing Then workingMovieDetails.fullmoviebody.stars = ""
- If workingMovieDetails.fullmoviebody.filename = Nothing Then workingMovieDetails.fullmoviebody.filename = ""
- If workingMovieDetails.fullmoviebody.genre = Nothing Then workingMovieDetails.fullmoviebody.genre = ""
- If workingMovieDetails.fullmoviebody.imdbid = Nothing Then workingMovieDetails.fullmoviebody.imdbid = ""
- If workingMovieDetails.fullmoviebody.mpaa = Nothing Then workingMovieDetails.fullmoviebody.mpaa = ""
- If workingMovieDetails.fullmoviebody.outline = Nothing Then workingMovieDetails.fullmoviebody.outline = ""
- If workingMovieDetails.fullmoviebody.playcount = Nothing Then workingMovieDetails.fullmoviebody.playcount = ""
- If workingMovieDetails.fullmoviebody.plot = Nothing Then workingMovieDetails.fullmoviebody.plot = ""
- If workingMovieDetails.fullmoviebody.premiered = Nothing Then workingMovieDetails.fullmoviebody.premiered = ""
- If workingMovieDetails.fullmoviebody.rating = Nothing Then workingMovieDetails.fullmoviebody.rating = ""
- If workingMovieDetails.fullmoviebody.runtime = Nothing Then workingMovieDetails.fullmoviebody.runtime = ""
- If workingMovieDetails.fullmoviebody.studio = Nothing Then workingMovieDetails.fullmoviebody.studio = ""
- If workingMovieDetails.fullmoviebody.tagline = Nothing Then workingMovieDetails.fullmoviebody.tagline = ""
- If workingMovieDetails.fullmoviebody.title = Nothing Then workingMovieDetails.fullmoviebody.title = ""
- If workingMovieDetails.fullmoviebody.originaltitle = Nothing Then workingMovieDetails.fullmoviebody.originaltitle = ""
- If workingMovieDetails.fullmoviebody.top250 = Nothing Then workingMovieDetails.fullmoviebody.top250 = ""
- If workingMovieDetails.fullmoviebody.trailer = Nothing Then workingMovieDetails.fullmoviebody.trailer = ""
- If workingMovieDetails.fullmoviebody.votes = Nothing Then workingMovieDetails.fullmoviebody.votes = ""
- If workingMovieDetails.fullmoviebody.year = Nothing Then workingMovieDetails.fullmoviebody.year = ""
- If workingMovieDetails.fullmoviebody.source = Nothing Then workingMovieDetails.fullmoviebody.source = ""
-
- titletxt.Items.Clear()
-
- titletxt.Items.Add(workingMovieDetails.fullmoviebody.title)
- For Each title In workingMovieDetails.alternativetitles
- titletxt.Items.Add(title)
- Next
- titletxt.Text = workingMovieDetails.fullmoviebody.title
- TextBox3.Text = workingMovieDetails.fullmoviebody.title & " (" & workingMovieDetails.fullmoviebody.year & ")"
- tbCurrentMoviePoster.Text = workingMovieDetails.fullmoviebody.title & " (" & workingMovieDetails.fullmoviebody.year & ")"
- Me.ToolTip1.SetToolTip(Me.titletxt, "Original Title: '" & workingMovieDetails.fullmoviebody.originaltitle & "'")
- If workingMovieDetails.fullmoviebody.sortorder = "" Then workingMovieDetails.fullmoviebody.sortorder = workingMovieDetails.fullmoviebody.title
- TextBox34.Text = workingMovieDetails.fullmoviebody.sortorder
- outlinetxt.Text = workingMovieDetails.fullmoviebody.outline
- plottxt.Text = workingMovieDetails.fullmoviebody.plot
- taglinetxt.Text = workingMovieDetails.fullmoviebody.tagline
- txtStars.Text = workingMovieDetails.fullmoviebody.stars
- genretxt.Text = workingMovieDetails.fullmoviebody.genre
- premiertxt.Text = workingMovieDetails.fullmoviebody.premiered
- creditstxt.Text = workingMovieDetails.fullmoviebody.credits
- directortxt.Text = workingMovieDetails.fullmoviebody.director
- studiotxt.Text = workingMovieDetails.fullmoviebody.studio
- countrytxt.Text = workingMovieDetails.fullmoviebody.country
- pathtxt.Text = workingMovie.fullpathandfilename
- ratingtxt.Text = workingMovieDetails.fullmoviebody.rating.FormatRating
- cbUsrRated.Text = If(workingMovieDetails.fullmoviebody.usrrated = "0", "None", workingMovieDetails.fullmoviebody.usrrated)
- SetTagTxtField
- tagtxt.Text = ""
- tb_tagtxt_changed = False
- If workingMovieDetails.fullmoviebody.tag.Count <> 0 Then
- Dim first As Boolean = True
- For Each t In workingMovieDetails.fullmoviebody.tag
- If Not first Then tagtxt.Text &= ", "
- tagtxt.Text &= t
- first = False
- Next
- End If
- 'Catch exception thrown when votes is an empty string
- If workingMovieDetails.fullmoviebody.votes <> "" Then
- Dim votestext As String = workingMovieDetails.fullmoviebody.votes
- votestext = votestext.RemoveWhitespace
- votestxt.Text = Double.Parse(votestext.Replace(".",",")).ToString("N0")
- Else
- votestxt.Text = workingMovieDetails.fullmoviebody.votes
- End If
- certtxt.Text = workingMovieDetails.fullmoviebody.mpaa
- If lbl_movTop250.Text = "Top 250" Then
- top250txt.Text = workingMovieDetails.fullmoviebody.top250
- Else
- top250txt.Text = workingMovieDetails.fullmoviebody.metascore
- End If
- 'top250txt.Text = workingMovieDetails.fullmoviebody.top250
- If Pref.movieRuntimeDisplay = "file" Then
- displayRuntimeScraper = False
- Else
- displayRuntimeScraper = True
- End If
- Call mov_SwitchRuntime()
-
- workingMovieDetails.fileinfo.fullpathandfilename = workingMovie.fullpathandfilename
- workingMovieDetails.fileinfo.filename = IO.Path.GetFileName(workingMovie.fullpathandfilename)
- workingMovieDetails.fileinfo.path = IO.Path.GetFullPath(workingMovie.fullpathandfilename)
- workingMovieDetails.fileinfo.foldername = workingMovie.foldername
- workingMovieDetails.fileinfo.trailerpath = pref.ActualTrailerPath(workingMovieDetails.fileinfo.path)
- If Yield(yieldIng) Then Return
- HandleTrailerBtn(workingMovieDetails)
- If Yield(yieldIng) Then Return
- If workingMovieDetails.fileinfo.posterpath <> Nothing Then
-
- If Not File.Exists(workingMovieDetails.fileinfo.posterpath) Then
- If IO.File.Exists(workingMovieDetails.fileinfo.posterpath.Replace(IO.Path.GetFileName(workingMovieDetails.fileinfo.fanartpath), "folder.jpg")) Then
- workingMovieDetails.fileinfo.posterpath = workingMovieDetails.fileinfo.posterpath.Replace(IO.Path.GetFileName(workingMovieDetails.fileinfo.posterpath), "folder.jpg")
- End If
- End If
-
- End If
- If Yield(yieldIng) Then Return
- If workingMovieDetails.fileinfo.posterpath <> Nothing Then
- Dim workingposter As String = workingMovieDetails.fileinfo.posterpath
- util_ImageLoad(PbMoviePoster, workingposter, Utilities.DefaultPosterPath)
- If Yield(yieldIng) Then Return
- util_ImageLoad(PictureBoxAssignedMoviePoster, workingposter, Utilities.DefaultPosterPath)
- If Yield(yieldIng) Then Return
- lblCurrentLoadedPoster.Text = "Width: " & PictureBoxAssignedMoviePoster.Image.Width.ToString & " Height: " & PictureBoxAssignedMoviePoster.Image.Height.ToString
- lblMovPosterPages.Visible = False
- End If
- If workingMovieDetails.fileinfo.fanartpath <> Nothing Then
- Dim workingfanart As String = workingMovieDetails.fileinfo.fanartpath
- util_ImageLoad(PbMovieFanArt, workingfanart, Utilities.DefaultFanartPath)
- End If
-
- If Yield(yieldIng) Then Return
-
- If Convert.ToInt32(workingMovieDetails.fullmoviebody.playcount) > 0 Then
- btnMovWatched.Text = "&Watched"
- btnMovWatched.BackColor = Color.LawnGreen
- btnMovWatched.Refresh()
- Else
- btnMovWatched.Text = "Un&watched"
- btnMovWatched.BackColor = Color.Red
- btnMovWatched.Refresh()
- End If
-
- cbMovieDisplay_Actor.Items.Clear()
- For Each actor In workingMovieDetails.listactors
- If actor.actorname <> Nothing Then cbMovieDisplay_Actor.Items.Add(actor.actorname)
- Next
-
- If cbMovieDisplay_Actor.Items.Count > 0 Then
- cbMovieDisplay_Actor.SelectedIndex = 0
- Else
- util_ImageLoad(PictureBoxActor, Utilities.DefaultActorPath, Utilities.DefaultActorPath)
- End If
-
- Dim fi As New FilteredItems(cbFilterActor)
- fi.SelectFirstMatch(cbMovieDisplay_Actor)
-
- If Yield(yieldIng) Then Return
-
- If workingMovieDetails.fullmoviebody.MovieSet.MovieSetName <> "-None-" And workingMovieDetails.fullmoviebody.MovieSet.MovieSetName <> "" Then
- Dim add As Boolean = True
- For Each item In Pref.moviesets
- If item = workingMovieDetails.fullmoviebody.MovieSet.MovieSetName Then
- add = False
- Exit For
- End If
- Next
- If add Then
- Pref.moviesets.Add(workingMovieDetails.fullmoviebody.MovieSet.MovieSetName)
- End If
- End If
-
- cbMovieDisplay_MovieSet.SelectedItem=Nothing
-
- pop_cbMovieDisplay_MovieSet
-
- For f = 0 To cbMovieDisplay_Source.Items.Count - 1
- If cbMovieDisplay_Source.Items(f) = workingMovieDetails.fullmoviebody.source Then
- cbMovieDisplay_Source.SelectedIndex = f
- Exit For
- End If
- Next
-
- btnPlayMovie.Enabled = True
- mov_SplitContainerAutoPosition
-
- Dim video_flags = VidMediaFlags(workingMovieDetails.filedetails, workingMovieDetails.fullmoviebody.title.ToLower.Contains("3d"))
- movieGraphicInfo.OverlayInfo(PbMovieFanArt, ratingtxt.Text, video_flags,workingMovie.DisplayFolderSize)
- MovPanel6Update()
- End If
- Else
- cbMovieDisplay_Actor.Items.Clear()
- PictureBoxActor.CancelAsync()
- PictureBoxActor.Image = Nothing
- PictureBoxActor.Refresh()
-
- btnMoviePosterSaveCroppedImage.Enabled = False
- btnMoviePosterResetImage.Enabled = False
- thumbedItsMade = False
- cbMoviePosterSaveLoRes.Enabled = False
- btnPosterTabs_SaveImage.Enabled = False
- btnMovPosterNext.Visible = False
- btnMovPosterPrev.Visible = False
- lblMovPosterPages.Visible = False
- titletxt.Text = ""
- TextBox3.Text = ""
- outlinetxt.Text = ""
- plottxt.Text = ""
- taglinetxt.Text = ""
- txtStars.Text = ""
- genretxt.Text = ""
- premiertxt.Text = ""
- creditstxt.Text = ""
- directortxt.Text = ""
- studiotxt.Text = ""
- countrytxt.Text = ""
- pathtxt.Text = ""
- cbUsrRated.SelectedIndex = -1
- ratingtxt.Text = ""
- runtimetxt.Text = ""
- votestxt.Text = ""
- top250txt.Text = ""
- certtxt.Text = ""
- PbMovieFanArt.Image = Nothing
- PictureBox2.Image = Nothing
- PbMoviePoster.Image = Nothing
- lblMovFanartWidth.Text = ""
- lblMovFanartHeight.Text = ""
- PictureBoxAssignedMoviePoster.Image = Nothing
- lblCurrentLoadedPoster.Text = ""
- TextBox34.Text = ""
- titletxt.Text = ""
- tagtxt.Text = "" : tb_tagtxt_changed = False
- roletxt.Text = ""
- PictureBoxActor.Image = Nothing
- Panel6.Visible = False
- FanTvArtList.Items.Clear()
- btnPlayMovie.Enabled = False
- Me.Refresh()
- Application.DoEvents()
- End If
- If ratingtxt.Text.IndexOf("/10") <> -1 Then
- ratingtxt.Text = ratingtxt.Text.Replace("/10", "")
- workingMovieDetails.fullmoviebody.rating = ratingtxt.Text
- End If
-
- If ratingtxt.Text.Length > 3 Then
- ratingtxt.Text = ratingtxt.Text.Substring(0, 3).Trim
- End If
-
- If Yield(yieldIng) Then Return
- GC.Collect()
- End Sub
-
- Private Sub Mov_PictureboxLoad()
- util_ImageLoad(PbMoviePoster, workingMovieDetails.fileinfo.posterpath, Utilities.DefaultPosterPath)
- util_ImageLoad(PbMovieFanArt, workingMovieDetails.fileinfo.fanartpath, Utilities.DefaultPosterPath)
- End Sub
-
- Public Function CheckforExtraArt() As Boolean
- Dim confirmedpresent As Boolean = False
- If File.Exists(workingMovieDetails.fileinfo.movsetposterpath) Then FanTvArtList.Items.Add("Set Poster") : confirmedpresent = True
- If File.Exists(workingMovieDetails.fileinfo.movsetfanartpath) Then FanTvArtList.Items.Add("Set Fanart") : confirmedpresent = True
- If Not Pref.GetRootFolderCheck(workingMovieDetails.fileinfo.fullpathandfilename) Then
- Dim MovPath As String = IO.Path.GetDirectoryName(workingMovieDetails.fileinfo.fullpathandfilename) & "\"
- If Pref.MovFanartNaming Then MovPath = workingMovieDetails.fileinfo.fullpathandfilename.Replace(".nfo", "-")
- If File.Exists(MovPath & "clearart.png") Then FanTvArtList.Items.Add("ClearArt") : confirmedpresent = True
- If File.Exists(MovPath & "logo.png") Then FanTvArtList.Items.Add("Logo") : confirmedpresent = True
- If File.Exists(MovPath & "banner.jpg") Then FanTvArtList.Items.Add("Banner") : confirmedpresent = True
- If File.Exists(MovPath & "landscape.jpg") Then FanTvArtList.Items.Add("Landscape") : confirmedpresent = True
- If File.Exists(MovPath & "disc.png") Then FanTvArtList.Items.Add("Disc") : confirmedpresent = True
- If File.Exists(MovPath & "poster.jpg") AndAlso Not Pref.posterjpg AndAlso Not Pref.MovFanartNaming Then FanTvArtList.Items.Add("Poster") : confirmedpresent = True
- If File.Exists(MovPath & "fanart.jpg") AndAlso Not Pref.fanartjpg AndAlso Not Pref.MovFanartNaming Then FanTvArtList.Items.Add("Fanart") : confirmedpresent = True
- If File.Exists(MovPath & "folder.jpg") Then FanTvArtList.Items.Add("Folder") : confirmedpresent = True
- End If
- Return confirmedpresent
- End Function
-
- Public Sub MovPanel6Update()
- FanTvArtList.Items.Clear()
- Panel6.Visible = CheckforExtraArt()
- End Sub
-
- Private Sub FanTvArtList_Mouse(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles FanTvArtList.MouseDown
- Dim imagepath As String = Nothing
- Dim item As String = Nothing
- Dim pbheight As Integer = 112
- If e.button = Windows.Forms.MouseButtons.Right Then
- Dim index As Integer = FanTvArtList.IndexFromPoint(New Point(e.X, e.Y))
- If index >= 0 Then FanTvArtList.SelectedItem = FanTvArtList.Items(index)
- End If
- If IsNothing(FanTvArtList.SelectedItem) Then Exit Sub
- item = FanTvArtList.SelectedItem.ToString.ToLower
- If Not String.IsNullOrEmpty(item) Then
- If item.ToLower = "set poster" Or item.ToLower = "set fanart" Then
- If item.ToLower = "set poster" Then
- imagepath = workingMovieDetails.fileinfo.movsetposterpath
- Else
- imagepath = workingMovieDetails.fileinfo.movsetfanartpath
- End If
- Else
- If Pref.MovFanartNaming Then
- imagepath = workingMovieDetails.fileinfo.fullpathandfilename.Replace(".nfo", "-")
- Else
- imagepath = IO.Path.GetDirectoryName(workingMovieDetails.fileinfo.fullpathandfilename) & "\"
- End If
-
- Dim suffix As String = If((item = "clearart" or item = "logo" or item = "disc"),".png", ".jpg")
- imagepath &= item & suffix
- End If
-
- End If
- If e.Button = Windows.Forms.MouseButtons.Left Then
- ftvArtPicBox.Visible = True
- If IsNothing(imagepath) Then Exit Sub
- util_ImageLoad(ftvArtPicBox, imagepath, "")
- Try
- Dim panelwidth As Integer = SplitContainer1.Panel2.Width
- Dim panelheight As Integer = SplitContainer1.Panel2.Height
- Dim pbw As Integer = Math.Ceiling(panelwidth*.413)
- Dim pbh As Integer = Math.Ceiling(PbMovieFanArt.Height*.90)
- Dim imgw As Integer = ftvArtPicBox.Image.Width
- Dim imgh As Integer = ftvArtPicBox.Image.Height
- If item.ToLower.Contains("poster") Or item.ToLower.Contains("disc") Then
- ftvArtPicBox.Height = pbh
- ftvArtPicBox.Width = Math.Ceiling(pbh/(imgh/imgw))
- ftvArtPicBox.Location = New System.Drawing.Point(Math.Ceiling((panelwidth*.4)-(ftvArtPicBox.Width/2)), 45)
- Else
- ftvArtPicBox.Height = Math.Ceiling(pbw*(imgh/imgw))
- ftvArtPicBox.Width = pbw
- ftvArtPicBox.Location = New System.Drawing.Point(140, Math.Ceiling((panelheight*.3)-(ftvArtPicBox.Height/2)))
- End If
- Catch
- End Try
- ElseIf e.button = Windows.Forms.MouseButtons.Right Then
- Dim tempint = MessageBox.show("Do you wish to delete this image from" & vbCrLf & "this Movie?", "Fanart.Tv Artwork Delete", MessageBoxButtons.YesNoCancel)
- If tempint = Windows.Forms.DialogResult.No or tempint = DialogResult.Cancel Then Exit Sub
- If tempint = Windows.Forms.DialogResult.Yes Then
- Utilities.SafeDeleteFile(imagepath)
- MovPanel6Update()
- End If
- End If
- End Sub
-
- Private Sub FanTvArtList_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FanTvArtList.MouseLeave
- FanTvArtList.ClearSelected()
- ftvArtPicBox.Image = Nothing
- ftvArtPicBox.Visible = False
- End Sub
-
- Private Sub HandleTrailerBtn(ByVal fmd As FullMovieDetails)
-
- If IsNothing(fmd) Then
- Return
- End If
-
- DeleteZeroLengthFile(fmd.fileinfo.trailerpath)
-
- ButtonTrailer.Enabled = False
-
- If IO.File.Exists(fmd.fileinfo.trailerpath) Then
- ButtonTrailer.Text = "Play Trailer"
- ButtonTrailer.Enabled = True
- Else
- If fmd.fullmoviebody.trailer = ""
- ButtonTrailer.Text = "No trailer found"
- Else
- ButtonTrailer.Text = "Download Trailer"
- ButtonTrailer.Enabled = True
- End If
- End If
- End Sub
-
- Private Function mov_FileCheckValid(ByVal fullpathandfilename As String) As Boolean
- Dim validfile As Boolean = True
- Dim tempint2 As Integer = 0
- Dim tempstring As String
- Dim extension As String
- Dim tempname As String
-
- 'First check, is it a video file!
- extension = System.IO.Path.GetExtension(fullpathandfilename)
- Dim isvideofile As Boolean = False
- For Each extn In Utilities.VideoExtensions
- If extn = extension Then isvideofile = True
- Next
- If Not isvideofile Then Return False
-
- 'if the file is a .vob then check it is not part of a dvd folder (Stop dvdfolders vobs getting seperate nfos)
- If IO.Path.GetExtension(fullpathandfilename) = ".vob" Then
- If IO.File.Exists(fullpathandfilename.Replace(System.IO.Path.GetFileName(fullpathandfilename), "VIDEO_TS.IFO")) Then
- validfile = False
- End If
- End If
-
- Dim filename2 As String = System.IO.Path.GetFileName(fullpathandfilename).ToLower
- For each cleanmultipart In Utilities.cleanMultipart
- For Each separator In Utilities.separators
- For I = 2 To 5
- Dim lookfor As String = cleanmultipart & separator & I.ToString
- If filename2.IndexOf(cleanmultipart & separator & I.ToString) <> -1 Then validfile = False
- Next
- Next
- Next
- If filename2.IndexOf("-trailer") <> -1 Then validfile = False
- If filename2.IndexOf(".trailer") <> -1 Then validfile = False
- If filename2.IndexOf("_trailer") <> -1 Then validfile = False
- If filename2.IndexOf("-theme") <> -1 Then validfile = False
- If filename2.IndexOf(".theme") <> -1 Then validfile = False
- If filename2.IndexOf("_theme") <> -1 Then validfile = False
- If filename2.IndexOf("sample") <> -1 And filename2.IndexOf("people") = -1 Then validfile = False
-
-
- 'check for movies ending a,b,c, etc (moviea, movieb) for multipart. movieb is multipart if moviea exists
- 'extension = System.IO.Path.GetExtension(fullpathandfilename)
- tempname = fullpathandfilename.Replace(extension, "")
- If tempname.Substring(tempname.Length - 1) = "b" Or tempname.Substring(tempname.Length - 1) = "c" Or tempname.Substring(tempname.Length - 1) = "d" Or tempname.Substring(tempname.Length - 1) = "e" Or tempname.Substring(tempname.Length - 1) = "B" Or tempname.Substring(tempname.Length - 1) = "C" Or tempname.Substring(tempname.Length - 1) = "D" Or tempname.Substring(tempname.Length - 1) = "E" Then
- tempname = fullpathandfilename.Substring(0, fullpathandfilename.Length - (1 + extension.Length)) & "a" & extension
- If System.IO.File.Exists(tempname) Then validfile = False
- End If
-
- 'now need to deal with multipart rar files
- Dim tempmovie2 As String = fullpathandfilename.Replace(".nfo", ".rar")
- Dim tempmovie As String = String.Empty
- If IO.File.Exists(tempmovie2) = True Then
- If IO.File.Exists(fullpathandfilename) = False Then
- Dim rarname As String = tempmovie2
- Dim SizeOfFile As Integer = FileLen(rarname)
- tempint2 = Convert.ToInt32(Pref.rarsize) * 1048576
- If SizeOfFile > tempint2 Then
- Dim mat As Match
- mat = Regex.Match(rarname, "\.part[0-9][0-9]?[0-9]?[0-9]?.rar")
- If mat.Success = True Then
- rarname = mat.Value
- If rarname.ToLower.IndexOf(".part1.rar") <> -1 Or rarname.ToLower.IndexOf(".part01.rar") <> -1 Or rarname.ToLower.IndexOf(".part001.rar") <> -1 Or rarname.ToLower.IndexOf(".part0001.rar") <> -1 Then
- Dim stackrarexists As Boolean = False
- rarname = fullpathandfilename.Replace(".nfo", ".rar")
- If rarname.ToLower.IndexOf(".part1.rar") <> -1 Then
- rarname = rarname.Replace(".part1.rar", ".nfo")
- If IO.File.Exists(rarname) Then
- stackrarexists = True
- tempmovie = rarname
- Else
- stackrarexists = False
- tempmovie = rarname
- End If
- End If
- If rarname.ToLower.IndexOf(".part01.rar") <> -1 Then
- rarname = rarname.Replace(".part01.rar", ".nfo")
- If IO.File.Exists(rarname) Then
- stackrarexists = True
- tempmovie = rarname
- Else
- stackrarexists = False
- tempmovie = rarname
- End If
- End If
- If rarname.ToLower.IndexOf(".part001.rar") <> -1 Then
- rarname = rarname.Replace(".part001.rar", ".nfo")
- If IO.File.Exists(rarname) Then
- tempmovie = rarname
- stackrarexists = True
- Else
- stackrarexists = False
- tempmovie = rarname
- End If
- End If
- If rarname.ToLower.IndexOf(".part0001.rar") <> -1 Then
- rarname = rarname.Replace(".part0001.rar", ".nfo")
- If IO.File.Exists(rarname) Then
- tempmovie = rarname
- stackrarexists = True
- Else
- stackrarexists = False
- tempmovie = rarname
- End If
- End If
- If stackrarexists = True Then
- Dim allok As Boolean = False
- Try
- Dim filechck As IO.StreamReader = IO.File.OpenText(tempmovie)
- Do
-
- tempstring = filechck.ReadLine
- If tempstring = Nothing Then Exit Do
-
- If tempstring.IndexOf("<movie") <> -1 Then
- allok = True
- Exit Do
- End If
- Loop Until tempstring.IndexOf("</movie>") <> -1
- filechck.Close()
- filechck = Nothing
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- Finally
- End Try
- If allok = True Then
- validfile = False
- End If
- End If
- Else
- validfile = False
- End If
- End If
- Else
- validfile = False
- End If
- End If
- End If
-
- 'rename fullpathandfilename to that of the nfo file
- fullpathandfilename = fullpathandfilename.Replace(fullpathandfilename.Substring(fullpathandfilename.LastIndexOf("."), fullpathandfilename.Length - fullpathandfilename.LastIndexOf(".")), ".nfo")
-
- 'check for both variations of the filename
- Dim nfopaths(1) As String
- nfopaths(0) = fullpathandfilename
- nfopaths(1) = fullpathandfilename.Replace(IO.Path.GetFileName(fullpathandfilename), "movie.nfo")
- 'check if the file exists
- For f = 0 To 1
- If IO.File.Exists(nfopaths(f)) Then
- 'if it does check if it is a valid xbmc nfo, if it is not then move it or delete it according to prefs
- Try
- Dim filechck As IO.StreamReader = IO.File.OpenText(nfopaths(f))
- tempstring = filechck.ReadToEnd
- filechck.Close()
- If tempstring.IndexOf("<movie") = -1 And tempstring.IndexOf("</movie>") = -1 Then
- If Pref.renamenfofiles = True Then
- Dim fi As New IO.FileInfo(nfopaths(f))
- Dim newpath As String = nfopaths(f).Replace(nfopaths(f).Substring(nfopaths(f).LastIndexOf("."), nfopaths(f).Length - nfopaths(f).LastIndexOf(".")), ".info")
- fi.MoveTo(newpath)
- End If
- Else
- validfile = False
- End If
- filechck.Close()
- filechck = Nothing
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
-
- Finally
- End Try
- End If
- Next
- Return validfile
- End Function
-
- Private Sub DeleteZeroLengthFile(ByVal fileName)
-
- If IO.File.Exists(fileName) Then
- If (New IO.FileInfo(fileName)).Length = 0 Then
- Utilities.SafeDeleteFile(fileName)
- End If
- End If
-
- End Sub
-
- Private Sub ReloadMovieCacheToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReloadMovieCacheToolStripMenuItem.Click
- mov_CacheLoad()
- End Sub
-
- Private Sub StartVideo(ByVal tempstring As String)
- If Pref.videomode = 1 Then
- Call util_VideoMode(1, tempstring)
- Exit Sub
- End If
- If Pref.videomode = 2 OrElse Pref.videomode = 3 Then
- Call util_VideoMode(2, tempstring)
- Exit Sub
- End If
- If Pref.videomode >= 4 Then
- If Pref.selectedvideoplayer <> Nothing Then
- Call util_VideoMode(4, tempstring)
- Else
- Call util_VideoMode(1, tempstring)
- End If
- End If
- End Sub
-
- Private Sub util_VideoMode(ByVal mode As Integer, ByVal tempstring As String)
- Dim action As String = ""
- Dim errors As String = ""
- If mode = 1 Then
- Try
- Dim myProc As Process = Process.Start(tempstring)
- Catch ex As Exception
- errors = ex.ToString
- action = "Dim myProc As Process = Process.Start(" & tempstring & ")"
- Call util_ErrorLog(action, errors)
- End Try
- ElseIf mode = 2 Then
- Try
- Dim thePSI As New System.Diagnostics.ProcessStartInfo("wmplayer")
- thePSI.Arguments = """" & tempstring & """"
- System.Diagnostics.Process.Start(thePSI)
- Catch ex As Exception
- errors = ex.ToString
- action = "Dim thePSI As New System.Diagnostics.ProcessStartInfo(""wmplayer"")" & vbCrLf & "thePSI.Arguments = "" & tempstring & """ & vbCrLf & "System.Diagnostics.Process.Start(thePSI)"
- Call util_ErrorLog(action, errors)
- End Try
- ElseIf mode = 4 Then
- Try
- Dim myProc As Process = Process.Start("""" & Pref.selectedvideoplayer & """", """" & tempstring & """")
- Catch ex As Exception
- errors = ex.ToString
- action = "Dim myProc As Process = Process.Start(""" & Pref.selectedvideoplayer & """," & """" & tempstring & """)"
- Call util_ErrorLog(action, errors)
- End Try
- End If
- End Sub
-
- 'Private Sub util_VideoMode1(ByVal tempstring As String)
- ' Dim action As String
- ' Dim errors As String
- ' Try
- ' Dim myProc As Process = Process.Start(tempstring)
- ' Catch ex As Exception
- ' errors = ex.ToString
- ' action = "Dim myProc As Process = Process.Start(" & tempstring & ")"
- ' Call util_ErrorLog(action, errors)
- ' End Try
- 'End Sub
-
- 'Private Sub util_VideoMode2(ByVal tempstring As String)
- ' Dim action As String
- ' Dim errors As String
- ' Try
- ' Dim thePSI As New System.Diagnostics.ProcessStartInfo("wmplayer")
- ' thePSI.Arguments = """" & tempstring & """"
- ' System.Diagnostics.Process.Start(thePSI)
- ' Catch ex As Exception
- ' errors = ex.ToString
- ' action = "Dim thePSI As New System.Diagnostics.ProcessStartInfo(""wmplayer"")" & vbCrLf & "thePSI.Arguments = "" & tempstring & """ & vbCrLf & "System.Diagnostics.Process.Start(thePSI)"
- ' Call util_ErrorLog(action, errors)
- ' End Try
- 'End Sub
-
- 'Private Sub util_VideoMode4(ByVal tempstring As String)
- ' Dim action As String
- ' Dim errors As String
- ' Try
- ' Dim myProc As Process = Process.Start("""" & Pref.selectedvideoplayer & """", """" & tempstring & """")
- ' Catch ex As Exception
- ' errors = ex.ToString
- ' action = "Dim myProc As Process = Process.Start(""" & Pref.selectedvideoplayer & """," & """" & tempstring & """)"
- ' Call util_ErrorLog(action, errors)
- ' End Try
- 'End Sub
-
- Private Sub util_ErrorLog(ByVal action As String, Optional ByVal errors As String = "")
- Dim errpath As String = applicationPath & "\error.log"
- Try
-
- Dim objWriter As New System.IO.StreamWriter(errpath, True)
- objWriter.WriteLine(errors)
- objWriter.WriteLine(action)
- objWriter.WriteLine() '(Chr(13))
- objWriter.Close()
- Catch ex As Exception
- MsgBox("Error, cant write to " & errpath & vbCrLf & vbCrLf & ex.ToString)
- End Try
-
- End Sub
-
- Public Sub tv_RefreshLog(ByVal action As String, Optional ByVal errors As String = "", Optional ByVal clear As Boolean = False)
- If Pref.tvshowrefreshlog = False Then
- Exit Sub
- End If
-
- Dim errpath As String = IO.Path.Combine(applicationPath, "tvrefresh.log")
- If clear = True Then
- If IO.File.Exists(errpath) Then
- Try
- IO.File.Delete(errpath)
- Catch ex As Exception
- MsgBox("Error deleting: " & errpath & vbCrLf & vbCrLf & ex.ToString)
- End Try
- End If
- End If
- Try
-
- Dim objWriter As New System.IO.StreamWriter(errpath, True)
- objWriter.WriteLine(action)
- If errors <> "" Then
- objWriter.WriteLine(errors)
- End If
- objWriter.Close()
- Catch ex As Exception
- MsgBox("Error, cant write to " & errpath & vbCrLf & vbCrLf & ex.ToString)
- End Try
-
- End Sub
-
- Private Sub util_ThreadsRunningCheck()
- 'If globalthreadcounter = 0 Then
- ' ToolStripButton10.Visible = False
- 'Else
- ' ToolStripButton10.Visible = True
- 'End If
- End Sub
-
- Private Sub util_ThreadsAllExit()
- Dim busy As Boolean = False
- Try
- If bckgroundscanepisodes.IsBusy Then
- busy = True
- bckgroundscanepisodes.CancelAsync()
- End If
- If BckWrkScnMovies.IsBusy Then
- busy = True
- BckWrkScnMovies.CancelAsync()
- End If
- If bckepisodethumb.IsBusy Then
- busy = True
- bckepisodethumb.CancelAsync()
- End If
- If BWs.Count > 0 Then
- busy = True
- Bw.CancelAsync()
- End If
- If ImgBw.IsBusy Then
- busy = True
- ImgBw.CancelAsync()
- End If
-
- Dim exitnowok As Boolean = False
- If busy = True Then
- messbox.TextBox1.Text = "Please Wait"
- messbox.TextBox2.Text = ""
- messbox.TextBox3.Text = "Stopping threads when it is Safe to do so"
- messbox.Refresh()
- messbox.Visible = True
- End If
- Do Until busy = False
- If Not bckepisodethumb.IsBusy And Not bckgroundscanepisodes.IsBusy And Not BckWrkScnMovies.IsBusy And Not BWs.Count > 0 And Not ImgBw.IsBusy Then
- busy = False
- Exit Do
- End If
- Threading.Thread.Sleep(100)
- Application.DoEvents()
- Loop
- messbox.Visible = False
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- Finally
- End Try
- End Sub
-
- Public Sub util_ZoomImage(ByVal file As String)
- bigPanel = New Panel
- With bigPanel
- .Width = Me.Width
- .Height = Me.Height
- .BringToFront()
- .Dock = DockStyle.Fill
- End With
-
- bigPictureBox = New PictureBox()
- With bigPictureBox
- .Location = New Point(0, 0)
- .Width = bigPanel.Width
- .Height = bigPanel.Height
- .SizeMode = PictureBoxSizeMode.Zoom
- .Visible = True
- .BorderStyle = BorderStyle.Fixed3D
- AddHandler bigPictureBox.DoubleClick, AddressOf util_PicBoxClose
- .Dock = DockStyle.Fill
- End With
- util_ImageLoad(bigPictureBox, file, Utilities.DefaultPosterPath)
-
- 'Dim sizex As Integer = bigpicbox.Width
- 'Dim sizey As Integer = bigpicbox.Height
-
- Dim bigpanellabel As Label
- bigpanellabel = New Label
- With bigpanellabel
- .Location = New Point(20, 200)
- .Width = 170
- .Height = 75
- .Visible = True
- .Text = "Double Click Image To Return To Browser"
- .Font = New System.Drawing.Font("Microsoft Sans Serif", 12!, System.Drawing.FontStyle.Bold)
- End With
-
- Me.bigPanel.Controls.Add(bigpanellabel)
- bigpanellabel.BringToFront()
- Application.DoEvents()
-
- If Not bigPictureBox.Image Is Nothing And bigPictureBox.Image.Width > 20 Then
- Dim sizey As Integer = bigPictureBox.Image.Height
- Dim sizex As Integer = bigPictureBox.Image.Width
- Dim tempstring As String
- tempstring = "Full Image Resolution :- " & sizex.ToString & " x " & sizey.ToString
- Dim resolutionlbl As New Label
- With resolutionlbl
- .Location = New Point(20, 450)
- .Width = 200
- .Text = tempstring
- .BackColor = Color.Transparent
- End With
-
- Me.bigPanel.Controls.Add(resolutionlbl)
- resolutionlbl.BringToFront()
- Me.Refresh()
- Application.DoEvents()
- Dim tempstring2 As String = resolutionlbl.Text
- End If
-
- Me.Controls.Add(bigPanel)
- bigPanel.BringToFront()
- Me.bigPanel.Controls.Add(bigPictureBox)
- Me.Refresh()
- End Sub
-
- Private Sub util_PicBoxClose()
- Me.Controls.Remove(bigPanel)
- bigPanel = Nothing
- Me.Controls.Remove(bigPictureBox)
- bigPictureBox.Image = Nothing
- bigPictureBox = Nothing
- Me.ControlBox = True
- MenuStrip1.Enabled = True
- End Sub
-
- Public Sub resetallfilters()
- Try
- ResetFilters()
- Mc.clsGridViewMovie.mov_FiltersAndSortApply(Me)
-
- Try
- If DataGridViewMovies.SelectedRows.Count = 1 Then
- If workingMovieDetails.fileinfo.fullpathandfilename = DataGridViewMovies.SelectedCells(NFO_INDEX).Value.ToString Then Return
- End If
- Catch
- End Try
-
- DisplayMovie()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Sub ResetFilters()
- ProgState = ProgramState.ResettingFilters
- filterOverride = False
- TextBox1.Text = ""
- txt_titlesearch.Text = ""
- txt_titlesearch.BackColor = Color.White
- TextBox1.BackColor = Color.White
- rbTitleAndYear.Checked = True
- cbFilterGeneral.SelectedIndex = 0
- UpdateMinMaxMovieFilters()
- oMovies.ActorsFilter_AlsoInclude.Clear()
- oMovies.SetsFilter_AlsoInclude.Clear()
- cbFilterActor .UpdateItems(oMovies.ActorsFilter )
- cbFilterDirector.UpdateItems(oMovies.DirectorsFilter)
- cbFilterSet .UpdateItems(oMovies.SetsFilter )
- cbFilterTag .UpdateItems(oMovies.TagsFilter )
- Dim query = From c As Control In SplitContainer5.Panel2.Controls Where c.Name.IndexOf("cbFilter") = 0 And c.GetType().Namespace = "MC_UserControls"
- For Each c As Object In query
- c.Reset()
- Next
- ProgState = ProgramState.Other
- End Sub
-
-
- Public Sub UpdateMovieSetDisplayNames
- oMovies.UpdateMovieSetDisplayNames
- pop_cbMovieDisplay_MovieSet
- cbFilterSet.UpdateItems(oMovies.SetsFilter)
- End Sub
-
- Sub UpdateMinMaxMovieFilters()
- If cbFilterVotes .Visible Then cbFilterVotes .Values = oMovies.ListVotes
- If cbFilterRuntime .Visible Then cbFilterRuntime .Values = oMovies.ListRuntimes
-
- If cbFilterFolderSizes.Visible Then
- cbFilterFolderSizes.Min = oMovies.MinFolderSize
- cbFilterFolderSizes.Max = oMovies.MaxFolderSize
- End If
- If cbFilterYear.Visible Then
- cbFilterYear.Min = If(oMovies.MinYear < 1850, 1850, oMovies.MinYear)
- cbFilterYear.Max = oMovies.MaxYear
- End If
- End Sub
-
- 'Medianfo.dll to outputlog
- Private Sub util_FileDetailsGet()
- Try
- Dim tempstring As String = String.Empty
- Dim appPath As String = ""
- Dim exists As Boolean
- Dim movieinfo As String = String.Empty
- Dim medianfoexists As Boolean = False
- tempstring = Utilities.GetFileName(pathtxt.Text)
- If IO.Path.GetFileName(tempstring).ToLower = "video_ts.ifo" Then
- Dim temppath As String = tempstring.Replace(IO.Path.GetFileName(tempstring), "VTS_01_0.IFO")
- If IO.File.Exists(temppath) Then
- tempstring = temppath
- End If
- End If
- Dim fileisiso As Boolean = (IO.Path.GetExtension(tempstring).ToLower = ".iso")
- If fileisiso Then
- If applicationPath.IndexOf("/") <> -1 Then appPath = applicationPath & "/" & "mediainfo-rar.exe"
- If applicationPath.IndexOf("\") <> -1 Then appPath = applicationPath & "\" & "mediainfo-rar.exe"
- If Not IO.File.Exists(appPath) Then
- MsgBox("Unable to find th file ""mediainfo-rar.exe""" & vbCrLf & vbCrLf & "Please make sure this file is available in the programs root directory")
- Exit Sub
- End If
- Try
- Dim NewProcess As New System.Diagnostics.Process()
-
- With NewProcess.StartInfo
- .FileName = appPath
- .Arguments = tempstring
- .RedirectStandardOutput = True
- .RedirectStandardError = True
- .RedirectStandardInput = True
- .UseShellExecute = False
- .WindowStyle = ProcessWindowStyle.Hidden
- .CreateNoWindow = False
- End With
- Dim To_Display As String = ""
- NewProcess.Start()
- movieinfo = NewProcess.StandardOutput.ReadToEnd
- Catch ex As Exception
- End Try
- Else
- If applicationPath.IndexOf("/") <> -1 Then appPath = applicationPath & "/" & "MediaInfo.dll"
- If applicationPath.IndexOf("\") <> -1 Then appPath = applicationPath & "\" & "MediaInfo.dll"
- exists = IO.File.Exists(appPath)
- If exists = True Then
- medianfoexists = True
- End If
- If medianfoexists = False Then
- MsgBox("Unable to find th file ""MediaInfo.dll""" & vbCrLf & vbCrLf & "Please make sure this file is available in the programs root directory")
- Exit Sub
- End If
- Dim To_Display As String = ""
- Dim tempstring5 As String
-
- Dim MI As mediainfo
- MI = New mediainfo
- tempstring5 = MI.Option_("Info_Version", "0.7.0.0;MediaInfoDLL_Example_MSVB;0.7.0.0")
- If (tempstring5.Length() = 0) Then
- TextBox1.Text = "MediaInfo.Dll: this version of the DLL is not compatible"
- Exit Sub
- End If
-
- If IO.File.Exists(tempstring) Then
- MI.Open(tempstring)
- To_Display = MI.Inform
- movieinfo = To_Display
- MI.Close()
- End If
- End If
-
-
- TextBox8.Text = movieinfo
- Catch
- End Try
- End Sub
-
- Private Sub mov_Rescrape()
-
- If outlinetxt.Text = "MC cannot find this file, either the file no longer exists, or MC cannot access the file path" Then
- MsgBox("MC cannot find this file, either the file no longer exists, or MC cannot access the file path")
- Exit Sub
- End If
-
- If workingMovieDetails Is Nothing Then Exit Sub
-
- If workingMovieDetails.fullmoviebody.title = Nothing And workingMovieDetails.fullmoviebody.imdbid = Nothing Then
- MsgBox("Can't rescrape this movie because it doesn't have any NFO File" & vbCrLf & "refresh movie database, and search for new movies", MsgBoxStyle.OkOnly, "Error")
- Exit Sub
- End If
-
- Dim tempint = MessageBox.Show("Rescraping the movie will Overwrite all the current details" & vbCrLf & "Do you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
- If tempint = DialogResult.No Then
- Exit Sub
- End If
-
- RunBackgroundMovieScrape("RescrapeDisplayedMovie")
-
- End Sub
-
- Private Sub mov_SaveQuick()
-
- If DataGridViewMovies.SelectedRows.Count = 0 Then Return
-
- If DataGridViewMovies.SelectedRows.Count = 1 Then
- Dim movie As Movie = oMovies.LoadMovie(workingMovieDetails.fileinfo.fullpathandfilename)
- movie.ScrapedMovie.fullmoviebody.title = titletxt.Text.Replace(" (" & workingMovieDetails.fullmoviebody.year & ")", "")
- If movie.ScrapedMovie.fullmoviebody.originaltitle = Nothing Or movie.ScrapedMovie.fullmoviebody.originaltitle = "" Then
- movie.ScrapedMovie.fullmoviebody.originaltitle = movie.ScrapedMovie.fullmoviebody.title
- End If
- movie.ScrapedMovie.fullmoviebody.director = directortxt.Text
- movie.ScrapedMovie.fullmoviebody.playcount = workingMovieDetails.fullmoviebody.playcount
- movie.ScrapedMovie.fullmoviebody.lastplayed = workingMovieDetails.fullmoviebody.lastplayed
- movie.ScrapedMovie.fullmoviebody.credits = creditstxt.Text
- movie.ScrapedMovie.fullmoviebody.studio = studiotxt.Text
- movie.ScrapedMovie.fullmoviebody.country = countrytxt.Text
- movie.ScrapedMovie.fullmoviebody.genre = genretxt.Text
- movie.ScrapedMovie.fullmoviebody.premiered = premiertxt.Text
- movie.ScrapedMovie.fullmoviebody.votes = votestxt.Text
- If lbl_movTop250.Text = "Top 250" Then
- movie.ScrapedMovie.fullmoviebody.top250 = top250txt.Text
- Else
- movie.ScrapedMovie.fullmoviebody.metascore = top250txt.Text
- End If
- 'movie.ScrapedMovie.fullmoviebody.top250 = top250txt.Text
- movie.ScrapedMovie.fullmoviebody.rating = ratingtxt.Text
- movie.ScrapedMovie.fullmoviebody.usrrated = If(cbUsrRated.Text = "None", "0", cbUsrRated.Text)
- movie.ScrapedMovie.fullmoviebody.runtime = runtimetxt.Text
- movie.ScrapedMovie.fullmoviebody.outline = outlinetxt.Text
- movie.ScrapedMovie.fullmoviebody.plot = plottxt.Text
- movie.ScrapedMovie.fullmoviebody.tagline = taglinetxt.Text
- movie.ScrapedMovie.fullmoviebody.stars = txtStars.Text.ToString.Replace(", See full cast and crew", "")
- movie.ScrapedMovie.fullmoviebody.mpaa = certtxt.Text
- movie.ScrapedMovie.fullmoviebody.sortorder = TextBox34.Text
- If movie.ScrapedMovie.fullmoviebody.MovieSet.MovieSetName <> cbMovieDisplay_MovieSet.Items(cbMovieDisplay_MovieSet.SelectedIndex) AndAlso cbMovieDisplay_MovieSet.SelectedIndex <> -1 Then
- movie.ScrapedMovie.fullmoviebody.MovieSet.MovieSetName = cbMovieDisplay_MovieSet.Items(cbMovieDisplay_MovieSet.SelectedIndex)
- movie.ScrapedMovie.fullmoviebody.MovieSet.MovieSetId = oMovies.GetMovieSetIdFromName(movie.ScrapedMovie.fullmoviebody.MovieSet.MovieSetName)
- End If
- movie.ScrapedMovie.fullmoviebody.source = If(cbMovieDisplay_Source.SelectedIndex < 1, Nothing, cbMovieDisplay_Source.Items(cbMovieDisplay_Source.SelectedIndex))
- If TabControl2.SelectedTab.Name = tpMovSetsTags.Name Then
- For Each t In NewTagList
- Dim remtag As String = t.Replace("- ","").Replace("+ ","")
- If t.Contains("- ") Then
- If movie.ScrapedMovie.fullmoviebody.tag.Contains(remtag) Then
- movie.ScrapedMovie.fullmoviebody.tag.Remove(remtag)
- End If
- ElseIf t.Contains("+ ") Then
- If Not movie.ScrapedMovie.fullmoviebody.tag.Contains(remtag) Then
- movie.ScrapedMovie.fullmoviebody.tag.Add(remtag)
- End If
- End If
- Next
- If movie.ScrapedMovie.fullmoviebody.tag.Count <> 0 Then
- Dim first As Boolean = True
- tagtxt.Text = ""
- For Each t In movie.ScrapedMovie.fullmoviebody.tag
- If Not first Then
- tagtxt.Text &= ", " & t
- Else
- tagtxt.Text &= t
- End If
- first = False
- Next
- tb_tagtxt_changed = False
- End If
-
- Else
- If Pref.AllowUserTags AndAlso tb_tagtxt_changed Then
- tb_tagtxt_changed = False
- movie.ScrapedMovie.fullmoviebody.tag.Clear()
- For Each wd In tagtxt.Text.Split(",")
- wd = wd.Trim
- If wd.Length = 0 Then Continue For
- movie.ScrapedMovie.fullmoviebody.tag.Add(wd)
- If Not Pref.movietags.Contains(wd) Then
- Pref.movietags.Add(wd)
- End If
- If movie.ScrapedMovie.fullmoviebody.tag.Count >= Pref.keywordlimit Then Exit For
- Next
- ConfigSave()
- End If
- End If
- 'If TabControl2.SelectedTab.Name = tpMovSets.Name Then
- ' For Each t In NewTagList
- ' Dim remtag As String = t.Replace("- ", "").Replace("+ ", "")
- ' If t.Contains("- ") Then
- ' If movie.ScrapedMovie.fullmoviebody.tag.Contains(remtag) Then
- ' movie.ScrapedMovie.fullmoviebody.tag.Remove(remtag)
- ' End If
- ' ElseIf t.Contains("+ ") Then
- ' If Not movie.ScrapedMovie.fullmoviebody.tag.Contains(remtag) Then
- ' movie.ScrapedMovie.fullmoviebody.tag.Add(remtag)
- ' End If
- ' End If
- ' Next
- ' If movie.ScrapedMovie.fullmoviebody.tag.Count <> 0 Then
- ' Dim first As Boolean = True
- ' For Each t In movie.ScrapedMovie.fullmoviebody.tag
- ' If Not first Then tagtxt.Text &= ", "
- ' tagtxt.Text &= t
- ' first = False
- ' Next
- ' End If
- 'Else
- ' If Pref.AllowUserTags Then
- ' movie.ScrapedMovie.fullmoviebody.tag.Clear()
- ' For Each wd In tagtxt.Text.Split(",")
- ' wd = wd.Trim
- ' If wd.Length = 0 Then Continue For
- ' movie.ScrapedMovie.fullmoviebody.tag.Add(wd)
- ' If Not Pref.movietags.Contains(wd) Then
- ' Pref.movietags.Add(wd)
- ' End If
- ' ConfigSave()
- ' If movie.ScrapedMovie.fullmoviebody.tag.Count >= Pref.keywordlimit Then Exit For
- ' Next
- ' End If
- 'End If
- movie.AssignMovieToCache()
- movie.UpdateMovieCache()
- movie.SaveNFO()
- UpdateFilteredList()
- If TabControl2.SelectedTab.Name = tpMovSetsTags.Name Then TagsPopulate()
- Else
- messbox = New frmMessageBox("Saving Selected Movies", , " Please Wait. ") 'Multiple movies selected
- messbox.TextBox3.Text = "Press ESC to cancel"
- messbox.TopMost = True
- messbox.Show()
- messbox.Refresh()
- Application.DoEvents()
- Dim Startfullpathandfilename As String = ""
- If Not ISNothing(DataGridViewMovies.CurrentRow) Then
- Dim i As Integer = DataGridViewMovies.CurrentRow.Index
- Startfullpathandfilename = DataGridViewMovies.Item(5, i).Value.ToString
- messbox.Cancelled = False
- Dim pos As Integer = 0
- Dim NfosToSave As List(Of String) = (From x As datagridviewrow In DataGridViewMovies.SelectedRows Select nfo=x.Cells("fullpathandfilename").Value.ToString).ToList
- For Each nfo As String In NfosToSave
- If Not File.Exists(nfo) Then Continue For
- Dim movie As Movie = oMovies.LoadMovie(nfo)
- If IsNothing(movie) Then Continue For
- pos += 1
- messbox.TextBox2.Text = pos.ToString + " of " + NfosToSave.Count.ToString
- If directortxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.director = directortxt.Text
- If creditstxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.credits = creditstxt.Text
- If genretxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.genre = genretxt.Text
- If premiertxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.premiered = premiertxt.Text
- If certtxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.mpaa = certtxt.Text
- If outlinetxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.outline = outlinetxt.Text
- If runtimetxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.runtime = runtimetxt.Text
- If studiotxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.studio = studiotxt.Text
- If countrytxt.Text <> "" then movie.ScrapedMovie.fullmoviebody.country = countrytxt.Text
- If plottxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.plot = plottxt.Text
- If taglinetxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.tagline = taglinetxt.Text
- If txtStars.Text <> "" Then movie.ScrapedMovie.fullmoviebody.stars = txtStars.Text.ToString.Replace(", See full cast and crew", "")
- If ratingtxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.rating = ratingtxt.Text
- If votestxt.Text <> "" Then movie.ScrapedMovie.fullmoviebody.votes = votestxt.Text
- If top250txt.Text <> "" Then
- If lbl_movTop250.Text = "Top 250" Then
- movie.ScrapedMovie.fullmoviebody.top250 = top250txt.Text
- Else
- movie.ScrapedMovie.fullmoviebody.metascore = top250txt.Text
- End If
- 'movie.ScrapedMovie.fullmoviebody.top250 = top250txt.Text
- End If
- If Not cbMovieDisplay_MovieSet.SelectedIndex < 1 Then
- movie.ScrapedMovie.fullmoviebody.MovieSet.MovieSetName = cbMovieDisplay_MovieSet.Items(cbMovieDisplay_MovieSet.SelectedIndex)
- movie.ScrapedMovie.fullmoviebody.MovieSet.MovieSetId = oMovies.GetMovieSetIdFromName(movie.ScrapedMovie.fullmoviebody.MovieSet.MovieSetName)
- End If
- If cbUsrRated.SelectedIndex <> -1 Then movie.ScrapedMovie.fullmoviebody.usrrated = cbUsrRated.SelectedIndex.ToString'text
- movie.ScrapedMovie.fullmoviebody.source = If(cbMovieDisplay_Source.SelectedIndex < 1, Nothing, cbMovieDisplay_Source.Items(cbMovieDisplay_Source.SelectedIndex))
- If TabControl2.SelectedTab.Name = tpMovSetsTags.Name Then
- For Each t In NewTagList
- Dim remtag As String = t.Replace("- ","").Replace("+ ","")
- If t.Contains("- ") Then
- If movie.ScrapedMovie.fullmoviebody.tag.Contains(remtag) Then
- movie.ScrapedMovie.fullmoviebody.tag.Remove(remtag)
- End If
- ElseIf t.Contains("+ ") Then
- If Not movie.ScrapedMovie.fullmoviebody.tag.Contains(remtag) Then
- movie.ScrapedMovie.fullmoviebody.tag.Add(remtag)
- End If
- End If
- Next
- Else
- If tb_tagtxt_changed Then
- 'tb_tagtxt_changed = False
- movie.ScrapedMovie.fullmoviebody.tag.Clear()
- If tagtxt.Text <> "" AndAlso tagtxt.Text.Contains(",") Then
- Dim tags() As String = tagtxt.Text.Split(",")
- For Each strtag In tags
- If Not movie.ScrapedMovie.fullmoviebody.tag.Contains(strtag.Trim()) Then movie.ScrapedMovie.fullmoviebody.tag.Add(strtag.Trim())
- Next
- ElseIf tagtxt.Text <> "" Then
- If Not movie.ScrapedMovie.fullmoviebody.tag.Contains(tagtxt.Text.Trim()) Then movie.ScrapedMovie.fullmoviebody.tag.Add(tagtxt.Text.Trim())
- End If
- End If
- End If
- 'If TabControl2.SelectedTab.Name = tpMovSets.Name Then
- ' For Each t In NewTagList
- ' Dim remtag As String = t.Replace("- ", "").Replace("+ ", "")
- ' If t.Contains("- ") Then
- ' If movie.ScrapedMovie.fullmoviebody.tag.Contains(remtag) Then
- ' movie.ScrapedMovie.fullmoviebody.tag.Remove(remtag)
- ' End If
- ' ElseIf t.Contains("+ ") Then
- ' If Not movie.ScrapedMovie.fullmoviebody.tag.Contains(remtag) Then
- ' movie.ScrapedMovie.fullmoviebody.tag.Add(remtag)
- ' End If
- ' End If
- ' Next
- 'Else
- ' If tb_tagtxt_changed Then
- ' tb_tagtxt_changed = False
- ' movie.ScrapedMovie.fullmoviebody.tag.Clear()
- ' If tagtxt.Text <> "" AndAlso tagtxt.Text.Contains(",") Then
- ' Dim tags() As String = tagtxt.Text.Split(",")
- ' For Each strtag In tags
- ' If Not movie.ScrapedMovie.fullmoviebody.tag.Contains(strtag.Trim()) Then movie.ScrapedMovie.fullmoviebody.tag.Add(strtag.Trim())
- ' Next
- ' ElseIf tagtxt.Text <> "" Then
- ' If Not movie.ScrapedMovie.fullmoviebody.tag.Contains(tagtxt.Text.Trim()) Then movie.ScrapedMovie.fullmoviebody.tag.Add(tagtxt.Text.Trim())
- ' End If
- ' End If
- 'End If
- movie.AssignMovieToCache()
- movie.UpdateMovieCache()
- movie.SaveNFO()
- Application.DoEvents()
- If messbox.Cancelled Then Exit For
- Next
- If tb_tagtxt_changed Then tb_tagtxt_changed = False
- UpdateFilteredList()
- ProgState = ProgramState.Other
-
- Else
- messbox.Close()
- MsgBox("Must Select an Initial Movie" & vbCrLf & "Save Cancelled")
- Exit Sub
- End If
- workingMovie.fullpathandfilename = Startfullpathandfilename
- mov_FormPopulate()
- messbox.Close()
- If TabControl2.SelectedTab.Name = tpMovSetsTags.Name Then TabControl2.SelectedIndex = 0
- End If
-
- End Sub
-
-
- Private Sub mov_Edit()
- If outlinetxt.Text = "MC cannot find this file, either the file no longer exists, or MC cannot access the file path" Then
- MsgBox("MC cannot find this file, either the file no longer exists, or MC cannot access the file path")
- Exit Sub
- End If
- Dim oldmovietitle As String = workingMovieDetails.fileinfo.fullpathandfilename
- Dim newmovietitle As String = ""
- Dim MyFormObject As New Form2()
- MyFormObject.ShowDialog()
- newmovietitle = workingMovieDetails.fileinfo.fullpathandfilename
- For f = 0 To oMovies.MovieCache.Count - 1
- If oMovies.MovieCache(f).fullpathandfilename = newmovietitle Then
- Dim newfullmovie As New ComboList
-
- oMovies.MovieCache.RemoveAt(f)
-
- newfullmovie = nfoFunction.mov_NfoLoadBasic(workingMovieDetails.fileinfo.fullpathandfilename, "movielist")
- If workingMovie.title <> "ERROR" Then 'if there is a problem with the nfo being invalid we need to skip
- oMovies.MovieCache.Add(newfullmovie)
- End If
- Exit For
- End If
- Next
-
- 'Todo: need to update all details after edit.
-
- For f = 0 To filteredList.Count - 1
- If filteredList(f).fullpathandfilename = oldmovietitle Then
- Dim newfullmovie2 As New ComboList
- newfullmovie2 = filteredList(f)
- filteredList.RemoveAt(f)
- Dim filecreation2 As New IO.FileInfo(workingMovieDetails.fileinfo.fullpathandfilename)
- Dim myDate2 As Date = filecreation2.LastWriteTime
- Try
- newfullmovie2.filedate = Format(myDate2, datePattern).ToString
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- newfullmovie2.filename = workingMovieDetails.fileinfo.filename
- newfullmovie2.foldername = workingMovieDetails.fileinfo.foldername
- newfullmovie2.fullpathandfilename = workingMovieDetails.fileinfo.fullpathandfilename
- newfullmovie2.genre = workingMovieDetails.fullmoviebody.genre
- newfullmovie2.id = workingMovieDetails.fullmoviebody.imdbid
- newfullmovie2.playcount = workingMovieDetails.fullmoviebody.playcount
- newfullmovie2.lastplayed = workingMovieDetails.fullmoviebody.lastplayed
- newfullmovie2.rating = workingMovieDetails.fullmoviebody.rating.ToRating
- newfullmovie2.year = workingMovieDetails.fullmoviebody.year
- newfullmovie2.rootfolder = workingMovieDetails.fileinfo.rootfolder
- filteredList.Add(newfullmovie2)
- Exit For
- End If
- Next
- Call mov_FormPopulate()
- Call Mc.clsGridViewMovie.mov_FiltersAndSortApply(Me)
- End Sub
-
- Private Sub XBMCMCThreadToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles XBMCMCThreadToolStripMenuItem.Click
- Try
- Dim webAddress As String = "http://forum.xbmc.org/showthread.php?t=129134"
- OpenUrl(webAddress)
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub ListMoviesWithoutFanartToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- Try
- filterOverride = True
- Dim newlist As New List(Of ComboList)
- newlist.Clear()
- For Each movie In oMovies.MovieCache
- If Not IO.File.Exists(Pref.GetFanartPath(movie.fullpathandfilename)) Then
- Dim movietoadd As New ComboList
- movietoadd.fullpathandfilename = movie.fullpathandfilename
- movietoadd.filename = movie.filename
- movietoadd.year = movie.year
- movietoadd.filedate = movie.filedate
- movietoadd.foldername = movie.foldername
- movietoadd.rating = movie.rating
- movietoadd.top250 = movie.top250
- movietoadd.rootfolder = movie.rootfolder
- newlist.Add(movietoadd)
- End If
- Next
- filteredList = newlist
- mov_CacheLoad()
- filterOverride = False
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub ListMoviesWithoutPostersToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- Try
- filterOverride = True
- Dim newlist As New List(Of ComboList)
- newlist.Clear()
- For Each movie In oMovies.MovieCache
- If Not IO.File.Exists(Pref.GetPosterPath(movie.fullpathandfilename)) Then
- Dim movietoadd As New ComboList
- movietoadd.fullpathandfilename = movie.fullpathandfilename
- movietoadd.filename = movie.filename
- movietoadd.year = movie.year
- movietoadd.filedate = movie.filedate
- movietoadd.foldername = movie.foldername
- movietoadd.rating = movie.rating
- movietoadd.top250 = movie.top250
- movietoadd.rootfolder = movie.rootfolder
- newlist.Add(movietoadd)
- End If
- Next
- filteredList = newlist
- mov_CacheLoad()
- filterOverride = False
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub BatchRescraperToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BatchRescraperToolStripMenuItem.Click
-
- rescrapeList.ResetFields()
-
- Dim displaywizard As New frmBatchScraper
- displaywizard.ShowDialog()
-
- If rescrapeList.AnyEnabled Then
-
- _rescrapeList.FullPathAndFilenames.Clear()
-
- If DataGridViewMovies.SelectedRows.Count > 1 Then 'run batch wizard on multiple selected movies
- For Each row As DataGridViewRow In DataGridViewMovies.SelectedRows
- Dim fullpath As String = row.Cells("fullpathandfilename").Value.ToString
- If Not File.Exists(fullpath) Then Continue For
- If rescrapeList.EmptyMainTags AndAlso MovieHasEmptyMainTags(fullpath) Then Continue For
- _rescrapeList.FullPathAndFilenames.Add(fullpath)
- Next
- Else 'Otherwise run batch wizard on all movies.
- For Each row As DataGridViewRow In DataGridViewMovies.Rows
-
- Dim m As Data_GridViewMovie = row.DataBoundItem
- Dim fullpath As String = m.fullpathandfilename.ToString
- If Not File.Exists(fullpath) Then Continue For
- If rescrapeList.EmptyMainTags AndAlso MovieHasEmptyMainTags(fullpath) Then Continue For
- _rescrapeList.FullPathAndFilenames.Add(fullpath)
- Next
- End If
-
- RunBackgroundMovieScrape("BatchRescrape")
- End If
-
- End Sub
-
- Public Function MovieHasEmptyMainTags(ByVal checkmovie As String) As Boolean
- If rescrapeList.AnyNonMainEnabled Then Return True
- For each movie As ComboList In oMovies.MovieCache
- If Not movie.fullpathandfilename = checkmovie Then Continue For
- If rescrapeList.rating AndAlso movie.rating < 1 Then Return False
- If rescrapeList.votes AndAlso movie.Votes = 0 Then Return False
- If rescrapeList.mpaa AndAlso movie.Certificate = "" Then Return False
- If rescrapeList.genre AndAlso movie.genre = "" Then Return False
- If rescrapeList.year AndAlso movie.year < 1900 Then Return False
- If rescrapeList.top250 AndAlso movie.top250 = "" Then Return False
- If rescrapeList.outline AndAlso movie.outline = "" Then Return False
- If rescrapeList.plot AndAlso movie.plot = "" Then Return False
- If rescrapeList.tagline AndAlso movie.tagline = "" Then Return False
- If rescrapeList.runtime AndAlso movie.runtime = "" Then Return False
- If rescrapeList.director AndAlso movie.director = "" Then Return False
- If rescrapeList.credits AndAlso movie.credits = "" Then Return False
- If rescrapeList.title AndAlso movie.title = "" Then Return False
- If rescrapeList.premiered AndAlso movie.Premiered = "" Then Return False
- If rescrapeList.stars AndAlso movie.stars = "" Then Return False
- If rescrapeList.studio AndAlso movie.studios = "" Then Return False
- If rescrapeList.country AndAlso movie.countries = "" Then Return False
- If rescrapeList.metascore AndAlso movie.metascore = 0 Then Return False
- Exit For
- Next
- Return True
- End Function
-
- 'Public Function GetTrailerPath(ByVal s As String)
- ' Dim FileName As String = ""
-
- ' For Each extension In Utilities.TrailerExtensions
- ' FileName = IO.Path.Combine(s.Replace(IO.Path.GetFileName(s), ""), System.IO.Path.GetFileNameWithoutExtension(s) & "-trailer" & extension)
- ' If File.Exists(FileName) Then Return FileName
- ' Next
-
- ' 'set default trailer path and filename
- ' Return IO.Path.Combine(s.Replace(IO.Path.GetFileName(s), ""), System.IO.Path.GetFileNameWithoutExtension(s) & "-trailer.flv")
- 'End Function
-
- Private Sub mov_Play(ByVal type As String)
- If DataGridViewMovies.SelectedRows.Count < 1 Then Return
- Dim tempstring As String
- tempstring = DataGridViewMovies.SelectedCells(NFO_INDEX).Value.ToString
- Dim playlist As New List(Of String)
- Select Case type
- Case "Movie"
- If tempstring.IndexOf("index.nfo") <> -1 Then
- tempstring = tempstring.Replace(".nfo", ".bdmv")
- Else
- tempstring = Utilities.GetFileName(tempstring)
- End If
- playlist = Utilities.GetMediaList(tempstring)
- Case "Trailer"
- Dim movie = oMovies.LoadMovie(tempstring)
- If movie.TrailerExists Then playlist.Add(movie.ActualTrailerPath)
- Case "HomeMovie"
- tempstring = CType(ListBox18.SelectedItem, ValueDescriptionPair).Value
- tempstring = Utilities.GetFileName(tempstring)
- playlist = Utilities.GetMediaList(tempstring)
- End Select
- If playlist.Count <= 0 Then
- MsgBox("No Media File Found For This nfo")
- Exit Sub
- End If
- LaunchPlayList(playlist)
- End Sub
-
- Public Function CleanMovieTitle(ByVal s As String) As String
- Dim tmplist As New List(Of String)
- Dim q = From el In MovSepLst Order By el.Length Descending
- tmplist.AddRange(q.tolist)
- For each item In tmplist
- Dim t As String = " " & item
- If s.Contains(t) Then s = s.Replace(t, "")
- Next
- tmplist.Clear()
- Dim r = From el In ThreeDKeyWords Order By el.Length Descending
- tmplist.AddRange(r.ToList)
- For each item In tmplist
- Dim t As String = " " & item & " "
- If s.Contains(t) Then s = s.Replace(t, "")
- If s.Contains(t.TrimEnd) Then s = s.Replace(t.TrimEnd, "")
- Next
- Return s
- End Function
-
- Public Sub LaunchPlayList(ByVal plist As List(Of String))
- Statusstrip_Enable()
- ToolStripStatusLabel2.Text = ""
- ToolStripStatusLabel2.Visible = True
- Dim tempstring = applicationPath & "\Settings\temp.m3u"
- ToolStripStatusLabel2.Text = "Playing Movie...Creating m3u file:..." & tempstring
- Application.DoEvents()
- Dim aok As Boolean = True
- If IO.File.Exists(tempstring) Then
- aok = Utilities.SafeDeleteFile(tempstring)
- End If
- If aok Then
- Dim file As New StreamWriter(tempstring, False, Encoding.GetEncoding(1252))
- For Each part In plist
- If part <> Nothing Then file.WriteLine(part)
- Next
- file.Close()
- ToolStripStatusLabel2.Text &= "............Launching Player."
- StartVideo(tempstring)
- Else
- ToolStripStatusLabel2.Text = "Failed to create playlist"
- End If
- statusstripclear.Start()
- End Sub
-
- Private Sub MovieFormInit()
- workingMovie.filedate = Nothing
- workingMovie.filename = Nothing
- workingMovie.foldername = Nothing
- workingMovie.fullpathandfilename = Nothing
- workingMovie.genre = Nothing
- workingMovie.id = Nothing
- workingMovie.playcount = Nothing
- workingMovie.lastplayed = Nothing
- workingMovie.rating = Nothing
- workingMovie.title = Nothing
- workingMovie.top250 = Nothing
- workingMovie.year = Nothing
- workingMovie.MovieSet = Nothing
- workingMovie.rootfolder = Nothing
- titletxt.Text = ""
- TextBox3.Text = ""
- outlinetxt.Text = ""
- TextBox34.Text = ""
- plottxt.Text = ""
- taglinetxt.Text = ""
- txtStars.Text = ""
- genretxt.Text = ""
- premiertxt.Text = ""
- creditstxt.Text = ""
- directortxt.Text = ""
- studiotxt.Text = ""
- countrytxt.Text = ""
- pathtxt.Text = ""
- cbMovieDisplay_Actor.Items.Clear()
- ratingtxt.Text = ""
- runtimetxt.Text = ""
- votestxt.Text = ""
- top250txt.Text = ""
- certtxt.Text = ""
- PbMovieFanArt.Image = Nothing
- PbMoviePoster.Image = Nothing
- roletxt.Text = ""
- PictureBoxActor.Image = Nothing
- btnPlayMovie.Enabled = False
- End Sub
-
- Public Sub genretxt_MouseClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles genretxt.MouseDown
- If e.Button = Windows.Forms.MouseButtons.Right Then
- Dim multicount As Integer = 0
- Try
- Dim genre As String = ""
- Dim listof As New List(Of str_genre)
- Dim Multi As Boolean = DataGridViewMovies.SelectedRows.Count > 1
- If Not Multi Then
- Dim item As List(Of String) = workingMovieDetails.fullmoviebody.genre.Split("/").[Select](Function(p) p.Trim()).ToList
- If item(0) = "" Then item.RemoveAt(0)
- multicount = multicount +1
- listof.Clear()
- For Each i In item
- Dim g As New str_genre
- g.genre = i.Trim
- g.count = 1
- listof.Add(g)
- Next
- Else
- For Each row As DataGridViewRow In DataGridViewMovies.SelectedRows
- multicount = multicount +1
- Dim genretxt As String = row.Cells("genre").Value.ToString
- Dim spltgenre As List(Of String) = genretxt.Split("/").[Select](Function(p) p.Trim()).ToList
- If spltgenre(0) = "" Then spltgenre.RemoveAt(0)
- For Each i In spltgenre
- Dim g As New str_genre
- g.genre = i
- g.count = 1
- For each item In listof
- If item.genre.ToLower = g.genre.ToLower Then
- g.count = item.count
- Exit For
- End If
- Next
- If listof.Contains(g) Then
- listof.RemoveAt(listof.IndexOf(g))
- g.count = g.count + 1
- End If
- listof.Add(g)
- Next
- Next
- End If
- Dim frm As New frmGenreSelect
- frm.multicount = multicount
- frm.SelectedGenres = listof
- frm.Init()
- If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then
- listof.Clear()
- listof.AddRange(frm.SelectedGenres)
- If Not Multi Then
- genre = ""
- For each g In listof
- If g.count = 0 Then Continue For
- If genre = "" Then
- genre = g.genre
- Else
- genre += " / " & g.genre
- End If
- Next
- genretxt.Text = genre
- Call mov_SaveQuick()
- Else
- Dim NfosToSave As List(Of String) = (From x As datagridviewrow In DataGridViewMovies.SelectedRows Select nfo=x.Cells("fullpathandfilename").Value.ToString).ToList
- For Each nfo As String In NfosToSave
- If Not File.Exists(nfo) Then Continue For
- Dim movie As Movie = oMovies.LoadMovie(nfo)
- If IsNothing(movie) Then Continue For
- Dim genretxt As String = movie.ScrapedMovie.fullmoviebody.genre
- Dim spgenre2 As List(Of String) = genretxt.Split("/").[Select](Function(p) p.Trim()).ToList
- genre = ""
- For Each g In listof
- Dim ToAdd As Boolean = False
- If g.count = 0 Then Continue For
- If (g.count = 1 AndAlso spgenre2.Contains(g.genre)) OrElse g.count = 2 Then ToAdd = True
- If Not ToAdd Then Continue For
- If genre = "" Then
- genre = g.genre
- Else
- genre += " / " & g.genre
- End If
- Next
- movie.ScrapedMovie.fullmoviebody.genre = genre
- movie.AssignMovieToCache()
- movie.UpdateMovieCache()
- movie.SaveNFO()
- Application.DoEvents()
- Next
- End If
- End If
- frm.Dispose()
- Catch
- End Try
- End If
- End Sub
-
- Public Sub DisplayMovie(Optional yielding As Boolean = False)
- Try
- DisplayMovie(DataGridViewMovies.SelectedCells, DataGridViewMovies.SelectedRows, yielding)
- Catch
- Return
- End Try
- End Sub
-
- Public Sub DisplayMovie(ByVal selectedCells As DataGridViewSelectedCellCollection, ByVal selectedRows As DataGridViewSelectedRowCollection, yielding As Boolean)
-
- Try
- If selectedRows.Count = 1 Then
- If LastMovieDisplayed = selectedCells(NFO_INDEX).Value.ToString Then Return
- LastMovieDisplayed = selectedCells(NFO_INDEX).Value.ToString
- Else
- LastMovieDisplayed = ""
- End If
- Catch
- Return
- End Try
-
- If yielding Then
- _yield = True
- Application.DoEvents()
- _yield = False
- End If
-
- 'Clear all fields of the movie
- MovieFormInit()
-
- If selectedRows.Count = 0 Then Exit Sub
-
- Dim needtoload As Boolean = False
- Dim done As Boolean = False
-
-
- Dim blnShow = (selectedRows.Count=1)
-
- tsmiMov_PlayMovie.Visible = blnShow
- tsmiMov_OpenFolder.Visible = blnShow
- tsmiMov_ViewNfo.Visible = blnShow
- tsmiMov_Separator1.Visible = blnShow
- tsmiMov_Separator7.Visible = blnShow
- tsmiMov_FanartBrowserAlt.Visible = blnShow
- tsmiMov_PosterBrowserAlt.Visible = blnShow
- tsmiMov_EditMovieAlt.Visible = blnShow
- tsmiMov_ReloadFromCache.Visible = blnShow
-
-
- If Yield(yielding) Then Return
-
- If selectedRows.Count = 1 Then
- 'mov_ToolStripPlayMovie.Visible = True
- 'mov_ToolStripOpenFolder.Visible = True
- 'mov_ToolStripViewNfo.Visible = True
- 'ToolStripSeparator17.Visible = True
- 'ToolStripSeparator24.Visible = True
- 'ToolStripSeparator4.Visible = True
- 'mov_ToolStripFanartBrowserAlt.Visible = True
- 'mov_ToolStripPosterBrowserAlt.Visible = True
- 'mov_ToolStripEditMovieAlt.Visible = True
- 'mov_ToolStripReloadFromCache.Visible = True
- If titletxt.Visible = False Then
- needtoload = True
- End If
- titletxt.Visible = True
- TextBoxMutisave.Visible = False
- btnMovRescrape.Visible = True
- SplitContainer2.Visible = True
- Label128.Visible = False
- Label75.Visible = True
- TextBox34.Visible = True
-
- If Yield(yielding) Then Return
-
- If Yield(yielding) Then Return
-
- Dim query = From f In oMovies.Data_GridViewMovieCache Where f.fullpathandfilename = selectedCells(NFO_INDEX).Value.ToString
-
- Dim queryList As List(Of Data_GridViewMovie) = query.ToList()
-
- If Yield(yielding) Then Return
- If Not queryList.Count = 0 AndAlso Not File.Exists(queryList(0).MoviePathAndFileName) Then 'Detect if video file is missing
- If Mov_MissingMovie(queryList) Then Exit Sub
- End If
-
- If queryList.Count > 0 Then
- workingMovie.filedate = queryList(0).filedate
- workingMovie.filename = queryList(0).filename
- workingMovie.foldername = queryList(0).foldername
- workingMovie.fullpathandfilename = queryList(0).fullpathandfilename
- workingMovie.genre = queryList(0).genre
- workingMovie.id = queryList(0).id
- workingMovie.playcount = queryList(0).playcount
- workingMovie.rating = queryList(0).Rating
- workingMovie.title = queryList(0).title
- workingMovie.top250 = queryList(0).top250
- workingMovie.year = queryList(0).year
- workingMovie.FolderSize = queryList(0).FolderSize
- workingMovie.rootfolder = queryList(0).rootfolder
- workingMovie.MovieSet = queryList(0).movieset
- workingMovie.tmdbid = queryList(0).tmdbid
-
- tsmiMov_PlayTrailer.Visible = Not queryList(0).MissingTrailer
- tsmiMov_ViewMovieDbSetPage.Enabled = Not IsNothing(workingMovie.MovieSet) AndAlso Integer.TryParse(workingMovie.MovieSet.MovieSetId,Nothing)
- tsmiMov_ViewMovieDbMoviePage.Enabled = Integer.TryParse(workingMovie.tmdbid,Nothing) And Not workingMovie.tmdbid=""
- Call mov_FormPopulate(yielding)
- Else
- If needtoload = True Then Call mov_FormPopulate(yielding)
- End If
- done = True
- Else
- outlinetxt.Text = ""
- PbMovieFanArt.Image = Nothing
- PbMoviePoster.Image = Nothing
- roletxt.Text = ""
- PictureBoxActor.Image = Nothing
- SplitContainer2.Visible = False
- titletxt.Visible = False
- Label75.Visible = False
- TextBox34.Visible = False
- TextBoxMutisave.Visible = True
- Panel6.Visible = False
- FanTvArtList.Items.Clear()
- btnMovRescrape.Visible = False
- Label128.Visible = True
- cbMovieDisplay_MovieSet.Items.Insert(0, "")
- cbMovieDisplay_MovieSet.SelectedIndex = 0
- cbUsrRated.SelectedIndex = -1
- Dim add As Boolean = True
- Dim watched As String = ""
- For Each sRow As DataGridViewRow In selectedRows
- Dim old As String = watched
- For Each item In oMovies.MovieCache
- If item.fullpathandfilename = sRow.Cells(NFO_INDEX).Value.ToString Then
- If watched = "" Then
- watched = item.playcount
- old = watched
- Else
- watched = item.playcount
- End If
- If watched <> old Then
- add = False
- End If
- Exit For
- End If
-
- If Yield(yielding) Then Return
- Next
- Next
- If add = False Then
- btnMovWatched.Text = ""
- btnMovWatched.BackColor = Color.Gray
- Else
- If watched = "1" Then
- btnMovWatched.Text = "&Watched"
- btnMovWatched.BackColor = Color.LawnGreen
- btnMovWatched.Refresh()
- Else
- btnMovWatched.Text = "Un&watched"
- btnMovWatched.BackColor = Color.Red
- btnMovWatched.Refresh()
- End If
- End If
- End If
- End Sub
-
- #Region "DataGridViewMovies Events"
- Private Sub DataGridViewMovies_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridViewMovies.CellClick
- _yield = True
- Application.DoEvents()
- _yield = False
- DisplayMovie()
- End Sub
-
- Private Sub DataGridViewMovies_ColumnHeaderMouseClick( sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridViewMovies.ColumnHeaderMouseClick
- Dim col_index = e.ColumnIndex
- DGVMoviesColName = DataGridViewMovies.Columns(col_index).Name
- btnreverse.Checked = Not btnreverse.Checked
- btnreverse_CheckedChanged(Nothing,Nothing)
- End Sub
-
- Private Sub DataGridViewMovies_DoubleClick(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles DataGridViewMovies.DoubleClick
- Try
- Dim info = DataGridViewMovies.HitTest(e.X, e.Y)
- If info.ColumnX = -1 Then
- Return
- End If
- Try
- If IsNumeric(DataGridViewMovies.SelectedCells(NFO_INDEX).Value.ToString) Then Return
- Catch
- Return
- End Try
- If info.Type <> DataGridViewHitTestType.ColumnHeader Then
- mov_Play("Movie")
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub DataGridViewMovies_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles DataGridViewMovies.DragDrop
-
- Dim files() As String
-
- files = e.Data.GetData(DataFormats.FileDrop)
- For f = 0 To UBound(files)
- If IO.File.Exists(files(f)) Then
- ' This path is a file.
- Dim skip As Boolean = False
- For Each item In oMovies.MovieCache
- If item.fullpathandfilename = files(f) Then
- skip = True
- Exit For
- End If
- Next
- For Each item In droppedItems
- If item = files(f) Then
- skip = True
- Exit For
- End If
- Next
- If mov_FileCheckValid(files(f)) = True Then
- If skip = False Then droppedItems.Add(files(f))
- End If
- Else
- If IO.Directory.Exists(files(f)) Then
- ' This path is a directory.
- Dim di As New IO.DirectoryInfo(files(f))
- Dim diar1 As IO.FileInfo() = di.GetFiles()
- Dim dra As IO.FileInfo
-
- 'list the names of all files in the specified directory
- For Each dra In diar1
- Dim skip As Boolean = False
- For Each item In oMovies.MovieCache
- If item.fullpathandfilename = dra.FullName Then
- skip = True
- Exit For
- End If
- Next
- For Each item In droppedItems
- If item = dra.FullName Then
- skip = True
- Exit For
- End If
- Next
- If mov_FileCheckValid(dra.FullName) = True Then
- If skip = False Then droppedItems.Add(dra.FullName)
- End If
- Next
- End If
- End If
- Next
-
- If droppedItems.Count > 0 Then
- DoScrapeDroppedFiles()
- End If
-
- End Sub
-
- Private Sub DataGridViewMovies_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles DataGridViewMovies.DragEnter
- Try
- e.Effect = DragDropEffects.Copy
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub DataGridViewMovies_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridViewMovies.KeyUp
- DisplayMovie(True)
- End Sub
-
- Private Sub DataGridViewMovies_KeyPress(sender As Object, e As KeyPressEventArgs) Handles DataGridViewMovies.Keypress
- If [Char].IsLetter(e.KeyChar) or [Char].IsDigit(e.KeyChar) Then
- Dim ekey As String = e.KeyChar.ToString.ToLower
- keypresstimer.Stop()
- MovieKeyPress &= ekey
- keypresstimer.Start()
- For i As Integer = 0 To (DataGridViewMovies.Rows.Count) - 1
- Dim rtitle As String = DataGridViewMovies.Rows(i).Cells("DisplayTitle").Value.ToString.ToLower
- If rtitle.StartsWith(MovieKeyPress) Then
- Dim icell As Integer = DataGridViewMovies.CurrentCell.ColumnIndex
- DataGridViewMovies.CurrentCell = DataGridViewMovies.Rows(i).Cells(icell)
- DisplayMovie()
- Return
- End If
- Next
- End If
- End Sub
-
- Private Sub DataGridViewMovies_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGridViewMovies.MouseLeave
- TooltipGridViewMovies1.Visible = False
- TimerToolTip.Enabled = False
- End Sub
-
- Private Sub DataGridViewMovies_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGridViewMovies.MouseHover
- TimerToolTip.Start()
- End Sub
-
- Private Sub DataGridViewMovies_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridViewMovies.MouseMove
- Try
- Dim MousePos As Point = DataGridViewMovies.PointToClient(Control.MousePosition)
- Dim objHitTestInfo As DataGridView.HitTestInfo = DataGridViewMovies.HitTest (MousePos.X, MousePos.Y)
- Dim MouseRowIndex As Integer = objHitTestInfo.RowIndex
-
- TimerToolTip.Enabled = True
-
- If MouseRowIndex > -1 Then
- Dim Runtime As String = ""
- Dim RatingRuntime As String = ""
- Dim movietitle As String = DataGridViewMovies.Rows(MouseRowIndex).Cells("Title").Value.ToString
- Dim movieYear As String = DataGridViewMovies.Rows(MouseRowIndex).Cells("Year").Value.ToString
- Dim Rating As String = "Rating: " & DataGridViewMovies.Rows(MouseRowIndex).Cells("Rating").Value.ToString.FormatRating
-
- If DataGridViewMovies.Rows(MouseRowIndex).Cells("Runtime").Value.ToString.Length > 3 Then
- Runtime = "Runtime: " & DataGridViewMovies.Rows(MouseRowIndex).Cells("IntRuntime").Value.ToString
- End If
-
- RatingRuntime = Rating & " " & Runtime
-
- Dim Plot As String = DataGridViewMovies.Rows(MouseRowIndex).Cells("Plot").Value.ToString
-
- If objHitTestInfo.RowY > -1 Then
- TooltipGridViewMovies1.Visible = Pref.ShowMovieGridToolTip
-
- TooltipGridViewMovies1.Textinfo(Plot)
- TooltipGridViewMovies1.TextLabelMovieYear(movieYear)
- TooltipGridViewMovies1.TextMovieName(movietitle)
- TooltipGridViewMovies1.TextLabelRatingRuntime(RatingRuntime)
-
- TooltipGridViewMovies1.Left = MousePos.X + 10
- TooltipGridViewMovies1.Top = MousePos.Y + TooltipGridViewMovies1.Height + 30
- End If
- End If
- Catch
- End Try
- End Sub
-
- Private Sub DataGridViewMovies_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridViewMovies.MouseUp
- tsmiMov_PlayTrailer.Visible = True
- tsmiMov_ViewMovieDbSetPage.Enabled = False
- tsmiMov_ViewMovieDbMoviePage.Enabled = False
-
- If e.Button = MouseButtons.Right Then
- Dim multiselect As Boolean = False
- 'If more than one movie is selected, check if right-click is on the selection.
- If DataGridViewMovies.SelectedRows.Count > 1 Then
- multiselect = True
- End If
- 'Otherwise, bring up the context menu for a single movie
-
- If multiselect = True Then
- tsmiMov_MovieName.BackColor = Color.Orange
- tsmiMov_MovieName.Text = "Multisave Mode"
- tsmiMov_MovieName.Font = New Font("Arial", 10, FontStyle.Bold)
- tsmiMov_PlayTrailer.Visible = False 'multisave mode the "Play Trailer' is always hidden
- Else
-
- Try
- 'update context menu with movie name & also if we show the 'Play Trailer' menu item
- tsmiMov_MovieName.BackColor = Color.Honeydew
- tsmiMov_MovieName.Text = "'" & DataGridViewMovies.SelectedCells(NFO_INDEX+4).Value.ToString & "'"
- tsmiMov_MovieName.Font = New Font("Arial", 10, FontStyle.Bold)
-
- Dim movie As Data_GridViewMovie = (From f In oMovies.Data_GridViewMovieCache Where f.fullpathandfilename = DataGridViewMovies.selectedCells(NFO_INDEX).Value.ToString).ToList(0)
-
- tsmiMov_PlayTrailer.Visible = Not movie.MissingTrailer
- tsmiMov_ViewMovieDbSetPage.Enabled = Not IsNothing(workingMovie.MovieSet) AndAlso Integer.TryParse(movie.MovieSet.MovieSetId,Nothing)
- tsmiMov_ViewMovieDbMoviePage.Enabled = Integer.TryParse(workingMovie.tmdbid,Nothing) And Not workingMovie.tmdbid=""
- Catch
- End Try
-
- End If
- End If
- End Sub
-
- #End Region ' DataGridViewMovies Events
-
- Private Function Mov_MissingMovie(ByVal qrylst As List(Of Data_GridViewMovie)) As Boolean
- Dim missingstr As String
- Dim Filepathandname As String
- Filepathandname = qrylst(0).fullpathandfilename.Replace(".nfo","")
- missingstr = "Video file Missing" & vbCrLf & Filepathandname & vbCrLf & "Do you wish to remove from database?"
- If MsgBox(missingstr,MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
- Mov_RemoveMovie()
- Return True
- End If
- Return False
- End Function
-
- Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
- Try
- If filterOverride = False Then
- If TextBox1.Text.Length > 0 Then
- TextBox1.BackColor = Color.Pink
- Else
- TextBox1.BackColor = Color.White
- End If
- TextBox1.Refresh()
- Call Mc.clsGridViewMovie.mov_FiltersAndSortApply(Me)
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub TabControl2_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TabControl2.MouseWheel
- Try
- If TabControl2.SelectedIndex = 1 Then
- mouseDelta = e.Delta / 120
- Try
- tpMovWall.AutoScrollPosition = New Point(0, tpMovWall.VerticalScroll.Value - (mouseDelta * 30))
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub TabControl2_Selecting(ByVal sender As Object, ByVal e As CancelEventArgs) Handles TabControl2.Selecting
- Dim tab As String = TabControl2.SelectedTab.Text
- If tab.ToLower = "movie preferences" Then
- e.Cancel = True
- OpenPreferences(1)
- End If
- End Sub
-
- Private Sub TabControl2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl2.SelectedIndexChanged
-
- mov_PreferencesDisplay()
- Dim tempstring As String = ""
- Dim tab As String = TabControl2.SelectedTab.Name
- If tab <> tpMovMain.Name And tab <> tpMovFolders.Name And tab <> tpMovStubs.Name Then
- 'If tab <> "Main Browser" And tab <> "Folders" And tab <> "Movie Preferences" And tab <> "Media Stubs" Then
- If workingMovieDetails Is Nothing And movieFolders.Count = 0 And Pref.offlinefolders.Count = 0 Then
- Me.TabControl2.SelectedIndex = currentTabIndex
- MsgBox("There are no movies in your list to work on" & vbCrLf & "Add movie folders in the Folders Tab" & vbCrLf & "Then select the ""Search For New Movies"" Tab")
- Exit Sub
- ElseIf workingMovieDetails Is Nothing And movieFolders.Count > 0 Then 'And tab <> "Search for new movies" Then
- Me.TabControl2.SelectedIndex = currentTabIndex
- If oMovies.MovieCache.Count > 0 Then
- MsgBox("No Movie is selected")
- Exit Sub
- Else
- MsgBox("There are no movies in your list to work on" & vbCrLf & "If The Folders You Have Added In The" & vbCrLf & "Preferences Menu Contain Movie Files" & vbCrLf & "Then select the ""Search For New Movies"" Tab")
- Exit Sub
- End If
- End If
- Else
- currentTabIndex = Me.TabControl2.SelectedIndex
- End If
- If tab = tpMovWebBrowser.Name Then 'Movie WebBrowser tab.
- 'If tab = "" Then
- If workingMovieDetails.fullmoviebody.imdbid <> Nothing OrElse workingMovieDetails.fullmoviebody.tmdbid <> "" Then
- Dim weburl As String = ""
- Dim TMDB As String = workingMovieDetails.fullmoviebody.tmdbid
- Dim IMDB As String = workingMovieDetails.fullmoviebody.imdbid
- Dim TMDBLan As List(Of String) = Utilities.GetTmdbLanguage(Pref.TMDbSelectedLanguageName)
- If (IMDB <> "" And IMDB <> "0") AndAlso TMDB <> "" Then
- Dim tpi As Integer = tpMovWebBrowser.ImageIndex
- If tpi = 1 Then
- weburl = "https://www.themoviedb.org/movie/" & TMDB & "?language=" & TMDBLan(0) 'de"
- Else
- weburl = "http://www.imdb.com/title/" & IMDB & "/"
- End If
- ElseIf (IMDB <> "" And IMDB <> "0") AndAlso TMDB = "" Then
- weburl = "http://www.imdb.com/title/" & IMDB & "/"
- ElseIf IMDB = "0" AndAlso TMDB <> "" Then
- weburl = "https://www.themoviedb.org/movie/" & TMDB & "?language=" & TMDBLan(0) 'de"
- End If
-
- If Pref.externalbrowser = True Then
- Me.TabControl2.SelectedIndex = currentTabIndex
- 'AnotherPhil bug fix - If the default browser is <goz> IE <goz/> then not stating the exe throws an exception
- OpenUrl(weburl)
- Else
- Try
- currentTabIndex = TabControl2.SelectedIndex
- WebBrowser2.Hide()
- WebBrowser2.Navigate("about:blank")
- Do Until WebBrowser2.ReadyState = WebBrowserReadyState.Complete
- Application.DoEvents()
- System.Threading.Thread.Sleep(100)
- Loop
- WebBrowser2.Show()
- If IsNothing(WebBrowser2.Url) OrElse WebBrowser2.Url.AbsoluteUri.ToLower.ToString <> weburl Then
- WebBrowser2.Stop()
- WebBrowser2.ScriptErrorsSuppressed = True
- WebBrowser2.Navigate(weburl)
- currentTabIndex = TabControl2.SelectedIndex
- End If
- Catch
- WebBrowser2.Stop()
- WebBrowser2.ScriptErrorsSuppressed = True
- WebBrowser2.Navigate(weburl)
- End Try
- WebBrowser2.Focus()
- End If
- Else
- MsgBox("No IMDB or TMDB ID is available for this movie")
- End If
- ElseIf tab = tpMovMain.Name Then 'Movie Main Browser tab
- 'ElseIf tab = "Main Browser" Then
- 'Need to update displayed movies list as user may have invalidated it by have a 'missing...' filter selected and assigning one or more missing items
- currentTabIndex = TabControl2.SelectedIndex
- UpdateFilteredList()
- ElseIf tab = tpMovFileDetails.Name Then 'Movie File Details tab
- 'ElseIf tab.ToLower = "file details" Then
- currentTabIndex = TabControl2.SelectedIndex
- If TextBox8.Text = "" Then Call util_FileDetailsGet()
- ElseIf tab = tpMovFanart.Name Then 'Movie Fanart tab
- 'ElseIf tab.ToLower = "fanart" Then
- Dim isrootfolder As Boolean = False
- If Pref.movrootfoldercheck Then
- For Each moviefolder In movieFolders
- Dim movfolder As String = workingMovieDetails.fileinfo.fullpathandfilename.Replace("\" & workingMovieDetails.fileinfo.filename, "")
- If moviefolder.rpath = movfolder Then
- isrootfolder = True 'Check movie isn't in a rootfolder, if so, disable extrathumbs option from displaying
- Exit For
- End If
- Next
- End If
- If String.IsNullOrEmpty(tb_MovFanartScrnShtTime.Text) Then tb_MovFanartScrnShtTime.Text = "50"
- GroupBoxFanartExtrathumbs.Enabled = Not isrootfolder 'Or usefoldernames Or allfolders ' Visible 'hide or show fanart/extrathumbs depending of if we are using foldenames or not (extrathumbs needs foldernames to be used)
- UpdateMissingFanartNav()
- If Panel2.Controls.Count = 0 Then
- btn_MovFanartScrnSht.Visible = False
- tb_MovFanartScrnShtTime.Visible = False
- Label2.Visible = False
- Call mov_FanartLoad()
- End If
- If Panel2.Controls.Count = 1 AndAlso Panel2.Controls().Item(0).GetType Is GetType(Label) Then
- btn_MovFanartScrnSht.Visible = True
- tb_MovFanartScrnShtTime.Visible = True
- Label2.Visible = True
- End If
- currentTabIndex = TabControl2.SelectedIndex
- If Panel2.Controls.Count > 1 Then EnableFanartScrolling()
- ElseIf tab = tpMovPoster.Name Then 'Poster Tab
- 'ElseIf tab.ToLower = "posters" Then
- currentTabIndex = TabControl2.SelectedIndex
- gbMoviePostersAvailable.Refresh()
- btnMovPosterToggle.Visible = workingMovieDetails.fullmoviebody.MovieSet.MovieSetId <> ""
- UpdateMissingPosterNav()
- If Pref.MovPosterTabTMDBSelect Then btn_TMDb_posters.PerformClick()
- ElseIf tab = tpMovChange.Name Then 'Change Movie
- 'ElseIf tab.ToLower = "change movie" Then
- Call mov_ChangeMovieSetup(MovieSearchEngine)
- currentTabIndex = TabControl2.SelectedIndex
- ElseIf tab = tpMovWall.Name Then 'Wall Tab
- 'ElseIf tab.ToLower = "wall" Then
- Call mov_WallSetup()
- ElseIf tab = tpMovSetsTags.Name Then 'This will become obsolete
- 'ElseIf tab.ToLower = "moviesets & tags" Then
- Call MovieSetsAndTagsSetup()
- ElseIf tab = tpMovSets.Name Then 'Movie Sets & Tags tab
- 'ElseIf tab.ToLower = "moviesets & tags" Then
- Call MovieSetsAndTagsSetup() '' Change this to split Movie Sets and Tags
- ElseIf tab = tpMovTags.Name Then 'Movie Sets & Tags tab
- 'ElseIf tab.ToLower = "moviesets & tags" Then
- Call MovieSetsAndTagsSetup() '' Change this to split Movie Sets and Tags
- ElseIf tab = tpMovFanartTv.Name Then 'Fanart.Tv tab
- 'ElseIf tab.ToLower = "fanart.tv"
- UcFanartTv1.ucFanartTv_Refresh(workingMovieDetails)
- ElseIf tab = tpMovTable.Name Then 'Table tab
- 'ElseIf tab.ToLower = "table" Then
- currentTabIndex = TabControl2.SelectedIndex
- Call mov_TableSetup()
- Else
- currentTabIndex = TabControl2.SelectedIndex
- End If
- End Sub
-
- Private Sub TabControl2_Selecting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TabControlCancelEventArgs) Handles TabControl2.Selecting
- Try
- If Not IsNothing(messbox) AndAlso messbox.visible Then e.Cancel = True
-
- Dim selOption = cbFilterGeneral.Text.RemoveAfterMatch
-
- If selOption.IndexOf("Missing from set")=0 Then e.Cancel = True
- Catch
- End Try
- End Sub
-
- Private Sub TabControl2_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs) Handles TabControl2.MouseClick
- If e.Button = Windows.Forms.MouseButtons.Right Then
- For index As Integer = 0 To TabControl2.TabCount - 1 Step 1
- If TabControl2.GetTabRect(index).Contains(e.Location) Then
- If index = 8 Then
- Dim tpi As Integer = tpMovWebBrowser.ImageIndex
- If tpi = 0 Then
- tpMovWebBrowser.ImageIndex = 1
- Else
- tpMovWebBrowser.ImageIndex = 0
- End If
- tpMovWebBrowser.Refresh()
- End If
- Exit For
- End If
- Next index
- End If
- End Sub
-
- Private Sub mov_ChangeMovieSetup(ByVal engine As String)
- Dim tempstring As String = ""
- Dim isroot As Boolean = Pref.GetRootFolderCheck(workingMovieDetails.fileinfo.fullpathandfilename)
- If Pref.usefoldernames = False OrElse isroot Then
- tempstring = Utilities.RemoveFilenameExtension(IO.Path.GetFileName(workingMovieDetails.fileinfo.fullpathandfilename))
- Else
- tempstring = Utilities.GetLastFolder(workingMovieDetails.fileinfo.fullpathandfilename)
- End If
- If workingMovieDetails.fileinfo.fullpathandfilename.ToLower.IndexOf("\video_ts\") <> -1 Then
- tempstring = Utilities.GetLastFolder(workingMovieDetails.fileinfo.fullpathandfilename)
- End If
- Dim url As String
- If engine = "imdb" Then
- url = Pref.imdbmirror & "find?s=tt&q=" & Utilities.CleanFileName(tempstring)
- Else
- url = "http://www.themoviedb.org/search?query=" & Utilities.CleanFileName(tempstring)
- End If
- Dim uri As New Uri(url)
- WebBrowser1.Stop()
- WebBrowser1.ScriptErrorsSuppressed = True
- WebBrowser1.Navigate(uri.AbsoluteUri)
- WebBrowser1.Refresh()
- Panel2.Visible = True
- End Sub
-
-
- Public Sub util_OpenFolder(ByVal path As String)
- Dim tempstring As String = ""
- Dim action As String = String.Empty
- Dim errors As String = String.Empty
- Try
- If path <> "" Then
- tempstring = path
- Try
- If Not tempstring.ToLower.Contains("nfo") Then
- errors = "Trying to open Folder :- " & tempstring
- action = "Command - ""Call Shell(""explorer """ & tempstring & ", AppWinStyle.NormalFocus)"""
- Call Shell("explorer " & """" & tempstring & """", AppWinStyle.NormalFocus) 'opens the selected folder showing contents, no focus on any file.
- Else
- errors = "Trying to open Folder :- " & tempstring
- action = "Command - ""Call Shell(""explorer /select,""" & tempstring & ", AppWinStyle.NormalFocus)"""
- Call Shell("explorer /select," & """" & tempstring & """", AppWinStyle.NormalFocus) 'this shows the item as selected provided as tempstring i.e. a folder or a file (.nfo)
- End If
- Catch ex As Exception
- MsgBox("Can't open folder :- " & path)
- Call util_ErrorLog(action, errors)
- End Try
- Else
- MsgBox("No Folder To Open")
- End If
- Catch
- MsgBox("No Folder To Open")
- End Try
- End Sub
-
- Private Sub mov_FanartLoad()
- rbMovFanart.Checked = True
- MovFanartToggle = False
- btnMovFanartToggle.Visible = workingMovieDetails.fullmoviebody.MovieSet.MovieSetId <> ""
- Dim isfanartpath As String = workingMovieDetails.fileinfo.fanartpath
- Dim isvideotspath As String = If(workingMovieDetails.fileinfo.videotspath = "", "", workingMovieDetails.fileinfo.videotspath + "fanart.jpg")
- Dim movfanartpath As String = Utilities.DefaultFanartPath
- If isfanartpath <> Nothing Or isvideotspath <> "" Then
- Try
- If IO.File.Exists(isvideotspath) Then
- movfanartpath = isvideotspath
- ElseIf IO.File.Exists(isfanartpath) Then
- movfanartpath = isfanartpath
- End If
- util_ImageLoad(PictureBox2, movfanartpath, Utilities.DefaultFanartPath)
- If movfanartpath = "" Then
- lblMovFanartWidth.Text = ""
- lblMovFanartHeight.Text = ""
- Else
- lblMovFanartWidth.Text = PictureBox2.Image.Width
- lblMovFanartHeight.Text = PictureBox2.Image.Height
- End If
- Catch ex As Exception
- End Try
- End If
- MovFanartDisplay()
- End Sub
-
- Public Sub MovFanartClear()
- Try
- For i = Panel2.Controls.Count - 1 To 0 Step -1
- Panel2.Controls.RemoveAt(i)
- Next
- Catch
- End Try
- End Sub
-
- Public Sub MovFanartDisplay(Optional ByVal SetId As String = "")
-
- Me.Refresh()
- fanartArray.Clear()
- messbox = New frmMessageBox("", "Retrieving Fanart...", "Please wait...")
- messbox.Show()
- messbox.Refresh()
- Dim tmdb As New TMDb
- If SetId = "" Then
- tmdb.Imdb = If(workingMovieDetails.fullmoviebody.imdbid.Contains("tt"), workingMovieDetails.fullmoviebody.imdbid, "")
- tmdb.TmdbId = workingMovieDetails.fullmoviebody.tmdbid
- Try
- fanartArray.AddRange(tmdb.McFanart)
- Catch
- End Try
- Else
- tmdb.SetId = SetId
- Try
- fanartArray.AddRange(tmdb.McSetFanart)
- Catch
- End Try
- End If
- messbox.TextBox2.Text = "Setting up display...."
- messbox.Refresh()
- Try
- If fanartArray.Count > 0 Then
- Dim MovFanartPicBox As New List(Of FanartPicBox)
- Dim location As Integer = 0
- Dim itemcounter As Integer = 0
- For Each item In fanartArray
- Dim thispicbox As New FanartPicBox
- fanartBoxes() = New PictureBox()
- With fanartBoxes
- .Location = New Point(0, location)
- If fanartArray.Count > 2 Then
- .Width = 410
- .Height = 233
- Else
- .Width = 424
- .Height = 243
- End If
- .SizeMode = PictureBoxSizeMode.Zoom
- .Visible = True
- .BorderStyle = BorderStyle.Fixed3D
- .Name = "moviefanart" & itemcounter.ToString
- AddHandler fanartBoxes.DoubleClick, AddressOf util_ZoomImage2
- End With
- thispicbox.pbox = fanartBoxes
- thispicbox.imagepath = item.ldurl
- MovFanartPicBox.Add(thispicbox)
- Application.DoEvents()
- If fanartArray.Count > 2 Then
- fanartCheckBoxes() = New RadioButton()
- With fanartCheckBoxes
- .BringToFront()
- .Location = New Point(199, location + 229)
- .Name = "moviefanartcheckbox" & itemcounter.ToString
- End With
- resLabels = New Label()
- With resLabels
- .BringToFront()
- .Location = New Point(0, location + 235)
- .Name = "label" & itemcounter.ToString
- .Text = "(" & item.hdwidth & " x " & item.hdheight & ") (" & item.ldwidth & " x " & item.ldheight & ")"
- .Width = 200
- End With
- votelabels = New Label()
- With votelabels
- .BringToFront()
- .Location = New Point(300, location + 235)
- .Name = "votelabel" & itemcounter.ToString
- .Text = "Votes: " & item.votes.ToString
- '.Width = 200
- End With
- itemcounter += 1
- location += 260
- Else
- fanartCheckBoxes() = New RadioButton()
- With fanartCheckBoxes
- .BringToFront()
- .Location = New Point(199, location + 243)
- .Name = "moviefanartcheckbox" & itemcounter.ToString
- .Text = ""
- End With
- resLabels = New Label()
- With resLabels
- .BringToFront()
- .Location = New Point(0, location + 249)
- .Name = "label" & itemcounter.ToString
- .Text = "(" & item.hdwidth & " x " & item.hdheight & ") (" & item.ldwidth & " x " & item.ldheight & ")"
- .Width = 200
- End With
- votelabels = New Label()
- With votelabels
- .BringToFront()
- .Location = New Point(300, location + 249)
- .Name = "votelabel" & itemcounter.ToString
- .Text = "Votes: " & item.votes.ToString
- .Width = 200
- End With
- itemcounter += 1
- location += 275
- End If
- Me.Panel2.Controls.Add(fanartBoxes())
- Me.Panel2.Controls.Add(fanartCheckBoxes())
- Me.Panel2.Controls.Add(resLabels)
- Me.Panel2.Controls.Add(votelabels)
- Application.DoEvents()
- Next
- Me.Panel2.Refresh()
- Me.Refresh()
- If MovFanartPicBox.Count > 0 Then
- messbox.Close()
- If Not ImgBw.IsBusy Then
- ToolStripStatusLabel2.Text = "Starting Download of Images..."
- ToolStripStatusLabel2.Visible = True
- ImgBw.RunWorkerAsync({MovFanartPicBox, 0, MovFanartPicBox.Count, Me.Panel2})
- End If
- End If
- EnableFanartScrolling()
- Me.Panel2.Refresh()
- Me.Refresh
- Else
- Dim mainlabel2 As Label
- mainlabel2 = New Label
- With mainlabel2
- .Location = New Point(0, 100)
- .AutoSize = False
- .TextAlign = ContentAlignment.MiddleCenter
- .Width = 410
- .Height = 400
- .Font = New System.Drawing.Font("Arial", 15, FontStyle.Bold)
- .Text = "No Fanart Was Found At" & Environment.NewLine & "www.themoviedb.org For This Movie"
- End With
-
- Me.Panel2.Controls.Add(mainlabel2)
- End If
- messbox.Close()
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- If Not IsNothing(messbox) Then messbox.Close()
- End Try
- End Sub
-
- Sub EnableFanartScrolling()
- Try
- Panel2.Focus()
- 'Dim rb As RadioButton = Panel2.Controls("moviefanartcheckbox0")
- 'If rb Is Nothing Then Exit Sub
- 'rb.Select() 'Causes RadioButtons checked state to toggle
- 'rb.Checked = Not rb.Checked 'Undo unwanted checked state toggling
- Catch
- End Try
- End Sub
-
- Private Sub util_ZoomImage2(ByVal sender As Object, ByVal e As EventArgs)
-
- Dim tempstring As String = sender.name
- Dim tempstring2 As String = String.Empty
- Dim tempint As Integer = 0
- If tempstring.IndexOf("poster") <> -1 Then
- tempstring = tempstring.Replace("poster", "")
- tempint = Convert.ToDecimal(tempstring)
- If tempstring2 = Nothing Then
- tempint = Convert.ToDecimal(tempstring)
- tempint = tempint + ((currentPage - 1) * 10)
- tempstring2 = posterArray(tempint).hdUrl
- End If
- End If
- If tempstring.IndexOf("moviefanart") <> -1 Then
- tempstring = tempstring.Replace("moviefanart", "")
- tempint = Convert.ToDecimal(tempstring)
- tempstring2 = fanartArray(tempint).hdUrl
- End If
- If tempstring.IndexOf("tvfanart") <> -1 Then
- tempstring = tempstring.Replace("tvfanart", "")
- tempint = Convert.ToDecimal(tempstring)
- tempstring2 = listOfTvFanarts(tempint).bigUrl
- End If
- Dim buffer(4000000) As Byte
- Dim size As Integer = 0
- Dim bytesRead As Integer = 0
-
- bigPanel = New Panel
- With bigPanel
- .Width = Me.Width
- .Height = Me.Height
- .BringToFront()
- .Dock = DockStyle.Fill
- End With
- Me.Controls.Add(bigPanel)
- bigPanel.BringToFront()
- bigPictureBox = New PictureBox()
-
- With bigPictureBox
- .Location = New Point(0, 0)
- .Width = bigPanel.Width
- .Height = bigPanel.Height
- .SizeMode = PictureBoxSizeMode.Zoom
- .WaitOnLoad = True
-
- .Visible = False
- .BorderStyle = BorderStyle.Fixed3D
- AddHandler bigPictureBox.DoubleClick, AddressOf util_PicBoxClose
- .Dock = DockStyle.Fill
- End With
- Try
- util_ImageLoad(bigPictureBox, tempstring2, "")
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- Me.bigPanel.Controls.Add(bigPictureBox)
- Dim bigpanellabel As Label
- bigpanellabel = New Label
- With bigpanellabel
- .Location = New Point(20, 200)
- .Width = 150
- .Height = 50
- .Visible = True
- .Text = "Double Click Image To" & vbCrLf & "Return To Browser"
- End With
-
- Me.bigPanel.Controls.Add(bigpanellabel)
- bigpanellabel.BringToFront()
- Application.DoEvents()
- Me.Refresh()
- Try
- If bigPictureBox.Image Is Nothing Then
- tempstring2 = posterArray(tempint).ldUrl
- util_ImageLoad(bigPictureBox, tempstring2, "")
- End If
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- Try
- If bigPictureBox.Image.Width < 20 Then
- tempstring2 = posterArray(tempint).ldUrl
- util_ImageLoad(bigPictureBox, tempstring2, "")
- End If
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- Dim sizex As Integer = bigPictureBox.Image.Width
- Dim sizey As Integer = bigPictureBox.Image.Height
- tempstring = "Full Image Resolution :- " & sizex.ToString & " x " & sizey.ToString
- Dim resolutionlbl As New Label
- With resolutionlbl
- .Location = New Point(20, 450)
- .Width = 180
- .Text = tempstring
- .BackColor = Color.Transparent
- End With
-
- Me.bigPanel.Controls.Add(resolutionlbl)
- resolutionlbl.BringToFront()
- bigPictureBox.Visible = True
- bigPictureBox.Refresh()
- End Sub
-
- Private Sub SaveFanart(hd As Boolean, Optional clipbrd As Boolean = False)
- Try
- If ImgBw.Isbusy Then
- ImgBw.CancelAsync()
- Do Until Not ImgBw.IsBusy
- Application.DoEvents()
- Loop
- End If
- Try
- messbox.Close()
- Catch
- End Try
- messbox = New frmMessageBox("", "Downloading Fanart...", "")
- messbox.Show()
- messbox.Refresh()
- Application.DoEvents()
- System.Windows.Forms.Cursor.Current = Cursors.WaitCursor
-
- Dim tempstring As String = String.Empty
- Dim tempint As Integer = 0
- Dim tempstring2 As String = String.Empty
- Dim allok As Boolean = False
-
- If clipbrd Then
- tempstring2 = PictureBox2.Tag.tostring
- allok = True
- Else
- 'Find selected fanart, if any
- For Each button As Control In Me.Panel2.Controls
-
- If button.Name.IndexOf("checkbox") <> -1 Then
- Dim b1 As RadioButton = CType(button, RadioButton)
- If b1.Checked = True Then
- tempstring = b1.Name
- tempstring = tempstring.Replace("moviefanartcheckbox", "")
- tempint = Convert.ToDecimal(tempstring)
- If hd Then
- tempstring2 = fanartArray(tempint).hdUrl
- Else
- tempstring2 = fanartArray(tempint).ldUrl
- End If
- allok = True
- Exit For
- End If
- End If
- Next
- End If
-
- If Not allok Then
- MsgBox("No Fanart Is Selected")
- Else
- Try
- If Not MovFanartToggle Then
- Dim issavefanart As Boolean = Pref.savefanart
- Dim FanartOrExtraPath As String = mov_FanartORExtrathumbPath
- Dim xtra As Boolean = False
- Dim extrfanart As Boolean = False
- If rbMovThumb1.Checked Or rbMovThumb2.Checked Or rbMovThumb3.Checked Or rbMovThumb4.Checked Or rbMovThumb5.Checked Then xtra = True
- Pref.savefanart = True
- If xtra Then extrfanart = Movie.SaveFanartImageToCacheAndPath(tempstring2, FanartOrExtraPath)
-
- If xtra OrElse Movie.SaveFanartImageToCacheAndPath(tempstring2, FanartOrExtraPath) Then
- If Not xtra Then
- Dim paths As List(Of String) = Pref.GetfanartPaths(workingMovieDetails.fileinfo.fullpathandfilename,If(workingMovieDetails.fileinfo.videotspath <>"",workingMovieDetails.fileinfo.videotspath,""))
- Movie.SaveFanartImageToCacheAndPaths(tempstring2, paths)
- End If
- Pref.savefanart = issavefanart
- mov_DisplayFanart()
- util_ImageLoad(PbMovieFanArt, workingMovieDetails.fileinfo.fanartpath, Utilities.DefaultFanartPath)
- Dim video_flags = VidMediaFlags(workingMovieDetails.filedetails, workingMovieDetails.fullmoviebody.title.ToLower.Contains("3d"))
- movieGraphicInfo.OverlayInfo(PbMovieFanArt, ratingtxt.Text, video_flags, workingMovie.DisplayFolderSize)
-
- For Each paths In Pref.offlinefolders
- Dim offlinepath As String = paths & "\"
- If workingMovieDetails.fileinfo.fanartpath.IndexOf(offlinepath) <> -1 Then
- Dim mediapath As String
- mediapath = Utilities.GetFileName(workingMovieDetails.fileinfo.fullpathandfilename)
- messbox.TextBox1.Text = "Creating Offline Movie..."
- Call mov_OfflineDvdProcess(workingMovieDetails.fileinfo.fullpathandfilename, workingMovieDetails.fullmoviebody.title, mediapath)
- End If
- Next
- Else
- util_ImageLoad(PictureBox2, Utilities.DefaultFanartPath, Utilities.DefaultFanartPath)
- Pref.savefanart = issavefanart
- End If
-
- lblMovFanartWidth.Text = PictureBox2.Image.Width
- lblMovFanartHeight.Text = PictureBox2.Image.Height
-
- UpdateMissingFanart()
-
- XbmcLink_UpdateArtwork
- Else
- Dim MovSetFanartSavePath As String = workingMovieDetails.fileinfo.movsetfanartpath
- If MovSetFanartSavePath <> "" Then
- Movie.SaveFanartImageToCacheAndPath(tempstring2, MovSetFanartSavePath)
- MovPanel6Update()
- util_ImageLoad(PictureBox2, MovSetFanartSavePath, Utilities.DefaultFanartPath)
- Else
- MsgBox("!! Problem formulating correct save location for Fanart" & vbCrLf & " Please check your settings")
- End If
- End If
-
- Catch ex As WebException
- MsgBox(ex.Message)
- End Try
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- Finally
- messbox.Close()
- End Try
- End Sub
-
- Sub UpdateMissingFanart
- oMovies.LoadMovie(workingMovieDetails.fileinfo.fullpathandfilename)
-
- ProgState = ProgramState.ResettingFilters
- Assign_FilterGeneral()
- ProgState = ProgramState.Other
-
- UpdateMissingFanartNav
- End Sub
-
- Sub UpdateMissingFanartNav
-
- 'Default to selecting first row if non selected
- If DataGridViewMovies.SelectedRows.Count=0 And DataGridViewMovies.Rows.Count>1 Then
- DataGridViewMovies.Rows(0).Selected=True
- End If
-
- UpdateMissingFanartNextBtn
- UpdateMissingFanartPrevBtn
- UpdatelblFanartMissingCount
- End Sub
-
- Sub UpdatelblFanartMissingCount
- Dim i As Integer = 0
- Dim x As Integer = 0
-
- While i<DataGridViewMovies.Rows.Count
- Dim row As Data_GridViewMovie = DataGridViewMovies.DataSource(i)
-
- If row.MissingFanart Then x = x + 1
-
- i = i + 1
- End While
-
- lblFanartMissingCount.Text = x & " Missing"
- lblFanartMissingCount.Visible = x <> 0
- End Sub
-
- Sub UpdateMissingFanartNextBtn
- btnNextMissingFanart.Enabled = False
-
- If DataGridViewMovies.SelectedRows.Count=0 Then Return
-
- Dim i As Integer = DataGridViewMovies.SelectedRows(0).Index + 1
- While i<DataGridViewMovies.Rows.Count
- Dim row As Data_GridViewMovie = DataGridViewMovies.DataSource(i)
-
- If row.MissingFanart Then
- btnNextMissingFanart.Enabled = True
- btnNextMissingFanart.Tag = i
- Return
- End If
-
- i = i + 1
- End While
- btnNextMissingFanart.Visible = btnNextMissingFanart.Enabled
- End Sub
-
- Sub UpdateMissingFanartPrevBtn
- btnPrevMissingFanart.Enabled = False
-
- If DataGridViewMovies.SelectedRows.Count=0 Then Return
-
- Dim i As Integer = DataGridViewMovies.SelectedRows(0).Index - 1
- While i>=0
- Dim row As Data_GridViewMovie = DataGridViewMovies.DataSource(i)
-
- If row.MissingFanart Then
- btnPrevMissingFanart.Enabled = True
- btnPrevMissingFanart.Tag = i
- Return
- End If
-
- i = i - 1
- End While
- btnPrevMissingFanart.Visible = btnPrevMissingFanart.Enabled
- End Sub
-
- Sub UpdateMissingPoster
- oMovies.LoadMovie(workingMovieDetails.fileinfo.fullpathandfilename)
-
- ProgState = ProgramState.ResettingFilters
- Assign_FilterGeneral()
- ProgState = ProgramState.Other
-
- UpdateMissingPosterNav
- End Sub
-
- Sub UpdateMissingPosterNav
-
- 'Default to selecting first row if non selected
- If DataGridViewMovies.SelectedRows.Count=0 And DataGridViewMovies.Rows.Count>1 Then DataGridViewMovies.Rows(0).Selected=True
-
- UpdateMissingPosterNextBtn
- UpdateMissingPosterPrevBtn
- UpdatelblPosterMissingCount
- End Sub
-
- Sub UpdatelblPosterMissingCount
- Dim i As Integer = 0
- Dim x As Integer = 0
- While i<DataGridViewMovies.Rows.Count
- Dim row As Data_GridViewMovie = DataGridViewMovies.DataSource(i)
- If row.MissingPoster Then x = x + 1
- i = i + 1
- End While
- lblPosterMissingCount.Text = x & " Missing"
- lblPosterMissingCount.Visible = x <> 0
- End Sub
-
- Sub UpdateMissingPosterNextBtn
- btnNextMissingPoster.Enabled = False
- If DataGridViewMovies.SelectedRows.Count=0 Then Return
- Dim i As Integer = DataGridViewMovies.SelectedRows(0).Index + 1
- While i<DataGridViewMovies.Rows.Count
- Dim row As Data_GridViewMovie = DataGridViewMovies.DataSource(i)
- If row.MissingPoster Then
- btnNextMissingPoster.Enabled = True
- btnNextMissingPoster.Tag = i
- Return
- End If
- i = i + 1
- End While
- btnNextMissingPoster.Visible = btnNextMissingPoster.Enabled
- End Sub
-
- Sub UpdateMissingPosterPrevBtn
- btnPrevMissingPoster.Enabled = False
- If DataGridViewMovies.SelectedRows.Count=0 Then Return
- Dim i As Integer = DataGridViewMovies.SelectedRows(0).Index - 1
- While i>=0
- Dim row As Data_GridViewMovie = DataGridViewMovies.DataSource(i)
- If row.MissingPoster Then
- btnPrevMissingPoster.Enabled = True
- btnPrevMissingPoster.Tag = i
- Return
- End If
- i = i - 1
- End While
- btnPrevMissingPoster.Visible = btnPrevMissingPoster.Enabled
- End Sub
-
- Private Function util_ImageCrop(ByVal SrcBmp As Bitmap, ByVal NewSize As Size, ByVal StartPoint As Point) As Bitmap
- If NewSize.Width < 1 Or NewSize.Height < 1 Then
- Return SrcBmp
- Exit Function
- End If
- Dim SrcRect As New Rectangle(StartPoint.X, StartPoint.Y, NewSize.Width, NewSize.Height)
- Dim DestRect As New Rectangle(0, 0, NewSize.Width, NewSize.Height)
- Dim DestBmp As New Bitmap(NewSize.Width, NewSize.Height, Imaging.PixelFormat.Format32bppArgb)
- Dim g As Graphics = Graphics.FromImage(DestBmp)
- g.DrawImage(SrcBmp, DestRect, SrcRect, GraphicsUnit.Pixel)
- Return DestBmp
- End Function ' Crop Image Function
-
- Private Sub util_ImageCropTop()
- If PictureBox2.Image Is Nothing Then Exit Sub
- Dim imagewidth As Integer
- Dim imageheight As Integer
- imagewidth = PictureBox2.Image.Width
- imageheight = PictureBox2.Image.Height
- PictureBox2.Image = util_ImageCrop(PictureBox2.Image, New Size(imagewidth, imageheight - 1), New Point(0, 1)).Clone
- PictureBox2.SizeMode = PictureBoxSizeMode.Zoom
- End Sub
-
- Private Sub util_ImageCropBottom()
- If PictureBox2.Image Is Nothing Then Exit Sub
- Dim imagewidth As Integer
- Dim imageheight As Integer
- imagewidth = PictureBox2.Image.Width
- imageheight = PictureBox2.Image.Height
- PictureBox2.Image = util_ImageCrop(PictureBox2.Image, New Size(imagewidth, imageheight - 1), New Point(0, 0)).Clone
- PictureBox2.SizeMode = PictureBoxSizeMode.Zoom
- End Sub
-
- Private Sub util_ImageCropLeft()
- If PictureBox2.Image Is Nothing Then Exit Sub
- Dim imagewidth As Integer
- Dim imageheight As Integer
- imagewidth = PictureBox2.Image.Width
- imageheight = PictureBox2.Image.Height
- PictureBox2.Image = util_ImageCrop(PictureBox2.Image, New Size(imagewidth - 1, imageheight), New Point(1, 0)).Clone
- PictureBox2.SizeMode = PictureBoxSizeMode.Zoom
- End Sub
-
- Private Sub util_ImageCropRight()
- If PictureBox2.Image Is Nothing Then Exit Sub
- Dim imagewidth As Integer
- Dim imageheight As Integer
- thumbedItsMade = True
- imagewidth = PictureBox2.Image.Width
- imageheight = PictureBox2.Image.Height
- PictureBox2.Image = util_ImageCrop(PictureBox2.Image, New Size(imagewidth - 1, imageheight), New Point(0, 0)).Clone
- PictureBox2.SizeMode = PictureBoxSizeMode.Zoom
- End Sub
-
- Private Sub mov_PosterPanelClear()
- For i = panelAvailableMoviePosters.Controls.Count - 1 To 0 Step -1
- panelAvailableMoviePosters.Controls.RemoveAt(i)
- Next
- End Sub
-
- Private Sub mov_PosterInitialise()
- pageCount = 0
- currentPage = 1
- cbMoviePosterSaveLoRes.Enabled = False
- btnPosterTabs_SaveImage.Enabled = False
- mov_PosterPanelClear()
- If Pref.maximumthumbs < 1 Then
- Else
- Pref.maximumthumbs = 10
- End If
- btnPosterTabs_SaveImage.Enabled = False
- cbMoviePosterSaveLoRes.Enabled = False
- posterPicBoxes = Nothing
- posterCheckBoxes = Nothing
- resLabel = Nothing
- Application.DoEvents()
- posterArray.Clear()
- End Sub
-
- Private Sub mov_PosterSelectionDisplay()
- Dim names As New List(Of McImage)
- Me.panelAvailableMoviePosters.Visible = False
- If pageCount = 0 Then
- messbox = New frmMessageBox("", "Retrieving Posters...", "Please wait...")
- System.Windows.Forms.Cursor.Current = Cursors.WaitCursor
- messbox.Show()
- Me.Refresh()
- messbox.Refresh()
- End If
- Dim itemcounter As Integer = 0
- If posterArray.Count > 0 Then
- Dim MovPosterPicBox As New List(Of FanartPicBox)
- If pageCount = 0 Then pageCount = Math.Ceiling(posterArray.count/10)
- If posterArray.Count > 10 Then
- Dim totalthispagecount As Integer = ((currentPage*10)-1)
- If totalthispagecount >= posterArray.Count Then totalthispagecount = posterArray.Count -1
- For f = ((currentPage-1)*10) To totalthispagecount '((currentPage*10)-1)
- names.Add(posterArray(f))
- Next
- Else
- For f = 0 To posterArray.Count - 1
- names.Add(posterArray(f))
- Next
- End If
-
- If pageCount > 1 Then
- btnMovPosterNext.Visible = True
- btnMovPosterPrev.Visible = True
- If posterArray.Count >= 10 Then
- lblMovPosterPages.Text = "Displaying " & ((currentPage*10) - 9) & " to " & (currentPage*10) & " of " & posterArray.Count.ToString & " Images"
- Else
- lblMovPosterPages.Text = "Displaying 1 to " & posterArray.Count.ToString & " of " & posterArray.Count.ToString & " Images"
- End If
- lblMovPosterPages.Visible = True
- Me.Refresh()
- Application.DoEvents()
- btnMovPosterPrev.Enabled = currentPage > 1
- btnMovPosterNext.Enabled = currentPage < pagecount
- Else
- btnMovPosterPrev.Visible = False
- btnMovPosterNext.Visible = False
- lblMovPosterPages.Text = "Displaying 1 to " & posterArray.Count.ToString & " of " & posterArray.Count.ToString & " Images"
- lblMovPosterPages.Visible = True
- Me.Refresh()
- Application.DoEvents()
- End If
- Dim tempboolean As Boolean = True
- Dim locationX As Integer = 0
- Dim locationY As Integer = 0
-
- messbox.TextBox2.Text = "Setting up display...."
- messbox.Refresh()
-
- For Each item In names
- Dim thispicbox As New FanartPicBox
- Try
- posterPicBoxes() = New PictureBox()
- With posterPicBoxes
- .WaitOnLoad = True
- .Location = New Point(locationX, locationY)
- .Width = 126
- .Height = 189
- .SizeMode = PictureBoxSizeMode.Zoom
- .Visible = True
- .BorderStyle = BorderStyle.Fixed3D
- .Name = "poster" & itemcounter.ToString
- AddHandler posterPicBoxes.DoubleClick, AddressOf util_ZoomImage2
- AddHandler posterPicBoxes.LoadCompleted, AddressOf util_ImageRes
- End With
- thispicbox.imagepath = item.ldUrl
- thispicbox.pbox = posterPicBoxes
- MovPosterPicBox.Add(thispicbox)
-
- posterCheckBoxes() = New RadioButton()
- With posterCheckBoxes
- .Location = New Point(locationX + 18, locationY + 187) '179
- .Width = 79
- .Height = 32
- .Name = "postercheckbox" & itemcounter.ToString
- .SendToBack()
- .CheckAlign = ContentAlignment.TopCenter
- If item.hdheight <> "" Then
- .Text = item.hdwidth & " x " & item.hdheight
- Else
- .Text = "?"
- End If
- .TextAlign = ContentAlignment.BottomCenter
- AddHandler posterCheckBoxes.CheckedChanged, AddressOf mov_PosterRadioChanged
- End With
-
- itemcounter += 1
-
- Me.panelAvailableMoviePosters.Controls.Add(posterPicBoxes())
- Me.panelAvailableMoviePosters.Controls.Add(posterCheckBoxes())
- Me.Refresh()
- Application.DoEvents()
- If tempboolean = True Then
- locationY = (213 + 19)
- Else
- locationX += 126
- locationY = 0
- End If
- tempboolean = Not tempboolean
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- Next
- Me.panelAvailableMoviePosters.Refresh()
- Me.Refresh()
- Me.panelAvailableMoviePosters.Visible = True
- If MovPosterPicBox.Count > 0 Then
- messbox.Close()
- If Not ImgBw.IsBusy Then
- ToolStripStatusLabel2.Text = "Starting Download of Images..."
- ToolStripStatusLabel2.Visible = True
- ImgBw.RunWorkerAsync({MovPosterPicBox, 0, If(posterArray.Count >= 10, 10, posterArray.Count), Me.panelAvailableMoviePosters})
- End If
- End If
- Else
- Dim mainlabel2 As Label
- mainlabel2 = New Label
- With mainlabel2
- .Location = New Point(0, 100)
- .Width = 700
- .Height = 100
- .Font = New System.Drawing.Font("Arial", 15, FontStyle.Bold)
- .Text = "No Posters Were Found For This Movie"
-
- End With
- Me.panelAvailableMoviePosters.Controls.Add(mainlabel2)
- End If
- If itemcounter = 0 Then
- btnMovPosterNext.Visible = False
- btnMovPosterPrev.Visible = False
- Dim mainlabel2 As Label
- mainlabel2 = New Label
- With mainlabel2
- .Location = New Point(0, 100)
- .Width = 700
- .Height = 100
- .Font = New System.Drawing.Font("Arial", 15, FontStyle.Bold)
- .Text = "No Posters Were Found For This Movie"
- End With
- lblMovPosterPages.Text = "0 of 0 Images"
- Me.panelAvailableMoviePosters.Controls.Add(mainlabel2)
- End If
- Me.panelAvailableMoviePosters.Visible = True
- messbox.Close()
- End Sub
-
- Private Sub mov_PosterSelectionDisplayPrev()
- Try
- mov_PosterPanelClear()
- currentPage -= 1
- If currentPage = 1 Then
- btnMovPosterPrev.Enabled = False
- End If
- btnMovPosterNext.Enabled = True
- mov_PosterSelectionDisplay()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub mov_PosterSelectionDisplayNext()
- Try
- mov_PosterPanelClear()
- currentPage += 1
- If currentPage = pageCount Then
- btnMovPosterNext.Enabled = False
- End If
- btnMovPosterPrev.Enabled = True
- mov_PosterSelectionDisplay()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub mov_PosterRadioChanged(ByVal sender As Object, ByVal e As EventArgs)
- Dim tempstring As String = sender.name
- Dim tempint As Integer = 0
- Dim tempstring2 As String = tempstring
- Dim allok As Boolean = False
- tempstring = tempstring.Replace("postercheckbox", "")
- tempint = Convert.ToDecimal(tempstring)
- For Each button As Control In Me.panelAvailableMoviePosters.Controls
- If button.Name.IndexOf("postercheckbox") <> -1 Then
- Dim b1 As RadioButton = CType(button, RadioButton)
- If b1.Checked = True Then
- allok = True
- Exit For
- End If
- End If
- Next
- If allok = True Then
- btnPosterTabs_SaveImage.Enabled = True
- cbMoviePosterSaveLoRes.Enabled = ( posterArray(0).ldUrl.ToLower.IndexOf("impawards")<>-1 Or posterArray(0).ldUrl.ToLower.IndexOf("image.tmdb")<>-1 )
- Else
- cbMoviePosterSaveLoRes.Enabled = False
- btnPosterTabs_SaveImage.Enabled = False
- End If
- End Sub
-
- Private Sub util_ImageRes(ByVal sender As Object, ByVal e As EventArgs)
- resLabel = New Label
- Dim tempstring As String
- tempstring = sender.image.width.ToString
- tempstring = tempstring & " x "
- tempstring = tempstring & sender.image.height.ToString
- Dim locx As Integer = sender.location.x
- Dim locy As Integer = sender.location.y
- locy = locy + sender.height
- With resLabel
- .Location = New Point(locx + 30, locy)
- .Text = tempstring
- .BringToFront()
- End With
- Me.panelAvailableMoviePosters.Controls.Add(resLabel)
- Me.Refresh()
- Application.DoEvents()
- End Sub
-
- Private Sub cmbxEpActor_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbxEpActor.SelectedIndexChanged
- Try
- Dim Episode As Media_Companion.TvEpisode
- If TvTreeview.SelectedNode IsNot Nothing Then
- If TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvEpisode Then
- Episode = TvTreeview.SelectedNode.Tag
- Else
- Exit Sub
- End If
- Else
- Exit Sub
- End If
-
- pbEpActorImage.Image = Nothing
- pbEpActorImage.Visible = True
- For Each actor In Episode.ListActors
- If actor.actorname = cmbxEpActor.Text Then
- tbEpRole.Text = actor.actorrole
-
- Dim temppath As String = Episode.ShowObj.FolderPath
- Dim tempname As String = actor.actorname.Replace(" ", "_") & If(Pref.FrodoEnabled, ".jpg", ".tbn")
- temppath = temppath & ".actors\" & tempname
- If IO.File.Exists(temppath) Then
- util_ImageLoad(pbEpActorImage, temppath, Utilities.DefaultActorPath)
- Exit Sub
- End If
- If actor.actorthumb <> Nothing Then
- If actor.actorthumb.IndexOf("http") <> -1 Or IO.File.Exists(actor.actorthumb) Then
- util_ImageLoad(pbEpActorImage, actor.actorthumb, Utilities.DefaultActorPath)
- Else
- util_ImageLoad(pbEpActorImage, Utilities.DefaultActorPath, Utilities.DefaultActorPath)
- End If
- Else
- util_ImageLoad(pbEpActorImage, Utilities.DefaultActorPath, Utilities.DefaultActorPath)
- End If
- pbEpActorImage.SizeMode = PictureBoxSizeMode.Zoom
- End If
- Next
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
-
- End Sub
-
- Private Sub ExpandAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExpandAllToolStripMenuItem.Click
- Try
- Dim node As TreeNode
- For Each node In TvTreeview.Nodes
- node.ExpandAll()
- Next
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub CollapseAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CollapseAllToolStripMenuItem.Click
- Try
- Dim node As TreeNode
- For Each node In TvTreeview.Nodes
- node.Collapse()
- Next
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub ExpandSelectedShowToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExpandSelectedShowToolStripMenuItem.Click
- Try
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
-
- WorkingTvShow.ShowNode.ExpandAll()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub CollapseSelectedShowToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CollapseSelectedShowToolStripMenuItem.Click
- Try
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
-
- WorkingTvShow.ShowNode.Collapse()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub ReloadItemToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_ReloadFromCache.Click
- Try
- Call tv_ShowReload(True)
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub tv_ShowReload(Optional ByVal force As Boolean = False)
- Dim Show As Media_Companion.TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim Season As Media_Companion.TvSeason = tv_SeasonSelectedCurrently(TvTreeview)
- Dim Episode As Media_Companion.TvEpisode = ep_SelectedCurrently(TvTreeview)
- End Sub
-
- Private Sub TabControl3_Selecting(ByVal sender As Object, ByVal e As CancelEventArgs) Handles TabControl3.Selecting
- If TabControl3.SelectedTab.Name = tpTvPrefs.Name Then
- e.Cancel = True
- OpenPreferences(2)
- End If
- End Sub
-
- Private Sub TabControl3_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl3.SelectedIndexChanged
-
- Try
- Dim Show As Media_Companion.TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim tab As String = TabControl3.SelectedTab.Name
- Dim WorkingEpisode As TvEpisode = ep_SelectedCurrently(TvTreeview)
- If (tab <> tpTvMainBrowser.Name And tab <> tpTvFolders.Name And tab <> tpTvPrefs.Name) AndAlso Show Is Nothing Then
- MsgBox("No TV Show is selected")
- Exit Sub
- End If
-
- Dim tempstring As String = ""
- If tab <> tpTvMainBrowser.Name And tab <> tpTvFolders.Name And tab <> tpTvPrefs.Name Then
- If Show.NfoFilePath = "" And tvFolders.Count = 0 Then
- Me.TabControl3.SelectedIndex = tvCurrentTabIndex
- MsgBox("There are no TV Shows in your list to work on" & vbCrLf & "Set the Preferences as you want them" & vbCrLf & "Using the Preferences Tab, then" & vbCrLf & "add your TV Folders using the Folders Tab" & vbCrLf & "Once the tvshow has been scraped then" & vbCrLf & "Use the tab, ""Search for new episodes""")
- If tab <> tpTvPrefs.Name Then Exit Sub
- ElseIf Show.NfoFilePath = "" And tvFolders.Count > 0 And tab <> tpTvPrefs.Name Then
- Me.TabControl3.SelectedIndex = tvCurrentTabIndex
- If Cache.TvCache.Shows.Count > 0 Then
- MsgBox("No TV Show is selected")
- Exit Sub
- Else
- MsgBox("There are no TV Shows in your list to work on")
- Exit Sub
- End If
- End If
- ElseIf tab = tpTvFolders.Name Then 'Tv Folders tab
- tvCurrentTabIndex = TabControl3.SelectedIndex
- TabControl3.SelectedIndex = tvCurrentTabIndex
- Call tv_FoldersSetup()
- Else
- tvCurrentTabIndex = 0
- Exit Sub
- End If
- If tab = tpTvSelector.Name Then 'Tv Show Change tba
- If ListBox3.Items.Count = 0 Then
- tvCurrentTabIndex = TabControl3.SelectedIndex
- Call tv_ShowChangedRePopulate()
- End If
- ElseIf tab = tpTvMainBrowser.Name Then 'Tv Main Browser tab
- If TvTreeview.Nodes.Count = 0 Then TvTreeview.SelectedNode = TvTreeview.TopNode
- TvTreeview.Focus()
- tvCurrentTabIndex = 0
- ElseIf tab = tpTvPosters.Name Then 'Tv Posters tab
- tvCurrentTabIndex = TabControl3.SelectedIndex
- Call tv_PosterSetup()
- ElseIf tab = tpTvTable.Name Then 'Tv TableView tab
- tvCurrentTabIndex = TabControl3.SelectedIndex
- Call tv_TableView()
- ElseIf tab = tpTvWall.Name Then 'Tv Wall View tab
- tvCurrentTabIndex = TabControl3.SelectedIndex
- Call tv_wallSetup()
- ElseIf tab = tpTvWeb.Name Then 'Tv Web Browser tab
- Dim TvdbId As Integer = 0
- If Not String.IsNullOrEmpty(Show.TvdbId.Value) AndAlso Integer.TryParse(Show.TvdbId.Value, TvdbId) Then
- Dim tpi As Integer = tpTvWeb.ImageIndex
- If tpi = 0 Then
- tempstring = "http://thetvdb.com/?tab=series&id=" & TvdbId & "&lid=7"
- Else
- tempstring = "http://www.imdb.com/title/" & Show.ImdbId.Value & "/"
- End If
- Call GoTvWebBrowser(tempstring)
- ElseIf String.IsNullOrEmpty(Show.TvdbId.Value) AndAlso String.IsNullOrEmpty(Show.ImdbId.Value) Then
- TabControl3.SelectedIndex = 0
- MsgBox("No TVDB or IMDB ID present for selected Show" & vbCrLf & "Use Tv Show Selector Tab, to select" & vbCrLf & "correct show")
- End If
- ElseIf tab = tpTvFanart.Name Then 'Tv Fanart tab
- Call tv_Fanart_Load()
- tvCurrentTabIndex = TabControl3.SelectedIndex
- ElseIf tab = tpTvFanartTv.Name Then 'Tv Fanart.Tv tab
- UcFanartTvTv1.ucFanartTv_Refresh(tv_ShowSelectedCurrently(TvTreeview))
- ElseIf tab = tpTvScreenshot.Name Then 'Tv Episode Screenshot tab
- tvCurrentTabIndex = TabControl3.SelectedIndex
- Call GoScreenshotTab(WorkingEpisode)
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub TabControl3_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs) Handles TabControl3.MouseClick
- If e.Button = Windows.Forms.MouseButtons.Right Then
- For index As Integer = 0 To TabControl3.TabCount - 2 Step 1
- If TabControl3.GetTabRect(index).Contains(e.X,e.Y) AndAlso TabControl3.TabPages(index).Name.ToLower = "tptvweb" Then
- Dim tpi As Integer = tpTvWeb.ImageIndex
- If tpi = 0 Then
- tpTvWeb.ImageIndex = 1
- Else
- tpTvWeb.ImageIndex = 0
- End If
- tpTvWeb.Refresh()
- Exit For
- End If
- Next
- End If
- End Sub
-
- Private Sub TabControl3_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TabControl3.MouseWheel
- Try
- If Tabcontrol3.TabPages(TabControl3.SelectedIndex).Text.ToLower = "wall" Then
- mouseDelta = e.Delta / 120
- Try
- tptvwall.AutoScrollPosition = New Point(0, tptvwall.VerticalScroll.Value - (mouseDelta * 30))
- Catch ex As Exception
- End Try
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub GoTvWebBrowser(ByVal tempstring As String)
- If Pref.externalbrowser = True Then
- Me.TabControl3.SelectedIndex = tvCurrentTabIndex
- OpenUrl(tempstring)
- Else
- tvCurrentTabIndex = TabControl3.SelectedIndex
- Try
- WebBrowser4.Stop()
- WebBrowser4.ScriptErrorsSuppressed = True
- WebBrowser4.Navigate(tempstring)
- Catch
- WebBrowser4.Stop()
- WebBrowser4.ScriptErrorsSuppressed = True
- WebBrowser4.Navigate(tempstring)
- End Try
- WebBrowser4.Focus()
- End If
- End Sub
-
- Private Sub GoScreenshotTab(ByRef WorkingEpisode As TvEpisode)
- If Pref.EdenEnabled Then
- util_ImageLoad(pbTvEpScrnShot, WorkingEpisode.VideoFilePath.Replace(IO.Path.GetExtension(WorkingEpisode.VideoFilePath), ".tbn"), Utilities.DefaultScreenShotPath)
- End If
- If Pref.FrodoEnabled Then
- util_ImageLoad(pbTvEpScrnShot, WorkingEpisode.VideoFilePath.Replace(IO.Path.GetExtension(WorkingEpisode.VideoFilePath), "-thumb.jpg"), Utilities.DefaultScreenShotPath)
- End If
- If TextBox35.Text = "" Then
- TextBox35.Text = Pref.ScrShtDelay
- End If
- End Sub
-
- Private Sub tv_TableView()
- Dim availableshows As New List(Of TvShow)
-
- messbox = New frmMessageBox("Loading all tvshow.nfo")
- messbox.Show
-
- For Each sh As TvShow In Cache.TvCache.Shows
- Dim shload As New TvShow
- shload.NfoFilePath = sh.NfoFilePath
- shload = nfoFunction.tvshow_NfoLoad(sh.NfoFilePath) '.Load()
- availableshows.Add(shload)
- Next
- messbox.Close()
- Dim tvdbase(availableshows.Count, 8) as String
- DataGridView2.Rows.Clear()
- DataGridView2.Columns.Item(1).DefaultCellStyle.WrapMode = DataGridViewTriState.True
-
- Try
- Dim lst As List(Of TvShow) = (From x In availableshows Order By x.Title.Value).ToList
- For Each sh As TvShow In lst
- Dim n As Integer = DataGridView2.Rows.Add()
- DataGridView2.Rows(n).Cells(0).Value = sh.Title.Value
- DataGridView2.Rows(n).Cells(1).Value = sh.Plot.Value
- DataGridView2.Rows(n).Cells(2).Value = sh.Premiered.Value
- DataGridView2.Rows(n).Cells(3).Value = sh.Rating.Value
- DataGridView2.Rows(n).Cells(4).Value = sh.Genre.Value
- DataGridView2.Rows(n).Cells(5).Value = sh.Studio.Value
- DataGridView2.Rows(n).Cells(6).Value = sh.TvdbId.Value
- DataGridView2.Rows(n).Cells(7).Value = sh.ImdbId.Value
- DataGridView2.Rows(n).Cells(8).Value = sh.Mpaa.Value
- Next
- Catch
- End Try
- End Sub
-
- Public Sub util_LanguageListLoad()
- languageList.Clear()
- Application.DoEvents()
- System.Threading.Thread.Sleep(500)
- Dim XmlFile As String
- XmlFile = Utilities.DownloadTextFiles("http://thetvdb.com/api/6E82FED600783400/languages.xml")
- Dim LangList As New Tvdb.Languages()
- LangList.LoadXml(XmlFile)
- For Each Lang As Tvdb.Language In LangList.Languages
- languageList.Add(Lang)
- Next
- ListBox1.Items.Clear()
- For Each lan In languageList
- ListBox1.Items.Add(lan.Language.Value)
- Next
- End Sub
-
- Private Sub tv_ShowChangedRePopulate()
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Try
- TextBox26.Text = Utilities.GetLastFolder(WorkingTvShow.NfoFilePath)
- tb_TvShSelectSeriesPath.Enabled = True
- tb_TvShSelectSeriesPath.Text = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "")
- PictureBox9.Image = Nothing
- If languageList.Count = 0 Then
- util_LanguageListLoad()
- End If
- If workingTvShow.language <> Nothing Then
- For Each language In languageList
- If language.Abbreviation.Value = WorkingTvShow.Language.Value Then
- ListBox1.SelectedItem = language.Language.Value
- Exit For
- End If
- Next
- Else
- ListBox1.SelectedItem = Pref.TvdbLanguage
- End If
- Label55.Text = "Default Language for TV Shows is :- " & Pref.TvdbLanguage
- Call tv_ShowListLoad()
- Try
- If Pref.sortorder <> Nothing Then
- If Pref.sortorder = "dvd" Then
- RadioButton14.Checked = True
- Else
- RadioButton15.Checked = True
- End If
- Else
- RadioButton15.Checked = True
- End If
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- RadioButton15.Checked = True
- End Try
-
- Select Case Pref.seasonall
- Case "none"
- RadioButton18.Checked = True
- Case "poster"
- RadioButton17.Checked = True
- Case "wide"
- RadioButton16.Checked = True
- End Select
- '0 - Everything from TVDB
- '1 - Everything from IMDB
- '2 - TV show Nfo From IMDB, Episode nfo from TVDB
- '3 - TV show Nfo From TVDB, Episode nfo from IMDB
- If Pref.tvdbactorscrape = 0 Then
- RadioButton13.Checked = True
- RadioButton11.Checked = True
- End If
- If Pref.tvdbactorscrape = 1 Then
- RadioButton12.Checked = True
- RadioButton10.Checked = True
- End If
- If Pref.tvdbactorscrape = 2 Then
- RadioButton12.Checked = True
- RadioButton11.Checked = True
- End If
- If Pref.tvdbactorscrape = 3 Then
- RadioButton13.Checked = True
- RadioButton10.Checked = True
- End If
- If Pref.postertype = "poster" Then
- RadioButton9.Checked = True
- Else
- RadioButton8.Checked = True
- End If
-
- cbTvChgShowDLFanart .Checked = Pref.tvdlfanart
- cbTvChgShowDLPoster .Checked = Pref.tvdlposter
- cbTvChgShowDLSeason .Checked = Pref.tvdlseasonthumbs
- cbTvChgShowDLFanartTvArt .Checked = Pref.TvDlFanartTvArt
-
- If Pref.tvshow_useXBMC_Scraper = True Then
- GroupBox2.Enabled = False
- GroupBox3.Enabled = False
- GroupBox5.Enabled = False
- Else
- GroupBox2.Enabled = True
- GroupBox3.Enabled = True
- GroupBox5.Enabled = True
- End If
- cbTvChgShowOverwriteImgs.CheckState = CheckState.Checked 'set overwrite images for changing shows.
- Catch ex As WebException
- MsgBox("There seems to be a problem with the tvdb website, please try again later")
- tvCurrentTabIndex = 0
- TabControl3.SelectedIndex = 0
- End Try
- End Sub
-
- Private Sub util_LanguageCheck()
- Try
- If ListBox1.SelectedIndex < 0 Then ListBox1.SelectedIndex = languageList.FindIndex(Function(index As Tvdb.Language) index.Abbreviation.Value = Pref.TvdbLanguageCode)
- If ListBox3.SelectedIndex = -1 orElse listOfShows(ListBox3.SelectedIndex).showid = "none" Then Exit Sub
- Dim languagecode As String = languageList(ListBox1.SelectedIndex).Abbreviation.Value
- Dim url As String = "http://thetvdb.com/api/6E82FED600783400/series/" & listOfShows(ListBox3.SelectedIndex).showid & "/" & languagecode & ".xml"
- Dim websource(10000)
- Dim urllinecount As Integer = 0
- Try
- Dim wrGETURL As WebRequest
- wrGETURL = WebRequest.Create(url)
- wrGETURL.Proxy = Utilities.MyProxy
- Dim objStream As Stream
- objStream = wrGETURL.GetResponse.GetResponseStream()
- Dim objReader As New StreamReader(objStream)
- Dim sLine As String = ""
- urllinecount = 0
- Do While Not sLine Is Nothing
- urllinecount += 1
- sLine = objReader.ReadLine
- If Not sLine Is Nothing Then
- websource(urllinecount) = sLine
- End If
- Loop
- objReader.Close()
- objStream.Close()
- objReader = Nothing
- objStream = Nothing
- urllinecount -= 1
- Catch ex As Exception
- End Try
- For f = 1 To urllinecount
- If websource(f).IndexOf("<Language>") <> -1 Then
- websource(f) = websource(f).Replace("<Language>", "")
- websource(f) = websource(f).Replace("</Language>", "")
- websource(f) = websource(f).Replace(" ", "")
- If websource(f).ToLower <> languagecode Then
- Label55.BackColor = Color.Red
- Label55.Text = ListBox3.SelectedItem.ToString & " is not available in " & ListBox1.SelectedItem.ToString & ", Please try another language"
- Else
- Label55.BackColor = Color.Transparent
- Label55.Text = ListBox3.SelectedItem.ToString & " is available in " & ListBox1.SelectedItem.ToString
- Label55.Font = New Font(Label55.Font, FontStyle.Bold)
- End If
- End If
- Next
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End Sub
-
- Private Sub RefreshShowsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshShowsToolStripMenuItem.Click
- Call tv_CacheRefresh()
- End Sub
-
- Private Sub Tv_tsmi_CheckDuplicateEpisodes_Click(sender As Object, e As EventArgs) Handles Tv_tsmi_CheckDuplicateEpisodes.Click
- Tv_CacheCheckDuplicates()
- End Sub
-
- Private Sub ReloadShowCacheToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReloadShowCacheToolStripMenuItem.Click
- Try
- If IO.File.Exists(workingProfile.tvcache) Then
- Call tv_CacheLoad()
- Else
- MsgBox("No Cache exists to load")
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Function util_ReplaceXMLChrs(ByVal Text As String) 'Convert textcodes to real characters
- If Text.IndexOf("‘") <> -1 Then Text = Text.Replace("‘", "'")
- If Text.IndexOf("’") <> -1 Then Text = Text.Replace("’", "'")
- If Text.IndexOf("’") <> -1 Then Text = Text.Replace("’", "'")
- If Text.IndexOf("â€" & Chr(147)) <> -1 Then Text = Text.Replace("â€" & Chr(147), "-")
-
- Return Text
- End Function
-
- Private Function ep_NfoValidate(ByVal nfopath As String)
- Dim validated As Boolean = True
- If IO.File.Exists(nfopath) Then
- Dim tvshow As New XmlDocument
- Try
- tvshow.Load(nfopath)
- Catch ex As Exception
- If ex.Message.ToLower.Contains("multiple root elements") Then
- validated = chkxbmcmultinfo(nfopath)
- Else
- validated = False
- End If
- End Try
- If validated = True Then
- Try
- Dim tempstring As String
- Dim filechck As IO.StreamReader = IO.File.OpenText(nfopath)
- tempstring = filechck.ReadToEnd.ToLower
- filechck.Close()
- filechck = Nothing
- If tempstring = Nothing Then
- validated = False
- End If
- Try
- Dim seasonno As String = tempstring.Substring(tempstring.IndexOf("<season>") + 8, tempstring.IndexOf("</season>") - tempstring.IndexOf("<season>") - 8)
- If Not IsNumeric(seasonno) Then
- validated = False
- End If
- Catch ex As Exception
- validated = False
- End Try
- Try
- Dim episodeno As String = tempstring.Substring(tempstring.IndexOf("<episode>") + 9, tempstring.IndexOf("</episode>") - tempstring.IndexOf("<episode>") - 9)
- If Not IsNumeric(episodeno) Then
- validated = False
- End If
- Catch ex As Exception
- validated = False
- End Try
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End If
- Return validated
- End If
- Return False
- End Function
-
- Private Function chkxbmcmultinfo(ByVal xmlpath As String) As Boolean
- Try
- Dim testxml() As String = File.ReadAllLines(xmlpath)
- Dim first As Boolean = True
- Dim finalxml As String = ""
- For Each line In testxml
- If line.Contains("<episodedetails>") AndAlso first Then
- finalxml &= "<multiepisodenfo>"
- End If
- finalxml &= line
- If line.Contains("</episodedetails>") Then first = False
- Next
- finalxml &= "</multiepisodenfo>"
- Dim Finaldoc As New XmlDocument
- Finaldoc.LoadXml(finalxml)
- Finaldoc.Save(xmlpath)
- Return ep_NfoValidate(xmlpath)
- Catch
- Return False
- End Try
- Return False
- End Function
-
- Private Sub tv_NewFind(ByVal path As String, ByVal pattern As String)
- Dim episode As New List(Of TvEpisode)
- Dim propfile As Boolean = False
- Dim allok As Boolean = False
- Dim dir_info As New System.IO.DirectoryInfo(path)
-
- Dim fs_infos() As String = IO.Directory.GetFiles(path, "*" & pattern, SearchOption.TopDirectoryOnly)
- Dim counter As Integer = 1
- Dim counter2 As Integer = 1
- For Each FilePath As String In fs_infos
- Dim filename_video As String = FilePath
- Dim filename_nfo As String = filename_video.Replace(IO.Path.GetExtension(filename_video), ".nfo")
- If IO.File.Exists(filename_nfo) Then
- If ep_NfoValidate(filename_nfo) = False And Pref.renamenfofiles = True Then
- Dim movefilename As String = filename_nfo.Replace(IO.Path.GetExtension(filename_nfo), ".info")
- Try
- If File.Exists(movefilename) Then
- Utilities.SafeDeleteFile(movefilename)
- End If
- IO.File.Move(filename_nfo, movefilename)
- Catch ex As Exception
- Utilities.SafeDeleteFile(movefilename)
- End Try
- End If
- End If
- If Not IO.File.Exists(filename_nfo) Then
- Dim add As Boolean = True
- If pattern = ".vob" Then 'If a vob file is detected, check that it is not part of a dvd file structure
- Dim name As String = filename_nfo
- name = name.Replace(IO.Path.GetFileName(name), "VIDEO_TS.IFO")
- If IO.File.Exists(name) Then
- add = False
- End If
- End If
- If pattern = "*.rar" Then
- Dim tempmovie As String = String.Empty
- Dim tempint2 As Integer = 0
- Dim tempmovie2 As String = FilePath
- If IO.Path.GetExtension(tempmovie2).ToLower = ".rar" Then
- If IO.File.Exists(tempmovie2) = True Then
- If IO.File.Exists(tempmovie) = False Then
- Dim rarname As String = tempmovie2
- Dim SizeOfFile As Integer = FileLen(rarname)
- tempint2 = Convert.ToInt32(Pref.rarsize) * 1048576
- If SizeOfFile > tempint2 Then
- Dim mat As Match
- mat = Regex.Match(rarname, "\.part[0-9][0-9]?[0-9]?[0-9]?.rar")
- If mat.Success = True Then
- rarname = mat.Value
- If rarname.ToLower.IndexOf(".part1.rar") <> -1 Or rarname.ToLower.IndexOf(".part01.rar") <> -1 Or rarname.ToLower.IndexOf(".part001.rar") <> -1 Or rarname.ToLower.IndexOf(".part0001.rar") <> -1 Then
- Dim stackrarexists As Boolean = False
- rarname = tempmovie.Replace(".nfo", ".rar")
- If rarname.ToLower.IndexOf(".part1.rar") <> -1 Then
- rarname = rarname.Replace(".part1.rar", ".nfo")
- If IO.File.Exists(rarname) Then
- stackrarexists = True
- tempmovie = rarname
- Else
- stackrarexists = False
- tempmovie = rarname
- End If
- End If
- If rarname.ToLower.IndexOf(".part01.rar") <> -1 Then
- rarname = rarname.Replace(".part01.rar", ".nfo")
- If IO.File.Exists(rarname) Then
- stackrarexists = True
- tempmovie = rarname
- Else
- stackrarexists = False
- tempmovie = rarname
- End If
- End If
- If rarname.ToLower.IndexOf(".part001.rar") <> -1 Then
- rarname = rarname.Replace(".part001.rar", ".nfo")
- If IO.File.Exists(rarname) Then
- tempmovie = rarname
- stackrarexists = True
- Else
- stackrarexists = False
- tempmovie = rarname
- End If
- End If
- If rarname.ToLower.IndexOf(".part0001.rar") <> -1 Then
- rarname = rarname.Replace(".part0001.rar", ".nfo")
- If IO.File.Exists(rarname) Then
- tempmovie = rarname
- stackrarexists = True
- Else
- stackrarexists = False
- tempmovie = rarname
- End If
- End If
- Else
- add = False
- End If
- Else
- 'remove = True
- End If
- Else
- add = False
- End If
- End If
- End If
- End If
- End If
- Dim truefilename As String = Utilities.GetFileNameFromPath(filename_video)
- If truefilename.Substring(0,2)="._" Then add = False
- If add = True Then
- Dim newep As New TvEpisode
- newep.NfoFilePath = filename_nfo
- newep.VideoFilePath = filename_video
- newep.MediaExtension = IO.Path.GetExtension(filename_video)
- newEpisodeList.Add(newep)
- End If
- End If
- Next
- fs_infos = Nothing
- End Sub
-
- Private Sub OpenFolderToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_OpenFolder.Click
- Try
- If Not TvTreeview.SelectedNode Is Nothing Then
- Dim Path As String = Nothing
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview) 'set WORKINGTVSHOW to show obj irrelavent if we have selected show/season/episode
- Dim WorkingTvEpisode As TvEpisode = ep_SelectedCurrently(TvTreeview)
- Dim WorkingTvSeason As TvSeason = tv_SeasonSelectedCurrently(TvTreeview)
- If Not IsNothing(WorkingTvEpisode) AndAlso Not WorkingTvEpisode.IsMissing Then
- Path = WorkingTvEpisode.NfoFilePath
- ElseIf Not IsNothing(WorkingTvSeason) AndAlso Not IsNothing(WorkingTvSeason.FolderPath) Then
- Path = WorkingTvSeason.FolderPath
- ElseIf Not WorkingTvShow.NfoFilePath Is Nothing And Not WorkingTvShow.NfoFilePath = "" Then
- Path = WorkingTvShow.NfoFilePath 'we send the path of the tvshow.nfo, that way in explorer it will be highlighted in the folder
- Else
- MsgBox("There is no show selected to open")
- End If
- If Not IsNothing(Path) Then
- Call util_OpenFolder(Path)
- End If
- Else
- MsgBox("There is no show selected to open")
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub WebBrowser2_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser2.NewWindow
- Try
- e.Cancel = True
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub WebBrowser4_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser4.NewWindow
- Try
- Dim myelement As HtmlElement = WebBrowser4.Document.ActiveElement
- Dim target As String = myelement.GetAttribute("href")
- e.Cancel = True
- WebBrowser4.Navigate(target)
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub PictureBox_Zoom(ByVal sender As Object, ByVal e As System.EventArgs) Handles tv_PictureBoxBottom.DoubleClick, tv_PictureBoxRight.DoubleClick, tv_PictureBoxLeft.DoubleClick
- Try
- Dim picBox As PictureBox = sender
- Dim imageLocation As String = picBox.tag
- If imageLocation <> Nothing Then
- If IO.File.Exists(imageLocation) Then
- Me.ControlBox = False
- MenuStrip1.Enabled = False
- Call util_ZoomImage(imageLocation)
- End If
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub tv_Fanart_Load()
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Me.Panel13.Controls.Clear()
- listOfTvFanarts.Clear()
- btnTvFanartResetImage.Visible = False
- btnTvFanartSaveCropped.Visible = False
- If TvTreeview.SelectedNode.Name.ToLower.IndexOf("tvshow.nfo") <> -1 Or TvTreeview.SelectedNode.Name = "" Then
- If Not tv_PictureBoxLeft.Image Is Nothing Then
- util_ImageLoad(PictureBox10, WorkingTvShow.FolderPath & "fanart.jpg", Utilities.DefaultTvFanartPath)
- Else
- PictureBox10.Image = Nothing
- End If
- Else
- util_ImageLoad(PictureBox10, WorkingTvShow.FolderPath & "fanart.jpg", Utilities.DefaultTvFanartPath)
- End If
- Try
- Label58.Text = PictureBox10.Image.Height.ToString
- Label59.Text = PictureBox10.Image.Width.ToString
- Catch ex As Exception
- End Try
- TextBox28.Text = WorkingTvShow.Title.Value
- messbox = New frmMessageBox("Please wait,", "", "Querying TVDB for fanart list")
- System.Windows.Forms.Cursor.Current = Cursors.WaitCursor
- messbox.Show()
- Me.Refresh()
- messbox.Refresh()
- Dim fanarturl As String = "http://www.thetvdb.com/api/6E82FED600783400/series/" & WorkingTvShow.TvdbId.Value & "/banners.xml"
- Dim apple2(4000) As String
- Dim fanartlinecount As Integer = 0
- Dim tmplistOfTvFanarts As New List(Of str_FanartList)
- Try
- Dim wrGETURL As WebRequest
- wrGETURL = WebRequest.Create(fanarturl)
- wrGETURL.Proxy = Utilities.MyProxy
- Dim objStream As Stream
- objStream = wrGETURL.GetResponse.GetResponseStream()
- Dim objReader As New StreamReader(objStream)
- Dim sLine As String = ""
- fanartlinecount = 0
- sLine = objReader.ReadToEnd
- Dim bannerslist As New XmlDocument
- Dim bannerlist As String = "<banners>"
- bannerslist.LoadXml(sLine)
- Dim thisresult As XmlNode = Nothing
- objReader.Close()
- objStream.Close()
- objReader = Nothing
- objStream = Nothing
- For Each thisresult In bannerslist("Banners")
- Select Case thisresult.Name
- Case "Banner"
- Dim fanart As New str_FanartList(SetDefaults)
- Dim bannerselection As XmlNode = Nothing
- For Each bannerselection In thisresult.ChildNodes
- Select Case bannerselection.Name
- Case "BannerPath"
- fanart.bigUrl = "http://thetvdb.com/banners/" & bannerselection.InnerXml
- fanart.smallUrl = "http://thetvdb.com/banners/_cache/" & bannerselection.InnerXml
- Case "BannerType"
- fanart.type = bannerselection.InnerXml
- Case "BannerType2"
- fanart.resolution = bannerselection.InnerXml
- Case "Rating"
- fanart.rating = bannerselection.InnerXml.ToRating
- End Select
- Next
- If fanart.type = "fanart" Then
- tmplistOfTvFanarts.Add(fanart)
- 'listOfTvFanarts.Add(fanart)
- End If
- End Select
- Next
- Catch ex As WebException
- Dim webmsg As String = ex.Message
- MsgBox("TVDB appears to be down at the moment, please try again later")
- End Try
- If tmplistOfTvFanarts.Count > 1 Then
- Dim q = From x In tmplistOfTvFanarts Order By x.rating Descending
- listOfTvFanarts.AddRange(q.ToList)
- End If
-
- If listOfTvFanarts.Count > 0 Then
- Dim MovFanartPicBox As New List(Of FanartPicBox)
- Dim location As Integer = 0
- Dim itemcounter As Integer = 0
- For Each item In listOfTvFanarts
- Dim thispicbox As New FanartPicBox
- tvFanartBoxes() = New PictureBox()
- With tvFanartBoxes
- .Location = New Point(0, location)
- If listOfTvFanarts.Count > 2 Then
- .Width = 400
- .Height = 225
- Else
- .Width = 415
- .Height = 225
- End If
- .SizeMode = PictureBoxSizeMode.Zoom
- .Visible = True
- .BorderStyle = BorderStyle.Fixed3D
- .Name = "tvfanart" & itemcounter.ToString
- AddHandler tvFanartBoxes.DoubleClick, AddressOf util_ZoomImage2
- End With
- thispicbox.pbox = tvFanartBoxes
- thispicbox.imagepath = item.smallUrl
- MovFanartPicBox.Add(thispicbox)
- Application.DoEvents()
-
- tvFanartCheckBoxes() = New RadioButton()
- With tvFanartCheckBoxes
- .BringToFront()
- .Location = New Point(199, location + 225)
- .Name = "checkbox" & itemcounter.ToString
- End With
-
- resolutionLabels() = New Label
- With resolutionLabels
- .BringToFront()
- .Location = New Point(10, location + 225)
- .Name = item.resolution
- .Text = item.resolution
- End With
- itemcounter += 1
- location += 250
- Me.Panel13.Controls.Add(tvFanartBoxes())
- Me.Panel13.Controls.Add(tvFanartCheckBoxes())
- Me.Panel13.Controls.Add(resolutionLabels())
- Application.DoEvents()
- Next
- Me.Panel13.Refresh()
- Me.Refresh()
- If MovFanartPicBox.Count > 0 Then
- messbox.Close()
- If Not ImgBw.IsBusy Then
- ToolStripStatusLabel2.Text = "Starting Download of Images..."
- ToolStripStatusLabel2.Visible = True
- ImgBw.RunWorkerAsync({MovFanartPicBox, 0, MovFanartPicBox.Count, Me.Panel13})
- End If
- End If
- Me.Panel13.Refresh()
- Me.Refresh()
- EnableTvFanartScrolling
- Else
- Dim mainlabel2 As Label
- mainlabel2 = New Label
- With mainlabel2
- .Location = New Point(0, 100)
- .Width = 700
- .Height = 100
- .Font = New System.Drawing.Font("Arial", 15, FontStyle.Bold)
- .Text = "No Fanart Was Found At TVDB For This Movie"
- End With
- Me.Panel13.Controls.Add(mainlabel2)
- End If
- System.Windows.Forms.Cursor.Current = Cursors.Default
- messbox.Close()
- End Sub
-
- 'Set focus on the first checkbox to enable mouse wheel scrolling
- Sub EnableTvFanartScrolling
- Try
- Dim rb As RadioButton = Panel13.Controls("checkbox0")
-
- rb.Select 'Causes RadioButtons checked state to toggle
- rb.Checked = Not rb.Checked 'Undo unwanted checked state toggling
- Catch
- End Try
- End Sub
-
- Sub EnableTvBannerScrolling
- Try
- Panel16.Focus()
- Catch
- End Try
- End Sub
-
- Private Sub Tv_FanartDisplay()
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- If IsNothing(WorkingTvShow) Then Exit Sub
- If TvTreeview.SelectedNode.Name.ToLower.IndexOf("tvshow.nfo") <> -1 Or TvTreeview.SelectedNode.Name = "" Then
- If Not tv_PictureBoxLeft.Image Is Nothing Then
- util_ImageLoad(PictureBox10, WorkingTvShow.FolderPath & "fanart.jpg", Utilities.DefaultTvFanartPath)
- Else
- PictureBox10.Image = Nothing
- End If
- Else
- util_ImageLoad(PictureBox10, WorkingTvShow.FolderPath & "fanart.jpg", Utilities.DefaultTvFanartPath)
- End If
- End Sub
-
- Private Sub tv_FanartCropTop()
- Dim imagewidth As Integer = PictureBox10.Image.Width
- Dim imageheight As Integer = PictureBox10.Image.Height
- PictureBox10.Image = util_ImageCrop(PictureBox10.Image, New Size(imagewidth, imageheight - 1), New Point(0, 1)).Clone
- PictureBox10.SizeMode = PictureBoxSizeMode.Zoom
- End Sub
-
- Private Sub tv_FanartCropBottom()
- Dim imagewidth As Integer = PictureBox10.Image.Width
- Dim imageheight As Integer = PictureBox10.Image.Height
- PictureBox10.Image = util_ImageCrop(PictureBox10.Image, New Size(imagewidth, imageheight - 1), New Point(0, 0)).Clone
- PictureBox10.SizeMode = PictureBoxSizeMode.Zoom
- End Sub
-
- Private Sub tv_FanartCropLeft()
- Dim imagewidth As Integer = PictureBox10.Image.Width
- Dim imageheight As Integer = PictureBox10.Image.Height
- PictureBox10.Image = util_ImageCrop(PictureBox10.Image, New Size(imagewidth - 1, imageheight), New Point(1, 0)).Clone
- PictureBox10.SizeMode = PictureBoxSizeMode.Zoom
- End Sub
-
- Private Sub tv_FanartCropRight()
- Dim imagewidth As Integer = PictureBox10.Image.Width
- Dim imageheight As Integer = PictureBox10.Image.Height
- PictureBox10.Image = util_ImageCrop(PictureBox10.Image, New Size(imagewidth - 1, imageheight), New Point(0, 0)).Clone
- PictureBox10.SizeMode = PictureBoxSizeMode.Zoom
- End Sub
-
- Sub tv_Rescrape() 'Panel9 visibility indicates which is selected - a tvshow or an episode
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim WorkingEpisode As TvEpisode = ep_SelectedCurrently(TvTreeview)
- If IsNothing(WorkingTvShow.TvdbId.Value) = True Then
- WorkingTvShow.TvdbId.Value = ""
- End If
- If WorkingTvShow.TvdbId.Value.IndexOf("tt").Equals(0) Then tv_IMDbID_detected = True
- If Panel_EpisodeInfo.Visible = False Then 'i.e. rescrape selected TVSHOW else rescrape selected EPISODE
- 'its a tv show
- Dim selectednode As Integer = TvTreeview.SelectedNode.Index
- tv_Rescrape_Show(WorkingTvShow)
- TvTreeview.SelectedNode = TvTreeview.Nodes(selectednode)
- Else
- 'its an episode
- tv_Rescrape_Episode(WorkingTvShow, WorkingEpisode)
- End If
- If Not tv_IMDbID_warned And tv_IMDbID_detected Then
- MessageBox.Show(tv_IMDbID_detectedMsg, "TV Show ID", MessageBoxButtons.OK, MessageBoxIcon.Information)
- tv_IMDbID_warned = True
- End If
- End Sub
-
- Private Sub Tv_TreeViewContext_RenameEp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_RenameEp.Click
-
- Try
- Dim renamelog As String = ""
- Dim tempint As Integer = 0
- Dim oldname As String = ""
- Dim nfofilestorename As New List(Of String)
- nfofilestorename.Clear()
- Dim donelist As New List(Of String)
- donelist.Clear()
- If TvTreeview.SelectedNode.Name.IndexOf("\missing\") = -1 Then
- If TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvEpisode Then
- 'individual episode
- tempint = MessageBox.Show("Using this option will rename the selected episode" & vbCrLf & "Do you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
- If tempint = DialogResult.No Then
- Exit Sub
- End If
- If Not nfofilestorename.Contains(TvTreeview.SelectedNode.Name) And TvTreeview.SelectedNode.Name.IndexOf("Missing: ") <> 0 Then
- nfofilestorename.Add(TvTreeview.SelectedNode.Name)
- End If
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvSeason Then
- 'season
- tempint = MessageBox.Show("Using this option will rename all episode nfo's within the selected season" & vbCrLf & "Do you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
- If tempint = DialogResult.No Then
- Exit Sub
- End If
- Dim childnode As TreeNode
- For Each childnode In TvTreeview.SelectedNode.Nodes
- If Not nfofilestorename.Contains(childnode.Name) And childnode.Name.IndexOf("\missing\") = -1 Then
- nfofilestorename.Add(childnode.Name)
- End If
- Next
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvShow Then
- 'full show
- tempint = MessageBox.Show("Using this option will rename all episode nfo's within the selected show" & vbCrLf & "Do you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
- If tempint = DialogResult.No Then
- Exit Sub
- End If
- Dim childnode As TreeNode
- Dim childchildnode As TreeNode
- For Each childnode In TvTreeview.SelectedNode.Nodes
- For Each childchildnode In childnode.Nodes
- If Not nfofilestorename.Contains(childchildnode.Name) And childchildnode.Name.IndexOf("\missing\") = -1 Then
- nfofilestorename.Add(childchildnode.Name)
- End If
- Next
- Next
- End If
- Else
- MsgBox("This is a Missing Episode, and can not be renamed!")
- Exit Sub
- End If
-
- messbox = New frmMessageBox("Renaming episodes,", "", " Please Wait")
- messbox.Show()
- messbox.Refresh()
- Application.DoEvents()
- If nfofilestorename.Count <= 0 Then
- messbox.Close()
- Exit Sub
- End If
- renamelog += "!!! " & nfofilestorename.Count & " nfo's to rename..." & vbCrLf & vbCrLf
- For Each renamefile In nfofilestorename
- Dim seasonno As String = ""
- Dim episodetitle As String = ""
- Dim showtitle As String = ""
- Dim episodeno As New List(Of String)
- episodeno.Clear()
- For Each tvshow In Cache.TvCache.Shows
- Dim showpath As String = tvshow.NfoFilePath.Replace(IO.Path.GetFileName(tvshow.NfoFilePath), "")
- If renamefile.IndexOf(showpath) <> -1 Then
- showtitle = Pref.RemoveIgnoredArticles(tvshow.Title.Value)
- For Each episode In tvshow.Episodes
- If episode.NfoFilePath = renamefile Then
- If seasonno = "" Then
- seasonno = episode.Season.Value
- End If
- If episodetitle = "" Then
- episodetitle = episode.Title.Value
- End If
- episodeno.Add(episode.Episode.Value)
- End If
- Next
- Dim newfilename As String
- newfilename = ""
- If seasonno.Length = 1 Then
- seasonno = "0" & seasonno
- End If
- For f = 0 To episodeno.Count - 1
- If episodeno(f).Length = 1 Then
- episodeno(f) = "0" & episodeno(f)
- End If
- Next
- newfilename = Renamer.setTVFilename(showtitle, episodetitle, episodeno, seasonno)
-
- newfilename = newfilename.Replace("?", "")
- newfilename = newfilename.Replace("/", "")
- newfilename = newfilename.Replace("\", "")
- newfilename = newfilename.Replace("<", "")
- newfilename = newfilename.Replace(">", "")
- newfilename = newfilename.Replace(":", "")
- newfilename = newfilename.Replace("""", "")
- newfilename = newfilename.Replace("*", "")
- If Pref.TvRenameReplaceSpace Then
- If Pref.TvRenameReplaceSpaceDot Then
- newfilename = newfilename.Replace(" ", ".")
- Else
- newfilename = newfilename.Replace(" ", "_")
- End If
- End If
- Dim listtorename As New List(Of String)
- listtorename.Clear()
- listtorename.Add(renamefile)
- For Each ext In Utilities.VideoExtensions
- If ext = "VIDEO_TS.IFO" Then Continue For
- Dim temppath2 As String = renamefile.Replace(IO.Path.GetExtension(renamefile), ext)
- If IO.File.Exists(temppath2) Then
- listtorename.Add(temppath2)
- End If
- Next
- Dim di As DirectoryInfo = New DirectoryInfo(renamefile.Replace(IO.Path.GetFileName(renamefile), ""))
- Dim filenama As String = IO.Path.GetFileNameWithoutExtension(renamefile)
- Dim fils As IO.FileInfo() = di.GetFiles(filenama & ".*")
- For Each fiNext In fils
- If Not listtorename.Contains(fiNext.FullName) Then
- listtorename.Add(fiNext.FullName)
- End If
- Next
-
- Dim temppath As String = renamefile
- temppath = temppath.Replace(IO.Path.GetExtension(temppath), ".tbn")
- If IO.File.Exists(temppath) Then
- If Not listtorename.Contains(temppath) Then
- listtorename.Add(temppath)
- End If
- End If
-
- temppath = temppath.Replace(IO.Path.GetExtension(temppath), ".rar")
- If IO.File.Exists(temppath) Then
- If Not listtorename.Contains(temppath) Then
- listtorename.Add(temppath)
- End If
- End If
-
- temppath = temppath.Replace(IO.Path.GetExtension(temppath), "-thumb.jpg")
- If IO.File.Exists(temppath) Then
- If Not listtorename.Contains(temppath) Then
- listtorename.Add(temppath)
- End If
- End If
-
- Dim oldnfofile As String = ""
- Dim newnfofile As String = ""
- For Each items In listtorename
- If IO.Path.GetExtension(items).ToLower = ".nfo" And oldnfofile = "" Then
- oldnfofile = items
- newnfofile = items.Replace(IO.Path.GetFileName(items), newfilename) & IO.Path.GetExtension(items)
- End If
- Dim newname As String = items.Replace(filenama, newfilename)
- Try
- Dim pathsep As String = If(items.Contains("/"), "/", "\")
- Dim origpath As String = items.Substring(0, items.LastIndexOf(pathsep)+1)
- renamelog += "!!! " & items.Replace(origpath, "") & " -- to -- " & newname.Replace(origpath, "")
- Dim fi As New IO.FileInfo(items)
- If Not IO.File.Exists(newname) Then
- fi.MoveTo(newname)
- If items.ToLower = IO.Path.Combine(tb_EpPath.Text, tb_EpFilename.Text).ToLower Then
- tb_EpFilename.Text = IO.Path.GetFileName(fi.FullName)
- End If
- renamelog += " ---Succeeded" & vbCrLf
- Else
- renamelog += " --! Not Renamed - Same" & vbCrLf
- End If
- Catch ex As Exception
- renamelog += "!!! *** Not Succeeded - Please rename all files manually!" & vbCrLf & "!!! Reported Message: " & ex.Message.ToString & vbCrLf
- End Try
- Next
- renamelog += "!!! " & vbCrLf
- renamelog += "!!! Updating Tables" & vbCrLf
- Try
- For Each noder2 In TvTreeview.Nodes
- If noder2.name = oldnfofile Then
- noder2.name = newnfofile
- End If
- For Each noder3 In noder2.nodes
- If noder3.name = oldnfofile Then
- noder3.name = newnfofile
- End If
- For Each noder4 In noder3.nodes
- If noder4.name = oldnfofile Then
- noder4.name = newnfofile
- End If
- Next
- Next
- Next
- For Each episode In tvshow.Episodes
- If episode.NfoFilePath = oldnfofile Then
- episode.NfoFilePath = newnfofile
- End If
- Next
- renamelog += "!!! Tables Updated" & vbCrLf & vbCrLf
- Catch
- renamelog += "!!! Failed to update tables, use 'Refresh TV Shows' menu item to fix" & vbCrLf & vbCrLf
- End Try
- End If
- Next
- Next
- Call Tv_CacheSave()
- messbox.Close()
- If Pref.disabletvlogs Then
- Dim MyFormObject As New frmoutputlog(renamelog, True)
- Try
- MyFormObject.ShowDialog()
- Catch ex As ObjectDisposedException
-
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub Tv_TreeViewContext_RescrapeWizard_Click(sender As System.Object, e As System.EventArgs) Handles Tv_TreeViewContext_RescrapeWizard.Click
- Try
- singleshow = True
- TV_BatchRescrapeWizardToolStripMenuItem.PerformClick()
- While tvbckrescrapewizard.IsBusy
- Application.DoEvents()
- End While
- singleshow = False
- Catch ex As Exception
- End Try
- End Sub
-
- Private Sub Tv_TreeViewContext_RescrapeMediaTags_Click(sender As System.Object, e As System.EventArgs) Handles Tv_TreeViewContext_RescrapeMediaTags.Click
- Try
- Dim tmp As Integer = Utilities.languagelibrary.count
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim tempint As Integer = 0
- Dim nfofilestorename As New List(Of String)
- nfofilestorename.Clear()
- Dim donelist As New List(Of String)
- donelist.Clear()
- If TvTreeview.SelectedNode.Name.IndexOf("\missing\") = -1 Then
- If TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvEpisode Then
- 'individual episode
- If Not nfofilestorename.Contains(TvTreeview.SelectedNode.Name) And TvTreeview.SelectedNode.Name.IndexOf("\missing\") = -1 Then
- nfofilestorename.Add(TvTreeview.SelectedNode.Name)
- End If
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvSeason Then
- 'season
- tempint = MessageBox.Show("This option will Rescrape Media tags for the selected season" & vbCrLf & "Do you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
- If tempint = DialogResult.No Then
- Exit Sub
- End If
- Dim childnode As TreeNode
- For Each childnode In TvTreeview.SelectedNode.Nodes
- If Not nfofilestorename.Contains(childnode.Name) And childnode.Name.IndexOf("\missing\") = -1 Then
- nfofilestorename.Add(childnode.Name)
- End If
- Next
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvShow Then
- 'full show
- tempint = MessageBox.Show("This option will Rescrape Media tags for the selected show" & vbCrLf & "Do you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
- If tempint = DialogResult.No Then
- Exit Sub
- End If
- Dim childnode As TreeNode
- Dim childchildnode As TreeNode
- For Each childnode In TvTreeview.SelectedNode.Nodes
- For Each childchildnode In childnode.Nodes
- If Not nfofilestorename.Contains(childchildnode.Name) And childchildnode.Name.IndexOf("\missing\") = -1 Then
- nfofilestorename.Add(childchildnode.Name)
- End If
- Next
- Next
- End If
- End If
-
- messbox = New frmMessageBox("Getting Media Tags for episodes,", "", " Please Wait")
- messbox.Show()
- messbox.Refresh()
- Application.DoEvents()
- If nfofilestorename.Count <= 0 Then
- messbox.Close()
- Exit Sub
- End If
-
- For Each nfo In nfofilestorename
- Try
- Dim ThisEp As New List(Of TvEpisode)
- ThisEp.Clear()
- ThisEp = WorkingWithNfoFiles.ep_NfoLoad(nfo)
- For h = ThisEp.Count - 1 To 0 Step -1
- Dim fileStreamDetails As FullFileDetails = Pref.Get_HdTags(Utilities.GetFileName(ThisEp(h).VideoFilePath))
- ThisEp(h).Details.StreamDetails.Video = fileStreamDetails.filedetails_video
- ThisEp(h).Details.StreamDetails.Audio.Clear()
- For Each audioStream In fileStreamDetails.filedetails_audio
- ThisEp(h).Details.StreamDetails.Audio.Add(audioStream)
- Next
- ThisEp(h).Details.StreamDetails.Subtitles.Clear()
- For each langStream In fileStreamDetails.filedetails_subtitles
- ThisEp(h).Details.StreamDetails.Subtitles.Add(langStream)
- Next
- If ThisEp(h).Details.StreamDetails.Video.DurationInSeconds.Value <> Nothing Then
- Try
- Dim tempstring As String
- tempstring = ThisEp(h).Details.StreamDetails.Video.DurationInSeconds.Value
- If Pref.intruntime Then
- ThisEp(h).Runtime.Value = Math.Round(tempstring / 60).ToString
- Else
- ThisEp(h).Runtime.Value = Math.Round(tempstring / 60).ToString & " min"
- End If
- Catch
- End Try
- End If
- Next
- WorkingWithNfoFiles.ep_NfoSave(ThisEp, ThisEp(0).NfoFilePath)
- Catch ex As Exception
- messbox.Close()
- ExceptionHandler.LogError(ex)
- End Try
- Next
- messbox.Close()
- tv_CacheRefresh(WorkingTvShow)
- Catch ex As Exception
- messbox.Close()
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub Tv_TreeViewContext_MissingEpThumbs_Click(sender As System.Object, e As System.EventArgs) Handles Tv_TreeViewContext_MissingEpThumbs.Click
- Try
- Dim tmp As Integer = Utilities.languagelibrary.count
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim tempint As Integer = 0
- Dim seasonnumber As Integer = -1
- Dim nfofilestorename As New List(Of String)
- nfofilestorename.Clear()
- Dim donelist As New List(Of String)
- donelist.Clear()
- If WorkingTvShow.Episodes.Count = 0 Then
- MsgBox("No Episodes in this Show")
- Exit Sub
- End If
- If TvTreeview.SelectedNode.Name.IndexOf("\missing\") = -1 Then
- If TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvSeason Then
- Dim Thisseason As TvSeason = TvTreeview.SelectedNode.Tag
- seasonnumber = Thisseason.SeasonNumber
- End If
- End If
- messbox = New frmMessageBox("Scanning for Missing episode thumbnails,", "and downloading if available.", " Please Wait")
- messbox.Show()
- messbox.Refresh()
- Application.DoEvents()
-
- Dim tvdbstuff As New TVDBScraper
- Dim tvseriesdata As New Tvdb.ShowData
- Dim language As String = WorkingTvShow.Language.Value
- If language = "" Then language = "en"
- tvseriesdata = tvdbstuff.GetShow(WorkingTvShow.TvdbId.Value, language, SeriesXmlPath)
-
- For Each ep As TvEpisode In WorkingTvShow.Episodes
- If ep.IsMissing Then Continue For
- If Not seasonnumber = -1 AndAlso ep.Season.Value <> seasonnumber.ToString Then Continue For
- Dim Episodedata As New Tvdb.Episode
- Dim epfound As Boolean = False
- If Not tvseriesdata.FailedLoad Then
- For Each NewEpisode As Tvdb.Episode In tvseriesdata.Episodes
- If Not String.IsNullOrEmpty(ep.UniqueId.Value) Then
- If NewEpisode.Id.Value = ep.UniqueId.Value Then epfound = True
- ElseIf NewEpisode.SeasonNumber.Value = ep.Season.Value
- If NewEpisode.EpisodeNumber.Value = ep.Episode.Value Then epfound = True
- End If
- If epfound Then
- Episodedata = NewEpisode
- Episodedata.ThumbNail.Value = "http://www.thetvdb.com/banners/" & NewEpisode.ThumbNail.value
- Exit For
- End If
- Next
- End If
- If Not epfound Then
- Dim sortorder As String = WorkingTvShow.SortOrder.Value
- If sortorder = "" Then sortorder = "default"
- Dim tvdbid As String = WorkingTvShow.TvdbId.Value
- Dim imdbid As String = WorkingTvShow.ImdbId.Value
- Dim seasonno As String = ep.Season.Value
- Dim episodeno As String = ep.Episode.Value
- Episodedata = tvdbstuff.getepisodefromxml(tvdbid, sortorder, seasonno, episodeno, language, True)
- If Episodedata.FailedLoad Then Continue For
- End If
- Dim epdata As New TvEpisode
- epdata.AbsorbTvdbEpisode(Episodedata)
- epdata.NfoFilePath = ep.NfoFilePath
- epdata.VideoFilePath = ep.VideoFilePath
- epdata.Thumbnail.Url = Episodedata.ThumbNail.Value
- tv_EpisodeFanartGet(epdata, False)
- Next
- messbox.Close()
- Catch ex As Exception
- messbox.Close()
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub tv_PosterSetup(Optional ByVal IsOfType As String = "")
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim WorkingSeason As TvSeason = tv_SeasonSelectedCurrently(TvTreeview)
- tvposterpage = 0
- imdbposterlist.Clear()
- tvdbposterlist.Clear()
- rbTVposter.Checked = True
- rbTVposter.Enabled = False
- rbTVbanner.Enabled = False
- ComboBox2.Items.Clear()
- tvobjects.Clear()
- TextBox31.Text = WorkingTvShow.Title.Value
- Label72.Text = ""
- tv_PosterPanelClear()
- ComboBox2.Items.Add("Main Image")
- ComboBox2.Items.Add("Season All")
- For Each tvshow In Cache.TvCache.Shows
- If tvshow.TvdbId = WorkingTvShow.TvdbId Then
- For Each Season As Media_Companion.TvSeason In tvshow.Seasons.Values
- For Each ep As Media_Companion.TvEpisode In Season.Episodes
- Dim seasonstring As String = ""
- If ep.Season.Value < 1 Then
- seasonstring = "Specials"
- Else
- seasonstring = "Season " & Utilities.PadNumber(ep.Season.Value.ToString, 2)
- End If
- If Not ComboBox2.Items.Contains(seasonstring) Then
- ComboBox2.Items.Add(seasonstring)
- End If
- Next
- Next
- Exit For
- End If
- Next
- ComboBox2.SelectedIndex = 0
-
- If Not WorkingSeason is Nothing then
- Dim ThisSeason As String = WorkingSeason.ToString
- If ThisSeason = "Season 00" then ThisSeason = "Specials"
- For i=0 to ComboBox2.Items.Count
- ComboBox2.SelectedIndex = i
- If ComboBox2.text = ThisSeason Then
- If IsOfType = "banner" Then rbTVbanner.Checked = True
- Exit For
- End If
- Next
- End If
- End Sub
-
- Public Function BannerAndPosterViewer()
- Try
- Me.Panel16.Hide()
- Label72.Text = ""
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- rbTVposter.Enabled = True
- rbTVbanner.Enabled = True
- btnTvPosterTVDBSpecific.Enabled = True
- Dim eden As Boolean = Pref.EdenEnabled
- Dim frodo As Boolean = Pref.FrodoEnabled
- Dim edenpath As String =""
- Dim frodopath As string =""
- Dim tempstring As String = ComboBox2.SelectedItem
- Dim PresentImage As String = ""
- Dim defimg As String = ""
- Dim path As String = ""
- EdenImageTrue.Visible = False
- FrodoImageTrue.Visible=False
- If tempstring = "Main Image" Then
- If eden Then
- path = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "folder.jpg")
- edenpath = path
- End If
- If frodo Then
- If rbTVbanner.Checked = True Then
- path = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "banner.jpg")
- frodopath = path
- ElseIf rbTVposter.Checked = True Then
- path = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "poster.jpg")
- frodopath = path
- End If
- End If
- ElseIf tempstring = "Specials" Then
- If eden Then
- path = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "season-specials.tbn")
- edenpath = path
- End If
- If frodo Then
- If rbTVbanner.Checked = True Then
- path = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "season-specials-banner.jpg")
- frodopath = path
- ElseIf rbTVposter.Checked = True Then
- path = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "season-specials-poster.jpg")
- frodopath = path
- End If
- End If
- ElseIf tempstring.IndexOf("Season") = 0 And tempstring.IndexOf("Season All") = -1 Then
- path = tempstring.Replace("Season ", "")
- path = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "season" & path & ".tbn")
- edenpath = path
- If frodo Then
- If rbTVbanner.Checked = True Then
- path = path.Replace(".tbn", "-banner.jpg")
- frodopath = path
- ElseIf rbTVposter.Checked = True Then
- path = path.Replace(".tbn", "-poster.jpg")
- frodopath = path
- End If
- End If
- ElseIf tempstring = "Season All" Then
- btnTvPosterTVDBSpecific.Enabled = False
- If eden Then
- path = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "season-all.tbn")
- edenpath = path
- End If
- If frodo Then
- If rbTVbanner.Checked = True Then
- path = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "season-all-banner.jpg")
- frodopath = path
- ElseIf rbTVposter.Checked = True Then
- path = WorkingTvShow.NfoFilePath.Replace("tvshow.nfo", "season-all-poster.jpg")
- frodopath = path
- End If
- End If
- End If
-
- If (eden and IO.File.Exists(edenpath)) or (frodo and IO.File.Exists(frodopath)) Then
- EdenImageTrue.Visible =False
- EdenImageTrue.Text = "Eden Image Present"
- FrodoImageTrue.Visible=False
- FrodoImageTrue.Text = "Frodo Image Present"
- ArtMode.Text=""
- If eden Then
- EdenImageTrue.Visible = True
- ArtMode.Text="Pre-Frodo Enabled"
- End If
- If frodo Then
- FrodoImageTrue.Visible = True
- ArtMode.Text="Frodo Enabled"
- End If
- If frodo and eden then
- ArtMode.text="Both Enabled"
- EdenImageTrue.Visible=True
- FrodoImageTrue.Visible=True
- End If
- If IO.File.Exists(edenpath) then
- PresentImage = edenpath
- EdenImageTrue.Text = "Eden Image Present"
- Else
- EdenImageTrue.Text = "No Eden Image"
- End If
- If IO.File.Exists(frodopath) then
- PresentImage = frodopath
- FrodoImageTrue.Text="Frodo Image Present"
- Else
- FrodoImageTrue.Text = "No Frodo Image"
- End If
- Else
- If rbTVbanner.Checked = True Then
- defimg = Utilities.DefaultBannerPath
- If eden and not frodo then
- EdenImageTrue.Text="No Eden Image"
- EdenImageTrue.Visible=True
- FrodoImageTrue.Visible=False
- ElseIf frodo and Not eden then
- FrodoImageTrue.Text="No Frodo Image"
- FrodoImageTrue.Visible=True
- EdenImageTrue.Visible=False
- ElseIf frodo and eden then
- EdenImageTrue.Text="No Eden Image"
- EdenImageTrue.Visible=True
- FrodoImageTrue.Text="No Frodo Image"
- FrodoImageTrue.Visible=True
- End If
- Else
- defimg = Utilities.DefaultPosterPath
- If eden and not frodo then
- EdenImageTrue.Text="No Eden Image"
- EdenImageTrue.Visible=True
- FrodoImageTrue.Visible=False
- ElseIf frodo and Not eden then
- FrodoImageTrue.Text="No Frodo Image"
- FrodoImageTrue.Visible=True
- EdenImageTrue.Visible=False
- ElseIf frodo and eden then
- EdenImageTrue.Text="No Eden Image"
- EdenImageTrue.Visible=True
- FrodoImageTrue.Text="No Frodo Image"
- FrodoImageTrue.Visible=True
- End If
- End If
- End If
- util_ImageLoad(PictureBox12, PresentImage, If(rbTVbanner.Checked, Utilities.DefaultTvBannerPath, Utilities.DefaultTvPosterPath))
- If rbTVbanner.Checked = True Then
- Label73.Text = "Current Banner - " & PictureBox12.Image.Width.ToString & " x " & PictureBox12.Image.Height.ToString
- Else
- Label73.Text = "Current Poster - " & PictureBox12.Image.Width.ToString & " x " & PictureBox12.Image.Height.ToString
- End If
-
- Return 0
- Catch ex As Exception
- Return 0
- ExceptionHandler.LogError(ex)
- End Try
- End Function
-
- Private Sub tv_TvdbThumbsGet()
-
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim showlist As New XmlDocument
- Dim tvdbstuff As New TVDBScraper
- 'Dim AListOfBanners As New List(Of TvBanners)
- Dim thumblist As String = tvdbstuff.GetPosterList(WorkingTvShow.TvdbId.Value, tvdbposterlist)
- If thumblist <> "ok" Then MsgBox(thumblist, MsgBoxStyle.OkOnly, "TVdb site returned.....")
- 'Try
- ' showlist.LoadXml(thumblist)
- 'Catch ex As Exception
- ' MsgBox(thumblist, MsgBoxStyle.OkOnly, "TVdb site returned.....")
- ' Exit Sub
- 'End Try
-
- 'For Each thisresult In showlist("banners")
- ' Select Case thisresult.Name
- ' Case "banner"
- ' Dim individualposter As New TvBanners
- ' For Each results In thisresult.ChildNodes
- ' Select Case results.Name
- ' Case "id"
- ' individualposter.id = results.InnerText
- ' Case "url"
- ' individualposter.Url = results.InnerText
- ' Case "bannertype"
- ' individualposter.BannerType = results.InnerText
- ' Case "resolution"
- ' individualposter.Resolution = results.InnerText
- ' Case "language"
- ' individualposter.Language = results.InnerText
- ' Case "season"
- ' individualposter.Season = results.InnerText
- ' End Select
- ' Next
- ' individualposter.SmallUrl = individualposter.Url.Replace("http://thetvdb.com/banners/", "http://thetvdb.com/banners/_cache/")
- ' tvdbposterlist.Add(individualposter)
- ' End Select
- 'Next
- End Sub
-
- Private Sub tv_PosterPanelPopulate()
- Me.Panel16.Show()
- tvposterpage = 1
- If usedlist.Count <= 0 Then
- Label72.Text = "Displaying 0 of 0 Images"
- Label72.Visible = True
- btnTvPosterNext.Visible = False
- btnTvPosterPrev.Visible = False
- Call tv_PosterPanelClear()
- Exit Sub
- End If
- If Not rbTVbanner.Checked Then
- If usedlist.Count > 10 Then
- btnTvPosterNext.Visible = True
- btnTvPosterPrev.Visible = True
- If usedlist.Count >= 10 Then
- Label72.Text = "Displaying 1 to 10 of " & usedlist.Count.ToString & " Images"
- Else
- Label72.Text = "Displaying 1 to " & usedlist.Count.ToString & " of " & usedlist.Count.ToString & " Images"
- End If
- Label72.Visible = True
- Me.Refresh()
- Application.DoEvents()
- btnTvPosterPrev.Enabled = False
- btnTvPosterNext.Enabled = True
- Else
- btnTvPosterNext.Visible = False
- btnTvPosterPrev.Visible = False
- If posterArray.Count >= 10 Then
- Label72.Text = "Displaying 1 to 10 of " & usedlist.Count.ToString & " Images"
- 'Label72.Text = "Displaying 1 to " & Pref.maximumthumbs & " of " & usedlist.Count.ToString & " Images"
- Else
- Label72.Text = "Displaying 1 to " & usedlist.Count.ToString & " of " & usedlist.Count.ToString & " Images"
- End If
- Label72.Visible = True
- Me.Refresh()
- Application.DoEvents()
- End If
- Else
- btnTvPosterNext.Visible = False
- btnTvPosterPrev.Visible = False
- Label72.Text = "Displaying 1 to " & usedlist.Count.ToString
- End If
- Call tv_PosterSelectionDisplay()
- End Sub
-
- Private Sub tv_PosterPanelClear()
- For i = Panel16.Controls.Count - 1 To 0 Step -1
- Panel16.Controls.RemoveAt(i)
- Next
- End Sub
-
- Private Sub tv_PosterSelectionDisplay()
- tv_PosterPanelClear()
- Dim tempint As Integer = ((tvposterpage * 10) + 1) - 10
- Dim tempint2 As Integer = tvposterpage * 10
-
- If tempint2 > usedlist.Count Then
- tempint2 = usedlist.Count
- End If
-
- If Not rbTVbanner.Checked Then
- Label72.Text = "Displaying " & tempint.ToString & " to " & tempint2 & " of " & usedlist.Count.ToString & " Images"
- Else
- Label72.Text = "Displaying 1 to " & usedlist.Count.ToString
- tempint2 = usedlist.Count
- End If
-
- Dim locationX As Integer = 0
- Dim locationY As Integer = 0
- Dim itemcounter As Integer = 0
- Dim tempboolean As Boolean = True
- Dim MovFanartPicBox As New List(Of FanartPicBox)
- If rbTVposter.Checked = True Or rbTVbanner.Enabled = False Then
- For f = tempint - 1 To tempint2 - 1
- Dim thispicbox As New FanartPicBox
- tvposterpicboxes() = New PictureBox()
- With tvposterpicboxes
- .Location = New Point(locationX, locationY)
- .Width = 123
- .Height = 168
- .SizeMode = PictureBoxSizeMode.Zoom
- .Tag = usedlist(f).Url
- .Visible = True
- .BorderStyle = BorderStyle.Fixed3D
- .Name = "poster" & itemcounter.ToString
- AddHandler tvposterpicboxes.DoubleClick, AddressOf tv_PosterDoubleClick
- 'AddHandler tvposterpicboxes.LoadCompleted, AddressOf imageres
- End With
- thispicbox.pbox = tvposterpicboxes
- thispicbox.imagepath = usedlist(f).SmallUrl
- MovFanartPicBox.Add(thispicbox)
-
- tvpostercheckboxes() = New RadioButton()
- With tvpostercheckboxes
- .Location = New Point(locationX + 19, locationY + 166) '179
- .Width = 79
- .Height = 32
- .Name = "postercheckbox" & itemcounter.ToString
- .SendToBack()
- .CheckAlign = ContentAlignment.TopCenter
- If usedlist(f).Resolution = "season" Then
- .Text = " "
- ElseIf usedlist(f).Resolution <> "" Then
- .Text = usedlist(f).Resolution
- Else
- .Text = "?"
- End If
- .TextAlign = ContentAlignment.BottomCenter
- .Tag = usedlist(f).Url
- AddHandler tvpostercheckboxes.CheckedChanged, AddressOf tv_PosterRadioChanged
- End With
-
- itemcounter += 1
- Me.Panel16.Controls.Add(tvposterpicboxes())
- Me.Panel16.Controls.Add(tvpostercheckboxes())
- Application.DoEvents()
- If tempboolean = True Then
- locationY = (192 + 19)
- Else
- locationX += 120
- locationY = 0
- End If
- tempboolean = Not tempboolean
- Next
- Else
- For f = tempint - 1 To tempint2 - 1
- Dim thispicbox As New FanartPicBox
- tvposterpicboxes() = New PictureBox()
- With tvposterpicboxes
- .Location = New Point(0, locationY)
- .Width = 600
- .Height = 114
- .SizeMode = PictureBoxSizeMode.Zoom
- .Tag = usedlist(f).Url
- .Visible = True
- .BorderStyle = BorderStyle.Fixed3D
- .Name = "poster" & itemcounter.ToString
- AddHandler tvposterpicboxes.DoubleClick, AddressOf tv_PosterDoubleClick
- 'AddHandler tvposterpicboxes.LoadCompleted, AddressOf imageres
- End With
- thispicbox.pbox = tvposterpicboxes
- thispicbox.imagepath = usedlist(f).Url
- MovFanartPicBox.Add(thispicbox)
-
- tvpostercheckboxes() = New RadioButton()
- With tvpostercheckboxes
- .Location = New Point(290, locationY + 110)
- .Name = "postercheckbox" & itemcounter.ToString
- .SendToBack()
- .Text = " "
- .Tag = usedlist(f).Url
- AddHandler tvpostercheckboxes.CheckedChanged, AddressOf tv_PosterRadioChanged
- End With
- itemcounter += 1
- locationY += 140
-
- Me.Panel16.Controls.Add(tvposterpicboxes())
- Me.Panel16.Controls.Add(tvpostercheckboxes())
- Application.DoEvents()
- Next
- End If
- Me.Panel16.Refresh()
- Me.Refresh()
- If MovFanartPicBox.Count > 0 Then
- messbox.Close()
- If Not ImgBw.IsBusy Then
- ToolStripStatusLabel2.Text = "Starting Download of Images..."
- ToolStripStatusLabel2.Visible = True
- ImgBw.RunWorkerAsync({MovFanartPicBox, tempint, tempint2, Me.Panel16})
- End If
- End If
- Me.Panel16.Refresh()
- Me.Refresh()
- Application.DoEvents()
- If rbTVbanner.Checked AndAlso Me.Panel16.Controls.Count > 0 Then EnableTvBannerScrolling
- Me.Refresh()
- End Sub
-
- Private Sub tv_PosterRadioChanged(ByVal sender As Object, ByVal e As EventArgs)
-
- Dim tempstring As String = sender.name
- Dim tempint As Integer = 0
- Dim tempstring2 As String = tempstring
- Dim allok As Boolean = False
- tempstring = tempstring.Replace("postercheckbox", "")
- tempint = Convert.ToDecimal(tempstring)
- Dim hires(1)
- Dim lores(1)
- lores(0) = ""
- hires(0) = ""
- lores(1) = ""
- hires(1) = ""
- For Each cont As Control In Me.Panel16.Controls()
- If cont.Name.Replace("poster", "") = tempint.ToString Then
- Dim picbox As PictureBox = cont
- lores(0) = "Save Image (" & picbox.Image.Width & " x " & picbox.Image.Height & ")"
- lores(1) = picbox.Name
- For Each poster In usedlist
- If poster.url = sender.tag Then
- If Not IsNothing(poster.Resolution) AndAlso IsNumeric(poster.resolution.Replace("x", "")) Then
- hires(0) = "Save Image (" & poster.resolution & ")"
- hires(0) = hires(0).replace("x", " x ")
- Else
- hires(0) = "Save Image (Hi-Res)"
- End If
- hires(1) = poster.url
- Exit For
- End If
- Next
- allok = True
- Exit For
- End If
- Next
-
- If allok = True Then
- btnTvPosterSaveBig.Text = hires(0)
- btnTvPosterSaveBig.Visible = True
- btnTvPosterSaveBig.Tag = hires(1)
- Else
- btnTvPosterSaveBig.Visible = False
- End If
- End Sub
-
- Private Sub tv_PosterDoubleClick(ByVal sender As Object, ByVal e As EventArgs)
- Dim tempstring As String = sender.name.replace("poster", "postercheckbox")
- Dim hdurl As String = ""
- For Each Control In Panel16.Controls
- If Control.name = tempstring Then
- Dim rb As RadioButton = Control
- rb.Checked = True
- hdurl = rb.Tag.ToString
- End If
- Next
- messbox = New frmMessageBox("Please wait,", "", "Downloading Full Image")
- System.Windows.Forms.Cursor.Current = Cursors.WaitCursor
- messbox.Show()
- Me.Refresh()
- messbox.Refresh()
- If hdurl = "" Then hdurl = sender.tag.tostring
- Dim cachefile As String = Utilities.Download2Cache(hdurl)
- Call util_ZoomImage(cachefile)
- messbox.Close()
- End Sub
-
- Private Sub TvPosterSave(ByVal imageUrl As String)
- If ImgBw.IsBusy Then
- ImgBw.CancelAsync()
- Do Until Not ImgBw.IsBusy
- Application.DoEvents()
- Loop
- End If
- Try
- Dim witherror As Boolean = False
- Dim witherror2 As Boolean = False
- Dim path As String = ""
- Dim eden As Int16=0
- Dim frodo As Int16=0
- Dim imagePaths As New List(Of String)
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim workingposterpath = WorkingTvShow.FolderPath & "folder.jpg"
- If ComboBox2.Text.ToLower = "main image" Then
- If (Pref.EdenEnabled OrElse Pref.tvfolderjpg) And Not (Pref.FrodoEnabled AndAlso rbTVbanner.Checked) Then
- imagePaths.Add(workingposterpath)
- eden = 1
- End If
- If Pref.FrodoEnabled Then
- If rbTVbanner.Checked = True Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), "banner.jpg"))
- frodo = 1
- ElseIf rbTVposter.Checked = True Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), "poster.jpg"))
- frodo = 1
- End If
- End If
- If Pref.tvfolderjpg AndAlso rbTVposter.Checked Then
- imagePaths.Add(workingposterpath)
- End If
- ElseIf ComboBox2.Text.ToLower.IndexOf("season") <> -1 And ComboBox2.Text.ToLower.IndexOf("all") = -1 Then
- Dim temp As String = ComboBox2.Text.ToLower
- temp = temp.Replace(" ", "")
- If Pref.EdenEnabled Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), temp & ".tbn"))
- eden =1
- End If
- If Pref.FrodoEnabled Then
- If rbTVbanner.Checked = True Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), temp & "-banner.jpg"))
- frodo = 1
- ElseIf rbTVposter.Checked = True Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), temp & "-poster.jpg"))
- frodo = 1
- End If
- End If
- If Pref.seasonfolderjpg Then
- temp = temp.Replace("season", "")
- Dim seasonno As Integer = temp.ToInt
- Dim seasonpath As String = Nothing
- For Each ep As TvEpisode In WorkingTvShow.Episodes
- If ep.Season.Value = seasonno Then
- seasonpath = ep.FolderPath.Replace(WorkingTvShow.FolderPath, "")
- Exit For
- End If
- Next
- If Not IsNothing(seasonpath) Then imagePaths.Add(WorkingTvShow.FolderPath & seasonpath & "folder.jpg")
- End If
- ElseIf ComboBox2.Text.ToLower.IndexOf("season") <> -1 And ComboBox2.Text.ToLower.IndexOf("all") <> -1 Then
- If Pref.EdenEnabled Then
- If Pref.seasonall="poster" and rbTVposter.Checked Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), "season-all.tbn"))
- eden =1
- ElseIf Pref.seasonall="wide" and rbTVbanner.Checked Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), "season-all.tbn"))
- eden =1
- End If
- End If
- If Pref.FrodoEnabled Then
- If rbTVbanner.Checked = True Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), "season-all-banner.jpg"))
- frodo = 1
- ElseIf rbTVposter.Checked = True Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), "season-all-poster.jpg"))
- frodo = 1
- End If
- End If
- ElseIf ComboBox2.Text.ToLower = "specials" Then
- If Pref.EdenEnabled Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), "season-specials.tbn"))
- eden =1
- End If
- If Pref.FrodoEnabled Then
- If rbTVbanner.Checked = True Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), "season-specials-banner.jpg"))
- frodo = 1
- ElseIf rbTVposter.Checked = True Then
- imagePaths.Add(workingposterpath.Replace(IO.Path.GetFileName(workingposterpath), "season-specials-poster.jpg"))
- frodo = 1
- End If
- End If
- If Pref.seasonfolderjpg AndAlso rbTVposter.Checked Then
- Dim seasonpath As String = ""
- For Each seas In WorkingTvShow.Seasons.Values
- If seas.SeasonNumber = 0 Then
- seasonpath = seas.FolderPath
- Exit For
- End If
- Next
- If seasonpath <> "" Then
- imagePaths.Add(seasonpath & "folder.jpg")
- End If
- End If
- End If
- messbox = New frmMessageBox("Please wait,", "", "Downloading Full Resolution Image")
- System.Windows.Forms.Cursor.Current = Cursors.WaitCursor
- messbox.Show()
- Me.Refresh()
- messbox.Refresh()
- Try
- If Not IsNothing(imageUrl) Then
- witherror = Not DownloadCache.SaveImageToCacheAndPaths(imageUrl, ImagePaths, True)
- If Not witherror Then
- path = imagePaths(0)
- If rbTVbanner.Checked Then
- util_ImageLoad(tv_PictureBoxBottom, path, Utilities.DefaultTvBannerPath)
- End If
- If rbTVposter.Checked Then
- util_ImageLoad(tv_PictureBoxRight, path, Utilities.DefaultTvPosterPath)
- End If
- util_ImageLoad(PictureBox12, path, Utilities.DefaultTvPosterPath)
- Label73.Text = "Current Poster - " & PictureBox12.Image.Width.ToString & " x " & PictureBox12.Image.Height.ToString
- End If
- End If
- If witherror = True Then
- MsgBox("Unable to download image")
- Else
- If eden =1 then
- EdenImageTrue.Visible =True
- EdenImageTrue.Text="Eden Image Present"
- End if
- If frodo =1 then
- FrodoImageTrue.Visible =True
- FrodoImageTrue.Text="Frodo Image Present"
- End if
- End If
- Catch ex As Exception
- MsgBox(ex.ToString)
- Finally
- messbox.Close()
- End Try
- If ComboBox2.Text.ToLower = "main image" AndAlso rbtvposter.Checked Then
- Dim popath As String = Utilities.save2postercache(WorkingTvShow.NfoFilePath, WorkingTvShow.ImagePoster.Path, WallPicWidth, WallPicHeight)
- updateTvPosterWall(popath, WorkingTvShow.NfoFilePath)
- End If
- path = ""
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub RefreshMovieNfoFilesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshMovieNfoFilesToolStripMenuItem.Click
- Try
- Call Batch_Rewritenfo()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Sub ShowMovieFilter(cbFilter As Control)
- If Not cbFilter.Visible Then
- movie_filters.GetItem(cbFilter.Name).Visible = True
- Pref.movie_filters.SetMovieFiltersVisibility
- UpdateMovieFiltersPanel
- End If
- End Sub
-
- #Region "Media Info Export"
- Dim exportMovieInfo As Boolean = False 'these are used to allow only a single execution of media export functions
- Dim exportTVInfo As Boolean = False 'when there may be mulitple drop-down events. (Found that out the hard way!)
-
- Private Sub ExportMovieListInfoToolStripMenuItem_DropDownItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ExportMovieListInfoToolStripMenuItem.DropDownItemClicked
- If Not exportMovieInfo Then exportMovieInfo = mediaInfoExp.setTemplate(e.ClickedItem.Text)
- End Sub
-
- Private Sub ExportTVShowInfoToolStripMenuItem_DropDownItemClicked(sender As Object, e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ExportTVShowInfoToolStripMenuItem.DropDownItemClicked
- If Not exportTVInfo Then exportTVInfo = mediaInfoExp.setTemplate(e.ClickedItem.Text)
- End Sub
-
- Private Sub ExportMovieListInfoToolStripMenuItem_DropDownClosed(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExportMovieListInfoToolStripMenuItem.DropDownClosed
- If exportMovieInfo Then
- exportMovieInfo = False
- Call util_ExportMediaListInfo(MediaInfoExport.mediaType.Movie)
- End If
- End Sub
-
- Private Sub ExportTVShowInfoToolStripMenuItem_DropDownClosed(sender As Object, e As System.EventArgs) Handles ExportTVShowInfoToolStripMenuItem.DropDownClosed
- If exportTVInfo = True Then
- exportTVInfo = False
- Call util_ExportMediaListInfo(MediaInfoExport.mediaType.TV)
- End If
- End Sub
-
- Private Sub util_ExportMediaListInfo(ByVal mediaType As String)
- Dim savepath As String
- Dim extensions As New Dictionary(Of String, String)
- extensions.Add("html", "Html Documents (*.html)|*.html")
- extensions.Add("xml", "XML Data (*.xml)|*.xml")
- extensions.Add("csv", "CSV (Comma delimited) (*.csv)|*.csv")
- Dim ext As String = mediaInfoExp.getPossibleFileType
- Dim idx As Integer
- For idx = 1 To extensions.Count
- If extensions.Keys(idx - 1) = ext Then Exit For
- Next
- With SaveFileDialog1
- .DefaultExt = ext
- .Filter = String.Join("|", extensions.Values)
- .FilterIndex = idx
- .Title = "ExportMedia File"
- .OverwritePrompt = True
- .CheckPathExists = True
- If mediaInfoExp.workingTemplate.FileName <> "" Then
- .FileName = mediaInfoExp.workingTemplate.FileName
- End If
- End With
- If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
- savepath = SaveFileDialog1.FileName
- Dim mediaCollection As Object
- If mediaType = MediaInfoExport.mediaType.Movie Then
- 'Dirty hack to get the media export to use the data grid source. Wasn't as straight forward as hoped,
- 'and after spending many hours trying to find an elegant solution, I gave up.
- 'If anyone comes across this and thinks "Huey, you twat, just do it like this", then please go right
- 'ahead! - HueyHQ 15Feb13
- Dim mediaList As New List(Of ComboList)
- For Each mediaItem As Data_GridViewMovie In DataGridViewMovies.DataSource
- mediaList.Add(mediaItem.Export)
- Next
- mediaCollection = mediaList
- Else
- mediaCollection = Cache.TvCache.Shows
- End If
- mediaInfoExp.createDocument(savepath, mediaCollection)
- End If
- End Sub
-
- #End Region 'Media Info Export
-
- Private Sub bckgroundscanepisodes_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs, Optional ByVal manual As Boolean = False) Handles bckgroundscanepisodes.DoWork
- Try
- Dim List As List(Of TvShow) = e.Argument(0)
- Dim Force As Boolean = e.Argument(1)
- Statusstrip_Enable()
- 'StatusStrip1.BackColor = Color.Honeydew
- 'StatusStrip1.Visible = True
- 'tsStatusLabel1.Visible = False
-
- Call TV_EpisodeScraper(List, Force)
-
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub bckgroundscanepisodes_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles bckgroundscanepisodes.ProgressChanged
- Try
- If e.ProgressPercentage = 0 Then
- ToolStripStatusLabel6.Text = e.UserState
- ToolStripStatusLabel6.Visible = True
- ElseIf e.ProgressPercentage = 1 Then
- If TypeOf e.UserState Is TvEpisode Then
- Dim TempEpisode As TvEpisode = CType(e.UserState, TvEpisode)
-
- TempEpisode.ShowObj.AddEpisode(TempEpisode)
- TempEpisode.SeasonObj.UpdateTreenode()
- TempEpisode.UpdateTreenode(True)
- 'This bit updates the Epsiode Count on the fly when the progress is updated. It has to be done here to avoid thread issues. (GUI wouldn't update properly)
- TextBox_TotEpisodeCount.Text = Cache.TvCache.Episodes.Count
- End If
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub bckgroundscanepisodes_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bckgroundscanepisodes.RunWorkerCompleted
- Try
- If scrapeAndQuit = True Then
- sandq = sandq -1
- Exit Sub
- End If
-
- If Not (e.Error Is Nothing) Then
- tvScraperLog = tvScraperLog & vbCrLf
- tvScraperLog = tvScraperLog & "!!! Error, exiting TV episode scraper" & vbCrLf
- tvScraperLog = tvScraperLog & "Error:-" & vbCrLf
- tvScraperLog = tvScraperLog & e.Error.ToString & vbCrLf
- Else
- tvScraperLog = tvScraperLog & vbCrLf & "!!! Operation Completed" & vbCrLf
- End If
-
- ToolStripStatusLabel6.Text = "TV Show Scraper"
- ToolStripStatusLabel6.Visible = False
- StatusStrip1.Visible = BckWrkScnMovies.IsBusy OrElse Not Pref.AutoHideStatusBar
- If Not BckWrkScnMovies.IsBusy Then StatusStrip1.BackColor = Color.LightGray
- tsStatusLabel1.Visible = Not BckWrkScnMovies.IsBusy
- btnTvSearchNew.Text = "Search New"
-
- Call util_ThreadsRunningCheck()
- Tv_CacheSave()
- tv_CacheLoad()
- tv_Filter()
- If Pref.disabletvlogs Or ScraperErrorDetected Then
- Dim MyFormObject As New frmoutputlog(tvScraperLog, True)
- Try
- MyFormObject.ShowDialog()
- Catch ex As ObjectDisposedException
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- ScraperErrorDetected = False
- Else
- BlinkTaskBar()
- End If
- GC.Collect()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub ep_Search()
- Dim ShowList As New List(Of TvShow)
-
- If Not bckgroundscanepisodes.IsBusy And Not Bckgrndfindmissingepisodes.IsBusy Then
- btnTvSearchNew.Text = "Cancel "
- For Each item In Cache.TvCache.Shows
- If (item.NfoFilePath.ToLower.IndexOf("tvshow.nfo") <> -1) And ((item.State = Media_Companion.ShowState.Open) Or TVSearchALL = True) Then
- ShowList.Add(item)
- End If
- Next
- bckgroundscanepisodes.RunWorkerAsync({ShowList, TVSearchALL}) 'if searching all episodes (inc locked) TVSearchALL is true
- ElseIf bckgroundscanepisodes.IsBusy Then
- MsgBox("This Episode Scraper is already running")
- ElseIf Bckgrndfindmissingepisodes.IsBusy Then
- MsgBox("The missing episode search cannot be performed" & vbCrLf & " while the episode scraper is running")
- End If
- End Sub
-
- Private Sub SearchThisShowForNewEpisodesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_SearchNewEp.Click
- Try
- If TvTreeview.SelectedNode Is Nothing Then Exit Sub
-
- Dim Season As TvSeason
- Dim Episode As TvEpisode
- Dim ShowList As New List(Of TvShow)
- Dim selectednode As Integer = TvTreeview.SelectedNode.Index
- If TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvShow Then
- ShowList.Add(TvTreeview.SelectedNode.Tag)
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvSeason Then
-
- Season = TvTreeview.SelectedNode.Tag
- ShowList.Add(Season.ShowObj)
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvEpisode Then
- Episode = TvTreeview.SelectedNode.Tag
- ShowList.Add(Episode.ShowObj)
- End If
- Dim OverrideLock As Boolean = False
- If ShowList(0).State <> 0 Then 'i.e. it is either locked or unverified
- If MsgBox("This show is either 'Locked' or 'Unverified'. Do you want to continue scan?", MsgBoxStyle.YesNo, "Question?") = MsgBoxResult.Yes Then
- OverrideLock = True
- Else
- Exit Sub
- End If
- End If
-
- If Not bckgroundscanepisodes.IsBusy And Not Bckgrndfindmissingepisodes.IsBusy Then
- btnTvSearchNew.Text = "Cancel "
-
- bckgroundscanepisodes.RunWorkerAsync({ShowList, OverrideLock})
- ElseIf bckgroundscanepisodes.IsBusy Then
- MsgBox("This Episode Scraper is already running")
- ElseIf Bckgrndfindmissingepisodes.IsBusy Then
- MsgBox("The missing episode search cannot be performed" & vbCrLf & " while the episode scraper is running")
- End If
- Do Until Not bckgroundscanepisodes.IsBusy
- Application.DoEvents()
- Loop
- TvTreeview.SelectedNode = TvTreeview.Nodes(selectednode)
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub tpMovWall_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tpMovWall.LostFocus
- Try
- tpMovWall.Focus()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub RefreshActorDBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
- Try
- Call mov_ActorRebuild()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub DownsizeAllFanartsToSelectedSizeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DownsizeAllFanartsToSelectedSizeToolStripMenuItem.Click
- DownSizeAll("Backdrops")
- End Sub
-
- Private Sub DownsizeAllPostersToSelectedSizeToolStripMenuItem_Click( sender As System.Object, e As System.EventArgs) Handles DownsizeAllPostersToSelectedSizeToolStripMenuItem.Click
- DownSizeAll("Posters")
- End Sub
-
- Private Sub DownSizeAll(postersOrBackdrops As String)
- Dim tempint As Integer = oMovies.MovieCache.Count
- System.Windows.Forms.Cursor.Current = Cursors.WaitCursor
- Dim point As Point
- Dim height = 0
- If postersOrBackdrops = "Backdrops" then
- point = Movie.GetBackDropResolution(Pref.BackDropResolutionSI)
- Else
- height = Movie.GetHeightResolution(Pref.PosterResolutionSI)
- End If
- Using messbox As frmMessageBox = New frmMessageBox("Please wait - " & postersOrBackdrops & " are being resized", "", tempint.ToString & " remaining")
- messbox.Show
- Me.Refresh
- messbox.Refresh
- Dim path = ""
- For Each m In oMovies.MovieCache
- If postersOrBackdrops = "Backdrops" then
- path = Pref.GetFanartPath(m.fullpathandfilename)
- If File.Exists(path) Then DownloadCache.CopyAndDownSizeImage(path, path, point.x, point.y)
- Else
- path = Pref.GetPosterPath(m.fullpathandfilename)
- If File.Exists(path) Then DownloadCache.CopyAndDownSizeImage(path, path, , height )
- End If
- tempint -= 1
- messbox.TextBox3.Text = tempint.ToString & " remaining"
- messbox.TextBox3.Refresh
- Application.DoEvents
- Next
- End Using
- End Sub
-
- Public Sub mov_RebuildMovieCaches
- mov_PreferencesDisplay
- RunBackgroundMovieScrape("RebuildCaches")
- End Sub
-
- Private Sub CheckRootsForToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckRootsForToolStripMenuItem.Click
- Try
- tv_ShowFind(Pref.tvRootFolders, False)
- If newTvFolders.Count > 0 Then
- For Each item In newTvFolders
- Pref.tvFolders.Add(item)
- Next
- Pref.tvFolders.Sort()
- Pref.ConfigSave()
- End If
- tv_ShowScrape()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Public Sub tv_ShowFind(ByVal rootfolders As List(Of str_RootPaths), Optional ByVal skiptvfolderschk As Boolean = False)
- Dim Folders As List(Of String)
- newTvFolders.Clear()
- For Each folder In rootfolders
- If Not folder.selected Then Continue For
- Folders = Utilities.EnumerateFolders(folder.rpath, 0)
- For Each strfolder2 As String In Folders
- If skiptvfolderschk Then
- If Not ListBox6.Items.Contains(strfolder2) AndAlso Utilities.ValidMovieDir(strfolder2) Then newTvFolders.Add(strfolder2)
- ElseIf Not Pref.tvFolders.Contains(strfolder2) AndAlso Utilities.ValidMovieDir(strfolder2) Then
- If Not ListBox6.Items.Contains(strfolder2) Then newTvFolders.Add(strfolder2)
- End If
- Next
- Next
- End Sub
-
- Public Sub tv_ShowScrape()
- If Not bckgrnd_tvshowscraper.IsBusy Then
- If newTvFolders.Count > 0 Then
- ToolStripStatusLabel5.Text = "Scraping TV Shows, " & newTvFolders.Count & " remaining"
- ToolStripStatusLabel5.Visible = True
- End If
- Dim selectedLang As String = If(Pref.tvshow_useXBMC_Scraper, Pref.XBMCTVDbLanguage, Pref.TvdbLanguageCode)
- Dim args As TvdbArgs = New TvdbArgs("", selectedLang)
- bckgrnd_tvshowscraper.RunWorkerAsync(args) ' Even if no shows scraped, saves tvcache and updates treeview in RunWorkerComplete
- End If
- End Sub
-
- Public Function util_RegexValidate(ByVal regexs As String)
- Try
- Dim test As Match
- test = Regex.Match("", regexs)
- Catch ex As Exception
- Return False
- End Try
- Return True
- End Function
-
- Public Function tv_LanguageCheck(ByVal id As String, ByVal language As String)
- Try
- Dim languagecode As String = language
- Dim url As String = "http://thetvdb.com/api/6E82FED600783400/series/" & id & "/" & languagecode & ".xml"
- Dim websource(10000)
- Dim urllinecount As Integer = 0
- Try
- Dim wrGETURL As WebRequest
- wrGETURL = WebRequest.Create(url)
- wrGETURL.Proxy = Utilities.MyProxy
- Dim objStream As Stream
- objStream = wrGETURL.GetResponse.GetResponseStream()
- Dim objReader As New StreamReader(objStream)
- Dim sLine As String = ""
- urllinecount = 0
-
- Do While Not sLine Is Nothing
- urllinecount += 1
- sLine = objReader.ReadLine
- If Not sLine Is Nothing Then
- websource(urllinecount) = sLine
- End If
- Loop
- objReader.Close()
- objStream.Close()
- objReader = Nothing
- objStream = Nothing
- urllinecount -= 1
-
- Catch ex As Exception
- End Try
- For f = 1 To urllinecount
- If websource(f).IndexOf("<Language>") <> -1 Then
- websource(f) = websource(f).Replace("<Language>", "")
- websource(f) = websource(f).Replace("</Language>", "")
- websource(f) = websource(f).Replace(" ", "")
- If websource(f).ToLower = languagecode Then
- Return True
- Else
- Return False
- End If
- End If
- Next
- Catch ex As Exception
- End Try
- Return "Error"
- End Function
-
- Private Sub ProfilesToolStripMenuItem_DropDownItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ProfilesToolStripMenuItem.DropDownItemClicked
- Try
- Pref.ConfigSave()
- For Each prof In profileStruct.ProfileList
- If prof.ProfileName = e.ClickedItem.Text Then
- workingProfile.actorcache = prof.actorcache
- workingProfile.DirectorCache = prof.DirectorCache
- workingProfile.config = prof.config
- workingProfile.Genres = prof.Genres
- workingProfile.moviecache = prof.moviecache
- workingProfile.MusicVideoCache = prof.MusicVideoCache
- workingProfile.profilename = prof.profilename
- workingProfile.regexlist = prof.regexlist
- workingProfile.tvcache = prof.tvcache
- workingProfile.MovieSetCache = prof.MovieSetCache
- workingProfile.CustomTvCache = prof.CustomTvCache
- Call util_ProfileSetup()
- End If
- Next
- If e.ClickedItem.Text <> workingProfile.profilename Then Exit Sub
- For Each item In ProfilesToolStripMenuItem.DropDownItems
- If item.text = workingProfile.profilename Then
- With item
- item.checked = True
- End With
- Else
- item.checked = False
- End If
- Next
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub util_ProfileSetup()
- messbox = New frmMessageBox(" Please Wait", , "Loading Profile")
- messbox.Show()
- messbox.Refresh()
- Application.DoEvents()
- Me.Enabled = False
- If IO.File.Exists(workingProfile.config) Then
- Pref.moviesets.Clear()
- Me.util_ConfigLoad()
- Else
- Call SetUpPreferences()
- End If
- util_MainFormTitleUpdate() 'creates & shows new title to Form1, also includes current profile name
- If Not IO.File.Exists(workingProfile.moviecache) Or Pref.startupCache = False Then
- mov_RebuildMovieCaches
- Else
- oMovies.LoadCaches
- End If
- If IO.File.Exists(workingProfile.Genres) Then Call util_GenreLoad()
-
- If Not IO.File.Exists(workingProfile.tvcache) Or Pref.startupCache = False Then
- Call tv_CacheRefresh()
- Else
- Call tv_CacheLoad()
- End If
-
- If Not IO.File.Exists(workingProfile.CustomTvCache) Or Pref.startupCache = False Then
- Call Custtv_CacheRefresh()
- Else
- Call Custtv_CacheLoad()
- End If
-
- If IO.File.Exists(workingProfile.MusicVideoCache) Then Call UcMusicVideo1.MVCacheLoad()
-
- Me.Refresh()
- Application.DoEvents()
-
- If Pref.splt5 = 0 Then
- Dim tempint As Integer = SplitContainer1.Height
- tempint = tempint / 4
- tempint = tempint * 3
- Pref.splt5 = If(tempint > 275, tempint, 275)
- End If
-
- If Pref.startuptab = 0 Then
- SplitContainer1.SplitterDistance = Pref.splt1
- SplitContainer2.SplitterDistance = Pref.splt2
- SplitContainer5.SplitterDistance = Pref.splt5
- TabLevel1.SelectedIndex = 1
- SplitContainer3.SplitterDistance = Pref.splt3
- SplitContainer4.SplitterDistance = Pref.splt4
- _tv_SplitContainer.SplitterDistance = Pref.splt6
- TabLevel1.SelectedIndex = 0
- Else
- SplitContainer1.SplitterDistance = Pref.splt1
- SplitContainer2.SplitterDistance = Pref.splt2
- SplitContainer5.SplitterDistance = Pref.splt5
- TabLevel1.SelectedIndex = 1
- SplitContainer3.SplitterDistance = Pref.splt3
- SplitContainer4.SplitterDistance = Pref.splt4
- _tv_SplitContainer.SplitterDistance = Pref.splt6
- End If
- SplitContainer1.IsSplitterFixed = False
- SplitContainer2.IsSplitterFixed = False
- SplitContainer3.IsSplitterFixed = False
- SplitContainer4.IsSplitterFixed = False
- SplitContainer5.IsSplitterFixed = False
- _tv_SplitContainer.IsSplitterFixed = False
- 'Dim tempboolean As Boolean = UrlIsValid("http://thetvdb.com/")
-
- Try
- If cbMovieDisplay_MovieSet.Items.Count <> Pref.moviesets.Count Then
- cbMovieDisplay_MovieSet.Items.Clear()
- For Each mset In Pref.moviesets
- cbMovieDisplay_MovieSet.Items.Add(If(Pref.MovSetTitleIgnArticle, Pref.RemoveIgnoredArticles(mset), mset))
- Next
- End If
- If workingMovieDetails.fullmoviebody.MovieSet.MovieSetName <> "-None-" Then
- For Each mset In Pref.moviesets
- cbMovieDisplay_MovieSet.Items.Add(If(Pref.MovSetTitleIgnArticle, Pref.RemoveIgnoredArticles(mset), mset))
- Next
- For te = 0 To cbMovieDisplay_MovieSet.Items.Count - 1
- If cbMovieDisplay_MovieSet.Items(te) = workingMovieDetails.fullmoviebody.MovieSet.MovieSetDisplayName Then
- cbMovieDisplay_MovieSet.SelectedIndex = te
- Exit For
- End If
- Next
- End If
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- mov_VideoSourcePopulate()
- ep_VideoSourcePopulate()
- Try
- TabControl2.SelectedIndex = 0
- currentTabIndex = 0
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- Try
- TabControl3.SelectedIndex = 0
- tvCurrentTabIndex = 0
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- Me.Enabled = True
- messbox.Close()
- End Sub
-
- Public Sub mov_SwitchRuntime()
- If workingMovieDetails Is Nothing Then Exit Sub
- If Pref.enablehdtags = True And workingMovieDetails.filedetails.filedetails_video.DurationInSeconds <> Nothing And Not displayRuntimeScraper Then
- runtimetxt.Text = Utilities.cleanruntime(workingMovieDetails.filedetails.filedetails_video.DurationInSeconds.Value) & " min"
- runtimetxt.Enabled = False
- Else
- runtimetxt.Text = workingMovieDetails.fullmoviebody.runtime
- runtimetxt.Enabled = True
- End If
- End Sub
-
- Public Sub mov_Switchtop250()
- If workingMovieDetails Is Nothing Then Exit Sub
- If lbl_movTop250.Text = "Top 250" Then
- lbl_movTop250.Text = "Metascore"
- top250txt.Text = workingMovieDetails.fullmoviebody.metascore
- Else
- lbl_movTop250.Text = "Top 250"
- top250txt.Text = workingMovieDetails.fullmoviebody.top250
- End If
- 'If Pref.enablehdtags = True And workingMovieDetails.filedetails.filedetails_video.DurationInSeconds <> Nothing And Not displayRuntimeScraper Then
- ' runtimetxt.Text = Utilities.cleanruntime(workingMovieDetails.filedetails.filedetails_video.DurationInSeconds.Value) & " min"
- ' runtimetxt.Enabled = False
- 'Else
- ' runtimetxt.Text = workingMovieDetails.fullmoviebody.runtime
- ' runtimetxt.Enabled = True
- 'End If
- End Sub
-
- Private Sub SearchForNewMoviesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchForNewMoviesToolStripMenuItem.Click
- SearchForNew
- End Sub
-
- Public Function Yield(yielding As Boolean) As Boolean
- If yielding Then
- Application.DoEvents
- Return _yield
- End If
- Return False
- End Function
-
- Private Sub util_FontSetup()
- If Pref.font <> Nothing Then
- If Pref.font <> "" Then
- Try
- Dim tcc As TypeConverter = TypeDescriptor.GetConverter(GetType(System.Drawing.Font))
- Dim newFont As System.Drawing.Font = CType(tcc.ConvertFromString(Pref.font), System.Drawing.Font)
- genretxt.Font = newFont
- premiertxt.Font = newFont
- certtxt.Font = newFont
- directortxt.Font = newFont
- creditstxt.Font = newFont
- outlinetxt.Font = newFont
- runtimetxt.Font = newFont
- studiotxt.Font = newFont
- countrytxt.Font = newFont
- taglinetxt.Font = newFont
- cbMovieDisplay_Actor.Font = newFont
- roletxt.Font = newFont
- pathtxt.Font = newFont
- TextBox34.Font = newFont
- DataGridViewMovies.Font = newFont
- plottxt.Font = newFont
- txtStars.Font = newFont
- cbMovieDisplay_MovieSet.Font = newFont
- cmbxEpActor.Font = newFont
- TvTreeview.Font = newFont
- tbEpRole.Font = newFont
- tb_EpDirector.Font = newFont
- tb_EpCredits.Font = newFont
- tb_EpPlot.Font = newFont
- tb_EpAired.Font = newFont
- tb_EpRating.Font = newFont
- tb_EpPath.Font = newFont
- tb_EpFilename.Font = newFont
- tb_ShPlot.Font = newFont
- cbTvActor.Font = newFont
- cbTvActorRole.Font = newFont
- tb_ShRunTime.Font = newFont
- tb_ShStudio.Font = newFont
- tb_ShPremiered.Font = newFont
- tb_ShRating.Font = newFont
- tb_ShVotes.Font = newFont
- tb_ShTvdbId.Font = newFont
- tb_ShGenre.Font = newFont
- tb_ShImdbId.Font = newFont
- tb_ShCert.Font = newFont
-
- ratingtxt.Font = newFont
- votestxt.Font = newFont
- top250txt.Font = newFont
- cbUsrRated.Font = newFont
- cbFilterGeneral.Font = newFont
- cbFilterGenre.Font = newFont
- cbFilterCountries.Font = newFont
- cbFilterStudios.Font = newFont
- cbFilterSet.Font = newFont
- cbFilterActor.Font = newFont
- cbFilterTag.Font = newFont
- cbFilterDirector.Font = newFont
- cbFilterSource.Font = newFont
- cbFilterResolution.Font = newFont
- cbFilterVideoCodec.Font = newFont
- cbFilterSubTitleLang.Font = newFont
- cbFilterRootFolder.Font = newfont
- cbFilterUserRated.Font = newfont
- cbFilterAudioCodecs.Font = newFont
- cbFilterAudioLanguages.Font = newFont
- cbFilterAudioDefaultLanguages.Font = newFont
- cbFilterAudioBitrates .Font = newFont
- cbFilterAudioChannels .Font = newFont
- cbFilterNumAudioTracks.Font = newFont
- cbFilterCertificate .Font = newFont
- LabelCountFilter.Font = newFont
- Me.Refresh()
- Application.DoEvents()
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End If
- End If
- End Sub
-
- Private Sub langarrsetup()
- Dim strfilename As String
- Dim num_rows As Long
- Dim num_cols As Long
- Dim x As Integer
- Dim y As Integer
- strfilename = applicationPath & "\Assets\" & "test.csv"
- If File.Exists(strfilename) Then
- Dim tmpstream As StreamReader = File.OpenText(strfilename)
- Dim strlines() As String
- Dim strline() As String
- strlines = tmpstream.ReadToEnd().Split(Environment.NewLine)
- num_rows = UBound(strlines)
- strline = strlines(0).Split(",")
- num_cols = UBound(strline)
-
- ' Copy the data into the array.
- For x = 0 To num_rows-1
- strline = strlines(x).Split(",")
- For y = 0 To num_cols
- langarray(x, y) = strline(y)
- Next
- Next
- tmpstream.Close()
- tmpstream = Nothing
- End If
- End Sub
-
- #Region "Movie Table"
-
- 'tabpage events
- Private Sub tpMovTable_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles tpMovTable.Enter
- 'MovSetsRepopulate()
- 'mov_TableSetup()
- End Sub
-
- Private Sub tpMovTable_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles tpMovTable.Leave
- DataGridView1.EndEdit()
- Pref.tableview.Clear()
- For Each column In DataGridView1.Columns
- Dim tempstring As String = String.Format("{0}|{1}|{2}|{3}", column.name, column.width, column.displayindex, column.visible)
- Pref.tableview.Add(tempstring)
- Next
- If IsNothing(DataGridView1.SortedColumn) = False Then
- Pref.tablesortorder = String.Format("{0} | {1}", DataGridView1.SortedColumn.HeaderText, DataGridView1.SortOrder.ToString)
- Pref.ConfigSave()
- End If
-
- If DataDirty Then
- Dim tempint As Integer = MessageBox.Show("You appear to have made changes to some of your movie details." & vbCrLf & vbCrLf & "Any changes will be lost if you do not save the changes now." & " Do wish to save the changes?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
- If tempint = DialogResult.Yes Then
- Call mov_TableChangesSave()
- MsgBox("Changes Saved")
- End If
- End If
-
- DataDirty=False
- btn_movTableSave.Enabled = DataDirty
- End Sub
-
- 'Table Setup and update
- Private Sub mov_TableViewSetup()
- Pref.tableview.Clear()
- Pref.tableview.Add("title|150|0|true")
- Pref.tableview.Add("year|40|1|true")
- Pref.tableview.Add("genre|160|2|true")
- Pref.tableview.Add("rating|50|3|true")
- Pref.tableview.Add("runtime|60|4|true")
- Pref.tableview.Add("top250|89|5|false")
- Pref.tableview.Add("source|150|6|false")
- Pref.tableview.Add("playcount|120|7|true")
- Pref.tableview.Add("set|150|8|true")
- Pref.tableview.Add("certificate|100|9|false")
- Pref.tableview.Add("sorttitle|100|10|false")
- Pref.tableview.Add("outline|200|11|false")
- Pref.tableview.Add("plot|200|12|false")
- Pref.tableview.Add("stars|200|13|false")
- Pref.tableview.Add("id|82|14|false")
- Pref.tableview.Add("missingdata1|115|15|false")
- Pref.tableview.Add("fullpathandfilename|300|16|false")
- Pref.tableview.Add("createdate|104|17|false")
- Pref.tableview.Add("userrated|100|18|false")
- End Sub
-
- Private Sub mov_TableSetup()
- DataGridView1.Columns.Clear()
- If Pref.tablesortorder = Nothing Then Pref.tablesortorder = "Title|Ascending"
- If Pref.tablesortorder = "" Then Pref.tablesortorder = "Title|Ascending"
- If Pref.tableview.Count < 19 Then 'Counter. Increase if adding new tableview column else new columns won't be added to config.xml.
- Call mov_TableViewSetup()
- End If
- tableSets.Clear()
- For Each item In Pref.tableview
- Dim tempdata() As String
- tempdata = item.Split("|")
- Dim newcolumn As New str_TableItems(SetDefaults)
- newcolumn.title = tempdata(0)
- newcolumn.width = Convert.ToInt32(tempdata(1))
- newcolumn.index = Convert.ToInt32(tempdata(2))
- newcolumn.visible = (tempdata(3).ToLower = "true")
- tableSets.Add(newcolumn)
- Next
-
- DataGridView1.AutoGenerateColumns = False
- Dim doc As New XmlDocument
- Dim thispref As XmlNode = Nothing
- Dim xmlproc As XmlDeclaration
- xmlproc = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes")
- doc.AppendChild(xmlproc)
- Dim root As XmlElement
- Dim child As XmlElement
- root = doc.CreateElement("movie_cache")
- Dim childchild As XmlElement
- For Each row As DataGridViewRow In DataGridViewMovies.Rows
- Dim movie As Data_GridViewMovie = row.DataBoundItem
- child = doc.CreateElement("movie")
- childchild = doc.CreateElement("filedate") : childchild.InnerText = movie.filedate : child.AppendChild(childchild)
- childchild = doc.CreateElement("missingdata1") : childchild.InnerText = movie.missingdata1.ToString : child.AppendChild(childchild)
- childchild = doc.CreateElement("filename") : childchild.InnerText = movie.filename : child.AppendChild(childchild)
- childchild = doc.CreateElement("foldername") : childchild.InnerText = movie.foldername : child.AppendChild(childchild)
- childchild = doc.CreateElement("fullpathandfilename") : childchild.InnerText = movie.fullpathandfilename : child.AppendChild(childchild)
- childchild = doc.CreateElement("set") : childchild.InnerText = movie.movieset.MovieSetName : child.AppendChild(childchild)
- childchild = doc.CreateElement("source") : childchild.InnerText = movie.source : child.AppendChild(childchild)
- childchild = doc.CreateElement("genre") : childchild.InnerText = movie.genre : child.AppendChild(childchild)
- childchild = doc.CreateElement("id") : childchild.InnerText = movie.id : child.AppendChild(childchild)
- childchild = doc.CreateElement("playcount") : childchild.InnerText = movie.playcount : child.AppendChild(childchild)
- childchild = doc.CreateElement("rating") : childchild.InnerText = movie.Rating : child.AppendChild(childchild)
- childchild = doc.CreateElement("title") : childchild.InnerText = movie.title : child.AppendChild(childchild)
- childchild = doc.CreateElement("certificate") : childchild.InnerText = movie.Certificate : child.AppendChild(childchild)
- childchild = doc.CreateElement("outline") : childchild.InnerText = movie.outline : child.AppendChild(childchild)
- childchild = doc.CreateElement("plot") : childchild.InnerText = movie.plot : child.AppendChild(childchild)
- childchild = doc.CreateElement("stars") : childchild.InnerText = movie.stars : child.AppendChild(childchild)
- childchild = doc.CreateElement("sortorder") : childchild.InnerText = movie.SortOrder : child.AppendChild(childchild)
- childchild = doc.CreateElement("runtime") : childchild.InnerText = movie.runtime : child.AppendChild(childchild)
- childchild = doc.CreateElement("top250") : childchild.InnerText = movie.top250 : child.AppendChild(childchild)
- childchild = doc.CreateElement("year") : childchild.InnerText = movie.year : child.AppendChild(childchild)
- childchild = doc.CreateElement("createdate") : childchild.InnerText = movie.createdate : child.AppendChild(childchild)
- childchild = doc.CreateElement("usrrated") : childchild.InnerText = movie.usrrated : child.AppendChild(childchild)
- root.AppendChild(child)
- Next
-
- doc.AppendChild(root)
-
- For Each thisresult In doc("movie_cache")
- Select Case thisresult.Name
- Case "movie"
- Dim chi As XmlElement
- For Each chi In thisresult.childnodes
- If chi.Name = "runtime" Then
- chi.InnerText = chi.InnerText.Replace("minutes", "")
- chi.InnerText = chi.InnerText.Replace("mins", "")
- chi.InnerText = chi.InnerText.Replace("min", "")
- chi.InnerText = chi.InnerText.Replace(" ", "")
- If chi.InnerText.Length = 1 Then
- chi.InnerText = "00" & chi.InnerText
- End If
- If chi.InnerText.Length = 2 Then
- chi.InnerText = "0" & chi.InnerText
- End If
- chi.InnerText = chi.InnerText & " min"
- End If
- If chi.Name = "top250" Then
- If chi.InnerText = "" Then
- chi.InnerText = "000" & chi.InnerText
- End If
- If IsNumeric(chi.InnerText) Then
- If chi.InnerText.Length = 0 Then
- chi.InnerText = "000" & chi.InnerText
- End If
- If chi.InnerText.Length = 1 Then
- chi.InnerText = "00" & chi.InnerText
- End If
- If chi.InnerText.Length = 2 Then
- chi.InnerText = "0" & chi.InnerText
- End If
- End If
- End If
- If chi.Name = "playcount" Then
- If chi.InnerText = "" OrElse chi.InnerText = "0" OrElse Not IsNumeric(chi.InnerText) Then
- chi.InnerText = "UnWatched"
- Else
- chi.InnerText = "Watched"
- End If
- End If
- If chi.Name = "missingdata1" Then
- If chi.InnerText = "" Or Not IsNumeric(chi.InnerText) Then
- chi.InnerText = "0"
- Else
- chi.InnerText = Movie.GetMissingDataText( Convert.ToByte(chi.InnerText) )
- End If
- End If
- If chi.Name = "createdate" Then
- If chi.InnerText = "" Or Not IsNumeric(chi.InnerText) Then
- chi.InnerText = "0"
- Else
- chi.InnerText = Utilities.DecodeDateTime(chi.InnerText, Pref.DateFormat)
- End If
- End If
- Next
- End Select
- Next
-
- Dim movstring As String = doc.InnerXml
- Dim XMLreader2 As StringReader = New System.IO.StringReader(movstring)
-
- ' Create the dataset
- Dim newDS As DataSet = New DataSet
- newDS.ReadXml(XMLreader2)
- XMLreader2.Dispose()
- DataGridView1.DataSource = Nothing
- Try
- DataGridView1.DataSource = newDS.Tables(0)
- Catch
- End Try
-
- DataGridView1.AllowUserToOrderColumns = True
- DataGridView1.RowHeadersVisible = True
- DataGridView1.RowHeadersWidth = 25
-
- Dim titlecolumn As New DataGridViewColumn()
- With titlecolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Title"
- .DataPropertyName = "title"
- .Name = "title"
- .SortMode = DataGridViewColumnSortMode.Automatic
- End With
-
- Dim yearcolumn As New DataGridViewColumn()
- With yearcolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Year"
- .DataPropertyName = "year"
- .Name = "year"
- .SortMode = DataGridViewColumnSortMode.Automatic
- .DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter
- End With
-
-
- Dim idcolumn As New DataGridViewColumn()
- With idcolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "IMDB ID"
- .DataPropertyName = "id"
- .Name = "id"
- .SortMode = DataGridViewColumnSortMode.Automatic
- .ReadOnly = True
- End With
-
- Dim pathcolumn As New DataGridViewColumn()
- With pathcolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Full Path"
- .DataPropertyName = "fullpathandfilename"
- .Name = "fullpathandfilename"
- .SortMode = DataGridViewColumnSortMode.Automatic
- .ReadOnly = True
- End With
-
- Dim genrecolumn As New DataGridViewColumn()
- With genrecolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Genre"
- .DataPropertyName = "genre"
- .Name = "genre"
- .SortMode = DataGridViewColumnSortMode.Automatic
- .ToolTipText = "Separate Genre's with a ""Space/Space"", ie: Action / Horror"
- End With
-
- Dim ratingcolumn As New DataGridViewColumn()
- With ratingcolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Rating"
- .DataPropertyName = "rating"
- .Name = "rating"
- .SortMode = DataGridViewColumnSortMode.Automatic
- .DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter
- End With
-
- Dim outlinecolumn As New DataGridViewColumn()
- With outlinecolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Outline"
- .DataPropertyName = "outline"
- .Name = "outline"
- .SortMode = DataGridViewColumnSortMode.Automatic
- End With
-
- Dim plotcolumn As New DataGridViewColumn()
- With plotcolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Plot"
- .DataPropertyName = "plot"
- .Name = "plot"
- .SortMode = DataGridViewColumnSortMode.Automatic
- End With
-
- Dim starscolumn As New DataGridViewColumn()
- With starscolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Stars"
- .DataPropertyName = "stars"
- .Name = "stars"
- .SortMode = DataGridViewColumnSortMode.Automatic
- .ReadOnly = True
- End With
-
- Dim sorttitlecolumn As New DataGridViewColumn()
- With sorttitlecolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Sort Title"
- .DataPropertyName = "sortorder"
- .Name = "sorttitle"
- .SortMode = DataGridViewColumnSortMode.Automatic
- End With
-
- Dim top250column As New DataGridViewColumn()
- With top250column
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Top 250"
- .DataPropertyName = "top250"
- .Name = "top250"
- .SortMode = DataGridViewColumnSortMode.Automatic
- End With
-
- Dim watchedcolumn As New DataGridViewComboBoxColumn()
- watchedcolumn.Items.Add("UnWatched")
- watchedcolumn.Items.Add("Watched")
- With watchedcolumn
- .HeaderText = "Watched"
- .Name = "playcount"
- .DataPropertyName = "playcount"
- .SortMode = DataGridViewColumnSortMode.Automatic
- .DefaultCellStyle.NullValue = ""
- End With
-
- Dim sourcecolumn As New DataGridViewComboBoxColumn()
- For Each src In Pref.releaseformat
- sourcecolumn.Items.Add(src)
- Next
- sourcecolumn.Items.Insert(0, "")
- With sourcecolumn
- .HeaderText = "Source"
- .Name = "source"
- .DataPropertyName = "source"
- .SortMode = DataGridViewColumnSortMode.Automatic
- .DefaultCellStyle.NullValue = ""
- End With
-
- Dim runtimecolumn As New DataGridViewColumn()
- With runtimecolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Runtime"
- .Name = "runtime"
- .DataPropertyName = "runtime"
- .SortMode = DataGridViewColumnSortMode.Automatic
- End With
-
- Dim certificatecolumn As New DataGridViewColumn()
- With certificatecolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Certificate"
- .Name = "certificate"
- .DataPropertyName = "certificate"
- .SortMode = DataGridViewColumnSortMode.Automatic
- End With
-
- Dim setscolumn As New DataGridViewComboBoxColumn
- For Each sets In Pref.moviesets
- setscolumn.Items.Add(sets)
- Next
- With setscolumn
- .HeaderText = "Sets"
- .Name = "set"
- .DataPropertyName = "set"
- .SortMode = DataGridViewColumnSortMode.Automatic
- .DefaultCellStyle.NullValue = "-None-"
- End With
-
- Dim artcolumn As New DataGridViewColumn()
- With artcolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Missing"
- .Name = "missingdata1"
- .DataPropertyName = "missingdata1"
- .SortMode = DataGridViewColumnSortMode.Automatic
- .ReadOnly = True
- End With
-
- Dim createdatecolumn As New DataGridViewColumn()
- With createdatecolumn
- Dim oCell As DataGridViewCell = New DataGridViewTextBoxCell
- .CellTemplate = oCell
- .HeaderText = "Date Added"
- .Name = "createdate"
- .DataPropertyName = "createdate"
- .SortMode = DataGridViewColumnSortMode.Automatic
- End With
-
- Dim usrratedcolumn As New DataGridViewComboBoxColumn()
- For each t In cbUsrRated.Items
- usrratedcolumn.Items.Add(t)
- Next
- usrratedcolumn.Items.Item(0) = "0"
- With usrratedcolumn
- .HeaderText = "User Rating"
- .DataPropertyName = "usrrated"
- .Name = "userrated"
- .SortMode = DataGridViewColumnSortMode.Automatic
- End With
-
- For f = 0 To tableview.Count -1
- For Each col In tableSets
- If col.index = f Then
- Select Case col.title
- Case "title"
- titlecolumn.Width = col.width
- titlecolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, titlecolumn)
- Exit For
- Case "year"
- yearcolumn.Width = col.width
- yearcolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, yearcolumn)
- Exit For
- Case "sorttitle"
- sorttitlecolumn.Width = col.width
- sorttitlecolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, sorttitlecolumn)
- Exit For
- Case "genre"
- genrecolumn.Width = col.width
- genrecolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, genrecolumn)
- Exit For
- Case "rating"
- ratingcolumn.Width = col.width
- ratingcolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, ratingcolumn)
- Exit For
- Case "runtime"
- runtimecolumn.Width = col.width
- runtimecolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, runtimecolumn)
- Exit For
- Case "top250"
- top250column.Width = col.width
- top250column.Visible = col.visible
- DataGridView1.Columns.Insert(f, top250column)
- Exit For
- Case "certificate"
- certificatecolumn.Width = col.width
- certificatecolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, certificatecolumn)
- Case "source"
- sourcecolumn.Width = col.width
- sourcecolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, sourcecolumn)
- Exit For
- Case "playcount"
- watchedcolumn.Width = col.width
- watchedcolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, watchedcolumn)
- Exit For
- Case "set"
- setscolumn.Width = col.width
- setscolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, setscolumn)
- Exit For
- Case "outline"
- outlinecolumn.Width = col.width
- outlinecolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, outlinecolumn)
- Exit For
- Case "plot"
- plotcolumn.Width = col.width
- plotcolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, plotcolumn)
- Exit For
- Case "stars"
- starscolumn.Width = col.width
- starscolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, starscolumn)
- Exit For
- Case "id"
- idcolumn.Width = col.width
- idcolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, idcolumn)
- Exit For
- Case "missingdata1"
- artcolumn.Width = col.width
- artcolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, artcolumn)
- Exit For
- Case "fullpathandfilename"
- pathcolumn.Width = col.width
- pathcolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, pathcolumn)
- Exit For
- Case "createdate"
- createdatecolumn.Width = col.width
- createdatecolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, createdatecolumn)
- Exit For
- Case "userrated"
- usrratedcolumn.Width = col.width
- usrratedcolumn.Visible = col.visible
- DataGridView1.Columns.Insert(f, usrratedcolumn)
- Exit For
- End Select
- End If
- Next
- Next f
-
- Dim sortheader As String
- Dim sortord As String
- Dim tempdata2() As String
- tempdata2 = Pref.tablesortorder.Split("|")
- sortheader = tempdata2(0)
- sortord = tempdata2(1)
-
- For Each col In DataGridView1.Columns
- If col.headertext = sortheader Then
- If sortord.ToLower.IndexOf("desc") <> -1 Then
- DataGridView1.Sort(DataGridView1.Columns(col.index), ListSortDirection.Descending)
- Else
- DataGridView1.Sort(DataGridView1.Columns(col.index), ListSortDirection.Ascending)
- End If
- End If
- Next
-
- For Each tempRow As System.Windows.Forms.DataGridViewRow In Me.DataGridView1.Rows
- For Each tempCell As Windows.Forms.DataGridViewCell In tempRow.Cells
- If tempCell.Value = "Fanart" Or tempCell.Value = "Poster" Or tempCell.Value = "Poster & Fanart" Then tempCell.Style.BackColor = Color.Red
- Next
- Next
-
- Call mov_TableEditSetup()
- Try
- For f = 0 To DataGridView1.Rows.Count-1
- If DataGridView1.Rows(f).Cells("fullpathandfilename").Value = workingMovieDetails.fileinfo.fullpathandfilename Then
- DataGridView1.ClearSelection()
- DataGridView1.FirstDisplayedScrollingRowIndex = f
- Exit For
- End If
- Next
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End Sub
-
- Private Sub mov_TableEditSetup()
- mov_TableEditDGV.Columns.Clear()
- mov_TableEditDGV.AutoGenerateColumns = False
- mov_TableEditDGV.DataSource = Nothing
- For Each dgvCol As DataGridViewColumn In DataGridView1.Columns
- Dim dgvNewCol As New DataGridViewColumn
- dgvNewCol = DirectCast(dgvCol.Clone(), DataGridViewColumn)
- dgvNewCol.CellTemplate = DirectCast(dgvCol.CellTemplate, DataGridViewCell)
- If dgvNewCol.Name = "plot" Or dgvNewCol.Name = "outline" Or dgvNewCol.Name = "stars" Or dgvNewCol.Name = "id" Or dgvNewCol.Name = "missingdata1" or dgvNewCol.Name = "fullpathandfilename"Then
- dgvNewCol.ReadOnly = True
- dgvNewCol.DefaultCellStyle.BackColor = System.Drawing.Color.gray
- End If
- mov_TableEditDGV.Columns.Add(dgvNewCol)
- Next
-
- 'add "Unchanged"
- Dim src_add As DataGridViewComboBoxColumn = DirectCast(Me.mov_TableEditDGV.Columns("source"), DataGridViewComboBoxColumn)
- src_add.Items.Insert(0, "UnChanged")
- Dim set_add As DataGridViewComboBoxColumn = DirectCast(Me.mov_TableEditDGV.Columns("set"), DataGridViewComboBoxColumn)
- set_add.Items.Insert(0, "UnChanged")
- Dim play_add As DataGridViewComboBoxColumn = DirectCast(Me.mov_TableEditDGV.Columns("playcount"), DataGridViewComboBoxColumn)
- play_add.Items.Insert(0, "UnChanged")
- Dim usrrated_add As DataGridViewComboBoxColumn = DirectCast(Me.mov_TableEditDGV.Columns("userrated"), DataGridViewComboBoxColumn)
- usrrated_add.Items.Insert(0, "UnChanged")
-
- mov_TableEditDGV.RowHeadersWidth = DataGridView1.RowHeadersWidth
- mov_TableEditDGV.ClearSelection
- mov_TableEditDGV.ScrollBars = ScrollBars.None
- Me.mov_TableEditDGV.DefaultCellStyle.SelectionBackColor = Me.mov_TableEditDGV.DefaultCellStyle.BackColor
- Me.mov_TableEditDGV.DefaultCellStyle.SelectionForeColor = Me.mov_TableEditDGV.DefaultCellStyle.ForeColor
-
- Dim emptydata As String = FillEmptydoc().InnerXml
- Dim XMLreader3 As StringReader = New System.IO.StringReader(emptydata)
-
- ' Create the Empty dataset
- Dim emptydataset As DataSet = New DataSet
- emptydataset.ReadXml(XMLreader3)
- XMLreader3.Dispose()
- mov_TableEditDGV.DataSource = emptydataset.tables(0)
- mov_TableEditDGV.CurrentRow.Selected = false
- End Sub
-
- Private Sub mov_TableChangesSave()
-
- DataDirty=False
-
- frmSplash2.Text = "Saving Table Changes..."
- frmSplash2.Label1.Text = "Saving Movie Data....."
- frmSplash2.Label1.Visible = True
- frmSplash2.Label2.Visible = True
- frmSplash2.ProgressBar1.Visible = True
- frmSplash2.ProgressBar1.Maximum = DataGridView1.Rows.Count
- frmSplash2.Show()
-
- Application.DoEvents
-
- Dim progcount As Integer = 0
- Dim changed As Boolean
- Dim oCachedMovie As ComboList
-
- For Each gridrow As DataGridViewRow In DataGridView1.Rows
- changed = False
- progcount += 1
- frmSplash2.ProgressBar1.Value = progcount
- frmSplash2.Label2.Text = gridrow.Cells("Title").Value
- oCachedMovie = oMovies.FindCachedMovie( gridrow.Cells("fullpathandfilename").Value )
-
- Try
- If oCachedMovie.title <> gridrow.Cells("Title").Value Then changed = True
- Catch
- End Try
- Try
- If oCachedMovie.outline <> gridrow.Cells("Outline").Value Then changed = True
- Catch
- End Try
- Try
- If oCachedMovie.genre <> gridrow.Cells("genre").Value Then changed = True
- Catch
- End Try
- Try
- If oCachedMovie.rating <> gridrow.Cells("rating").Value Then changed = True
- Catch
- End Try
- Try
- Dim playstatus As String = gridrow.Cells("playcount").EditedFormattedValue
- Dim plycnt As Integer = 0
- If playstatus.tolower = "watched" Then plycnt = 1
- If oCachedMovie.playcount <> plycnt Then Changed = True
- Catch
- End Try
- Try
- If oCachedMovie.sortorder <> gridrow.Cells("sorttitle").Value Then changed = True
- Catch
- End Try
- Try
- If oCachedMovie.year <> gridrow.Cells("year").Value Then
- If IsNumeric(gridrow.Cells("year").Value) Then changed = True
- End If
- Catch
- End Try
- Try
- If Convert.ToInt32(oCachedMovie.top250) <> Convert.ToInt32(gridrow.Cells("top250").Value) Then
- If IsNumeric(gridrow.Cells("top250").Value) Then changed = True
- End If
- Catch
- End Try
- Try
- If oCachedMovie.Certificate <> gridrow.Cells("certificate").Value Then changed = True
- Catch
- End Try
- Dim runtime As String=""
- Dim intRunTime As Integer
- Dim runTimeChanged As Boolean
- Dim newRunTime As String=""
-
- Try
- runtime = gridrow.Cells("runtime").Value
- runtime = runtime.Replace("min", "")
- runtime = runtime.Trim(" ")
- If IsNumeric(runtime) Then
- intRunTime = Convert.ToInt32(runtime)
- newRunTime = intRunTime.ToString & " min"
- If oCachedMovie.runtime <> newRunTime Then changed = True : runTimeChanged = True
- End If
- Catch
- End Try
- If oCachedMovie.source <> If(IsDBNull(gridrow.Cells("source").Value), "", gridrow.Cells("source").Value) Then changed = True
- If oCachedMovie.MovieSet.MovieSetName <> If(IsDBNull(gridrow.Cells("set").Value), "", gridrow.Cells("set").Value) Then changed = True
- If oCachedMovie.usrrated <> gridrow.Cells("userrated").Value Then changed = True
- If changed And IO.File.Exists(oCachedMovie.fullpathandfilename) Then
-
- Dim oMovie As Movie = oMovies.LoadMovie(oCachedMovie.fullpathandfilename)
- If IsNothing(oMovie) Then Continue For
-
- Try
- oCachedMovie.genre = gridrow.Cells("genre").Value
- Catch
- End Try
- Try
- oCachedMovie.title = gridrow.Cells("title").Value
- Catch
- End Try
- Try
- oCachedMovie.year = gridrow.Cells("year").Value
- Catch
- End Try
- Try
- oCachedMovie.sortorder = gridrow.Cells("sorttitle").Value
- Catch
- End Try
- Try
- oCachedMovie.rating = gridrow.Cells("rating").Value
- Catch
- End Try
- Try
- oCachedMovie.source = If(IsDBNull(gridrow.Cells("source").Value), "", gridrow.Cells("source").Value)
- Catch
- End Try
- Try
- Dim NewSetName As String = If(IsDBNull(gridrow.Cells("set").Value), "", gridrow.Cells("set").Value)
- If NewSetName = "" Then
- oCachedMovie.MovieSet.MovieSetName = ""
- oCachedMovie.MovieSet.MovieSetId = ""
- Else
- Dim aok As Boolean = False
- For Each m In oMovies.MovieSetDB
- If m.MovieSetName = NewSetName Then
- oCachedMovie.MovieSet.MovieSetName = m.MovieSetName
- oCachedMovie.MovieSet.MovieSetId = m.MovieSetId
- aok = True
- End If
- Next
- If Not aok Then
- For each m In Pref.moviesets
- If m = NewSetName Then
- oCachedMovie.MovieSet.MovieSetName = m
- Exit For
- End If
- Next
- End If
- End If
- Catch
- End Try
- oCachedMovie.top250 = Convert.ToInt32(gridrow.Cells("top250").Value).ToString
- If gridrow.Cells("playcount").EditedFormattedValue = "Watched" Then
- oCachedMovie.playcount = "1"
- Else
- oCachedMovie.playcount = "0"
- End If
- Try
- oCachedMovie.Certificate = gridrow.Cells("certificate").Value
- Catch
- End Try
- Try
- oCachedMovie.usrrated = gridrow.Cells("userrated").Value
- Catch
- End Try
-
- If runTimeChanged Then
- oMovie.ScrapedMovie.fullmoviebody.runtime = newRunTime
- End If
- oMovie.ScrapedMovie.fullmoviebody.title = oCachedMovie.title
- oMovie.ScrapedMovie.fullmoviebody.year = oCachedMovie.year
- oMovie.ScrapedMovie.fullmoviebody.playcount = oCachedMovie.playcount
- oMovie.ScrapedMovie.fullmoviebody.genre = oCachedMovie.genre
- oMovie.ScrapedMovie.fullmoviebody.rating = oCachedMovie.rating
- oMovie.ScrapedMovie.fullmoviebody.source = oCachedMovie.source
- oMovie.ScrapedMovie.fullmoviebody.MovieSet.MovieSetName = oCachedMovie.MovieSet.MovieSetName
- oMovie.ScrapedMovie.fullmoviebody.MovieSet.MovieSetId = oCachedMovie.MovieSet.MovieSetId
- oMovie.ScrapedMovie.fullmoviebody.sortorder = oCachedMovie.sortorder
- oMovie.ScrapedMovie.fullmoviebody.top250 = oCachedMovie.top250
- oMovie.ScrapedMovie.fullmoviebody.director = oCachedMovie.director
- oMovie.ScrapedMovie.fullmoviebody.credits = oCachedMovie.credits
- oMovie.ScrapedMovie.fullmoviebody.usrrated = oCachedMovie.usrrated.ToString
-
- Dim checkmpaa = oCachedMovie.Certificate
- oMovie.ScrapedMovie.fullmoviebody.mpaa = checkmpaa
- oMovie.AssignMovieToCache
- oMovie.SaveNFO
- oMovie.UpdateMovieCache
- End If
- Next
-
- oMovies.SaveMovieCache
- UpdateFilteredList
- frmSplash2.Hide
-
- Application.DoEvents
- Me.BringToFront
- End Sub
-
- Private Sub mov_TableUpdate()
- ''Table View is not the best location to edit Outline, Plot, IMDB Id.
- Dim changed As Boolean = False
- For Each row In DataGridView1.SelectedRows
- If mov_TableEditDGV.Columns("title").Visible AndAlso mov_TableEditDGV.Rows(0).Cells("title").Value <> "" Then
- row.cells("title").value = mov_TableEditDGV.Rows(0).Cells("title").Value : changed = True
- End If
- If mov_TableEditDGV.Columns("top250").Visible AndAlso mov_TableEditDGV.Rows(0).Cells("top250").Value <> "" Then
- row.cells("top250").value = mov_TableEditDGV.Rows(0).Cells("top250").Value : changed = True
- End If
- If mov_TableEditDGV.Columns("year").Visible AndAlso mov_TableEditDGV.Rows(0).Cells("year").Value <> "" Then
- row.cells("year").value = mov_TableEditDGV.Rows(0).Cells("year").Value : changed = True
- End If
- If mov_TableEditDGV.Columns("sorttitle").Visible AndAlso mov_TableEditDGV.Rows(0).Cells("sorttitle").Value <> "" Then
- row.cells("sorttitle") = mov_TableEditDGV.Rows(0).Cells("sorttitle").Value : changed = True
- End If
- If mov_TableEditDGV.Columns("runtime").Visible AndAlso mov_TableEditDGV.Rows(0).Cells("runtime").Value <> "" Then
- row.cells("runtime").value = mov_TableEditDGV.Rows(0).Cells("runtime").Value : changed = True
- End If
- If mov_TableEditDGV.Columns("rating").Visible AndAlso mov_TableEditDGV.Rows(0).Cells("rating").Value <> "" Then
- row.cells("rating").value = mov_TableEditDGV.Rows(0).Cells("rating").Value : changed = True
- End If
- If mov_TableEditDGV.Columns("certificate").Visible AndAlso mov_TableEditDGV.Rows(0).Cells("certificate").Value <> "" Then
- row.cells("certificate").value = mov_TableEditDGV.Rows(0).Cells("certificate").Value : changed = True
- End If
- If mov_TableEditDGV.Columns("genre").Visible AndAlso mov_TableEditDGV.Rows(0).Cells("genre").Value <> "" Then
- row.cells("genre").value = mov_TableEditDGV.Rows(0).Cells("genre").Value : changed = True
- End If
- If mov_TableEditDGV.Columns("source").Visible AndAlso mov_TableEditDGV.Rows(0).Cells("source").Value <> "UnChanged" Then
- row.cells("source").value = mov_TableEditDGV.Rows(0).Cells("source").Value : changed = True
- End If
- If mov_TableEditDGV.Columns("playcount").Visible AndAlso mov_TableEditDGV.Rows(0).Cells("playcount").Value <> "UnChanged" Then
- If mov_TableEditDGV.Rows(0).Cells("playcount").Value = "Watched" Then
- row.cells("playcount").value = "Watched"
- Else
- row.cells("playcount").value = "UnWatched"
- End If
- changed = True
- End If
- If mov_TableEditDGV.Columns("set").Visible AndAlso (IsDBNull(mov_TableEditDGV.Rows(0).Cells("set").Value) OrElse mov_TableEditDGV.Rows(0).Cells("set").Value <> "UnChanged") Then
- row.cells("set").value = If(IsDBNull(mov_TableEditDGV.Rows(0).Cells("set").Value), Nothing, mov_TableEditDGV.Rows(0).Cells("set").Value) : changed = True
- End If
- If mov_TableEditDGV.Columns("userrated").Visible AndAlso mov_TableEditDGV.ROws(0).Cells("userrated").Value <> "UnChanged" Then
- row.cells("userrated").Value = mov_TableEditDGV.Rows(0).Cells("userrated").Value : changed = True
- End If
- Next
- DataDirty = changed
- btn_movTableSave.Enabled = changed
- End Sub
-
- Private Function FillEmptyDoc() As XmlDocument
- Dim doc As New XmlDocument
-
- Dim thispref As XmlNode = Nothing
- Dim xmlproc As XmlDeclaration
- xmlproc = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes")
- doc.AppendChild(xmlproc)
- Dim root As XmlElement
- Dim child As XmlElement
- root = doc.CreateElement("movie_cache")
- Dim childchild As XmlElement
- child = doc.CreateElement("movie")
- childchild = doc.CreateElement("filedate") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("missingdata1") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("filename") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("foldername") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("fullpathandfilename") : childchild.InnerText = "Not Editable in TableView" : child.AppendChild(childchild)
- childchild = doc.CreateElement("set") : childchild.InnerText = "UnChanged" : child.AppendChild(childchild)
- childchild = doc.CreateElement("source") : childchild.InnerText = "UnChanged" : child.AppendChild(childchild)
- childchild = doc.CreateElement("genre") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("id") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("playcount") : childchild.InnerText = "UnChanged" : child.AppendChild(childchild)
- childchild = doc.CreateElement("rating") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("title") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("certificate") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("outline") : childchild.InnerText = "Not Editable in TableView" : child.AppendChild(childchild)
- childchild = doc.CreateElement("plot") : childchild.InnerText = "Not Editable in TableView" : child.AppendChild(childchild)
- childchild = doc.CreateElement("sortorder") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("runtime") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("top250") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("year") : childchild.InnerText = "" : child.AppendChild(childchild)
- childchild = doc.CreateElement("usrrated") : childchild.InnerText = "UnChanged" : child.AppendChild(childchild)
- root.AppendChild(child)
- doc.AppendChild(root)
- Return doc
- End Function
-
- 'Table buttons
- Private Sub btnTableColumnsSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_movTableColumnsSelect.Click
- Try
- Dim frm As New frmConfigureTableColumns
- frm.Init()
- frm.ShowDialog()
- mov_TableSetup()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub btn_movTableSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_movTableSave.Click
- Try
- Call mov_TableChangesSave()
- MsgBox("Changes Saved")
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub btn_movTableApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_movTableApply.Click
- Try
- Call mov_TableUpdate()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- 'Table - DataGridView1 events
- Private Sub DataGridView1_ColumnWidthChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewColumnEventArgs) Handles DataGridView1.ColumnWidthChanged
- Try
- mov_TableEditDGV.Columns(e.Column.Index).Width = e.Column.Width
- Dim offSetValue As Integer = DataGridView1.HorizontalScrollingOffset
- mov_TableEditDGV.HorizontalScrollingOffset = offSetValue
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub dataGridViews1_Scroll(sender As Object, e As ScrollEventArgs) Handles DataGridView1.Scroll
- Try
- Dim offSetValue As Integer = DataGridView1.HorizontalScrollingOffset
- mov_TableEditDGV.HorizontalScrollingOffset = offSetValue
- Catch
- End Try
- DataGridView1.Invalidate()
- End Sub
-
- Private Sub DataGridView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseDown
- Try
- Dim ColIndexFromMouseDown = DataGridView1.HitTest(e.X, e.Y).ColumnIndex
- Dim objHitTestInfo As DataGridView.HitTestInfo = DataGridView1.HitTest (e.X, e.Y)
- Dim MouseRowIndex As Integer = objHitTestInfo.RowIndex
- mov_TableRowNum = MouseRowIndex
- If ColIndexFromMouseDown < 0 Then Exit Sub
- mov_TableColumnName = DataGridView1.Columns(ColIndexFromMouseDown).Name
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub DataGridView1_ColumnDisplayIndexChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewColumnEventArgs) Handles DataGridView1.ColumnDisplayIndexChanged
- Dim ColNewIndex = DataGridView1.Columns(mov_TableColumnName).DisplayIndex
- mov_TableEditDGV.Columns(mov_TableColumnName).DisplayIndex = ColNewIndex
- End Sub
-
- Private Sub DataGridView1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.SelectionChanged
- Dim MultiRowsSelected As Boolean = DataGridView1.SelectedRows.Count > 1
- If MultiRowsSelected Then
- mov_TableEditDGV.Visible = True
- lbl_movTableEdit.Visible = True
- lbl_movTableMulti.Visible = True
- btn_movTableApply.Visible = True
- Else
- mov_TableEditDGV.Visible = False
- lbl_movTableEdit.Visible = False
- lbl_movTableMulti.Visible = False
- btn_movTableApply.Visible = False
- End If
- End Sub
-
- Private Sub DataGridView1_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.Sorted
- Try
- For Each tempRow As System.Windows.Forms.DataGridViewRow In Me.DataGridView1.Rows
- For Each tempCell As Windows.Forms.DataGridViewCell In tempRow.Cells
- If tempCell.Value = "Fanart" Or tempCell.Value = "Poster" Or tempCell.Value = "Poster & Fanart" Then
- tempCell.Style.BackColor = Color.Red
- End If
- Next
- Next
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub mov_TableEditDGV_CellClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles mov_TableEditDGV.CellClick
- Try
- mov_TableEditDGV.CurrentRow.Selected = False
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub DataGridView1_CurrentCellDirtyStateChanged(sender As Object, e As EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged
- DataDirty = True
- btn_movTableSave.Enabled = DataDirty
- End Sub
-
- 'Table context toolstrips
- Private Sub MarkAllSelectedAsWatchedToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MarkAllSelectedAsWatchedToolStripMenuItem.Click
- Try
- Dim selectedrowindex As New List(Of Integer)
- For Each row in DataGridView1.SelectedRows
- selectedrowindex.Add(row.index)
- Next
- If selectedrowindex.Count = 0 Then selectedrowindex.Add(DataGridView1.CurrentRow.Index)
- DataGridView1.ClearSelection()
- DataGridView1.CurrentCell = DataGridView1.Rows(selectedrowindex.Item(0)).Cells(0)
- For Each row In selectedrowindex
- DataGridView1.rows(row).Selected = True
- DataGridView1.rows(row).Cells("playcount").Value = "Watched"
- Next
- DataDirty = True
- btn_movTableSave.Enabled = True
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub MarkAllSelectedAsUnWatchedToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MarkAllSelectedAsUnWatchedToolStripMenuItem.Click
- Try
- Dim selectedrowindex As New List(Of Integer)
- For Each row in DataGridView1.SelectedRows
- selectedrowindex.Add(row.index)
- Next
- If selectedrowindex.Count = 0 Then selectedrowindex.Add(DataGridView1.CurrentRow.Index)
- DataGridView1.ClearSelection()
- DataGridView1.CurrentCell = DataGridView1.Rows(selectedrowindex.Item(0)).Cells(0)
- For Each row In selectedrowindex
- DataGridView1.rows(row).Selected = True
- DataGridView1.rows(row).Cells("playcount").Value = "UnWatched"
- Next
- DataDirty = True
- btn_movTableSave.Enabled = True
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub MovieTableContextMenu_Opening(sender As Object, e As CancelEventArgs) Handles MovieTableContextMenu.Opening
- If mov_TableRowNum = -1 Then e.Cancel = True
- End Sub
-
- Private Sub GoToToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToToolStripMenuItem.Click
- Try
- Dim tempstring As String = ""
- tempstring = DataGridView1.Rows(mov_TableRowNum).Cells("fullpathandfilename").Value
- For f = 0 To DataGridViewMovies.Rows.Count - 1
- If DataGridViewMovies.Rows(f).Cells("fullpathandfilename").Value.ToString = tempstring Then
- DataGridViewMovies.ClearSelection()
- DataGridViewMovies.Rows(f).Selected = True
- Application.DoEvents()
- currentTabIndex = 0
- Me.TabControl2.SelectedIndex = 0
- Exit For
- End If
- Next
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub GoToSelectedMoviePosterSelectorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToSelectedMoviePosterSelectorToolStripMenuItem.Click
- Try
- Dim tempstring As String = ""
- tempstring = DataGridView1.Rows(mov_TableRowNum).Cells("fullpathandfilename").Value
- For f = 0 To DataGridViewMovies.Rows.Count - 1
- If DataGridViewMovies.Rows(f).Cells("fullpathandfilename").Value.ToString = tempstring Then
- DataGridViewMovies.ClearSelection()
- DataGridViewMovies.Rows(f).Selected = True
- DisplayMovie()
- For Each tabs In TabControl2.TabPages
- If tabs.text = "Posters" Then
- currentTabIndex = tabs.tabindex + 1
- Me.TabControl2.SelectedIndex = tabs.tabindex + 1
- Exit For
- End If
- Next
- Exit For
- End If
- Next
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub GoToSelectedMovieFanartSelectorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToSelectedMovieFanartSelectorToolStripMenuItem.Click
- Try
- Dim tempstring As String = ""
- tempstring = DataGridView1.Rows(mov_TableRowNum).Cells("fullpathandfilename").Value
- For f = 0 To DataGridViewMovies.RowCount - 1
- If DataGridViewMovies.Rows(f).Cells("fullpathandfilename").Value.ToString = tempstring Then
- DataGridViewMovies.ClearSelection()
- DataGridViewMovies.Rows(f).Selected = True
- DisplayMovie()
- For Each tabs In TabControl2.TabPages
- If tabs.text = "Fanart" Then
- currentTabIndex = tabs.tabindex + 1
- Me.TabControl2.SelectedIndex = tabs.tabindex + 1
- Exit For
- End If
- Next
- Exit For
- End If
- Next
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- #End Region 'Movie Tableview code
-
- Private Sub SearchForNewEpisodesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchForNewEpisodesToolStripMenuItem.Click
- Try
- SearchForNewEpisodesToolStripMenuItem.Owner.Hide()
- Call ep_Search()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
- Private Sub SearchALLForNewEpisodesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchALLForNewEpisodesToolStripMenuItem.Click
- Try
- TVSearchALL = True
- Call ep_Search()
- TVSearchALL = False
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
- Private Sub mov_ScrapeSpecific(ByVal field As String)
-
- _rescrapeList.Field = field
- _rescrapeList.FullPathAndFilenames.Clear
-
- For Each row As DataGridViewRow In DataGridViewMovies.SelectedRows
- Dim fullpath As String = row.Cells("fullpathandfilename").Value.ToString
- If Not File.Exists(fullpath) Then Continue For
- _rescrapeList.FullPathAndFilenames.Add(fullpath)
- Next
-
- RunBackgroundMovieScrape("RescrapeSpecific")
- End Sub
-
- Private Sub RescrapeFanartToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RescrapeFanartToolStripMenuItem.Click
- Try
- 'rescrape fanart
- Call mov_FanartGet()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub DownloadFanartToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DownloadFanartToolStripMenuItem.Click
- Try
- 'download fanart
- Call mov_FanartGet()
- UpdateMissingFanart()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub mov_FanartGet(Optional ByVal MovSet As Boolean = False)
- If IsNothing(workingMovieDetails) Then Return
- messbox = New frmMessageBox(" Please Wait,", "", "Attempting to download Fanart")
- messbox.Show() : messbox.Refresh()
- Application.DoEvents()
-
- Dim tmdb As New TMDb
-
- tmdb.Imdb = If(workingMovieDetails.fullmoviebody.imdbid.Contains("tt"), workingMovieDetails.fullmoviebody.imdbid, "")
- tmdb.TmdbId = workingMovieDetails.fullmoviebody.tmdbid
- tmdb.SetId = workingMovieDetails.fullmoviebody.MovieSet.MovieSetId
-
- Try
- Dim FanartUrl As String = ""
- If Not MovSet Then
- FanartUrl = tmdb.GetBackDropUrl()
- Else
- FanartUrl = tmdb.McSetFanart(0).hdUrl
- End If
- Dim isvideotspath As String = If(workingMovieDetails.fileinfo.videotspath="","",workingMovieDetails.fileinfo.videotspath+"fanart.jpg")
- If IsNothing(FanartUrl) then
- MsgBox("No Fanart Found on TMDB")
- Else
- If Not MovSet Then
- Dim paths As List(Of String) = Pref.GetfanartPaths(workingMovieDetails.fileinfo.fullpathandfilename,If(workingMovieDetails.fileinfo.videotspath <>"",workingMovieDetails.fileinfo.videotspath,""))
- Dim point = Movie.GetBackDropResolution(Pref.BackDropResolutionSI)
- Dim aok As Boolean = DownloadCache.SaveImageToCacheAndPaths(FanartUrl, paths, True, point.X, point.Y)
- If Not aok Then Throw New Exception("TMDB is offline")
- util_ImageLoad(PbMovieFanArt, paths(0), Utilities.DefaultFanartPath)
- util_ImageLoad(PictureBox2, paths(0), Utilities.DefaultFanartPath)
- Dim video_flags = VidMediaFlags(workingMovieDetails.filedetails, workingMovieDetails.fullmoviebody.title.ToLower.Contains("3d"))
- movieGraphicInfo.OverlayInfo(PbMovieFanArt, ratingtxt.Text, video_flags, workingMovie.DisplayFolderSize)
- Else
- Dim MovSetFanartSavePath As String = workingMovieDetails.fileinfo.movsetfanartpath
- If MovSetFanartSavePath <> "" Then
- Movie.SaveFanartImageToCacheAndPath(FanartUrl, MovSetFanartSavePath)
- MovPanel6Update()
- Else
- MsgBox("!! Problem formulating correct save location for Fanart" & vbCrLf & " Please check your settings")
- End If
- End If
- End If
- Catch ex As Exception
- If ex.Message = "TMDB is offline" Then
- messbox.Close()
- MsgBox("Unable to connect to TheMovieDb.org." & vbCrLf & "Please confirm site is online")
- ElseIf ex.Message.Contains("Index was out of range") Then
- messbox.Close()
- MsgBox("No Fanart available on TMDB Site")
- End If
- End Try
- If Not IsNothing(messbox) Then messbox.Close()
- End Sub
-
- 'Rescrape Poster
- Private Sub RescrapePToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RescrapePToolStripMenuItem.Click
- Try
- 'rescrape poster IMPA
- mov_PosterGet("impa")
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub RescrapePosterFromTMDBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RescrapePosterFromTMDBToolStripMenuItem.Click
- Try
- 'rescrape poster tmdb
- mov_PosterGet("tmdb")
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub RescraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RescraToolStripMenuItem.Click
- Try
- 'rescrape poster mpdb
- MsgBox("MoviePoster Db is not longer available")
- 'mov_PosterGet("mpdb")
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub PeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PeToolStripMenuItem.Click
- Try
- 'rescrape poster imdb
- mov_PosterGet("imdb")
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub DownloadPosterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DownloadPosterToolStripMenuItem.Click
- Try
- 'downloadposter impa
- mov_PosterGet("impa")
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub DownloadPosterFromTMDBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DownloadPosterFromTMDBToolStripMenuItem.Click
- Try
- 'downloadposter tmdb
- mov_PosterGet("tmdb")
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub DownloadPosterFromMPDBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DownloadPosterFromMPDBToolStripMenuItem.Click
- Try
- 'downloadposter mpdb
- MsgBox("MoviePoster Db is not longer available")
- 'mov_PosterGet("mpdb")
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub DownloadPosterFromIMDBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DownloadPosterFromIMDBToolStripMenuItem.Click
- Try
- 'downloadposter imdb
- mov_PosterGet("imdb")
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub mov_PosterGet(ByVal source As String, Optional ByVal MovSet As Boolean = False)
- Dim success As Boolean = False
- Try
- If workingMovieDetails Is Nothing Then Exit Sub
- messbox = New frmMessageBox(" Please Wait,", "", "Attempting to download Poster from " & source.ToUpper)
- messbox.Show()
- messbox.Refresh()
- Application.DoEvents()
- Dim isvideotspath As String = ""
- If workingMovieDetails.fileinfo.videotspath<>"" Then
- isvideotspath=workingMovieDetails.fileinfo.videotspath+"poster.jpg"
- End If
- Dim moviethumburl As String = ""
-
- Dim tmdb As New TMDb
-
- tmdb.Imdb = If(workingMovieDetails.fullmoviebody.imdbid.Contains("tt"), workingMovieDetails.fullmoviebody.imdbid, "")
- tmdb.TmdbId = workingMovieDetails.fullmoviebody.tmdbid
- tmdb.SetId = workingMovieDetails.fullmoviebody.MovieSet.MovieSetId
-
- If tmdb.Imdb = "" AndAlso tmdb.TmdbId = "" Then Exit Sub
-
- If source = "impa" Then
- If workingMovieDetails.fullmoviebody.title <> "" And workingMovieDetails.fullmoviebody.year <> "" Then
- moviethumburl = scraperFunction2.impathumb(workingMovieDetails.fullmoviebody.title, workingMovieDetails.fullmoviebody.year)
- End If
- ElseIf source = "tmdb" Then
- If workingMovieDetails.fullmoviebody.imdbid.Contains("tt") OrElse workingMovieDetails.fullmoviebody.tmdbid <> "" Then
- Try
- If Not MovSet Then
- moviethumburl = tmdb.FirstOriginalPosterUrl
- Else
- moviethumburl = tmdb.McSetPosters(0).hdUrl
- End If
- Catch
- End Try
- End If
- ElseIf source = "mpdb" Then
- If workingMovieDetails.fullmoviebody.imdbid.Contains("tt") Then
- moviethumburl = scraperFunction2.mpdbthumb(workingMovieDetails.fullmoviebody.imdbid)
- End If
- ElseIf source = "imdb" Then
- If workingMovieDetails.fullmoviebody.imdbid.Contains("tt") Then
- moviethumburl = scraperFunction2.imdbthumb(workingMovieDetails.fullmoviebody.imdbid)
- End If
- End If
-
- If moviethumburl <> "" And moviethumburl <> "na" Then
- Try
- If Not MovSet Then
- Dim PostPaths As List(Of String) = Pref.GetPosterPaths(workingMovieDetails.fileinfo.fullpathandfilename,workingMovieDetails.fileinfo.videotspath)
- Dim height As Integer = 0
- height = Movie.GetHeightResolution(Pref.PosterResolutionSI)
- Dim aok As Boolean = DownloadCache.SaveImageToCacheAndPaths(moviethumburl, PostPaths, True, , height)
- If Not aok Then Throw New Exception()
- util_ImageLoad(PictureBoxAssignedMoviePoster, PostPaths(0), Utilities.DefaultPosterPath)
- util_ImageLoad(PbMoviePoster, PostPaths(0), Utilities.DefaultPosterPath)
- Dim path As String = Utilities.save2postercache(workingMovieDetails.fileinfo.fullpathandfilename, PostPaths(0), WallPicWidth, WallPicHeight)
- updateposterwall(path, workingMovieDetails.fileinfo.fullpathandfilename)
- success = True
- Else
- Dim MovSetPosterSavePath As String = workingMovieDetails.fileinfo.movsetposterpath
- If MovSetPosterSavePath <> "" Then
- Movie.SavePosterImageToCacheAndPath(moviethumburl, MovSetPosterSavePath)
- MovPanel6Update()
- Else
- messbox.Close()
- MsgBox("!! Problem formulating correct save location for Poster" & vbCrLf & " Please check your settings")
- End If
- End If
- Catch ex As Exception
- MsgBox("Error [" & ex.Message & "] occurred while trying to download and save the poster")
- End Try
- Else
- MsgBox("Unable to obtain a Poster from " & source.ToUpper)
- End If
- messbox.Close()
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- Finally
- messbox.Close()
- End Try
- If success then UpdateMissingPoster()
- End Sub
-
- Public Sub mov_OfflineDvdProcess(ByVal nfopath As String, ByVal title As String, ByVal mediapath As String)
- Dim tempint2 As Integer = 2097152
- Dim SizeOfFile As Integer = FileLen(mediapath)
- If SizeOfFile > tempint2 Then
- Exit Sub
- End If
- Try
- Dim fanartpath As String = ""
- If IO.File.Exists(Pref.GetFanartPath(nfopath)) Then
- fanartpath = Pref.GetFanartPath(nfopath)
- Else
- fanartpath = Utilities.DefaultOfflineArtPath
- End If
- Dim curImage As Image = Image.FromFile(fanartpath)
- Dim tempstring As String = Pref.OfflineDVDTitle.Replace("%T", title)
- Dim g As System.Drawing.Graphics
- g = Graphics.FromImage(curImage)
- Dim semiTransBrush As New SolidBrush(Color.FromArgb(80, 0, 0, 0))
- Dim drawString As String = tempstring
- Dim drawFont As New System.Drawing.Font("Arial", 40)
- Dim drawBrush As New SolidBrush(Color.White)
- Dim StringSize As New SizeF
- StringSize = g.MeasureString(drawString, drawFont)
- Dim width As Single = StringSize.Width + 5
- Dim height As Single = StringSize.Height + 5
-
- If height < (curImage.Height / 100) * 8 Then
- Do
- Dim newsize As Integer = drawFont.Size + 1
- drawFont = New System.Drawing.Font("Arial", newsize)
- StringSize = g.MeasureString(drawString, drawFont)
- height = StringSize.Height
- Loop Until height > (curImage.Height / 100) * 8
- End If
- If height > (curImage.Height / 100) * 8 Then
- Do
- Dim newsize As Integer = drawFont.Size - 1
- drawFont = New System.Drawing.Font("Arial", newsize)
- StringSize = g.MeasureString(drawString, drawFont)
- height = StringSize.Height
- Loop Until height < (curImage.Height / 100) * 8
- End If
- StringSize = g.MeasureString(drawString, drawFont)
- width = StringSize.Width
- height = StringSize.Height
- If width > curImage.Width - 30 Then
- Do
- Dim newsize As Integer = drawFont.Size - 1
- drawFont = New System.Drawing.Font("Arial", newsize)
- StringSize = g.MeasureString(drawString, drawFont)
- width = StringSize.Width + 20
- Loop Until width < curImage.Width - 30
- End If
- StringSize = g.MeasureString(drawString, drawFont)
- width = StringSize.Width + 5
- height = StringSize.Height + 5
- Dim x As Integer = (curImage.Width / 2) - (width / 2)
- Dim y As Integer = (curImage.Height - StringSize.Height) - ((curImage.Height / 100) * 2)
- Dim drawRect As New RectangleF(x, y, width, height)
-
-
- g.FillRectangle(semiTransBrush, New Rectangle(x, y, width, height))
-
- Dim drawFormat As New StringFormat
- drawFormat.Alignment = StringAlignment.Center
-
- g.DrawString(drawString, drawFont, drawBrush, drawRect, drawFormat)
- For f = 1 To 16
- Dim path As String
- If f < 10 Then
- path = applicationPath & "\Settings\00" & f.ToString & ".jpg"
- Else
- path = applicationPath & "\Settings\0" & f.ToString & ".jpg"
- End If
- curImage.Save(path, Drawing.Imaging.ImageFormat.Jpeg)
- Next
-
- Dim myProcess As Process = New Process
- myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
- myProcess.StartInfo.CreateNoWindow = False
- myProcess.StartInfo.FileName = applicationPath & "\Assets\ffmpeg.exe"
- Dim proc_arguments As String = "-r 1 -b 1800 -qmax 6 -i """ & applicationPath & "\Settings\%03d.jpg"" -vcodec msmpeg4v2 -y """ & mediapath & """"
- myProcess.StartInfo.Arguments = proc_arguments
- myProcess.Start()
- myProcess.WaitForExit()
-
- For f = 1 To 16
- Dim tempstring4 As String
- If f < 10 Then
- tempstring4 = applicationPath & "\Settings\00" & f.ToString & ".jpg"
- Else
- tempstring4 = applicationPath & "\Settings\0" & f.ToString & ".jpg"
- End If
- Try
- IO.File.Delete(tempstring4)
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- Next
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End Sub
-
- Private Sub ToolsToolStripMenuItem_DropDownItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ToolsToolStripMenuItem.DropDownItemClicked
- Try
- For Each temp In Pref.commandlist
- If temp.title = e.ClickedItem.Text Then
- Try
- Process.Start(temp.command)
- Catch ex As Exception
- End Try
- Exit For
- End If
- Next
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub PreferencesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PreferencesToolStripMenuItem.Click
- OpenPreferences(0)
- End Sub
-
- Private Sub OpenPreferences(Optional ByVal TabRequired As Integer = 0)
- Try
- Dim t As New frmPreferences
- t.SelectTab = TabRequired
- If Pref.MultiMonitoEnabled Then
- t.Bounds = screen.AllScreens(CurrentScreen).Bounds
- t.StartPosition = FormStartPosition.Manual
- End If
- t.ShowDialog()
- If Not tvbckrescrapewizard.IsBusy AndAlso Not bckgroundscanepisodes.IsBusy AndAlso Not bckgrnd_tvshowscraper.IsBusy AndAlso Not Bckgrndfindmissingepisodes.IsBusy AndAlso Not BckWrkScnMovies.IsBusy Then
- Statusstrip_Enable(False)
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub SearchForMissingEpisodesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchForMissingEpisodesToolStripMenuItem.Click
- Try
- If Not Bckgrndfindmissingepisodes.IsBusy And bckgroundscanepisodes.IsBusy = False Then
- Pref.displayMissingEpisodes = SearchForMissingEpisodesToolStripMenuItem.Checked
- Pref.ConfigSave()
- If Pref.displayMissingEpisodes = False
- RefreshMissingEpisodesToolStripMenuItem.Enabled = False
- rbTvListAll.Checked = True
- rbTvMissingEpisodes.Enabled = False
- rbTvMissingAiredEp.Enabled = False
- RefreshMissingEpisodesToolStripMenuItem.ToolTipText = Nothing
- tv_CacheRefresh
- Return
- End If
- RefreshMissingEpisodesToolStripMenuItem.Enabled = True
- RefreshMissingEpisodesToolStripMenuItem.ToolTipText = "Last Refresh: " & Pref.lastrefreshmissingdate
- rbTvMissingEpisodes.Enabled = True
- rbTvMissingAiredEp.Enabled = True
- Pref.DlMissingEpData = False
- tv_EpisodesMissingLoad(False)
- ElseIf Bckgrndfindmissingepisodes.IsBusy Then
- MsgBox("Process is already running")
- Else
- MsgBox("Missing episode search cannot be performed" & vbCrLf & " when the episode scraper is running")
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub RefreshMissingEpisodesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshMissingEpisodesToolStripMenuItem.Click
- Pref.DlMissingEpData = True
- Pref.lastrefreshmissingdate = DateTime.Now.ToString("yyyy-MM-dd")
- ClearMissingFolder()
- tv_EpisodesMissingLoad(True)
- End Sub
-
- Private Sub RefreshThisShowToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_RefreshShow.Click
- Try
- Dim Show As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim selectednode As Integer = TvTreeview.SelectedNode.Index
- If Show IsNot Nothing Then
- Call tv_CacheRefreshSelected(Show)
- Else
- MsgBox("No Show Selected")
- End If
- TvTreeview.SelectedNode = TvTreeview.Nodes(selectednode)
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub Tv_TreeViewContext_ShowMissEps_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_ShowMissEps.Click
- Try
- Dim Show As TvShow = tv_ShowSelectedCurrently(TvTreeview)
-
- If Not Bckgrndfindmissingepisodes.IsBusy Then
- Dim tempstring As String = ""
- For Each sho In Cache.TvCache.Shows
- If sho.NfoFilePath = TvTreeview.SelectedNode.Name Then
- tempstring = "Checking """ & sho.Title.Value & """ for missing episodes"
- Exit For
- End If
- Next
- If tempstring = "" Then tempstring = "Checking for missing episodes"
- messbox = New frmMessageBox(tempstring, "", "Please Wait")
- messbox.Show()
- messbox.Refresh()
- Application.DoEvents()
- Dim ShowList As New List(Of TvShow)
- ShowList.Add(Show)
- Bckgrndfindmissingepisodes.RunWorkerAsync(ShowList)
- messbox.Close()
- Else
- MsgBox("The missing episode thread is already running")
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
-
- End Sub
-
- Private Sub LockAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LockAllToolStripMenuItem.Click
- Try
- Dim Show As Media_Companion.TvShow
- For Each Show In Cache.TvCache.Shows
- Show = nfoFunction.tvshow_NfoLoad(Show.NfoFilePath) '.Load()
- Show.State = Media_Companion.ShowState.Locked
- nfoFunction.tvshow_NfoSave(Show, True)
- 'Show.Save()
- Tv_CacheSave()
- Next
- tv_CacheLoad()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub UnlockAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnlockAllToolStripMenuItem.Click
- Try
- Dim Show As Media_Companion.TvShow
- For Each Show In Cache.TvCache.Shows
- Show = nfoFunction.tvshow_NfoLoad(Show.NfoFilePath) '.Load()
- Show.State = Media_Companion.ShowState.Open
- nfoFunction.tvshow_NfoSave(Show, True)
- 'Show.Save()
- Tv_CacheSave()
- Next
- tv_CacheLoad()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub TV_BatchRescrapeWizardToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TV_BatchRescrapeWizardToolStripMenuItem.Click
- Try
- If Not tvbckrescrapewizard.IsBusy Then
- tvBatchList.Reset()
-
- Dim displaywizard As New tv_batch_wizard
- If Pref.MultiMonitoEnabled Then
- displaywizard.Bounds = screen.AllScreens(CurrentScreen).Bounds
- displaywizard.StartPosition = FormStartPosition.Manual
- End If
- displaywizard.ShowDialog()
-
- If tvBatchList.activate = True Then
- Statusstrip_Enable()
- ToolStripStatusLabel8.Text = "Starting TV Batch Scrape"
- ToolStripStatusLabel8.Visible = True
- ToolStripProgressBar7.Value = 0
- ToolStripProgressBar7.Visible = True
- tvbckrescrapewizard.RunWorkerAsync()
- End If
- Else
- MsgBox("The update Wizard is Already Running")
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
-
- End Sub
-
- Private Sub tsmiMov_ExportMovies_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmiMov_ExportMovies.Click
- Try
- listoffilestomove.Clear()
- If DataGridViewMovies.SelectedRows.Count > 0 Then
- For Each sRow As DataGridViewRow In DataGridViewMovies.SelectedRows
- Dim playlist As New List(Of String)
- Dim tempstring As String = Utilities.GetFileName(DataGridViewMovies.SelectedCells(NFO_INDEX).Value.ToString)
- playlist = Utilities.GetMediaList(tempstring)
- If playlist.Count > 0 Then
- For Each File In playlist
- If Not listoffilestomove.Contains(File) Then listoffilestomove.Add(File)
- Next
- Dim fullpathandfilename As String = sRow.Cells("fullpathandfilename").Value.ToString
- listoffilestomove.Add(fullpathandfilename)
- If IO.File.Exists(Pref.GetFanartPath(fullpathandfilename)) Then listoffilestomove.Add(Pref.GetFanartPath(fullpathandfilename))
- If IO.File.Exists(Pref.GetPosterPath(fullpathandfilename)) Then listoffilestomove.Add(Pref.GetPosterPath(fullpathandfilename))
- Dim di As DirectoryInfo = New DirectoryInfo(fullpathandfilename.Replace(IO.Path.GetFileName(fullpathandfilename), ""))
- Dim filenama As String = IO.Path.GetFileNameWithoutExtension(fullpathandfilename)
- Dim fils As IO.FileInfo() = di.GetFiles(filenama & ".*")
- For Each fiNext In fils
- If Not listoffilestomove.Contains(fiNext.FullName) Then
- listoffilestomove.Add(fiNext.FullName)
- End If
- Next
- Dim trailerpath As String = Pref.ActualTrailerPath(fullpathandfilename) 'fullpathandfilename.Replace(IO.Path.GetExtension(fullpathandfilename), "-trailer.flv")
- Dim filenama2 As String = IO.Path.GetFileNameWithoutExtension(trailerpath)
- Dim fils2 As IO.FileInfo() = di.GetFiles(filenama2 & ".*")
- For Each fiNext In fils2
- If Not listoffilestomove.Contains(fiNext.FullName) Then
- listoffilestomove.Add(fiNext.FullName)
- End If
- Next
- End If
- Next
-
- totalfilesize = 0
- For Each item In listoffilestomove
- totalfilesize = totalfilesize + Utilities.GetFileSize(item)
- Next
-
- With FolderBrowserDialog1
- .ShowNewFolderButton = True
- .Description = "Select destination for file copy"
- End With
- Dim drive As String = ""
- Dim savepath As String = ""
- Dim frm As New frmCopyProgress
- If Pref.MultiMonitoEnabled Then
- frm.Bounds = screen.AllScreens(CurrentScreen).Bounds
- frm.StartPosition = FormStartPosition.Manual
- End If
- frm.ShowDialog()
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub frm_ExportTabSetup()
- If TextBox45.Text = "" Then
-
- Dim tempstring2 As String = workingProfile.config.Replace(IO.Path.GetFileName(workingProfile.config), "pathsubstitution.xml")
- If IO.File.Exists(tempstring2) Then
- relativeFolderList.Clear()
- Dim prefs As New XmlDocument
- Try
- prefs.Load(tempstring2)
- Catch ex As Exception
- End Try
- Dim thisresult As XmlNode = Nothing
- For Each thisresult In prefs("relativepaths")
- Select Case thisresult.Name
- Case "folder"
- Dim mc As New str_RelativeFileList(SetDefaults)
- Dim it2 As XmlNode
- For Each it2 In thisresult.ChildNodes
- Select Case it2.Name
- Case "mc"
- mc.mc = it2.InnerText
- Case "xbmc"
- mc.xbmc = it2.InnerText
- relativeFolderList.Add(mc)
- End Select
- Next
- End Select
- Next
- For Each item In relativeFolderList
- TextBox45.Text += "<folder>" & vbCrLf
- TextBox45.Text += " <mc>" & item.mc & "</mc>" & vbCrLf
- TextBox45.Text += " <xbmc>" & item.xbmc & "</xbmc>" & vbCrLf
- TextBox45.Text += "</folder>" & vbCrLf & vbCrLf
- Next
- End If
- If TextBox45.Text = "" Then
- For Each pat In movieFolders
- If Not pat.selected Then Continue For
- TextBox45.Text += "<folder>" & vbCrLf
- TextBox45.Text += " <mc>" & pat.rpath & "</mc>" & vbCrLf
- TextBox45.Text += " <xbmc>" & pat.rpath & "</xbmc>" & vbCrLf
- TextBox45.Text += "</folder>" & vbCrLf & vbCrLf
- Next
- For Each pat In Pref.offlinefolders
- TextBox45.Text += "<folder>" & vbCrLf
- TextBox45.Text += " <mc>" & pat & "</mc>" & vbCrLf
- TextBox45.Text += " <xbmc>" & pat & "</xbmc>" & vbCrLf
- TextBox45.Text += "</folder>" & vbCrLf & vbCrLf
- Next
- For Each pat In tvRootFolders
- TextBox45.Text += "<folder>" & vbCrLf
- TextBox45.Text += " <mc>" & pat.rpath & "</mc>" & vbCrLf
- TextBox45.Text += " <xbmc>" & pat.rpath & "</xbmc>" & vbCrLf
- TextBox45.Text += "</folder>" & vbCrLf & vbCrLf
- Next
- End If
- End If
- End Sub
-
- Private Sub Button109_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button109.Click
- Try
- relativeFolderList.Clear()
- Dim tempstring2 As String = workingProfile.config.Replace(IO.Path.GetFileName(workingProfile.config), "pathsubstitution.xml")
- Dim temptext As String = ""
- temptext = "<relativepaths>" & TextBox45.Text & "</relativepaths>"
- Dim doc As New XmlDocument
- doc.LoadXml(temptext)
- Dim thisresult As XmlElement
- For Each thisresult In doc("relativepaths")
- Dim newfo As New str_RelativeFileList(SetDefaults)
- For Each innerresult In thisresult
- Select Case innerresult.Name
- Case "mc"
- newfo.mc = innerresult.InnerText
- Case "xbmc"
- newfo.xbmc = innerresult.InnerText
- End Select
- Next
- If Not String.IsNullOrEmpty(newfo.mc) AndAlso Not String.IsNullOrEmpty(newfo.xbmc) Then relativeFolderList.Add(newfo)
- Next
-
- If relativeFolderList.Count > 0 Then
- Dim docs As New XmlDocument
- Dim thispref As XmlNode = Nothing
- Dim xmlproc As XmlDeclaration
- xmlproc = docs.CreateXmlDeclaration("1.0", "UTF-8", "yes")
- docs.AppendChild(xmlproc)
- Dim root As XmlElement
- Dim child As XmlElement
- Dim childchild As XmlElement
- root = doc.CreateElement("relativepaths")
- For Each item In relativeFolderList
- child = doc.CreateElement("folder")
- childchild = doc.CreateElement("mc")
- childchild.InnerText = item.mc
- child.AppendChild(childchild)
- childchild = doc.CreateElement("xbmc")
- childchild.InnerText = item.xbmc
- child.AppendChild(childchild)
- root.AppendChild(child)
- Next
- Dim output As New XmlTextWriter(tempstring2, System.Text.Encoding.UTF8)
- output.Formatting = Formatting.Indented
- doc.WriteTo(output)
- output.Close()
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
-
- Private Sub SplitContainer1_SplitterMoved(ByVal sender As System.Object, ByVal e As System.Windows.Forms.SplitterEventArgs) Handles SplitContainer1.SplitterMoved
- Mc.clsGridViewMovie.SetFirstColumnWidth(DataGridViewMovies)
- End Sub
-
- Private Sub SplitContainer5_SplitterMoved(ByVal sender As System.Object, ByVal e As System.Windows.Forms.SplitterEventArgs) Handles SplitContainer5.SplitterMoved
-
- ResizeBottomLHSPanel()
- Try
- DebugSplitter5PosLabel.Text = SplitContainer5.SplitterDistance
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub MediaCompanionCodeplexSiteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MediaCompanionCodeplexSiteToolStripMenuItem.Click
- Try
- Dim webAddress As String = "http://mediacompanion.codeplex.com/"
- OpenUrl(webAddress)
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub CheckBoxDebugShowXML_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBoxDebugShowXML.CheckedChanged
- Try
- If CheckBoxDebugShowXML.Checked = False Then
- TabLevel1.TabPages.Remove(Me.TabConfigXML)
- TabLevel1.TabPages.Remove(Me.TabMovieCacheXML)
- TabLevel1.TabPages.Remove(Me.TabTVCacheXML)
- TabLevel1.TabPages.Remove(Me.TabProfile)
- TabLevel1.TabPages.Remove(Me.TabActorCache)
- TabLevel1.TabPages.Remove(Me.TabRegex)
- Else
- TabLevel1.TabPages.Add(Me.TabConfigXML)
- TabLevel1.TabPages.Add(Me.TabMovieCacheXML)
- TabLevel1.TabPages.Add(Me.TabTVCacheXML)
- TabLevel1.TabPages.Add(Me.TabProfile)
- TabLevel1.TabPages.Add(Me.TabActorCache)
- TabLevel1.TabPages.Add(Me.TabRegex)
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Public Sub util_ConfigLoad(ByVal Optional prefs As Boolean = False)
- Pref.SetUpPreferences()
- Pref.ConfigLoad()
- Pref.MultiMonitoEnabled = convert.ToBoolean(multimonitor)
-
- DataGridViewMovies.DataSource = Nothing
-
- Me.SearchForMissingEpisodesToolStripMenuItem.Checked = Pref.displayMissingEpisodes
- Me.RefreshMissingEpisodesToolStripMenuItem.Enabled = Pref.displayMissingEpisodes
- If Pref.displayMissingEpisodes Then
- Me.RefreshMissingEpisodesToolStripMenuItem.ToolTipText = "Last Refresh: " & Pref.lastrefreshmissingdate
- End If
- Me.rbTvMissingEpisodes.Enabled = Pref.displayMissingEpisodes
- Me.rbTvMissingAiredEp.Enabled = Pref.displayMissingEpisodes
-
- Renamer.setRenamePref(Pref.tv_RegexRename.Item(Pref.tvrename), Pref.tv_RegexScraper)
- XBMCTMDBConfigSave()
- XBMCTVDBConfigSave()
-
- '----------------------------------------------------------
-
- mScraperManager = New ScraperManager(IO.Path.Combine(My.Application.Info.DirectoryPath, "Assets\scrapers"))
- '----------------------------------------------------------
- Dim loadinginfo As String = ""
- If Not IO.File.Exists(workingProfile.moviecache) Or Pref.startupCache = False Then
- loadinginfo = "Status :- Building Movie caches"
- frmSplash.Label3.Text = loadinginfo
- frmSplash.Label3.Refresh()
- mov_RebuildMovieCaches()
- Else
- loadinginfo = "Status :- Loading Movie Database"
- frmSplash.Label3.Text = loadinginfo
- frmSplash.Label3.Refresh()
- mov_CacheLoad()
- End If
-
- If IO.File.Exists(workingProfile.Genres) Then
- loadinginfo = "Status :- Loading Genre List"
- frmSplash.Label3.Text = loadinginfo
- frmSplash.Label3.Refresh()
- Call util_GenreLoad()
- End If
-
- If IO.File.Exists(workingProfile.homemoviecache) Then
- loadinginfo = "Status :- Loading Home Movie Database"
- frmSplash.Label3.Text = loadinginfo
- frmSplash.Label3.Refresh()
- Call homemovieCacheLoad()
- End If
-
- If IO.File.Exists(workingProfile.MusicVideoCache) Then
- loadinginfo = "Status :- Loading Music Video Database"
- frmSplash.Label3.Text = loadinginfo
- frmSplash.Label3.Refresh()
- UcMusicVideo1.cmbxMVSort.SelectedIndex = 0
- Call UcMusicVideo1.MVCacheLoad()
- End If
-
- If Not prefs then
- If Not IO.File.Exists(workingProfile.tvcache) Or Pref.startupCache = False Then
- loadinginfo = "Status :- Building TV Database"
- frmSplash.Label3.Text = loadinginfo
- frmSplash.Label3.Refresh()
- Call tv_CacheRefresh()
- Else
- loadinginfo = "Status :- Loading TV Database"
- frmSplash.Label3.Text = loadinginfo
- frmSplash.Label3.Refresh()
- Call tv_CacheLoad()
- End If
- Call tv_Filter()
- End If
-
- If Pref.homemoviefolders.Count > 0 Then
- AuthorizeCheck = True
- clbx_HMMovieFolders.Items.Clear()
- For Each folder In homemoviefolders
- clbx_HMMovieFolders.Items.Add(folder.rpath, folder.selected)
- Next
- AuthorizeCheck = False
- End If
-
- cbBtnLink.Checked = Pref.XBMC_Link
- SetcbBtnLink
- If Pref.XbmcLinkReady Then
- XbmcControllerQ.Write(XbmcController.E.ConnectReq, PriorityQueue.Priorities.low)
- End If
- End Sub
-
- Private Sub MediaCompanionHelpFileToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles MediaCompanionHelpFileToolStripMenuItem.Click
- Try
- Process.Start(applicationPath & "\Media_Companion.chm")
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub Tv_TreeViewContext_DispByAiredDate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_DispByAiredDate.Click
- 'This function displays in a Form with a fullscreen textbox, a list off all of a TvShows episodes in 'date aired' order, separated by calendar year.
- 'It can be called from a TVShow, Season or Episode context menu
- 'It handles the following errors - no aired date, episodes on the same aired date, episodes on same date with same series & same episode i.e. a duplicate....
-
- Try
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim NoDateCountUp As Integer = 0
- Dim Abort As Boolean = True 'this is used to verify that we actually have episodes to process
- Dim mySortedList As New SortedList() 'this is our sorted list, we add to the list a key (aired date) & the associated data (episode name), then we sort it & then we read out the data
- Dim childNodeLevel1 As TreeNode
-
- Select Case TvTreeview.SelectedNode.Level
- Case Is = 0
- childNodeLevel1 = TvTreeview.SelectedNode
- Case Is = 1
- childNodeLevel1 = TvTreeview.SelectedNode.Parent
- Case Is = 2
- childNodeLevel1 = TvTreeview.SelectedNode.Parent.Parent
- Case Else
- MsgBox("Unsupported TvTreeviewlevel in Aired Date Function", MsgBoxStyle.Exclamation, "Error!")
- Exit Sub
- End Select
-
-
- 'this section steps down through the tree to get from the tvshow to each episode
- For Each childNodeLevel2 As TreeNode In childNodeLevel1.Nodes
- For Each childNodeLevel3 As TreeNode In childNodeLevel2.Nodes
- Abort = False 'if we get here then there is at least 1 episode
- Dim episode As New TvEpisode
- episode.Load(childNodeLevel3.Name)
-
- Dim EpAired As String = episode.Aired.Value 'this holds the 'aired' value
-
- If EpAired Is Nothing Then
- EpAired = "9999-" & Utilities.PadNumber(NoDateCountUp, 5) 'if the aired date is nothing then we add it as 9999-xxxxx where x increments
- NoDateCountUp += 1
- End If
-
- 'Convert episode to 2 digits for formatting
- Dim episode2digit As New List(Of String)
- episode2digit.Clear()
- episode2digit.Add(childNodeLevel3.Tag.Episode.Value)
- If episode2digit(0).Length = 1 Then episode2digit(0) = "0" & episode2digit(0)
-
- 'Convert season to 2 digits for formatting
- Dim season2digit As String = childNodeLevel3.Tag.Season.Value
- If season2digit.Length = 1 Then season2digit = "0" & season2digit
-
- 'here we add our data in the order that it is read in the tree - the sorted list will sort it for us
- 'using the key value .aired (date format is yyyy-mm-dd so simple alphabetical sort is all that is required)
- 'FormatTVFilename formats the show title,episode tile, season no & episode no as per the users preferences
- Dim SameDateLoop As Boolean = True
- Dim Key As String
- Key = EpAired & season2digit & episode2digit(0) 'the key index (which is the string used to sort by) is the date+season+episode - this should be unique!
-
- Do Until SameDateLoop = False
- If mySortedList.ContainsKey(Key) Then
- Key += "^" 'we add an aditional ^ to the key if its still not unique.....
- Else
- SameDateLoop = False
- End If
- Loop
- mySortedList.Add(Key, EpAired & " " & Renamer.setTVFilename(WorkingTvShow.Title.Value, childNodeLevel3.Tag.title.value, episode2digit, season2digit))
- Next
- Next
-
- If Not Abort Then 'i.e. we have episodes in this show....
- Dim textstring As String = "!!! " & WorkingTvShow.Title.Value & " Seasons: " & WorkingTvShow.Seasons.Count & " Episodes: " & WorkingTvShow.Episodes.Count & vbCrLf 'start our text with the show title
- textstring += "!!! " & StrDup(textstring.Length - 2, "-") & vbCrLf 'add an underline of the same length
- Dim prevkey As String = mySortedList.GetKey(0).Substring(0, 4) 'load with first year value first four digits of aired date
- For Line = 0 To mySortedList.Count - 1 'read the data from the sorted list
- If mySortedList.GetKey(Line).Substring(0, 4) <> prevkey Then textstring += "!!! ----------" & vbCrLf 'line break between years...
- prevkey = mySortedList.GetKey(Line).Substring(0, 4) 'set so that we can compare with next iteration
- textstring += "!!! " & mySortedList.GetByIndex(Line) & vbCrLf ' "!!! " allows this to be shown in either brief or Full log modes
- Next
-
- textstring += "!!! " & vbCrLf & "!!! 9999 episodes have no valid aired date stored" & vbCrLf
-
- ' 'Show Final Listing Screen
- Dim MyFormObject As New frmoutputlog(textstring, True) 'create the log form & modify it to suit our needs
- MyFormObject.TextBox1.Font = New System.Drawing.Font("Courier New", 10.2!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 'constant width font
- MyFormObject.btn_savelog.AutoSize = True 'change button size to text will fit automatically
- MyFormObject.btn_savelog.Text = "Save Details..." 'change the button text
- MyFormObject.Text = "Episodes in Aired Order for " & WorkingTvShow.Title.Value 'change the form title text
- MyFormObject.ShowDialog() 'show the form
-
- Else 'we get here if abort still = true, i.e. no episodes
- MsgBox("There are no Epsiodes or Missing Episodes for this show.", MsgBoxStyle.OkOnly, "No Episodes")
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
-
- End Sub
- Private Sub util_FixSeasonEpisode() 'atleast try... if season or episode is -1, but title contains a regexable name to retreive season & episode
- Dim textstring As String = "!!! Season Episode -1 fix..." & vbCrLf
- Dim correctionsfound As Integer = 0
- Dim correctionsfixed As Integer = 0
- Dim childNodeLevel1 As TreeNode
- Dim originallabeltext = Label148.Text
- For Each childNodeLevel1 In TvTreeview.Nodes 'step thru each tvshow/season/episode in the treeview
- For Each childNodeLevel2 As TreeNode In childNodeLevel1.Nodes
- Label148.Text = childNodeLevel1.Text & " - " & childNodeLevel2.Text 'display some sort of progress using the text label associated with the fix
- Label148.Invalidate()
- Windows.Forms.Application.DoEvents() 'this refreshes the label whilst we are still in this sub
- For Each childNodeLevel3 As TreeNode In childNodeLevel2.Nodes
- Dim episode As New TvEpisode
- episode.Load(childNodeLevel3.Name) 'load the episode from the nfo using the path stored in the treeview
-
- If episode.Season.Value <> -1 AndAlso episode.Episode.Value <> -1 Then Continue For ' check if we have the issue
-
- textstring += "!!! " & childNodeLevel1.Text & " - " & childNodeLevel3.Name 'add details to the log"
- correctionsfound += 1 'increment the found issues counter
- For Each regexp In Pref.tv_RegexScraper
-
- Dim M As Match
- Dim sourcetext As String = ""
- If RadioButton_Fix_Filename.Checked Then
- sourcetext = childNodeLevel3.Name 'use nfo filename to retrieve season/episode
- Else
- sourcetext = episode.Title.Value 'use 'title' node in nfo to retieve season/episode
- End If
- M = Regex.Match(episode.Title.Value, regexp)
- If Not M.Success Then Continue For 'we found a valid regex match
- Try
- episode.Season.Value = M.Groups(1).Value.ToString 'set new values
- episode.Episode.Value = M.Groups(2).Value.ToString
- correctionsfixed += 1
- episode.Save(childNodeLevel3.Name) 'save episode
- textstring += " - Corrected - S" & episode.Season.Value & "E" & episode.Episode.Value
- Exit For
- Catch
- textstring += vbCrLf & "**** exception created during nfo save **** - " & childNodeLevel3.Name
- End Try
- Next
- textstring += vbCrLf
- Next
- Next
- Next
- Label148.Text = originallabeltext 'return the label text back after we have used it to diplay progress
- Dim MyFormObject As New frmoutputlog(textstring, True) 'create the log form & modify it to suit our needs
- MyFormObject.TextBox1.Font = New System.Drawing.Font("Courier New", 10.2!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 'constant width font
- MyFormObject.btn_savelog.AutoSize = True 'change button size to text will fit automatically
- MyFormObject.btn_savelog.Text = "Save Details..." 'change the button text
- MyFormObject.Font = New System.Drawing.Font("Courier New", 10.2!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- MyFormObject.Text = "Corrections" & vbCrLf & "Found: " & correctionsfound & vbCrLf & " Fixed: " & correctionsfixed 'change the form title text
- MyFormObject.ShowDialog() 'show the form
- If MsgBox("Corrections" & vbCrLf & "Found: " & correctionsfound & vbCrLf & "Fixed: " & correctionsfixed & vbCrLf & vbCrLf & "Do you want to perform a refresh to reload the corrected nfo's?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
- tv_CacheRefresh() 'ask to do a refresh or not, user may want to try both methods before do a refresh.
- End If
- End Sub
-
- Private Sub tsmiTvDelShowNfoArt_Click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tsmiTvDelShowNfoArt.MouseDown
- Dim NoDelArt As Boolean = (e.Button = MouseButtons.Right)
- TVContextMenu.Close()
- Dim Sh As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- TvDelShowNfoArt(Sh, False, NoDelArt)
- End Sub
-
- Private Sub tsmiTvDelShowEpNfoArt_Click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tsmiTvDelShowEpNfoArt.MouseDown
- Dim NoDelArt As Boolean = (e.Button = MouseButtons.Right)
- TVContextMenu.Close()
- Dim msgstring As String = "Warning: This will Remove all nfo's" & If(Not NoDelArt, " and artwork", "") & " for this Show and Episodes"
- msgstring &= vbcrlf & "and remove the show's folder from MC's ""List Of Separate Folders""." & vbCrLf
- msgstring &= vbCrLf & "To Rescrape this show, use ""Check Roots for New TV Shows"" or "
- msgstring &= vbCrLf & "Add this show's folder again to your ""List Of Separate Folders""." & vbCrLf
- msgstring &= vbCrLf & "Are your sure you wish to continue?"
- Dim x = MsgBox(msgstring, MsgBoxStyle.OkCancel, "Delete Show and Episode's nfo's" & If(Not NoDelArt, " and artwork", ""))
- If x = MsgBoxResult.Cancel Then Exit Sub
- Dim Sh As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim seas As TvSeason = tv_SeasonSelectedCurrently(TvTreeview)
- Dim ep As TvEpisode = ep_SelectedCurrently(TvTreeview)
- TvDelEpNfoAst(Sh, seas, ep, True, NoDelArt)
- TvDelShowNfoArt(Sh, True, NoDelArt)
- End Sub
-
- Private Sub tsmiTvDelEpNfoArt_Click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tsmiTvDelEpNfoArt.MouseDown
- Dim NoDelArt As Boolean = (e.Button = MouseButtons.Right)
- TVContextMenu.Close()
- Dim Sh As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim seas As TvSeason = tv_SeasonSelectedCurrently(TvTreeview)
- Dim ep As TvEpisode = ep_SelectedCurrently(TvTreeview)
- TvDelEpNfoAst(Sh, seas, ep, False, NoDelArt)
- End Sub
-
- Private Sub Tv_TreeViewContext_RescrapeShowOrEpisode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_RescrapeShowOrEpisode.Click
- tv_Rescrape()
- End Sub
- Private Sub Tv_TreeViewContext_WatchedShowOrEpisode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_WatchedShowOrEpisode.Click
- Tv_MarkAs_Watched_UnWatched("1")
- End Sub
- Private Sub Tv_TreeViewContext_UnWatchedShowOrEpisode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_UnWatchedShowOrEpisode.Click
- Tv_MarkAs_Watched_UnWatched("0")
- End Sub
- Private Sub Tv_TreeViewContext_Play_Episode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_Play_Episode.Click
- Try
- Dim ep As TvEpisode = ep_SelectedCurrently(TvTreeview)
- If ep.IsMissing Then Exit Sub
- Dim tempstring As String = ep.VideoFilePath 'DirectCast(TvTreeview.SelectedNode.Tag, Media_Companion.TvEpisode).VideoFilePath
- StartVideo(tempstring)
- 'If Pref.videomode = 1 Then Call util_VideoMode1(tempstring)
- 'If Pref.videomode = 2 Then Call util_VideoMode2(tempstring)
- 'If Pref.videomode = 3 Then
- ' Pref.videomode = 2
- ' Call util_VideoMode2(tempstring)
- 'End If
- 'If Pref.videomode >= 4 Then
- ' If Pref.selectedvideoplayer <> Nothing Then
- ' Call util_VideoMode4(tempstring)
- ' Else
- ' Call util_VideoMode1(tempstring)
- ' End If
- 'End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub Tv_TreeViewContext_ViewNfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_ViewNfo.Click
- Try
- If TvTreeview.SelectedNode Is Nothing Then Exit Sub
- If TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvShow Then
- Utilities.NfoNotepadDisplay(DirectCast(TvTreeview.SelectedNode.Tag, Media_Companion.TvShow).NfoFilePath, Pref.altnfoeditor)
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvSeason Then
- MsgBox("A Season NFO is invalid so it can't be shown")
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvEpisode Then
- Utilities.NfoNotepadDisplay(DirectCast(TvTreeview.SelectedNode.Tag, Media_Companion.TvEpisode).NfoFilePath, Pref.altnfoeditor)
- Else
- MsgBox("None")
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
-
- Debug.Print(Me.Controls.Count)
- End Sub
-
- Private Sub TvDelShowNfoArt(Show As TvShow, ByVal Ignore As Boolean, Optional ByVal NoDelArt As Boolean = False)
- Try
- If Not Ignore Then
- Dim msgstring As String = "Warning: This will Remove the selected Tv Show's nfo" & If(Not NoDelArt, " and artwork", "")
- msgstring &= vbcrlf & "and remove the show's folder from MC's ""List Of Separate Folders""." & vbCrLf
- msgstring &= vbCrLf & "To Rescrape this show, use ""Check Roots for New TV Shows"" or "
- msgstring &= vbCrLf & "Add this show's folder again to your ""List Of Separate Folders""." & vbCrLf
- msgstring &= vbCrLf & "Are your sure you wish to continue?"
- Dim x = MsgBox(msgstring, MsgBoxStyle.OkCancel, "Delete Show's nfo's" & If(Not NoDelArt, " and artwork", ""))
- If x = MsgBoxResult.Cancel Then Exit Sub
- End If
- If Not NoDelArt Then TvDeleteShowArt(show)
- Dim showpath As String = Show.FolderPath
- Utilities.SafeDeleteFile(showpath & "tvshow.nfo")
- showpath = showpath.Substring(0, showpath.Length-1)
- If ListBox6.items.Contains(showpath) Then ListBox6.Items.Remove(showpath)
- If Pref.tvFolders.Contains(showpath) Then Pref.tvFolders.Remove(showpath)
- TvTreeview.Nodes.Remove(show.ShowNode)
- Cache.TvCache.Remove(show)
- Tv_CacheSave()
- TvTreeviewRebuild()
- Show.UpdateTreenode()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub TvDelEpNfoAst(Show As TvShow, season As TvSeason, ep As TvEpisode, ByVal Ignore As Boolean, Optional ByVal NoDelArt As Boolean = False)
- Try
- If Not Ignore Then
- Dim msgstring As String = "Warning, This operation will delete all Episode nfo's" & If(Not NoDelArt, " and artwork", "")
- msgstring &= vbCrLf & "!! Note: will not delete missing episodes." & vbCrLf
- msgstring &= vbCrLf & "Are your sure you wish to continue?"
- Dim res As MsgBoxResult = MsgBox(msgstring, MsgBoxStyle.YesNoCancel, "Delete episode nfo(s)" & If(Not NoDelArt, " and artwork", ""))
- If res = MsgBoxResult.No OrElse res = MsgBoxResult.Cancel Then Exit Sub
- End If
- Dim TheseEpisodes As New List(Of Media_Companion.TvEpisode)
- If Not IsNothing(ep) Then
- For Each epis In season.Episodes
- If epis.NfoFilePath = ep.NfoFilePath Then TheseEpisodes.Add(epis)
- Next
- Else
- TheseEpisodes.AddRange(Show.Episodes)
- End If
- For Each episode In TheseEpisodes
- If IsNothing(season) OrElse episode.Season.Value = season.SeasonNumber.ToString Then
- If Not episode.IsMissing Then
- If episode.FolderPath <> Show.FolderPath AndAlso File.Exists(episode.FolderPath & "folder.jpg") Then
- Utilities.SafeDeleteFile(episode.FolderPath & "folder.jpg")
- End If
- Dim eppath As String = episode.NfoFilePath
- Utilities.SafeDeleteFile(eppath)
- If Not NoDelArt Then
- Utilities.SafeDeleteFile(eppath.Replace(".nfo", ".tbn"))
- Utilities.SafeDeleteFile(eppath.Replace(".nfo", "-thumb.jpg"))
- End If
- End If
- Cache.TvCache.Remove(episode)
- TvTreeview.Nodes.Remove(episode.EpisodeNode)
- If Not IsNothing(season) Then season.Episodes.Remove(episode)
- End If
- Next
- Dim listofnodes As New List(Of TreeNode)
- For Each n As TreeNode In TvTreeview.Nodes
- listofnodes.Add(n)
- For Each chn As TreeNode in n.nodes
- listofnodes.Add(chn)
- Next
- Next
- For Each n In listofnodes
- If n.FullPath.Contains(Show.Title.Value) AndAlso n.FullPath.ToLower.Contains("season") AndAlso n.GetNodeCount(False) = 0 Then
- TvTreeview.Nodes.Remove(n)
- End If
- Next
- Tv_CacheSave()
- TvTreeviewRebuild()
- Show.UpdateTreenode()
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub Tv_TreeViewContext_FindMissArt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tv_TreeViewContext_FindMissArt.Click
- Try
- tv_MissingArtDownload(tv_ShowSelectedCurrently(TvTreeview))
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub MovieContextMenu_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MovieContextMenu.Opening
- Try
- If DataGridViewMovies.SelectedRows.Count = 0 Then
- e.Cancel = True
- End If
- tsmiRescrapeRenameFiles.Enabled = Not Pref.usefoldernames AndAlso Not Pref.basicsavemode And Pref.MovieRenameEnable
- tsmiMov_OpenInMkvmergeGUI .Enabled = (Pref.MkvMergeGuiPath <> "")
- tsmiRescrapeFrodo_Poster_Thumbs .Enabled = Pref.FrodoEnabled
- tsmiRescrapeFrodo_Fanart_Thumbs .Enabled = Pref.FrodoEnabled
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub TVContextMenu_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TVContextMenu.Opening
- Try
- If (TvTreeview.SelectedNode Is Nothing) Then
- e.Cancel = True
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub SaveSelectedFanartAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveSelectedFanartAsToolStripMenuItem.Click
- Try
- messbox = New frmMessageBox("Please wait,", "", "Downloading Fanart")
- System.Windows.Forms.Cursor.Current = Cursors.WaitCursor
- messbox.Show()
- Me.Refresh()
- messbox.Refresh()
- Me.Refresh()
- Application.DoEvents()
-
- Dim tempstring As String
- Dim tempint As Integer = 0
- Dim tempstring2 As String = String.Empty
- Dim allok As Boolean = False
- For Each button As Control In Me.Panel2.Controls
- If button.Name.IndexOf("checkbox") <> -1 Then
- Dim b1 As RadioButton = CType(button, RadioButton)
- If b1.Checked = True Then
- tempstring = b1.Name
- tempstring = tempstring.Replace("moviefanartcheckbox", "")
- tempint = Convert.ToDecimal(tempstring)
- tempstring2 = fanartArray(tempint).hdUrl
- allok = True
- Exit For
- End If
- End If
- Next
- If allok = False Then
- MsgBox("No Fanart Is Selected")
- Else
- Try
- Panel1.Controls.Remove(Label1)
- With SaveFileDialog1
- .AddExtension = True
- .DefaultExt = "jpg"
- .Filter = "Jpg Pictures (*.jpg)|*.jpg"
- .Title = "Save Hi-Res Fanart as"
- .OverwritePrompt = True
- .CheckPathExists = True
- .InitialDirectory = workingMovieDetails.fileinfo.path
- End With
- If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
- Movie.SaveFanartImageToCacheAndPath(tempstring2, SaveFileDialog1.FileName)
- End If
- Catch ex As WebException
- MsgBox(ex.Message)
- End Try
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- Finally
- messbox.Close()
- End Try
- End Sub
-
- Private Sub TasksDontShowCompleted_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles TasksDontShowCompleted.CheckedChanged
- Me.TasksOnlyIncompleteTasks = TasksDontShowCompleted.Checked
- End Sub
-
- Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
- util_FixSeasonEpisode()
- End Sub
-
- Private Sub mov_DisplayFanart()
- If workingMovieDetails Is Nothing Then Exit Sub
-
- If workingMovieDetails.fileinfo.fanartpath <> Nothing Then
- Try
- Dim fanartpath = mov_FanartORExtrathumbPath()
- If IO.File.Exists(fanartpath) Then
- util_ImageLoad(PictureBox2, fanartpath, Utilities.DefaultFanartPath)
- lblMovFanartWidth.Text = PictureBox2.Image.Width
- lblMovFanartHeight.Text = PictureBox2.Image.Height
- Else
- util_ImageLoad(PictureBox2, Utilities.DefaultFanartPath, Utilities.DefaultFanartPath)
- lblMovFanartWidth.Text = ""
- lblMovFanartHeight.Text = ""
- End If
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End If
- End Sub
-
- Private Function mov_FanartORExtrathumbPath() As String
- Dim fanarttype As String = ""
- For Each rb As RadioButton In GroupBoxFanartExtrathumbs.Controls
- If rb.Checked Then
- fanarttype = rb.Text.ToLower
- Exit For
- End If
- Next
- Dim workingfanartpath As String = workingMovieDetails.fileinfo.fanartpath
- If fanarttype = "fanart" Then
- Return workingfanartpath
- Else
- Return Strings.Left(workingfanartpath, workingfanartpath.LastIndexOf("\")) & "\extrathumbs\" & fanarttype & ".jpg"
- End If
- End Function
-
- Private Sub tpMovMain_Enter(sender As Object, e As System.EventArgs) Handles tpMovMain.Enter
- mov_SplitContainerAutoPosition()
- End Sub
-
- Private Sub tpTvMainBrowser_Enter(sender As Object, e As System.EventArgs) Handles tpTvMainBrowser.Enter
- tv_SplitContainerAutoPosition()
- End Sub
-
- Private Sub plottxt_DoubleClick(sender As System.Object, e As System.EventArgs) Handles plottxt.DoubleClick
- ShowBigMovieText()
- End Sub
-
- Private Sub plottxt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plottxt.KeyPress
- If e.KeyChar = Convert.ToChar(1) Then
- DirectCast(sender, TextBox).SelectAll()
- e.Handled = True
- End If
- End Sub
-
- Private Sub outlinetxt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles outlinetxt.KeyPress
- If e.KeyChar = Convert.ToChar(1) Then
- DirectCast(sender, TextBox).SelectAll()
- e.Handled = True
- End If
- End Sub
-
- Private Sub ShowBigMovieText()
-
- Dim frm As New frmBigMovieText
- If Pref.MultiMonitoEnabled Then
- frm.Bounds = screen.AllScreens(CurrentScreen).Bounds
- frm.StartPosition = FormStartPosition.Manual
- End If
- frm.ShowDialog(
- titletxt.Text,
- directortxt.Text,
- votestxt.Text,
- ratingtxt.Text,
- runtimetxt.Text,
- genretxt.Text,
- txtStars.Text,
- certtxt.Text,
- plottxt.Text
- )
- End Sub
-
- 'Private Function GetActorThumb(ByRef currentUri As String)
- ' Dim actorthumb As String = currentUri
- ' If Pref.actorsave Then
- ' Dim uri As Uri
- ' uri = New Uri(actorthumb)
- ' If Len(Pref.actornetworkpath) > 0 AndAlso Len(Pref.actorsavepath) > 0 Then
- ' Dim actorThumbFileName As String
- ' Dim localActorThumbFileName As String
- ' actorThumbFileName = System.IO.Path.Combine(Pref.actornetworkpath, uri.Segments(uri.Segments.GetLength(0) - 1))
- ' localActorThumbFileName = System.IO.Path.Combine(Pref.actorsavepath, uri.Segments(uri.Segments.GetLength(0) - 1))
- ' Movie.SaveActorImageToCacheAndPath(uri.OriginalString, localActorThumbFileName)
- ' actorthumb = actorThumbFileName
- ' End If
- ' End If
- ' Return actorthumb
- 'End Function
-
- Private Sub mov_RescrapeAllSelected()
- _rescrapeList.Field = Nothing
- _rescrapeList.FullPathAndFilenames.Clear()
- For Each row In DataGridViewMovies.SelectedRows
- Dim fullpath As String = row.Cells("fullpathandfilename").Value.ToString
- If Not File.Exists(fullpath) Then Continue For
- _rescrapeList.FullPathAndFilenames.Add(fullpath)
- Next
- RunBackgroundMovieScrape("RescrapeAll")
- End Sub
-
- Public Sub mov_VideoSourcePopulate()
- Try
- cbMovieDisplay_Source.Items.Clear()
- cbMovieDisplay_Source.Items.Add("")
- For Each mset In Pref.releaseformat
- cbMovieDisplay_Source.Items.Add(mset)
- Next
- cbFilterSource.UpdateItems( Pref.releaseformat.ToList )
- cbMovieDisplay_Source.SelectedIndex = 0
- If IsNothing(workingMovieDetails) = False Then
- If workingMovieDetails.fullmoviebody.source <> "" Then
- For te = 0 To cbMovieDisplay_Source.Items.Count - 1
- If cbMovieDisplay_Source.Items(te) = workingMovieDetails.fullmoviebody.source Then
- cbMovieDisplay_Source.SelectedIndex = te
- Exit For
- End If
- Next
- End If
- End If
- Catch ex As Exception
- #If SilentErrorScream Then
- Throw ex
- #End If
- End Try
- End Sub
-
- 'AnotherPhil bug fix - If the default browser is <goz> IE <goz/> then not stating the exe throws an exception
- Public Sub OpenUrl(ByVal url As String)
- 'Dim testprocess As New Process
- 'testprocess.Start("notepad.exe")
- Try
- If Pref.selectedBrowser <> "" Then
- 'testprocess.Start(Pref.selectedBrowser, Uri.EscapeUriString(url))
- Process.Start(Pref.selectedBrowser, Uri.EscapeUriString(url))
- Else
- Try
- 'testprocess.Start(url)
- Process.Start(url)
- Catch ex As Exception
- MessageBox.Show("An error occurred while trying to launch the default browser - Under 'General Preferences' check 'Use external Browser...' and then locate your browser to fix this error", "", MessageBoxButtons.OK)
- End Try
- End If
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- 'testprocess.Close()
- 'testprocess.Dispose()
- End Sub
-
- Private Sub ZoomActorPictureBox(pictureBox As PictureBox)
- If IsNothing(pictureBox.Tag) orElse pictureBox.Tag.ToString = Utilities.DefaultActorPath Then Exit Sub
- Me.ControlBox = False
- MenuStrip1.Enabled = False
- Try
- util_ZoomImage(pictureBox.Tag.ToString)
- Catch
- Dim wc As New WebClient()
- Dim ImageInBytes() As Byte = wc.DownloadData(pictureBox.Tag)
- Dim ImageStream As New IO.MemoryStream(ImageInBytes)
- Dim cachefile As String = Utilities.Download2Cache(pictureBox.Tag.ToString)
- util_ZoomImage(cachefile)
- End Try
- End Sub
-
- Private Sub Mov_RemoveMovie()
- For Each row As DataGridViewRow In DataGridViewMovies.SelectedRows
- oMovies.RemoveMovieFromCache(row.Cells("fullpathandfilename").Value.ToString)
- DataGridViewMovies.Rows.RemoveAt(row.Index)
- Next
- DataGridViewMovies.ClearSelection
- oMovies.SaveMovieCache
- UpdateFilteredList
- End Sub
-
- Private Sub Mov_DeleteNfoArtwork(Optional ByVal DelArtwork As Boolean = True)
- Dim msgstr As String = " Are you sure you wish to delete" & vbCrLf
- msgstr &= ".nfo" & If(DelArtwork, ", Fanart, Poster and Actors", " only") & " for" & vbCrLf
- msgstr &= "Selected Movie(s)?"
- If MsgBox(msgstr, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
- Dim movielist As New List(Of String)
- Pref.MovieDeleteNfoArtwork = True
- For Each row As DataGridViewRow In DataGridViewMovies.SelectedRows
- movielist.Add(row.Cells(NFO_INDEX).Value.ToString)
- oMovies.DeleteScrapedFiles(row.Cells(NFO_INDEX).Value.ToString, DelArtwork)
- Next
-
- 'Last remove from dataGridViewMovies and update cache.
- Mov_RemoveMovie()
- Pref.MovieDeleteNfoArtwork = False
- Else
- MsgBox(" Deletion of .nfo, artwork and Actors " &vbCrLf & "has been Cancelled")
- End If
- End Sub
-
- Private Sub TabLevel1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles TabLevel1.SelectedIndexChanged
-
- Select Case TabLevel1.SelectedTab.Text.ToLower
- Case "config.xml"
- RichTextBoxTabConfigXML.Text = Utilities.LoadFullText(workingProfile.config) ' applicationPath & "\Settings\config.xml"
- Case "moviecache"
- RichTextBoxTabMovieCache.Text = Utilities.LoadFullText(workingProfile.moviecache) ' applicationPath & "\Settings\moviecache.xml"
- Case = "tvcache"
- RichTextBoxTabTVCache.Text = Utilities.LoadFullText(workingProfile.tvcache) ' applicationPath & "\Settings\tvcache.xml"
- Case = "actorcache"
- RichTextBoxTabActorCache.Text = Utilities.LoadFullText(workingProfile.actorcache) ' applicationPath & "\Settings\actorcache.xml"
- Case = "profile"
- RichTextBoxTabProfile.Text = Utilities.LoadFullText(applicationPath & "\Settings\profile.xml") ' applicationPath & "\Settings\profile.xml"
- Case = "regex"
- RichTextBoxTabRegex.Text = Utilities.LoadFullText(workingProfile.regexlist) ' applicationPath & "\Settings\regex.xml"
- Case "export"
- frm_ExportTabSetup()
- Case "movies"
- If Not MoviesFiltersResizeCalled Then
- MoviesFiltersResizeCalled = True
- Pref.movie_filters.SetMovieFiltersVisibility
- UpdateMovieFiltersPanel
- End If
- Case "music videos"
- UcMusicVideo1.mv_FiltersAndSortApply(True)
- End Select
-
- End Sub
-
- Sub HandleMovieList_DisplayChange(DisplayField As String)
- Mc.clsGridViewMovie.GridFieldToDisplay1 = DisplayField
-
- If rbTitleAndYear.Checked Then Pref.moviedefaultlist = 0
- If rbFileName .Checked Then Pref.moviedefaultlist = 1
- If rbFolder .Checked Then Pref.moviedefaultlist = 2
-
- Mc.clsGridViewMovie.GridviewMovieDesign(Me)
- If MainFormLoadedStatus Then
- DisplayMovie()
- End If
- End Sub
-
- Private Sub cbFilterChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterGeneral.SelectedValueChanged, cbFilterSource.TextChanged,
- cbFilterGenre.TextChanged, cbFilterCertificate.TextChanged,
- cbFilterSet.TextChanged, cbFilterResolution.TextChanged,
- cbFilterAudioCodecs.TextChanged, cbFilterAudioChannels.TextChanged,
- cbFilterAudioBitrates.TextChanged, cbFilterNumAudioTracks.TextChanged,
- cbFilterAudioLanguages.TextChanged, cbFilterActor.TextChanged, cbFilterTag.TextChanged,
- cbFilterDirector.TextChanged, cbFilterVideoCodec.TextChanged, cbFilterSubTitleLang.TextChanged,
- cbFilterAudioDefaultLanguages.TextChanged, cbFilterCountries.TextChanged,
- cbFilterStudios.TextChanged, cbFilterRootFolder.TextChanged,
- cbFilterUserRated.TextChanged
-
- If TypeName(sender) = "TriStateCheckedComboBox" Then
- Dim x As MC_UserControls.TriStateCheckedComboBox = sender
- If x.opState <> 0 Then
- Return
- End If
- End If
- ApplyMovieFilters()
- End Sub
-
- Private Sub cbFilterRatingChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterRating.SelectionChanged, cbFilterVotes.SelectionChanged,
- cbFilterRuntime.SelectionChanged, cbFilterFolderSizes.SelectionChanged,
- cbFilterYear.SelectionChanged
- ApplyMovieFilters
- End Sub
-
- 'Private Sub cbFilterVotesChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterVotes.SelectionChanged
- ' ApplyMovieFilters
- 'End Sub
-
- 'Private Sub cbFilterRuntimeChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterRuntime.SelectionChanged
- ' ApplyMovieFilters
- 'End Sub
-
- 'Private Sub cbFilterFolderSizesChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterFolderSizes.SelectionChanged
- ' ApplyMovieFilters
- 'End Sub
-
- 'Private Sub cbFilterYearChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterYear.SelectionChanged
- ' ApplyMovieFilters
- 'End Sub
-
- Private Sub cbFilterBeginSliding(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterRuntime.BeginSliding, cbFilterYear.BeginSliding, cbFilterVotes.BeginSliding, cbFilterRating.BeginSliding, cbFilterFolderSizes.BeginSliding
- SplitContainer5.Panel2.ContextMenuStrip = Nothing
- End Sub
-
-
- Private Sub cbFilterEndSliding(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterRuntime.EndSliding, cbFilterYear.EndSliding, cbFilterVotes.EndSliding, cbFilterRating.EndSliding, cbFilterFolderSizes.EndSliding
- SplitContainer5.Panel2.ContextMenuStrip = cmsConfigureMovieFilters
- End Sub
-
- Private Sub ApplyMovieFilters
- tsmiMov_ConvertToFrodo.Enabled = (cbFilterGeneral.Text.RemoveAfterMatch="Pre-Frodo poster only") or (cbFilterGeneral.Text.RemoveAfterMatch="Both poster formats")
- If ProgState = ProgramState.Other Then
- Mc.clsGridViewMovie.mov_FiltersAndSortApply(Me)
- DisplayMovie
- End If
- End Sub
-
- Sub HandleMovieFilter_SelectedValueChanged(cbFilter As ComboBox, ByRef filterValue As String, Optional replaceUnknown As Boolean = False)
- If ProgState = ProgramState.Other Then
- If cbFilter.Text = "All" Then
- filterValue = ""
- Else
- filterValue = cbFilter.Text.RemoveAfterMatch
- If replaceUnknown Then filterValue = filterValue.Replace("Unknown","-1")
- End If
- ApplyMovieFilters
- End If
- End Sub
-
- Private Sub TimerToolTip_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerToolTip.Tick
- TimerToolTip.Enabled = False
- TooltipGridViewMovies1.Visible = Pref.ShowMovieGridToolTip
- End Sub
-
-
- #Region "Movie scraping stuff"
-
- Sub RunBackgroundMovieScrape(action As String)
- If Not BckWrkScnMovies.IsBusy Then
- scraperLog = ""
- tsStatusLabel.Text = ""
- tsMultiMovieProgressBar.Value = tsMultiMovieProgressBar.Minimum
- tsMultiMovieProgressBar.Visible = Get_MultiMovieProgressBar_Visiblity(action)
- tsStatusLabel.Visible = True
- tsLabelEscCancel.Visible = True
- Statusstrip_Enable()
- 'StatusStrip1.BackColor = Color.Honeydew
- 'StatusStrip1.Visible = True
- 'tsStatusLabel1.Visible = False
- ssFileDownload.Visible = False
- tsProgressBarFileDownload_Resize()
- EnableDisableByTag("M", False) 'Disable all UI options that can't be run while scraper is running
- ScraperErrorDetected = False
-
- BckWrkScnMovies.RunWorkerAsync(action)
- While BckWrkScnMovies.IsBusy
- Application.DoEvents()
- End While
- If Not Pref.MusicVidScrape Then oMovies.SaveCaches
- Else
- MsgBox("The " & If(Pref.MusicVidScrape, "MusicVideo", "Movie") & " Scraper is Already Running")
- End If
- End Sub
-
- Private cbBtnLink_Checked As Boolean
-
- Sub EnableDisableByTag(tagQualifier As String, _state As Boolean)
-
- If Not _state Then
- StateBefore = ProgState
- cbBtnLink_Checked = cbBtnLink.Checked
- ProgState = ProgramState.MovieControlsDisabled
- Else
- cbBtnLink.Checked = cbBtnLink_Checked
- ProgState = StateBefore
- End If
- If IsNothing(ControlsToDisableDuringMovieScrape) Then
- ControlsToDisableDuringMovieScrape = (From c As Control In GetAllMatchingControls("M")).ToList
- End If
- For Each c In ControlsToDisableDuringMovieScrape
- c.Enabled = _state
- Next
-
- 'Not picked up for some unknown reason...
- MoviesToolStripMenuItem.Enabled = _state
- End Sub
-
- Function GetAllMatchingControls(tagQualifier As String) As List(Of Control)
- Dim allControls As New List(Of Control)
- GetAllMatchingControls(tagQualifier, Me, allControls)
- Return allControls
- End Function
-
- Sub GetAllMatchingControls(tagQualifier As String, parent As Control, allControls As List(Of Control))
- Dim query = From c As Control In parent.Controls
- For Each c As Control In query
- Try
- If Not IsNothing(c) AndAlso Not IsNothing(c.Tag) AndAlso TypeName(c.Tag).ToLower = "string" AndAlso c.Tag = tagQualifier Then allControls.Add(c)
- Catch ex As Exception
- End Try
- GetAllMatchingControls(tagQualifier, c, allControls)
- Next
- End Sub
-
- #Region "MC Scraper Calls"
- Function Get_MultiMovieProgressBar_Visiblity(action As String)
-
- Select Case action
- Case "BatchRescrape" : Return _rescrapeList.FullPathAndFilenames.Count>1 ' filteredList.Count > 1
- Case "ChangeMovie" : Return False
- Case "RescrapeAll" : Return _rescrapeList.FullPathAndFilenames.Count>1
- Case