Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

9124 lines (7848 sloc) 472.543 kb
' ################################################################################
' # EMBER MEDIA MANAGER #
' ################################################################################
' ################################################################################
' # This file is part of Ember Media Manager. #
' # #
' # Ember Media Manager is free software: you can redistribute it and/or modify #
' # it under the terms of the GNU General Public License as published by #
' # the Free Software Foundation, either version 3 of the License, or #
' # (at your option) any later version. #
' # #
' # Ember Media Manager is distributed in the hope that it will be useful, #
' # but WITHOUT ANY WARRANTY; without even the implied warranty of #
' # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
' # GNU General Public License for more details. #
' # #
' # You should have received a copy of the GNU General Public License #
' # along with Ember Media Manager. If not, see <http://www.gnu.org/licenses/>. #
' ################################################################################
Imports System
Imports System.Drawing
Imports System.IO
Imports System.Linq
Imports System.Reflection
Imports System.Text.RegularExpressions
Imports EmberAPI
Imports Ember.Plugins
Imports Ember.Plugins.Scraper
Public Class frmMain
#Region "Fields"
Private plugin_manager As PluginManager
Private fLoading As New frmSplash
Friend WithEvents bwCleanDB As New System.ComponentModel.BackgroundWorker
Friend WithEvents bwDownloadPic As New System.ComponentModel.BackgroundWorker
Friend WithEvents bwLoadEpInfo As New System.ComponentModel.BackgroundWorker
Friend WithEvents bwLoadInfo As New System.ComponentModel.BackgroundWorker
Friend WithEvents bwLoadSeasonInfo As New System.ComponentModel.BackgroundWorker
Friend WithEvents bwLoadShowInfo As New System.ComponentModel.BackgroundWorker
Friend WithEvents bwMediaInfo As New System.ComponentModel.BackgroundWorker
Friend WithEvents bwMovieScraper As New System.ComponentModel.BackgroundWorker
Friend WithEvents bwNonScrape As New System.ComponentModel.BackgroundWorker
Friend WithEvents bwRefreshMovies As New System.ComponentModel.BackgroundWorker
Private alActors As New List(Of String)
Private aniFilterRaise As Boolean = False
Private aniRaise As Boolean = False
Private aniShowType As Integer = 0 '0 = down, 1 = mid, 2 = up
Private aniType As Integer = 0 '0 = down, 1 = mid, 2 = up
Private bsEpisodes As New BindingSource
Private bsMedia As New BindingSource
Private bsSeasons As New BindingSource
Private bsShows As New BindingSource
Private dtEpisodes As New DataTable
Private dtMedia As New DataTable
Private dtSeasons As New DataTable
Private dtShows As New DataTable
Private dScrapeRow As DataRow = Nothing
Private fScanner As New Scanner
Private GenreImage As Image
Private InfoCleared As Boolean = False
Private isCL As Boolean = False
Private LoadingDone As Boolean = False
Private MainAllSeason As New Images
Private MainFanart As New Images
Private MainPoster As New Images
Private pbGenre() As PictureBox = Nothing
Private pnlGenre() As Panel = Nothing
Private prevText As String = String.Empty
Private ReportDownloadPercent As Boolean = False
Private ScrapeList As New List(Of DataRow)
Private ScraperDone As Boolean = False
Private sHTTP As New HTTP
Private tmpLang As String = String.Empty
Private tmpTitle As String = String.Empty
Private tmpTVDB As String = String.Empty
Private tmpOrdering As Enums.Ordering = Enums.Ordering.Standard
'Loading Delays
Private currRow As Integer = -1
Private currEpRow As Integer = -1
Private currSeasonRow As Integer = -1
Private currShowRow As Integer = -1
Private currList As Integer = 0
Private currText As String = String.Empty
Private currThemeType As Theming.ThemeType
Private prevEpRow As Integer = -1
Private prevRow As Integer = -1
Private prevSeasonRow As Integer = -1
Private prevShowRow As Integer = -1
Private bDoingSearch As Boolean = False
'filters
Private FilterArray As New List(Of String)
Private filSearch As String = String.Empty
Private filSource As String = String.Empty
Private filYear As String = String.Empty
Private filGenre As String = String.Empty
Private filMissing As String = String.Empty
'Theme Information
Private _postermaxheight As Integer = 160
Private _postermaxwidth As Integer = 160
Private tTheme As New Theming
Private _genrepanelcolor As Color = Color.Gainsboro
Private _ipmid As Integer = 280
Private _ipup As Integer = 500
Private CloseApp As Boolean = False
Private oldStatus As String = String.Empty
Private KeyBuffer As String = String.Empty
#End Region 'Fields
#Region "Delegates"
Delegate Sub DelegateEvent(ByVal eType As Enums.MovieScraperEventType, ByVal Parameter As Object)
Delegate Sub MydtListUpdate(ByVal drow As DataRow, ByVal i As Integer, ByVal v As Object)
Delegate Sub MySettingsShow(ByVal dlg As dlgSettings)
#End Region 'Delegates
#Region "Properties"
Public Property PluginManager As PluginManager
Get
Return plugin_manager
End Get
Private Set(value As PluginManager)
plugin_manager = value
End Set
End Property
Public Property GenrePanelColor() As Color
Get
Return _genrepanelcolor
End Get
Set(ByVal value As Color)
_genrepanelcolor = value
End Set
End Property
Public Property IPMid() As Integer
Get
Return _ipmid
End Get
Set(ByVal value As Integer)
_ipmid = value
End Set
End Property
Public Property IPUp() As Integer
Get
Return _ipup
End Get
Set(ByVal value As Integer)
_ipup = value
End Set
End Property
Public Property PosterMaxHeight() As Integer
Get
Return _postermaxheight
End Get
Set(ByVal value As Integer)
_postermaxheight = value
End Set
End Property
Public Property PosterMaxWidth() As Integer
Get
Return _postermaxwidth
End Get
Set(ByVal value As Integer)
_postermaxwidth = value
End Set
End Property
#End Region 'Properties
#Region "Methods"
Public Sub InstallNewFiles(ByVal fname As String)
Dim _cmds As Containers.InstallCommands = Containers.InstallCommands.Load(fname)
For Each _cmd As Containers.InstallCommand In _cmds.Command
Try
Select Case _cmd.CommandType
Case "FILE.Move"
Dim s() As String = _cmd.CommandExecute.Split("|"c)
If s.Count >= 2 Then
If File.Exists(s(1)) Then File.Delete(s(1))
If Not Directory.Exists(Path.GetDirectoryName(s(1))) Then
Directory.CreateDirectory(Path.GetDirectoryName(s(1)))
End If
File.Move(s(0), s(1))
End If
Case "FILE.Delete"
If File.Exists(_cmd.CommandExecute) Then File.Delete(_cmd.CommandExecute)
End Select
Catch ex As Exception
Dim log As New StreamWriter(Path.Combine(Functions.AppPath, "install.log"), True)
log.WriteLine(String.Format("--- Error: {0}", ex.Message))
log.WriteLine(ex.StackTrace)
log.Close()
End Try
Next
End Sub
Public Sub ClearInfo(Optional ByVal WithAllSeasons As Boolean = True)
Try
With Me
.InfoCleared = True
If .bwDownloadPic.IsBusy Then .bwDownloadPic.CancelAsync()
If .bwLoadInfo.IsBusy Then .bwLoadInfo.CancelAsync()
If .bwLoadShowInfo.IsBusy Then .bwLoadShowInfo.CancelAsync()
If .bwLoadSeasonInfo.IsBusy Then .bwLoadSeasonInfo.CancelAsync()
If .bwLoadEpInfo.IsBusy Then .bwLoadEpInfo.CancelAsync()
While .bwDownloadPic.IsBusy OrElse .bwLoadInfo.IsBusy OrElse .bwLoadShowInfo.IsBusy OrElse _
.bwLoadSeasonInfo.IsBusy OrElse .bwLoadEpInfo.IsBusy
Application.DoEvents()
Threading.Thread.Sleep(50)
End While
If Not IsNothing(.pbFanart.Image) Then
.pbFanart.Image.Dispose()
.pbFanart.Image = Nothing
End If
.MainFanart.Clear()
If Not IsNothing(.pbPoster.Image) Then
.pbPoster.Image.Dispose()
.pbPoster.Image = Nothing
End If
.pnlPoster.Visible = False
.MainPoster.Clear()
If WithAllSeasons Then
If Not IsNothing(.pbAllSeason.Image) Then
.pbAllSeason.Image.Dispose()
.pbAllSeason.Image = Nothing
End If
.MainAllSeason.Clear()
End If
.pnlAllSeason.Visible = False
'remove all the current genres
Try
For iDel As Integer = UBound(.pnlGenre) To 0 Step -1
.scMain.Panel2.Controls.Remove(.pbGenre(iDel))
.scMain.Panel2.Controls.Remove(.pnlGenre(iDel))
Next
Catch
End Try
If Not IsNothing(.pbMPAA.Image) Then
.pbMPAA.Image = Nothing
End If
.pnlMPAA.Visible = False
.lblTitle.Text = String.Empty
.lblVotes.Text = String.Empty
.lblRuntime.Text = String.Empty
.pnlTop250.Visible = False
.lblTop250.Text = String.Empty
.pbStar1.Image = Nothing
.pbStar2.Image = Nothing
.pbStar3.Image = Nothing
.pbStar4.Image = Nothing
.pbStar5.Image = Nothing
ToolTips.SetToolTip(pbStar1, "")
ToolTips.SetToolTip(pbStar2, "")
ToolTips.SetToolTip(pbStar3, "")
ToolTips.SetToolTip(pbStar4, "")
ToolTips.SetToolTip(pbStar5, "")
.lstActors.Items.Clear()
If Not IsNothing(.alActors) Then
.alActors.Clear()
.alActors = Nothing
End If
If Not IsNothing(.pbActors.Image) Then
.pbActors.Image.Dispose()
.pbActors.Image = Nothing
End If
.lblDirector.Text = String.Empty
.lblReleaseDate.Text = String.Empty
.txtCerts.Text = String.Empty
.txtIMDBID.Text = String.Empty
.txtFilePath.Text = String.Empty
.txtOutline.Text = String.Empty
.txtPlot.Text = String.Empty
.lblTagline.Text = String.Empty
If Not IsNothing(.pbMPAA.Image) Then
.pbMPAA.Image.Dispose()
.pbMPAA.Image = Nothing
End If
.pbStudio.Image = Nothing
.pbVideo.Image = Nothing
.pbVType.Image = Nothing
.pbAudio.Image = Nothing
.pbResolution.Image = Nothing
.pbChannels.Image = Nothing
.txtMetaData.Text = String.Empty
.pnlTop.Visible = False
'.tslStatus.Text = String.Empty
Application.DoEvents()
End With
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Public Sub LoadMedia(ByVal Scan As Structures.Scans, Optional ByVal SourceName As String = "")
Try
Me.SetStatus(Master.eLang.GetString(116, "Performing Preliminary Tasks (Gathering Data)..."))
Me.tspbLoading.ProgressBar.Style = ProgressBarStyle.Marquee
Me.tspbLoading.Visible = True
Application.DoEvents()
Me.ClearInfo()
Me.ClearFilters()
Me.EnableFilters(False)
Me.SetControlsEnabled(False)
Me.tabMovies.Text = Master.eLang.GetString(36, "Movies")
Me.tabTV.Text = Master.eLang.GetString(653, "TV")
Me.txtSearch.Text = String.Empty
Me.fScanner.CancelAndWait()
If Scan.Movies Then
Me.dgvMediaList.DataSource = Nothing
End If
If Scan.TV Then
Me.dgvTVShows.DataSource = Nothing
Me.dgvTVSeasons.DataSource = Nothing
Me.dgvTVEpisodes.DataSource = Nothing
End If
Me.fScanner.Start(Scan, SourceName)
Catch ex As Exception
Me.LoadingDone = True
Me.EnableFilters(True)
Me.SetControlsEnabled(True)
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Public Sub SetListItemAfterEdit(ByVal iID As Integer, ByVal iRow As Integer)
Try
Dim dRow = From drvRow In dtMedia.Rows Where Convert.ToInt32(DirectCast(drvRow, DataRow).Item(0)) = iID Select drvRow
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
SQLcommand.CommandText = String.Concat("SELECT mark, SortTitle FROM movies WHERE id = ", iID, ";")
Using SQLreader As SQLite.SQLiteDataReader = SQLcommand.ExecuteReader()
DirectCast(dRow(0), DataRow).Item(11) = Convert.ToBoolean(SQLreader("mark"))
If Not DBNull.Value.Equals(SQLreader("SortTitle")) Then DirectCast(dRow(0), DataRow).Item(47) = SQLreader("SortTitle").ToString
End Using
End Using
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Public Sub SetShowListItemAfterEdit(ByVal iID As Integer, ByVal iRow As Integer)
Try
Dim dRow = From drvRow In dtShows.Rows Where Convert.ToInt32(DirectCast(drvRow, DataRow).Item(0)) = iID Select drvRow
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
SQLcommand.CommandText = String.Concat("SELECT Ordering FROM TVShows WHERE id = ", iID, ";")
Using SQLreader As SQLite.SQLiteDataReader = SQLcommand.ExecuteReader()
DirectCast(dRow(0), DataRow).Item(23) = Convert.ToInt32(SQLreader("Ordering"))
End Using
End Using
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
Using dAbout As New dlgAbout
dAbout.ShowDialog()
End Using
End Sub
Private Sub AddGenreToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddGenreToolStripMenuItem.Click
Try
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parGenre As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parGenre", DbType.String, 0, "Genre")
Dim parID As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parID", DbType.Int32, 0, "id")
SQLcommand.CommandText = "UPDATE movies SET Genre = (?) WHERE id = (?);"
For Each sRow As DataGridViewRow In Me.dgvMediaList.SelectedRows
If Not sRow.Cells(27).Value.ToString.Contains(Me.GenreListToolStripComboBox.Text) Then
If Not String.IsNullOrEmpty(sRow.Cells(27).Value.ToString) Then
parGenre.Value = String.Format("{0} / {1}", sRow.Cells(27).Value, Me.GenreListToolStripComboBox.Text).Trim
Else
parGenre.Value = Me.GenreListToolStripComboBox.Text.Trim
End If
parID.Value = sRow.Cells(0).Value
SQLcommand.ExecuteNonQuery()
End If
Next
End Using
SQLtransaction.Commit()
End Using
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
For Each sRow As DataGridViewRow In Me.dgvMediaList.SelectedRows
Me.RefreshMovie(Convert.ToInt64(sRow.Cells(0).Value), True, False, True)
Next
SQLtransaction.Commit()
End Using
Me.LoadInfo(Convert.ToInt32(Me.dgvMediaList.Item(0, Me.dgvMediaList.CurrentCell.RowIndex).Value), Me.dgvMediaList.Item(1, Me.dgvMediaList.CurrentCell.RowIndex).Value.ToString, True, False)
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub ApplyTheme(ByVal tType As Theming.ThemeType)
Me.pnlInfoPanel.SuspendLayout()
Me.currThemeType = tType
tTheme.ApplyTheme(tType)
Me.tmrAni.Stop()
Select Case If(Me.tabsMain.SelectedIndex = 0, aniType, aniShowType)
Case 1
If Me.btnMid.Visible Then
Me.pnlInfoPanel.Height = Me._ipmid
Me.btnUp.Enabled = True
Me.btnMid.Enabled = False
Me.btnDown.Enabled = True
ElseIf Me.btnUp.Visible Then
Me.pnlInfoPanel.Height = Me._ipup
If Me.tabsMain.SelectedIndex = 0 Then
aniType = 2
Else
aniShowType = 2
End If
Me.btnUp.Enabled = False
Me.btnMid.Enabled = True
Me.btnDown.Enabled = True
Else
Me.pnlInfoPanel.Height = 25
If Me.tabsMain.SelectedIndex = 0 Then
aniType = 0
Else
aniShowType = 0
End If
Me.btnUp.Enabled = True
Me.btnMid.Enabled = True
Me.btnDown.Enabled = False
End If
Case 2
If Me.btnUp.Visible Then
Me.pnlInfoPanel.Height = Me._ipup
Me.btnUp.Enabled = False
Me.btnMid.Enabled = True
Me.btnDown.Enabled = True
ElseIf Me.btnMid.Visible Then
Me.pnlInfoPanel.Height = Me._ipmid
If Me.tabsMain.SelectedIndex = 0 Then
aniType = 1
Else
aniShowType = 1
End If
Me.btnUp.Enabled = True
Me.btnMid.Enabled = False
Me.btnDown.Enabled = True
Else
Me.pnlInfoPanel.Height = 25
If Me.tabsMain.SelectedIndex = 0 Then
aniType = 0
Else
aniShowType = 0
End If
Me.btnUp.Enabled = True
Me.btnMid.Enabled = True
Me.btnDown.Enabled = False
End If
Case Else
Me.pnlInfoPanel.Height = 25
If Me.tabsMain.SelectedIndex = 0 Then
aniType = 0
Else
aniShowType = 0
End If
Me.btnUp.Enabled = True
Me.btnMid.Enabled = True
Me.btnDown.Enabled = False
End Select
Me.pbActLoad.Visible = False
Me.pbActors.Image = My.Resources.actor_silhouette
Me.pbMILoading.Visible = False
Me.pnlInfoPanel.ResumeLayout()
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
btnCancel.Visible = False
lblCanceling.Visible = True
pbCanceling.Visible = True
If Me.bwMovieScraper.IsBusy Then Me.bwMovieScraper.CancelAsync()
If Me.bwRefreshMovies.IsBusy Then Me.bwRefreshMovies.CancelAsync()
If Me.bwNonScrape.IsBusy Then Me.bwNonScrape.CancelAsync()
While Me.bwMovieScraper.IsBusy OrElse Me.bwRefreshMovies.IsBusy OrElse Me.bwNonScrape.IsBusy
Application.DoEvents()
Threading.Thread.Sleep(50)
End While
End Sub
Private Sub btnClearFilters_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearFilters.Click
Me.ClearFilters(True)
End Sub
Private Sub btnDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDown.Click
'//
' Begin animation to lower panel all the way down
'\\
Me.tabsMain.Focus()
If Me.tabsMain.SelectedIndex = 0 Then
Me.aniType = 0
Else
Me.aniShowType = 0
End If
Me.aniRaise = False
Me.tmrAni.Start()
End Sub
Private Sub btnFilterDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFilterDown.Click
'//
' Begin animation to lower panel all the way down
'\\
Me.aniFilterRaise = False
Me.tmrFilterAni.Start()
End Sub
Private Sub btnFilterUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFilterUp.Click
'//
' Begin animation to raise panel all the way up
'\\
Me.aniFilterRaise = True
Me.tmrFilterAni.Start()
End Sub
Private Sub btnIMDBRating_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIMDBRating.Click
If Me.dgvMediaList.RowCount > 0 Then
If Me.btnIMDBRating.Tag.ToString = "DESC" Then
Me.btnIMDBRating.Tag = "ASC"
Me.btnIMDBRating.Image = My.Resources.desc
Me.dgvMediaList.Sort(Me.dgvMediaList.Columns(18), ComponentModel.ListSortDirection.Descending)
Else
Me.btnIMDBRating.Tag = "DESC"
Me.btnIMDBRating.Image = My.Resources.asc
Me.dgvMediaList.Sort(Me.dgvMediaList.Columns(18), ComponentModel.ListSortDirection.Ascending)
End If
End If
End Sub
Private Sub btnMarkAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMarkAll.Click
Try
Dim MarkAll As Boolean = Not btnMarkAll.Text = Master.eLang.GetString(105, "Unmark All")
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parMark As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parMark", DbType.Boolean, 0, "mark")
SQLcommand.CommandText = "UPDATE movies SET mark = (?);"
parMark.Value = MarkAll
SQLcommand.ExecuteNonQuery()
End Using
SQLtransaction.Commit()
End Using
For Each drvRow As DataRow In dtMedia.Rows
drvRow.Item(11) = MarkAll
Next
dgvMediaList.Refresh()
btnMarkAll.Text = If(Not MarkAll, Master.eLang.GetString(35, "Mark All"), Master.eLang.GetString(105, "Unmark All"))
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub btnMid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMid.Click
'//
' Begin animation to raise/lower panel to mid point
'\\
Me.tabsMain.Focus()
If Me.pnlInfoPanel.Height = Me.IPUp Then
Me.aniRaise = False
Else
Me.aniRaise = True
End If
If Me.tabsMain.SelectedIndex = 0 Then
Me.aniType = 1
Else
Me.aniShowType = 1
End If
Me.tmrAni.Start()
End Sub
Private Sub btnMIRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMetaDataRefresh.Click
'//
' Refresh Media Info
'\\
If Me.tabsMain.SelectedIndex = 0 Then
If Not String.IsNullOrEmpty(Master.currMovie.Filename) AndAlso Me.dgvMediaList.SelectedRows.Count > 0 Then
Me.LoadInfo(Convert.ToInt32(Master.currMovie.ID), Master.currMovie.Filename, False, True, True)
End If
ElseIf Not String.IsNullOrEmpty(Master.currShow.Filename) AndAlso Me.dgvTVEpisodes.SelectedRows.Count > 0 Then
Me.SetControlsEnabled(False, True)
If Me.bwMediaInfo.IsBusy Then Me.bwMediaInfo.CancelAsync()
Me.txtMetaData.Clear()
Me.pbMILoading.Visible = True
Me.bwMediaInfo = New System.ComponentModel.BackgroundWorker
Me.bwMediaInfo.WorkerSupportsCancellation = True
Me.bwMediaInfo.RunWorkerAsync(New Arguments With {.TVShow = Master.currShow, .IsTV = True, .setEnabled = True})
End If
End Sub
Private Sub btnPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlay.Click
'//
' Launch video using system default player
'\\
Try
If Not String.IsNullOrEmpty(Me.txtFilePath.Text) Then
If File.Exists(Me.txtFilePath.Text) Then
If Master.isWindows Then
Process.Start(String.Concat("""", Me.txtFilePath.Text, """"))
Else
Using Explorer As New Process
Explorer.StartInfo.FileName = "xdg-open"
Explorer.StartInfo.Arguments = String.Format("""{0}""", Me.txtFilePath.Text)
Explorer.Start()
End Using
End If
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub btnSortDate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSortDate.Click
If Me.dgvMediaList.RowCount > 0 Then
If Me.btnSortDate.Tag.ToString = "DESC" Then
Me.btnSortDate.Tag = "ASC"
Me.btnSortDate.Image = My.Resources.desc
Me.dgvMediaList.Sort(Me.dgvMediaList.Columns(0), ComponentModel.ListSortDirection.Descending)
Else
Me.btnSortDate.Tag = "DESC"
Me.btnSortDate.Image = My.Resources.asc
Me.dgvMediaList.Sort(Me.dgvMediaList.Columns(0), ComponentModel.ListSortDirection.Ascending)
End If
End If
End Sub
Private Sub btnSortTitle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSortTitle.Click
If Me.dgvMediaList.RowCount > 0 Then
If Me.btnSortTitle.Tag.ToString = "DESC" Then
Me.btnSortTitle.Tag = "ASC"
Me.btnSortTitle.Image = My.Resources.desc
Me.dgvMediaList.Sort(Me.dgvMediaList.Columns(47), ComponentModel.ListSortDirection.Descending)
Else
Me.btnSortTitle.Tag = "DESC"
Me.btnSortTitle.Image = My.Resources.asc
Me.dgvMediaList.Sort(Me.dgvMediaList.Columns(47), ComponentModel.ListSortDirection.Ascending)
End If
End If
End Sub
Private Sub btnUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUp.Click
'//
' Begin animation to raise panel all the way up
'\\
Me.tabsMain.Focus()
If Me.tabsMain.SelectedIndex = 0 Then
Me.aniType = 2
Else
Me.aniShowType = 2
End If
Me.aniRaise = True
Me.tmrAni.Start()
End Sub
Private Sub BuildStars(ByVal sinRating As Single)
'//
' Convert # rating to star images
'\\
Try
With Me
.pbStar1.Image = Nothing
.pbStar2.Image = Nothing
.pbStar3.Image = Nothing
.pbStar4.Image = Nothing
.pbStar5.Image = Nothing
Dim tTip As String = String.Concat(Master.eLang.GetString(245, "Rating:"), String.Format(" {0:N}", sinRating))
ToolTips.SetToolTip(.pbStar1, tTip)
ToolTips.SetToolTip(.pbStar2, tTip)
ToolTips.SetToolTip(.pbStar3, tTip)
ToolTips.SetToolTip(.pbStar4, tTip)
ToolTips.SetToolTip(.pbStar5, tTip)
If sinRating >= 0.5 Then ' if rating is less than .5 out of ten, consider it a 0
Select Case (sinRating / 2)
Case Is <= 0.5
.pbStar1.Image = My.Resources.starhalf
Case Is <= 1
.pbStar1.Image = My.Resources.star
Case Is <= 1.5
.pbStar1.Image = My.Resources.star
.pbStar2.Image = My.Resources.starhalf
Case Is <= 2
.pbStar1.Image = My.Resources.star
.pbStar2.Image = My.Resources.star
Case Is <= 2.5
.pbStar1.Image = My.Resources.star
.pbStar2.Image = My.Resources.star
.pbStar3.Image = My.Resources.starhalf
Case Is <= 3
.pbStar1.Image = My.Resources.star
.pbStar2.Image = My.Resources.star
.pbStar3.Image = My.Resources.star
Case Is <= 3.5
.pbStar1.Image = My.Resources.star
.pbStar2.Image = My.Resources.star
.pbStar3.Image = My.Resources.star
.pbStar4.Image = My.Resources.starhalf
Case Is <= 4
.pbStar1.Image = My.Resources.star
.pbStar2.Image = My.Resources.star
.pbStar3.Image = My.Resources.star
.pbStar4.Image = My.Resources.star
Case Is <= 4.5
.pbStar1.Image = My.Resources.star
.pbStar2.Image = My.Resources.star
.pbStar3.Image = My.Resources.star
.pbStar4.Image = My.Resources.star
.pbStar5.Image = My.Resources.starhalf
Case Else
.pbStar1.Image = My.Resources.star
.pbStar2.Image = My.Resources.star
.pbStar3.Image = My.Resources.star
.pbStar4.Image = My.Resources.star
.pbStar5.Image = My.Resources.star
End Select
End If
End With
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub bwCleanDB_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwCleanDB.DoWork
Master.DB.Clean(True, True)
End Sub
Private Sub bwCleanDB_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwCleanDB.RunWorkerCompleted
Me.SetStatus(String.Empty)
Me.tspbLoading.Visible = False
Me.FillList(0)
End Sub
Private Sub bwDownloadPic_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwDownloadPic.DoWork
Dim Args As Arguments = DirectCast(e.Argument, Arguments)
Try
sHTTP.StartDownloadImage(Args.pURL)
While sHTTP.IsDownloading
Application.DoEvents()
If Me.bwDownloadPic.CancellationPending Then
e.Cancel = True
sHTTP.Cancel()
Return
End If
Threading.Thread.Sleep(50)
End While
e.Result = New Results With {.Result = sHTTP.Image}
Catch ex As Exception
e.Result = New Results With {.Result = Nothing}
e.Cancel = True
End Try
End Sub
Private Sub bwDownloadPic_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwDownloadPic.RunWorkerCompleted
'//
' Thread finished: display pic if it was able to get one
'\\
Me.pbActLoad.Visible = False
If e.Cancelled Then
Me.pbActors.Image = My.Resources.actor_silhouette
Else
Dim Res As Results = DirectCast(e.Result, Results)
If Not IsNothing(Res.Result) Then
Me.pbActors.Image = Res.Result
Else
Me.pbActors.Image = My.Resources.actor_silhouette
End If
End If
End Sub
Private Sub bwLoadEpInfo_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwLoadEpInfo.DoWork
Try
Dim Args As Arguments = DirectCast(e.Argument, Arguments)
Me.MainPoster.Clear()
Me.MainFanart.Clear()
If bwLoadEpInfo.CancellationPending Then
e.Cancel = True
Return
End If
Master.currShow = Master.DB.LoadTVEpFromDB(Args.ID, True)
If bwLoadEpInfo.CancellationPending Then
e.Cancel = True
Return
End If
If Not Master.eSettings.NoDisplayPoster Then Me.MainPoster.FromFile(Master.currShow.EpPosterPath)
If bwLoadEpInfo.CancellationPending Then
e.Cancel = True
Return
End If
If Not Master.eSettings.NoDisplayFanart Then
Dim NeedsGS As Boolean = False
If Not String.IsNullOrEmpty(Master.currShow.EpFanartPath) Then
Me.MainFanart.FromFile(Master.currShow.EpFanartPath)
Else
Me.MainFanart.FromFile(Master.currShow.ShowFanartPath)
NeedsGS = True
End If
If Not IsNothing(Me.MainFanart.Image) Then
If String.IsNullOrEmpty(Master.currShow.Filename) Then
Me.MainFanart.Image = ImageUtils.AddMissingStamp(Me.MainFanart.Image)
ElseIf NeedsGS Then
Me.MainFanart.Image = ImageUtils.GrayScale(Me.MainFanart.Image)
End If
End If
End If
'wait for mediainfo to update the nfo
While bwMediaInfo.IsBusy
Application.DoEvents()
Threading.Thread.Sleep(50)
End While
If bwLoadEpInfo.CancellationPending Then
e.Cancel = True
Return
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
e.Cancel = True
End Try
End Sub
Private Sub bwLoadEpInfo_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwLoadEpInfo.RunWorkerCompleted
Try
If Not e.Cancelled Then
Me.fillScreenInfoWithEpisode()
Else
Me.SetControlsEnabled(True)
End If
Me.dgvTVEpisodes.ResumeLayout()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub bwLoadInfo_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwLoadInfo.DoWork
Try
Dim Args As Arguments = DirectCast(e.Argument, Arguments)
Me.MainFanart.Clear()
Me.MainPoster.Clear()
If bwLoadInfo.CancellationPending Then
e.Cancel = True
Return
End If
Master.currMovie = Master.DB.LoadMovieFromDB(Args.ID)
If bwLoadInfo.CancellationPending Then
e.Cancel = True
Return
End If
If Not Master.eSettings.NoDisplayFanart Then Me.MainFanart.FromFile(Master.currMovie.FanartPath)
If bwLoadInfo.CancellationPending Then
e.Cancel = True
Return
End If
If Not Master.eSettings.NoDisplayPoster Then Me.MainPoster.FromFile(Master.currMovie.PosterPath)
'read nfo if it's there
'wait for mediainfo to update the nfo
While bwMediaInfo.IsBusy
Application.DoEvents()
Threading.Thread.Sleep(50)
End While
If bwLoadInfo.CancellationPending Then
e.Cancel = True
Return
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
e.Cancel = True
End Try
End Sub
Private Sub bwLoadInfo_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwLoadInfo.RunWorkerCompleted
Try
If Not e.Cancelled Then
Me.fillScreenInfoWithMovie()
Else
If Not bwMovieScraper.IsBusy AndAlso Not bwRefreshMovies.IsBusy AndAlso Not bwCleanDB.IsBusy AndAlso Not bwNonScrape.IsBusy Then
Me.SetControlsEnabled(True)
Me.EnableFilters(True)
Else
Me.dgvMediaList.Enabled = True
End If
End If
Me.dgvMediaList.ResumeLayout()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub bwLoadSeasonInfo_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwLoadSeasonInfo.DoWork
Try
Dim Args As Arguments = DirectCast(e.Argument, Arguments)
Me.MainPoster.Clear()
Me.MainFanart.Clear()
Master.currShow = Master.DB.LoadTVSeasonFromDB(Args.ID, Args.Season, True)
If bwLoadSeasonInfo.CancellationPending Then
e.Cancel = True
Return
End If
If Not Master.eSettings.NoDisplayPoster Then Me.MainPoster.FromFile(Master.currShow.SeasonPosterPath)
If bwLoadSeasonInfo.CancellationPending Then
e.Cancel = True
Return
End If
If Not Master.eSettings.NoDisplayFanart Then
If Not String.IsNullOrEmpty(Master.currShow.SeasonFanartPath) Then
Me.MainFanart.FromFile(Master.currShow.SeasonFanartPath)
Else
Me.MainFanart.FromFile(Master.currShow.ShowFanartPath)
If Not IsNothing(Me.MainFanart.Image) Then Me.MainFanart.Image = ImageUtils.GrayScale(Me.MainFanart.Image)
End If
End If
If bwLoadSeasonInfo.CancellationPending Then
e.Cancel = True
Return
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
e.Cancel = True
End Try
End Sub
Private Sub bwLoadSeasonInfo_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwLoadSeasonInfo.RunWorkerCompleted
Try
If Not e.Cancelled Then
Me.fillScreenInfoWithSeason()
Else
Me.SetControlsEnabled(True)
End If
Me.dgvTVSeasons.ResumeLayout()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub bwLoadShowInfo_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwLoadShowInfo.DoWork
Try
Dim Args As Arguments = DirectCast(e.Argument, Arguments)
Me.MainFanart.Clear()
Me.MainPoster.Clear()
If bwLoadShowInfo.CancellationPending Then
e.Cancel = True
Return
End If
Master.currShow = Master.DB.LoadTVFullShowFromDB(Args.ID)
If bwLoadShowInfo.CancellationPending Then
e.Cancel = True
Return
End If
If Not Master.eSettings.NoDisplayFanart Then Me.MainFanart.FromFile(Master.currShow.ShowFanartPath)
If bwLoadShowInfo.CancellationPending Then
e.Cancel = True
Return
End If
If Not Master.eSettings.NoDisplayPoster Then Me.MainPoster.FromFile(Master.currShow.ShowPosterPath)
If Master.eSettings.DisplayAllSeason AndAlso Master.eSettings.AllSeasonPosterEnabled Then
Me.MainAllSeason.FromFile(Master.currShow.SeasonPosterPath)
End If
If bwLoadShowInfo.CancellationPending Then
e.Cancel = True
Return
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
e.Cancel = True
End Try
End Sub
Private Sub bwLoadShowInfo_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwLoadShowInfo.RunWorkerCompleted
Try
If Not e.Cancelled Then
Me.fillScreenInfoWithShow()
Else
Me.SetControlsEnabled(True)
End If
Me.dgvTVShows.ResumeLayout()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub bwMediaInfo_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwMediaInfo.DoWork
'//
' Thread to procure technical and tag information about media via MediaInfo.dll
'\\
Dim Args As Arguments = DirectCast(e.Argument, Arguments)
Try
If Args.IsTV Then
MediaInfo.UpdateTVMediaInfo(Args.TVShow)
Master.DB.SaveTVEpToDB(Args.TVShow, False, False, False, True)
e.Result = New Results With {.fileinfo = NFO.FIToString(Args.TVShow.TVEp.FileInfo, True), .TVShow = Args.TVShow, .IsTV = True, .setEnabled = Args.setEnabled}
Else
MediaInfo.UpdateMediaInfo(Args.Movie)
Master.DB.SaveMovieToDB(Args.Movie, False, False, True)
e.Result = New Results With {.fileinfo = NFO.FIToString(Args.Movie.Movie.FileInfo, False), .setEnabled = Args.setEnabled, .Path = Args.Path, .Movie = Args.Movie}
End If
If Me.bwMediaInfo.CancellationPending Then
e.Cancel = True
Return
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
e.Result = New Results With {.fileinfo = "error", .setEnabled = Args.setEnabled}
e.Cancel = True
End Try
End Sub
Private Sub bwMediaInfo_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwMediaInfo.RunWorkerCompleted
'//
' Thread finished: fill textbox with result
'\\
If Not e.Cancelled Then
Dim Res As Results = DirectCast(e.Result, Results)
Try
If Not Res.fileInfo = "error" Then
Me.pbMILoading.Visible = False
Me.txtMetaData.Text = Res.fileInfo
If Res.IsTV Then
If Master.eSettings.ScanTVMediaInfo Then
Me.SetAVImages(APIXML.GetAVImages(Res.TVShow.TVEp.FileInfo, Res.TVShow.Filename, True, ""))
Me.pnlInfoIcons.Width = pbVideo.Width + pbVType.Width + pbResolution.Width + pbAudio.Width + pbChannels.Width + pbStudio.Width + 6
Me.pbStudio.Left = pbVideo.Width + pbVType.Width + pbResolution.Width + pbAudio.Width + pbChannels.Width + 5
Else
Me.pnlInfoIcons.Width = pbStudio.Width + 1
Me.pbStudio.Left = 0
End If
Else
If Master.eSettings.ScanMediaInfo Then
Me.SetAVImages(APIXML.GetAVImages(Res.Movie.Movie.FileInfo, Res.Movie.Filename, False, Res.Movie.FileSource))
Me.pnlInfoIcons.Width = pbVideo.Width + pbVType.Width + pbResolution.Width + pbAudio.Width + pbChannels.Width + pbStudio.Width + 6
Me.pbStudio.Left = pbVideo.Width + pbVType.Width + pbResolution.Width + pbAudio.Width + pbChannels.Width + 5
Else
Me.pnlInfoIcons.Width = pbStudio.Width + 1
Me.pbStudio.Left = 0
End If
If Master.eSettings.UseMIDuration Then
If Not String.IsNullOrEmpty(Res.Movie.Movie.Runtime) Then
Me.lblRuntime.Text = String.Format(Master.eLang.GetString(112, "Runtime: {0}"), Res.Movie.Movie.Runtime)
End If
End If
End If
Me.btnMetaDataRefresh.Focus()
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
If Res.setEnabled Then
Me.tabsMain.Enabled = True
Me.tsbRefreshMedia.Enabled = True
Me.cmnuTrayIconUpdateMedia.Enabled = True
If (Me.tabsMain.SelectedIndex = 0 AndAlso Me.dgvMediaList.RowCount > 0) OrElse _
(Me.tabsMain.SelectedIndex = 1 AndAlso Me.dgvTVShows.RowCount > 0) Then
Me.SetControlsEnabled(True)
End If
End If
End If
End Sub
Private Sub bwMovieScraper_Completed(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwMovieScraper.RunWorkerCompleted
Dim Res As Results = DirectCast(e.Result, Results)
If isCL Then
Me.ScraperDone = True
End If
If Res.scrapeType = Enums.ScrapeType.SingleScrape Then
Me.MovieInfoDownloaded()
Else
If Me.dgvMediaList.SelectedRows.Count > 0 Then
Me.SelectRow(Me.dgvMediaList.SelectedRows(0).Index)
Else
Me.ClearInfo()
End If
Me.tslLoading.Visible = False
Me.tspbLoading.Visible = False
Me.btnCancel.Visible = False
Me.lblCanceling.Visible = False
Me.pbCanceling.Visible = False
Me.pnlCancel.Visible = False
Me.SetControlsEnabled(True)
End If
End Sub
Private Sub bwMovieScraper_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwMovieScraper.DoWork
Dim Args As Arguments = DirectCast(e.Argument, Arguments)
Dim OldTitle As String = String.Empty
Dim NewTitle As String = String.Empty
AddHandler ModulesManager.Instance.MovieScraperEvent, AddressOf MovieScraperEvent
For Each dRow As DataRow In ScrapeList
Try
If bwMovieScraper.CancellationPending Then Exit For
OldTitle = dRow.Item(3).ToString
bwMovieScraper.ReportProgress(1, OldTitle)
dScrapeRow = dRow
Dim DBScrapeMovie As Structures.DBMovie = Master.DB.LoadMovieFromDB(Convert.ToInt64(dRow.Item(0)))
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.BeforeEditMovie, Nothing, DBScrapeMovie)
'' BEGIN Plug-in Manager
' Convert Args.scrapeType into something that the plug-in will understand.
Dim ask As Boolean = False
Dim scrapeType As Ember.Plugins.Scraper.ScrapeType = scrapeType.Automatic
Select Case Args.scrapeType
Case Enums.ScrapeType.SingleScrape
ask = True
scrapeType = Scraper.ScrapeType.Manual
Case Enums.ScrapeType.FullAsk, _
Enums.ScrapeType.NewAsk, _
Enums.ScrapeType.UpdateAsk, _
Enums.ScrapeType.FilterAsk, _
Enums.ScrapeType.MarkAsk
ask = True
End Select
Dim context As New MovieInfoScraperActionContext(DBScrapeMovie, scrapeType, ask, Args.Options)
Dim result As PluginActionResult = PluginManager.MovieScraper.ScrapeMovieInfo(context)
If Not (result.Cancelled Or IsNothing(result.Result)) Then
DBScrapeMovie = CType(result.Result, Structures.DBMovie)
'' END Plug-in Manager
'If Not ModulesManager.Instance.MovieScrapeOnly(DBScrapeMovie, Args.scrapeType, Args.Options) Then
If Master.eSettings.ScanMediaInfo AndAlso Master.GlobalScrapeMod.Meta Then
MediaInfo.UpdateMediaInfo(DBScrapeMovie)
End If
If bwMovieScraper.CancellationPending Then Exit For
If Not Args.scrapeType = Enums.ScrapeType.SingleScrape Then
MovieScraperEvent(Enums.MovieScraperEventType.NFOItem, True)
NewTitle = DBScrapeMovie.ListTitle
If Not NewTitle = OldTitle Then
bwMovieScraper.ReportProgress(0, String.Format(Master.eLang.GetString(812, "Old Title: {0} | New Title: {1}"), OldTitle, NewTitle))
End If
MovieScraperEvent(Enums.MovieScraperEventType.ListTitle, NewTitle)
MovieScraperEvent(Enums.MovieScraperEventType.SortTitle, DBScrapeMovie.Movie.SortTitle)
'Dim didEts As Interfaces.ModuleResult = ModulesManager.Instance.MoviePostScrapeOnly(DBScrapeMovie, Args.scrapeType)
Dim imgContext As New MovieImageScraperActionContext(DBScrapeMovie, ImageScrapeType.Poster, scrapeType, context.AskIfMultipleResults)
PluginManager.MovieScraper.ScrapeMovieImage(imgContext)
imgContext = New MovieImageScraperActionContext(DBScrapeMovie, ImageScrapeType.Fanart, scrapeType, context.AskIfMultipleResults)
PluginManager.MovieScraper.ScrapeMovieImage(imgContext)
If bwMovieScraper.CancellationPending Then Exit For
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.MovieScraperRDYtoSave, Nothing, DBScrapeMovie)
If Master.GlobalScrapeMod.Extra Then
If Master.eSettings.AutoThumbs > 0 AndAlso DBScrapeMovie.isSingle Then
Dim params As New List(Of Object)(New Object() {DBScrapeMovie, Master.eSettings.AutoThumbs, False, ""})
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.RandomFrameExtrator, params, Nothing, True)
MovieScraperEvent(Enums.MovieScraperEventType.ThumbsItem, True)
Dim ETasFA As String = DirectCast(params(3), String)
If Not String.IsNullOrEmpty(ETasFA) Then
DBScrapeMovie.ExtraPath = "TRUE"
If Not ETasFA = "TRUE" Then
MovieScraperEvent(Enums.MovieScraperEventType.FanartItem, True)
DBScrapeMovie.FanartPath = ETasFA
End If
End If
End If
End If
Master.DB.SaveMovieToDB(DBScrapeMovie, False, False, Not String.IsNullOrEmpty(DBScrapeMovie.Movie.IMDBID))
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.MovieSync, Nothing, DBScrapeMovie)
bwMovieScraper.ReportProgress(-1, If(Not OldTitle = NewTitle, String.Format(Master.eLang.GetString(812, "Old Title: {0} | New Title: {1}"), OldTitle, NewTitle), NewTitle))
bwMovieScraper.ReportProgress(-2, dScrapeRow.Item(0).ToString)
Else
Master.tmpMovie = DBScrapeMovie.Movie
End If
Else
Master.tmpMovie = DBScrapeMovie.Movie
Args.scrapeType = Enums.ScrapeType.None
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
End Try
Next
RemoveHandler ModulesManager.Instance.MovieScraperEvent, AddressOf MovieScraperEvent
e.Result = New Results With {.scrapeType = Args.scrapeType}
End Sub
Private Sub bwMovieScraper_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles bwMovieScraper.ProgressChanged
If e.ProgressPercentage = -1 Then
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.Notification, New List(Of Object)(New Object() {"moviescraped", 3, Master.eLang.GetString(813, "Movie Scraped"), e.UserState.ToString, Nothing}))
ElseIf e.ProgressPercentage = -2 Then
If Me.dgvMediaList.SelectedRows.Count > 0 AndAlso Me.dgvMediaList.SelectedRows(0).Cells(0).Value.ToString = e.UserState.ToString Then
If Me.dgvMediaList.CurrentCell Is Me.dgvMediaList.SelectedRows(0).Cells(3) Then
Me.SelectRow(Me.dgvMediaList.SelectedRows(0).Index)
End If
End If
Else
Me.tspbLoading.Value += e.ProgressPercentage
Me.SetStatus(e.UserState.ToString)
End If
End Sub
Private Sub bwNonScrape_Completed(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwNonScrape.RunWorkerCompleted
Me.tslLoading.Visible = False
Me.tspbLoading.Visible = False
Me.btnCancel.Visible = False
Me.lblCanceling.Visible = False
Me.pbCanceling.Visible = False
Me.pnlCancel.Visible = False
Me.SetControlsEnabled(True)
Me.EnableFilters(True)
Me.Cursor = Cursors.Default
End Sub
Private Sub bwNonScrape_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwNonScrape.DoWork
Dim scrapeMovie As Structures.DBMovie
Dim iCount As Integer = 0
Dim Args As Arguments = DirectCast(e.Argument, Arguments)
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Try
If Me.dtMedia.Rows.Count > 0 Then
Select Case Args.scrapeType
Case Enums.ScrapeType.CleanFolders
Dim fDeleter As New FileUtils.Delete
For Each drvRow As DataRow In Me.dtMedia.Rows
Try
Me.bwNonScrape.ReportProgress(iCount, drvRow.Item(15))
iCount += 1
If Convert.ToBoolean(drvRow.Item(14)) Then Continue For
If Me.bwNonScrape.CancellationPending Then GoTo doCancel
scrapeMovie = Master.DB.LoadMovieFromDB(Convert.ToInt64(drvRow.Item(0)))
fDeleter.GetItemsToDelete(True, scrapeMovie)
Me.RefreshMovie(Convert.ToInt64(drvRow.Item(0)), True, True)
Me.bwNonScrape.ReportProgress(iCount, String.Format("[[{0}]]", drvRow.Item(0).ToString))
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
End Try
Next
Case Enums.ScrapeType.CopyBD
Dim sPath As String = String.Empty
For Each drvRow As DataRow In Me.dtMedia.Rows
Try
Me.bwNonScrape.ReportProgress(iCount, drvRow.Item(15).ToString)
iCount += 1
If Me.bwNonScrape.CancellationPending Then GoTo doCancel
sPath = drvRow.Item(37).ToString
If Not String.IsNullOrEmpty(sPath) Then
If FileUtils.Common.isVideoTS(sPath) Then
If Master.eSettings.VideoTSParent Then
FileUtils.Common.MoveFileWithStream(sPath, Path.Combine(Master.eSettings.BDPath, String.Concat(Path.Combine(Directory.GetParent(Directory.GetParent(sPath).FullName).FullName, Directory.GetParent(Directory.GetParent(sPath).FullName).Name), "-fanart.jpg")))
Else
If Path.GetFileName(sPath).ToLower = "fanart.jpg" Then
FileUtils.Common.MoveFileWithStream(sPath, Path.Combine(Master.eSettings.BDPath, String.Concat(Directory.GetParent(Directory.GetParent(sPath).FullName).Name, "-fanart.jpg")))
Else
FileUtils.Common.MoveFileWithStream(sPath, Path.Combine(Master.eSettings.BDPath, Path.GetFileName(sPath)))
End If
End If
ElseIf FileUtils.Common.isBDRip(sPath) Then
If Master.eSettings.VideoTSParent Then
FileUtils.Common.MoveFileWithStream(sPath, Path.Combine(Master.eSettings.BDPath, String.Concat(Path.Combine(Directory.GetParent(Directory.GetParent(Directory.GetParent(sPath).FullName).FullName).FullName, Directory.GetParent(Directory.GetParent(Directory.GetParent(sPath).FullName).FullName).Name), "-fanart.jpg")))
Else
If Path.GetFileName(sPath).ToLower = "fanart.jpg" Then
FileUtils.Common.MoveFileWithStream(sPath, Path.Combine(Master.eSettings.BDPath, String.Concat(Directory.GetParent(Directory.GetParent(Directory.GetParent(sPath).FullName).FullName).Name, "-fanart.jpg")))
Else
FileUtils.Common.MoveFileWithStream(sPath, Path.Combine(Master.eSettings.BDPath, Path.GetFileName(sPath)))
End If
End If
Else
If Path.GetFileName(sPath).ToLower = "fanart.jpg" Then
FileUtils.Common.MoveFileWithStream(sPath, Path.Combine(Master.eSettings.BDPath, String.Concat(Path.GetFileNameWithoutExtension(drvRow.Item(1).ToString), "-fanart.jpg")))
Else
FileUtils.Common.MoveFileWithStream(sPath, Path.Combine(Master.eSettings.BDPath, Path.GetFileName(sPath)))
End If
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
End Try
Next
End Select
doCancel:
If Not Args.scrapeType = Enums.ScrapeType.CopyBD Then
SQLtransaction.Commit()
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
End Try
End Using
End Sub
Private Sub bwNonScrape_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles bwNonScrape.ProgressChanged
If Not isCL Then
If Regex.IsMatch(e.UserState.ToString, "\[\[[0-9]+\]\]") AndAlso Me.dgvMediaList.SelectedRows.Count > 0 Then
Try
If Me.dgvMediaList.SelectedRows(0).Cells(0).Value.ToString = e.UserState.ToString.Replace("[[", String.Empty).Replace("]]", String.Empty).Trim Then
Me.SelectRow(Me.dgvMediaList.SelectedRows(0).Index)
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
End Try
Else
Me.SetStatus(e.UserState.ToString)
Me.tspbLoading.Value = e.ProgressPercentage
End If
End If
Me.dgvMediaList.Invalidate()
End Sub
Private Sub bwRefreshMovies_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwRefreshMovies.DoWork
Dim iCount As Integer = 0
Dim MovieIDs As New Dictionary(Of Long, String)
For Each sRow As DataRow In Me.dtMedia.Rows
MovieIDs.Add(Convert.ToInt64(sRow.Item(0)), sRow.Item(3).ToString)
Next
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
For Each KVP As KeyValuePair(Of Long, String) In MovieIDs
Try
If Me.bwMovieScraper.CancellationPending Then Return
Me.bwRefreshMovies.ReportProgress(iCount, KVP.Value)
Me.RefreshMovie(KVP.Key, True)
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error", False)
End Try
iCount += 1
Next
SQLtransaction.Commit()
End Using
End Sub
Private Sub bwRefreshMovies_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles bwRefreshMovies.ProgressChanged
Me.SetStatus(e.UserState.ToString)
Me.tspbLoading.Value = e.ProgressPercentage
End Sub
Private Sub bwRefreshMovies_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bwRefreshMovies.RunWorkerCompleted
Me.tslLoading.Text = String.Empty
Me.tspbLoading.Visible = False
Me.tslLoading.Visible = False
Me.FillList(0)
Me.Cursor = Cursors.Default
End Sub
Private Sub cbFilterFileSource_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterFileSource.SelectedIndexChanged
Try
While Me.fScanner.IsBusy OrElse Me.bwMediaInfo.IsBusy OrElse Me.bwLoadInfo.IsBusy OrElse Me.bwDownloadPic.IsBusy OrElse Me.bwMovieScraper.IsBusy OrElse Me.bwRefreshMovies.IsBusy OrElse Me.bwCleanDB.IsBusy
Application.DoEvents()
Threading.Thread.Sleep(50)
End While
For i As Integer = Me.FilterArray.Count - 1 To 0 Step -1
If Me.FilterArray(i).ToString.StartsWith("FileSource =") Then
Me.FilterArray.RemoveAt(i)
End If
Next
If Not cbFilterFileSource.Text = Master.eLang.All Then
Me.FilterArray.Add(String.Format("FileSource = '{0}'", If(cbFilterFileSource.Text = Master.eLang.None, String.Empty, cbFilterFileSource.Text)))
End If
Me.RunFilter()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cbFilterYearMod_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterYearMod.SelectedIndexChanged
Try
If Not String.IsNullOrEmpty(cbFilterYear.Text) AndAlso Not cbFilterYear.Text = Master.eLang.All Then
Me.FilterArray.Remove(Me.filYear)
Me.filYear = String.Empty
Me.filYear = String.Concat("Year ", cbFilterYearMod.Text, " '", cbFilterYear.Text, "'")
Me.FilterArray.Add(Me.filYear)
Me.RunFilter()
Else
If Not String.IsNullOrEmpty(Me.filYear) Then
Me.FilterArray.Remove(Me.filYear)
Me.filYear = String.Empty
Me.RunFilter()
End If
End If
Catch
End Try
End Sub
Private Sub cbFilterYear_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFilterYear.SelectedIndexChanged
Try
If Not String.IsNullOrEmpty(cbFilterYearMod.Text) AndAlso Not cbFilterYear.Text = Master.eLang.All Then
Me.FilterArray.Remove(Me.filYear)
Me.filYear = String.Empty
Me.filYear = String.Concat("Year ", cbFilterYearMod.Text, " '", cbFilterYear.Text, "'")
Me.FilterArray.Add(Me.filYear)
Me.RunFilter()
Else
If Not String.IsNullOrEmpty(Me.filYear) Then
Me.FilterArray.Remove(Me.filYear)
Me.filYear = String.Empty
Me.RunFilter()
End If
If cbFilterYear.Text = Master.eLang.All Then
Me.cbFilterYearMod.Text = String.Empty
End If
End If
Catch
End Try
End Sub
Private Sub cbSearch_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbSearch.SelectedIndexChanged
Me.txtSearch.Text = String.Empty
End Sub
Private Sub chkFilterDupe_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkFilterDupe.Click
Try
Me.RunFilter(True)
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub chkFilterLock_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkFilterLock.Click
Try
If Me.chkFilterLock.Checked Then
Me.FilterArray.Add("Lock = 1")
Else
Me.FilterArray.Remove("Lock = 1")
End If
Me.RunFilter()
Catch
End Try
End Sub
Private Sub chkFilterMark_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkFilterMark.Click
Try
If Me.chkFilterMark.Checked Then
Me.FilterArray.Add("mark = 1")
Else
Me.FilterArray.Remove("mark = 1")
End If
Me.RunFilter()
Catch
End Try
End Sub
Private Sub chkFilterMissing_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkFilterMissing.Click
Try
Dim MissingFilter As New List(Of String)
If Me.chkFilterMissing.Checked Then
With Master.eSettings
If .MissingFilterPoster Then MissingFilter.Add("HasPoster = 0")
If .MissingFilterFanart Then MissingFilter.Add("HasFanart = 0")
If .MissingFilterNFO Then MissingFilter.Add("HasNfo = 0")
If .MissingFilterTrailer Then MissingFilter.Add("HasTrailer = 0")
If .MissingFilterSubs Then MissingFilter.Add("HasSub = 0")
If .MissingFilterExtras Then MissingFilter.Add("HasExtra = 0")
End With
filMissing = Microsoft.VisualBasic.Strings.Join(MissingFilter.ToArray, " OR ")
Me.FilterArray.Add(filMissing)
Else
Me.FilterArray.Remove(filMissing)
End If
Me.RunFilter()
Catch
End Try
End Sub
Private Sub chkFilterNew_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkFilterNew.Click
Try
If Me.chkFilterNew.Checked Then
Me.FilterArray.Add("new = 1")
Else
Me.FilterArray.Remove("new = 1")
End If
Me.RunFilter()
Catch
End Try
End Sub
Private Sub chkFilterTolerance_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkFilterTolerance.Click
Try
If Me.chkFilterTolerance.Checked Then
Me.FilterArray.Add("OutOfTolerance = 1")
Else
Me.FilterArray.Remove("OutOfTolerance = 1")
End If
Me.RunFilter()
Catch
End Try
End Sub
Private Sub clbFilterGenres_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles clbFilterGenres.LostFocus
Try
Me.pnlFilterGenre.Visible = False
Me.pnlFilterGenre.Tag = "NO"
If clbFilterGenres.CheckedItems.Count > 0 Then
Me.txtFilterGenre.Text = String.Empty
Me.FilterArray.Remove(Me.filGenre)
Dim alGenres As New List(Of String)
alGenres.AddRange(clbFilterGenres.CheckedItems.OfType(Of String).ToList)
If rbFilterAnd.Checked Then
Me.txtFilterGenre.Text = Microsoft.VisualBasic.Strings.Join(alGenres.ToArray, " AND ")
Else
Me.txtFilterGenre.Text = Microsoft.VisualBasic.Strings.Join(alGenres.ToArray, " OR ")
End If
For i As Integer = 0 To alGenres.Count - 1
alGenres.Item(i) = String.Format("Genre LIKE '%{0}%'", alGenres.Item(i))
Next
If rbFilterAnd.Checked Then
Me.filGenre = String.Format("({0})", Microsoft.VisualBasic.Strings.Join(alGenres.ToArray, " AND "))
Else
Me.filGenre = String.Format("({0})", Microsoft.VisualBasic.Strings.Join(alGenres.ToArray, " OR "))
End If
Me.FilterArray.Add(Me.filGenre)
Me.RunFilter()
Else
If Not String.IsNullOrEmpty(Me.filGenre) Then
Me.txtFilterGenre.Text = String.Empty
Me.FilterArray.Remove(Me.filGenre)
Me.filGenre = String.Empty
Me.RunFilter()
End If
End If
Catch
End Try
End Sub
Private Sub clbFilterSource_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles clbFilterSource.LostFocus
Try
Me.pnlFilterSource.Visible = False
Me.pnlFilterSource.Tag = "NO"
If clbFilterSource.CheckedItems.Count > 0 Then
Me.txtFilterSource.Text = String.Empty
Me.FilterArray.Remove(Me.filSource)
Dim alSource As New List(Of String)
alSource.AddRange(clbFilterSource.CheckedItems.OfType(Of String).ToList)
Me.txtFilterSource.Text = Microsoft.VisualBasic.Strings.Join(alSource.ToArray, " | ")
For i As Integer = 0 To alSource.Count - 1
alSource.Item(i) = String.Format("Source = '{0}'", alSource.Item(i))
Next
Me.filSource = String.Format("({0})", Microsoft.VisualBasic.Strings.Join(alSource.ToArray, " OR "))
Me.FilterArray.Add(Me.filSource)
Me.RunFilter()
Else
If Not String.IsNullOrEmpty(Me.filSource) Then
Me.txtFilterSource.Text = String.Empty
Me.FilterArray.Remove(Me.filSource)
Me.filSource = String.Empty
Me.RunFilter()
End If
End If
Catch
End Try
End Sub
Private Sub CleanDatabaseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CleanDatabaseToolStripMenuItem.Click, CleanDatabaseToolStripMenuItem1.Click
Me.SetControlsEnabled(False, True)
Me.tspbLoading.Style = ProgressBarStyle.Marquee
Me.EnableFilters(False)
Me.SetStatus(Master.eLang.GetString(644, "Cleaning Database..."))
Me.tspbLoading.Visible = True
Me.bwCleanDB.WorkerSupportsCancellation = True
Me.bwCleanDB.RunWorkerAsync()
End Sub
Private Sub CleanFiles()
Try
Dim sWarning As String = String.Empty
Dim sWarningFile As String = String.Empty
With Master.eSettings
If .ExpertCleaner Then
sWarning = String.Concat(Master.eLang.GetString(102, "WARNING: If you continue, all non-whitelisted file types will be deleted!"), vbNewLine, vbNewLine, Master.eLang.GetString(101, "Are you sure you want to continue?"))
Else
If .CleanDotFanartJPG Then sWarningFile += String.Concat("<movie>.fanart.jpg", vbNewLine)
If .CleanFanartJPG Then sWarningFile += String.Concat("fanart.jpg", vbNewLine)
If .CleanFolderJPG Then sWarningFile += String.Concat("folder.jpg", vbNewLine)
If .CleanMovieFanartJPG Then sWarningFile += String.Concat("<movie>-fanart.jpg", vbNewLine)
If .CleanMovieJPG Then sWarningFile += String.Concat("movie.jpg", vbNewLine)
If .CleanMovieNameJPG Then sWarningFile += String.Concat("<movie>.jpg", vbNewLine)
If .CleanMovieNFO Then sWarningFile += String.Concat("movie.nfo", vbNewLine)
If .CleanMovieNFOB Then sWarningFile += String.Concat("<movie>.nfo", vbNewLine)
If .CleanMovieTBN Then sWarningFile += String.Concat("movie.tbn", vbNewLine)
If .CleanMovieTBNB Then sWarningFile += String.Concat("<movie>.tbn", vbNewLine)
If .CleanPosterJPG Then sWarningFile += String.Concat("poster.jpg", vbNewLine)
If .CleanPosterTBN Then sWarningFile += String.Concat("poster.tbn", vbNewLine)
If .CleanExtraThumbs Then sWarningFile += String.Concat("/extrathumbs/", vbNewLine)
sWarning = String.Concat(Master.eLang.GetString(103, "WARNING: If you continue, all files of the following types will be permanently deleted:"), vbNewLine, vbNewLine, sWarningFile, vbNewLine, Master.eLang.GetString(101, "Are you sure you want to continue?"))
End If
End With
If MsgBox(sWarning, MsgBoxStyle.Critical Or MsgBoxStyle.YesNo, Master.eLang.GetString(104, "Are you sure?")) = MsgBoxResult.Yes Then
Me.NonScrape(Enums.ScrapeType.CleanFolders, Nothing)
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub CleanFoldersToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CleanFoldersToolStripMenuItem.Click, CleanFilesToolStripMenuItem.Click
Me.CleanFiles()
End Sub
Private Sub ClearAllCachesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearAllCachesToolStripMenuItem.Click, ClearAllCachesToolStripMenuItem1.Click
Me.ClearCache()
End Sub
Private Sub ClearCache()
If Directory.Exists(Master.TempPath) Then
Dim dInfo As New DirectoryInfo(Master.TempPath)
For Each dDir As DirectoryInfo In dInfo.GetDirectories.Where(Function(d) Not d.Name.ToLower = "shows" AndAlso Not d.Name.ToLower = "addons")
FileUtils.Delete.DeleteDirectory(dDir.FullName)
Next
For Each fFile As FileInfo In dInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly)
fFile.Delete()
Next
Else
Directory.CreateDirectory(Master.TempPath)
End If
End Sub
Private Sub ClearFilters(Optional ByVal Reload As Boolean = False)
Try
Me.bsMedia.RemoveFilter()
Me.FilterArray.Clear()
Me.filSearch = String.Empty
Me.filGenre = String.Empty
Me.filYear = String.Empty
Me.filSource = String.Empty
RemoveHandler txtSearch.TextChanged, AddressOf txtSearch_TextChanged
Me.txtSearch.Text = String.Empty
AddHandler txtSearch.TextChanged, AddressOf txtSearch_TextChanged
If Me.cbSearch.Items.Count > 0 Then
Me.cbSearch.SelectedIndex = 0
End If
Me.chkFilterDupe.Checked = False
Me.chkFilterTolerance.Checked = False
Me.chkFilterMissing.Checked = False
Me.chkFilterMark.Checked = False
Me.chkFilterNew.Checked = False
Me.chkFilterLock.Checked = False
Me.rbFilterOr.Checked = False
Me.rbFilterAnd.Checked = True
Me.txtFilterGenre.Text = String.Empty
For i As Integer = 0 To Me.clbFilterGenres.Items.Count - 1
Me.clbFilterGenres.SetItemChecked(i, False)
Next
Me.txtFilterSource.Text = String.Empty
For i As Integer = 0 To Me.clbFilterSource.Items.Count - 1
Me.clbFilterSource.SetItemChecked(i, False)
Next
RemoveHandler cbFilterYear.SelectedIndexChanged, AddressOf cbFilterYear_SelectedIndexChanged
If Me.cbFilterYear.Items.Count > 0 Then
Me.cbFilterYear.SelectedIndex = 0
End If
AddHandler cbFilterYear.SelectedIndexChanged, AddressOf cbFilterYear_SelectedIndexChanged
RemoveHandler cbFilterYearMod.SelectedIndexChanged, AddressOf cbFilterYearMod_SelectedIndexChanged
If Me.cbFilterYearMod.Items.Count > 0 Then
Me.cbFilterYearMod.SelectedIndex = 0
End If
AddHandler cbFilterYearMod.SelectedIndexChanged, AddressOf cbFilterYearMod_SelectedIndexChanged
RemoveHandler cbFilterFileSource.SelectedIndexChanged, AddressOf cbFilterFileSource_SelectedIndexChanged
If Me.cbFilterFileSource.Items.Count > 0 Then
Me.cbFilterFileSource.SelectedIndex = 0
End If
AddHandler cbFilterFileSource.SelectedIndexChanged, AddressOf cbFilterFileSource_SelectedIndexChanged
If Reload Then Me.FillList(0)
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnShowOpenFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuShowOpenFolder.Click
If Me.dgvTVShows.SelectedRows.Count > 0 Then
Dim doOpen As Boolean = True
If Me.dgvTVShows.SelectedRows.Count > 10 Then
If Not MsgBox(String.Format(Master.eLang.GetString(635, "You have selected {0} folders to open. Are you sure you want to do this?"), Me.dgvTVShows.SelectedRows.Count), MsgBoxStyle.YesNo Or MsgBoxStyle.Question, Master.eLang.GetString(104, "Are You Sure?")) = MsgBoxResult.Yes Then doOpen = False
End If
If doOpen Then
For Each sRow As DataGridViewRow In Me.dgvTVShows.SelectedRows
Using Explorer As New Diagnostics.Process
If Master.isWindows Then
Explorer.StartInfo.FileName = "explorer.exe"
Explorer.StartInfo.Arguments = String.Format("/select,""{0}""", sRow.Cells(7).Value.ToString)
Else
Explorer.StartInfo.FileName = "xdg-open"
Explorer.StartInfo.Arguments = String.Format("""{0}""", sRow.Cells(7).Value.ToString)
End If
Explorer.Start()
End Using
Next
End If
End If
End Sub
Private Sub cmnuChangeEp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuChangeEp.Click
Me.SetControlsEnabled(False, True)
Dim tEpisode As MediaContainers.EpisodeDetails = ModulesManager.Instance.ChangeEpisode(Convert.ToInt32(Master.currShow.ShowID), Me.tmpTVDB, Me.tmpLang)
If Not IsNothing(tEpisode) Then
Master.currShow.TVEp = tEpisode
Master.currShow.EpPosterPath = tEpisode.Poster.SaveAsEpPoster(Master.currShow)
Master.DB.SaveTVEpToDB(Master.currShow, False, True, False, True)
Me.FillEpisodes(Convert.ToInt32(Master.currShow.ShowID), Convert.ToInt32(Me.dgvTVSeasons.SelectedRows(0).Cells(2).Value))
End If
Me.SetControlsEnabled(True)
End Sub
Private Sub cmnuChangeShow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmnuChangeShow.Click
Me.SetControlsEnabled(False, True)
Dim Lang As String = Me.dgvTVShows.Item(22, Me.dgvTVShows.SelectedRows(0).Index).Value.ToString
ModulesManager.Instance.TVScrapeOnly(Convert.ToInt32(Me.dgvTVShows.Item(0, Me.dgvTVShows.SelectedRows(0).Index).Value), Me.dgvTVShows.Item(1, Me.dgvTVShows.SelectedRows(0).Index).Value.ToString, String.Empty, If(String.IsNullOrEmpty(Lang), Master.eSettings.TVDBLanguage, Lang), DirectCast(Convert.ToInt32(Me.dgvTVShows.Item(23, Me.dgvTVShows.SelectedRows(0).Index).Value), Enums.Ordering), Master.DefaultTVOptions, Enums.ScrapeType.FullAsk, False)
End Sub
Private Sub cmnuDeleteSeason_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmnuDeleteSeason.Click
Try
Dim SeasonsToDelete As New Dictionary(Of Long, Long)
Dim ShowId As Long = -1
Dim SeasonNum As Integer = -1
For Each sRow As DataGridViewRow In Me.dgvTVSeasons.SelectedRows
ShowId = Convert.ToInt64(sRow.Cells(0).Value)
SeasonNum = Convert.ToInt32(sRow.Cells(2).Value)
'seasonnum first... showid can't be key or else only one season will be deleted
If Not SeasonsToDelete.ContainsKey(SeasonNum) Then
SeasonsToDelete.Add(SeasonNum, ShowId)
End If
Next
If SeasonsToDelete.Count > 0 Then
Using dlg As New dlgDeleteConfirm
If dlg.ShowDialog(SeasonsToDelete, Enums.DelType.Seasons) = Windows.Forms.DialogResult.OK Then
Me.FillSeasons(Convert.ToInt32(Me.dgvTVSeasons.Item(0, Me.currSeasonRow).Value))
Me.SetTVCount()
End If
End Using
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuDeleteTVEp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuDeleteTVEp.Click
Try
Dim EpsToDelete As New Dictionary(Of Long, Long)
Dim EpId As Long = -1
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.SelectedRows
EpId = Convert.ToInt64(sRow.Cells(0).Value)
If Not EpsToDelete.ContainsKey(EpId) Then
EpsToDelete.Add(EpId, 0)
End If
Next
If EpsToDelete.Count > 0 Then
Using dlg As New dlgDeleteConfirm
If dlg.ShowDialog(EpsToDelete, Enums.DelType.Episodes) = Windows.Forms.DialogResult.OK Then
Me.FillEpisodes(Convert.ToInt32(Me.dgvTVSeasons.Item(0, Me.currSeasonRow).Value), Convert.ToInt32(Me.dgvTVSeasons.Item(2, Me.currSeasonRow).Value))
Me.SetTVCount()
End If
End Using
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuDeleteTVShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuDeleteTVShow.Click
Try
Dim ShowsToDelete As New Dictionary(Of Long, Long)
Dim ShowId As Long = -1
For Each sRow As DataGridViewRow In Me.dgvTVShows.SelectedRows
ShowId = Convert.ToInt64(sRow.Cells(0).Value)
If Not ShowsToDelete.ContainsKey(ShowId) Then
ShowsToDelete.Add(ShowId, 0)
End If
Next
If ShowsToDelete.Count > 0 Then
Using dlg As New dlgDeleteConfirm
If dlg.ShowDialog(ShowsToDelete, Enums.DelType.Shows) = Windows.Forms.DialogResult.OK Then
Me.FillList(0)
End If
End Using
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuEditEpisode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuEditEpisode.Click
Try
Dim indX As Integer = Me.dgvTVEpisodes.SelectedRows(0).Index
Dim ID As Integer = Convert.ToInt32(Me.dgvTVEpisodes.Item(0, indX).Value)
Master.currShow = Master.DB.LoadTVEpFromDB(ID, True)
Me.SetControlsEnabled(False)
Using dEditEpisode As New dlgEditEpisode
AddHandler ModulesManager.Instance.GenericEvent, AddressOf dEditEpisode.GenericRunCallBack
Select Case dEditEpisode.ShowDialog()
Case Windows.Forms.DialogResult.OK
If Me.RefreshEpisode(ID) Then
Me.FillEpisodes(Convert.ToInt32(Master.currShow.ShowID), Master.currShow.TVEp.Season)
End If
End Select
RemoveHandler ModulesManager.Instance.GenericEvent, AddressOf dEditEpisode.GenericRunCallBack
End Using
Me.SetControlsEnabled(True)
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuEditMovie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuEditMovie.Click
If Me.dgvMediaList.SelectedRows.Count > 1 Then Return
Try
Dim indX As Integer = Me.dgvMediaList.SelectedRows(0).Index
Dim ID As Integer = Convert.ToInt32(Me.dgvMediaList.Item(0, indX).Value)
Me.SetControlsEnabled(False)
Using dEditMovie As New dlgEditMovie(Me)
AddHandler ModulesManager.Instance.GenericEvent, AddressOf dEditMovie.GenericRunCallBack
Select Case dEditMovie.ShowDialog()
Case Windows.Forms.DialogResult.OK
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.MovieScraperRDYtoSave, Nothing, Master.currMovie)
Me.SetListItemAfterEdit(ID, indX)
If Me.RefreshMovie(ID) Then
Me.FillList(0)
Else
Me.SetControlsEnabled(True)
End If
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.MovieSync, Nothing, Master.currMovie)
Case Windows.Forms.DialogResult.Retry
Functions.SetScraperMod(Enums.ModType.All, True, True)
Me.MovieScrapeData(True, Enums.ScrapeType.SingleScrape, Master.DefaultOptions)
Case Windows.Forms.DialogResult.Abort
Master.currMovie.ClearExtras = False
Functions.SetScraperMod(Enums.ModType.DoSearch, True)
Functions.SetScraperMod(Enums.ModType.All, True, False)
Me.MovieScrapeData(True, Enums.ScrapeType.SingleScrape, Master.DefaultOptions)
Case Else
If Me.InfoCleared Then
Me.LoadInfo(ID, Me.dgvMediaList.Item(1, indX).Value.ToString, True, False)
Else
Me.SetControlsEnabled(True)
End If
End Select
RemoveHandler ModulesManager.Instance.GenericEvent, AddressOf dEditMovie.GenericRunCallBack
End Using
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuEditShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuEditShow.Click
Try
Dim indX As Integer = Me.dgvTVShows.SelectedRows(0).Index
Dim ID As Integer = Convert.ToInt32(Me.dgvTVShows.Item(0, indX).Value)
Master.currShow = Master.DB.LoadTVFullShowFromDB(ID)
Me.SetControlsEnabled(False)
Using dEditShow As New dlgEditShow
Select Case dEditShow.ShowDialog()
Case Windows.Forms.DialogResult.OK
Me.SetShowListItemAfterEdit(ID, indX)
If Me.RefreshShow(ID, False, True, False, False) Then
Me.FillList(0)
Else
Me.SetControlsEnabled(True)
End If
Case Else
Me.SetControlsEnabled(True)
End Select
End Using
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuEpOpenFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuEpOpenFolder.Click
If Me.dgvTVEpisodes.SelectedRows.Count > 0 Then
Dim doOpen As Boolean = True
Dim ePath As String = String.Empty
If Me.dgvTVEpisodes.SelectedRows.Count > 10 Then
If Not MsgBox(String.Format(Master.eLang.GetString(635, "You have selected {0} folders to open. Are you sure you want to do this?"), Me.dgvTVEpisodes.SelectedRows.Count), MsgBoxStyle.YesNo Or MsgBoxStyle.Question, Master.eLang.GetString(104, "Are You Sure?")) = MsgBoxResult.Yes Then doOpen = False
End If
If doOpen Then
Using SQLCommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.SelectedRows
SQLCommand.CommandText = String.Concat("SELECT TVEpPath FROM TVEpPaths WHERE ID = ", sRow.Cells(9).Value.ToString, ";")
ePath = SQLCommand.ExecuteScalar.ToString
If Not String.IsNullOrEmpty(ePath) Then
Using Explorer As New Diagnostics.Process
If Master.isWindows Then
Explorer.StartInfo.FileName = "explorer.exe"
Explorer.StartInfo.Arguments = String.Format("/select,""{0}""", ePath)
Else
Explorer.StartInfo.FileName = "xdg-open"
Explorer.StartInfo.Arguments = String.Format("""{0}""", ePath)
End If
Explorer.Start()
End Using
End If
Next
End Using
End If
End If
End Sub
Private Sub cmnuLockEp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuLockEp.Click
Try
Dim setLock As Boolean = False
If Me.dgvTVEpisodes.SelectedRows.Count > 1 Then
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.SelectedRows
'if any one item is set as unlocked, set menu to lock
'else they are all locked so set menu to unlock
If Not Convert.ToBoolean(sRow.Cells(11).Value) Then
setLock = True
Exit For
End If
Next
End If
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parLock As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parLock", DbType.Boolean, 0, "lock")
Dim parID As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parID", DbType.Int32, 0, "id")
SQLcommand.CommandText = "UPDATE TVShows SET lock = (?) WHERE id = (?);"
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.SelectedRows
parLock.Value = If(Me.dgvTVEpisodes.SelectedRows.Count > 1, setLock, Not Convert.ToBoolean(sRow.Cells(11).Value))
parID.Value = sRow.Cells(0).Value
SQLcommand.ExecuteNonQuery()
sRow.Cells(11).Value = parLock.Value
Next
End Using
'now check the status of all episodes in the season so we can update the season lock flag if needed
Dim LockCount As Integer = 0
Dim NotLockCount As Integer = 0
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.Rows
If Convert.ToBoolean(sRow.Cells(11).Value) Then
LockCount += 1
Else
NotLockCount += 1
End If
Next
If LockCount = 0 OrElse NotLockCount = 0 Then
Using SQLSeacommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parSeaLock As SQLite.SQLiteParameter = SQLSeacommand.Parameters.Add("parSeaLock", DbType.Boolean, 0, "lock")
Dim parSeaID As SQLite.SQLiteParameter = SQLSeacommand.Parameters.Add("parSeaID", DbType.Int32, 0, "TVShowID")
Dim parSeason As SQLite.SQLiteParameter = SQLSeacommand.Parameters.Add("parSeason", DbType.Int32, 0, "Season")
SQLSeacommand.CommandText = "UPDATE TVSeason SET lock = (?) WHERE TVShowID = (?) AND Season = (?);"
If LockCount = 0 Then
parSeaLock.Value = False
ElseIf NotLockCount = 0 Then
parSeaLock.Value = True
End If
parSeaID.Value = Convert.ToInt32(Me.dgvTVSeasons.SelectedRows(0).Cells(0).Value)
parSeason.Value = Convert.ToInt32(Me.dgvTVSeasons.SelectedRows(0).Cells(2).Value)
SQLSeacommand.ExecuteNonQuery()
Me.dgvTVSeasons.SelectedRows(0).Cells(7).Value = parSeaLock.Value
End Using
End If
SQLtransaction.Commit()
End Using
Me.dgvTVEpisodes.Invalidate()
Me.dgvTVSeasons.Invalidate()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuLockSeason_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuLockSeason.Click
Try
Dim setLock As Boolean = False
If Me.dgvTVSeasons.SelectedRows.Count > 1 Then
For Each sRow As DataGridViewRow In Me.dgvTVSeasons.SelectedRows
If Not Convert.ToBoolean(sRow.Cells(7).Value) Then
setLock = True
Exit For
End If
Next
End If
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parLock As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parLock", DbType.Boolean, 0, "mark")
Dim parID As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parID", DbType.Int32, 0, "TVShowID")
Dim parSeason As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parSeason", DbType.Int32, 0, "Season")
SQLcommand.CommandText = "UPDATE TVSeason SET Lock = (?) WHERE TVShowID = (?) AND Season = (?);"
For Each sRow As DataGridViewRow In Me.dgvTVSeasons.SelectedRows
parLock.Value = If(Me.dgvTVSeasons.SelectedRows.Count > 1, setLock, Not Convert.ToBoolean(sRow.Cells(7).Value))
parID.Value = sRow.Cells(0).Value
parSeason.Value = sRow.Cells(2).Value
SQLcommand.ExecuteNonQuery()
sRow.Cells(7).Value = parLock.Value
Using SQLECommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parELock As SQLite.SQLiteParameter = SQLECommand.Parameters.Add("parELock", DbType.Boolean, 0, "mark")
Dim parEID As SQLite.SQLiteParameter = SQLECommand.Parameters.Add("parEID", DbType.Int32, 0, "TVShowID")
Dim parESeason As SQLite.SQLiteParameter = SQLECommand.Parameters.Add("parESeason", DbType.Int32, 0, "Season")
SQLECommand.CommandText = "UPDATE TVEps SET Lock = (?) WHERE TVShowID = (?) AND Season = (?);"
parELock.Value = parLock.Value
parEID.Value = parID.Value
parESeason.Value = parSeason.Value
SQLECommand.ExecuteNonQuery()
For Each eRow As DataGridViewRow In Me.dgvTVEpisodes.Rows
eRow.Cells(11).Value = parLock.Value
Next
End Using
Next
End Using
SQLtransaction.Commit()
End Using
Me.dgvTVSeasons.Invalidate()
Me.dgvTVEpisodes.Invalidate()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuLockShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuLockShow.Click
Try
Dim setLock As Boolean = False
If Me.dgvTVShows.SelectedRows.Count > 1 Then
For Each sRow As DataGridViewRow In Me.dgvTVShows.SelectedRows
'if any one item is set as unlocked, set menu to lock
'else they are all locked so set menu to unlock
If Not Convert.ToBoolean(sRow.Cells(10).Value) Then
setLock = True
Exit For
End If
Next
End If
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parLock As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parLock", DbType.Boolean, 0, "lock")
Dim parID As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parID", DbType.Int32, 0, "id")
SQLcommand.CommandText = "UPDATE TVShows SET lock = (?) WHERE id = (?);"
For Each sRow As DataGridViewRow In Me.dgvTVShows.SelectedRows
parLock.Value = If(Me.dgvTVShows.SelectedRows.Count > 1, setLock, Not Convert.ToBoolean(sRow.Cells(10).Value))
parID.Value = sRow.Cells(0).Value
SQLcommand.ExecuteNonQuery()
sRow.Cells(10).Value = parLock.Value
Using SQLSeaCommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parSeaLock As SQLite.SQLiteParameter = SQLSeaCommand.Parameters.Add("parSeaLock", DbType.Boolean, 0, "lock")
Dim parSeaID As SQLite.SQLiteParameter = SQLSeaCommand.Parameters.Add("parSeaID", DbType.Int32, 0, "TVShowID")
SQLSeaCommand.CommandText = "UPDATE TVSeason SET lock = (?) WHERE TVShowID = (?);"
parSeaLock.Value = parLock.Value
parSeaID.Value = parID.Value
SQLSeaCommand.ExecuteNonQuery()
For Each eRow As DataGridViewRow In Me.dgvTVSeasons.Rows
eRow.Cells(7).Value = parLock.Value
Next
End Using
Using SQLECommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parELock As SQLite.SQLiteParameter = SQLECommand.Parameters.Add("parELock", DbType.Boolean, 0, "lock")
Dim parEID As SQLite.SQLiteParameter = SQLECommand.Parameters.Add("parEID", DbType.Int32, 0, "TVShowID")
SQLECommand.CommandText = "UPDATE TVEps SET lock = (?) WHERE TVShowID = (?);"
parELock.Value = parLock.Value
parEID.Value = parID.Value
SQLECommand.ExecuteNonQuery()
For Each eRow As DataGridViewRow In Me.dgvTVEpisodes.Rows
eRow.Cells(11).Value = parLock.Value
Next
End Using
Next
End Using
SQLtransaction.Commit()
End Using
Me.dgvTVShows.Invalidate()
Me.dgvTVSeasons.Invalidate()
Me.dgvTVEpisodes.Invalidate()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuLock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuLock.Click
Try
Dim setLock As Boolean = False
If Me.dgvMediaList.SelectedRows.Count > 1 Then
For Each sRow As DataGridViewRow In Me.dgvMediaList.SelectedRows
'if any one item is set as unlocked, set menu to lock
'else they are all locked so set menu to unlock
If Not Convert.ToBoolean(sRow.Cells(14).Value) Then
setLock = True
Exit For
End If
Next
End If
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parLock As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parLock", DbType.Boolean, 0, "lock")
Dim parID As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parID", DbType.Int32, 0, "id")
SQLcommand.CommandText = "UPDATE movies SET lock = (?) WHERE id = (?);"
For Each sRow As DataGridViewRow In Me.dgvMediaList.SelectedRows
parLock.Value = If(Me.dgvMediaList.SelectedRows.Count > 1, setLock, Not Convert.ToBoolean(sRow.Cells(14).Value))
parID.Value = sRow.Cells(0).Value
SQLcommand.ExecuteNonQuery()
sRow.Cells(14).Value = parLock.Value
Next
End Using
SQLtransaction.Commit()
End Using
If Me.chkFilterLock.Checked Then
Me.dgvMediaList.ClearSelection()
Me.dgvMediaList.CurrentCell = Nothing
If Me.dgvMediaList.RowCount <= 0 Then Me.ClearInfo()
End If
Me.dgvMediaList.Invalidate()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuMarkEp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuMarkEp.Click
Try
Dim setMark As Boolean = False
If Me.dgvTVEpisodes.SelectedRows.Count > 1 Then
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.SelectedRows
'if any one item is set as unmarked, set menu to mark
'else they are all marked, so set menu to unmark
If Not Convert.ToBoolean(sRow.Cells(8).Value) Then
setMark = True
Exit For
End If
Next
End If
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parMark As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parMark", DbType.Boolean, 0, "mark")
Dim parID As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parID", DbType.Int32, 0, "id")
SQLcommand.CommandText = "UPDATE TVEps SET mark = (?) WHERE id = (?);"
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.SelectedRows
parMark.Value = If(Me.dgvTVEpisodes.SelectedRows.Count > 1, setMark, Not Convert.ToBoolean(sRow.Cells(8).Value))
parID.Value = sRow.Cells(0).Value
SQLcommand.ExecuteNonQuery()
sRow.Cells(8).Value = parMark.Value
Next
End Using
'now check the status of all episodes in the season so we can update the season mark flag if needed
Dim MarkCount As Integer = 0
Dim NotMarkCount As Integer = 0
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.Rows
If Convert.ToBoolean(sRow.Cells(8).Value) Then
MarkCount += 1
Else
NotMarkCount += 1
End If
Next
If MarkCount = 0 OrElse NotMarkCount = 0 Then
Using SQLSeacommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parSeaMark As SQLite.SQLiteParameter = SQLSeacommand.Parameters.Add("parSeaMark", DbType.Boolean, 0, "Mark")
Dim parSeaID As SQLite.SQLiteParameter = SQLSeacommand.Parameters.Add("parSeaID", DbType.Int32, 0, "TVShowID")
Dim parSeason As SQLite.SQLiteParameter = SQLSeacommand.Parameters.Add("parSeason", DbType.Int32, 0, "Season")
SQLSeacommand.CommandText = "UPDATE TVSeason SET Mark = (?) WHERE TVShowID = (?) AND Season = (?);"
If MarkCount = 0 Then
parSeaMark.Value = False
ElseIf NotMarkCount = 0 Then
parSeaMark.Value = True
End If
parSeaID.Value = Convert.ToInt32(Me.dgvTVSeasons.SelectedRows(0).Cells(0).Value)
parSeason.Value = Convert.ToInt32(Me.dgvTVSeasons.SelectedRows(0).Cells(2).Value)
SQLSeacommand.ExecuteNonQuery()
Me.dgvTVSeasons.SelectedRows(0).Cells(8).Value = parSeaMark.Value
End Using
End If
SQLtransaction.Commit()
End Using
Me.dgvTVSeasons.Invalidate()
Me.dgvTVEpisodes.Invalidate()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuMarkSeason_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuMarkSeason.Click
Try
Dim setMark As Boolean = False
If Me.dgvTVSeasons.SelectedRows.Count > 1 Then
For Each sRow As DataGridViewRow In Me.dgvTVSeasons.SelectedRows
If Not Convert.ToBoolean(sRow.Cells(8).Value) Then
setMark = True
Exit For
End If
Next
End If
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parMark As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parMark", DbType.Boolean, 0, "mark")
Dim parID As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parID", DbType.Int32, 0, "TVShowID")
Dim parSeason As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parSeason", DbType.Int32, 0, "Season")
SQLcommand.CommandText = "UPDATE TVSeason SET mark = (?) WHERE TVShowID = (?) AND Season = (?);"
For Each sRow As DataGridViewRow In Me.dgvTVSeasons.SelectedRows
parMark.Value = If(Me.dgvTVSeasons.SelectedRows.Count > 1, setMark, Not Convert.ToBoolean(sRow.Cells(8).Value))
parID.Value = sRow.Cells(0).Value
parSeason.Value = sRow.Cells(2).Value
SQLcommand.ExecuteNonQuery()
sRow.Cells(8).Value = parMark.Value
Using SQLECommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parEMark As SQLite.SQLiteParameter = SQLECommand.Parameters.Add("parEMark", DbType.Boolean, 0, "mark")
Dim parEID As SQLite.SQLiteParameter = SQLECommand.Parameters.Add("parEID", DbType.Int32, 0, "TVShowID")
Dim parESeason As SQLite.SQLiteParameter = SQLECommand.Parameters.Add("parESeason", DbType.Int32, 0, "Season")
SQLECommand.CommandText = "UPDATE TVEps SET mark = (?) WHERE TVShowID = (?) AND Season = (?);"
parEMark.Value = parMark.Value
parEID.Value = parID.Value
parESeason.Value = parSeason.Value
SQLECommand.ExecuteNonQuery()
For Each eRow As DataGridViewRow In Me.dgvTVEpisodes.Rows
eRow.Cells(8).Value = parMark.Value
Next
End Using
Next
End Using
SQLtransaction.Commit()
End Using
Me.dgvTVSeasons.Invalidate()
Me.dgvTVEpisodes.Invalidate()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuMarkShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuMarkShow.Click
Try
Dim setMark As Boolean = False
If Me.dgvTVShows.SelectedRows.Count > 1 Then
For Each sRow As DataGridViewRow In Me.dgvTVShows.SelectedRows
'if any one item is set as unmarked, set menu to mark
'else they are all marked, so set menu to unmark
If Not Convert.ToBoolean(sRow.Cells(6).Value) Then
setMark = True
Exit For
End If
Next
End If
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parMark As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parMark", DbType.Boolean, 0, "mark")
Dim parID As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parID", DbType.Int32, 0, "id")
SQLcommand.CommandText = "UPDATE TVShows SET mark = (?) WHERE id = (?);"
For Each sRow As DataGridViewRow In Me.dgvTVShows.SelectedRows
parMark.Value = If(Me.dgvTVShows.SelectedRows.Count > 1, setMark, Not Convert.ToBoolean(sRow.Cells(6).Value))
parID.Value = sRow.Cells(0).Value
SQLcommand.ExecuteNonQuery()
sRow.Cells(6).Value = parMark.Value
Using SQLSeaCommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parSeaMark As SQLite.SQLiteParameter = SQLSeaCommand.Parameters.Add("parSeaMark", DbType.Boolean, 0, "mark")
Dim parSeaID As SQLite.SQLiteParameter = SQLSeaCommand.Parameters.Add("parSeaID", DbType.Int32, 0, "TVShowID")
SQLSeaCommand.CommandText = "UPDATE TVSeason SET mark = (?) WHERE TVShowID = (?);"
parSeaMark.Value = parMark.Value
parSeaID.Value = parID.Value
SQLSeaCommand.ExecuteNonQuery()
For Each eRow As DataGridViewRow In Me.dgvTVSeasons.Rows
eRow.Cells(8).Value = parMark.Value
Next
End Using
Using SQLECommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parEMark As SQLite.SQLiteParameter = SQLECommand.Parameters.Add("parEMark", DbType.Boolean, 0, "mark")
Dim parEID As SQLite.SQLiteParameter = SQLECommand.Parameters.Add("parEID", DbType.Int32, 0, "TVShowID")
SQLECommand.CommandText = "UPDATE TVEps SET mark = (?) WHERE TVShowID = (?);"
parEMark.Value = parMark.Value
parEID.Value = parID.Value
SQLECommand.ExecuteNonQuery()
For Each eRow As DataGridViewRow In Me.dgvTVEpisodes.Rows
eRow.Cells(8).Value = parMark.Value
Next
End Using
Next
End Using
SQLtransaction.Commit()
End Using
Me.dgvTVShows.Invalidate()
Me.dgvTVSeasons.Invalidate()
Me.dgvTVEpisodes.Invalidate()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuMark_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuMark.Click
Try
Dim setMark As Boolean = False
If Me.dgvMediaList.SelectedRows.Count > 1 Then
For Each sRow As DataGridViewRow In Me.dgvMediaList.SelectedRows
'if any one item is set as unmarked, set menu to mark
'else they are all marked, so set menu to unmark
If Not Convert.ToBoolean(sRow.Cells(11).Value) Then
setMark = True
Exit For
End If
Next
End If
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
Dim parMark As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parMark", DbType.Boolean, 0, "mark")
Dim parID As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parID", DbType.Int32, 0, "id")
SQLcommand.CommandText = "UPDATE movies SET mark = (?) WHERE id = (?);"
For Each sRow As DataGridViewRow In Me.dgvMediaList.SelectedRows
parMark.Value = If(Me.dgvMediaList.SelectedRows.Count > 1, setMark, Not Convert.ToBoolean(sRow.Cells(11).Value))
parID.Value = sRow.Cells(0).Value
SQLcommand.ExecuteNonQuery()
sRow.Cells(11).Value = parMark.Value
Next
End Using
SQLtransaction.Commit()
End Using
setMark = False
For Each sRow As DataGridViewRow In Me.dgvMediaList.Rows
If Convert.ToBoolean(sRow.Cells(11).Value) Then
setMark = True
Exit For
End If
Next
Me.btnMarkAll.Text = If(setMark, Master.eLang.GetString(105, "Unmark All"), Master.eLang.GetString(35, "Mark All"))
If Me.chkFilterMark.Checked Then
Me.dgvMediaList.ClearSelection()
Me.dgvMediaList.CurrentCell = Nothing
If Me.dgvMediaList.RowCount <= 0 Then Me.ClearInfo()
End If
Me.dgvMediaList.Invalidate()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuMetaData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuMetaData.Click
If Me.dgvMediaList.SelectedRows.Count > 1 Then Return
Dim indX As Integer = Me.dgvMediaList.SelectedRows(0).Index
Dim ID As Integer = Convert.ToInt32(Me.dgvMediaList.Item(0, indX).Value)
Using dEditMeta As New dlgFileInfo
Select Case dEditMeta.ShowDialog(False)
Case Windows.Forms.DialogResult.OK
Me.SetListItemAfterEdit(ID, indX)
If Me.RefreshMovie(ID) Then
Me.FillList(0)
End If
End Select
End Using
End Sub
Private Sub cmnuRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuRefresh.Click
ReloadMovie()
End Sub
Private Sub cmnuReloadEp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuReloadEp.Click
Try
Me.dgvTVShows.Cursor = Cursors.WaitCursor
Me.dgvTVSeasons.Cursor = Cursors.WaitCursor
Me.dgvTVEpisodes.Cursor = Cursors.WaitCursor
Me.SetControlsEnabled(False, True)
Dim doFill As Boolean = False
Dim tFill As Boolean = False
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.SelectedRows
tFill = Me.RefreshEpisode(Convert.ToInt64(sRow.Cells(0).Value), True)
If tFill Then doFill = True
Next
Master.DB.CleanSeasons(True)
SQLtransaction.Commit()
End Using
Me.dgvTVShows.Cursor = Cursors.Default
Me.dgvTVSeasons.Cursor = Cursors.Default
Me.dgvTVEpisodes.Cursor = Cursors.Default
Me.SetControlsEnabled(True)
If doFill Then FillEpisodes(Convert.ToInt32(Me.dgvTVEpisodes.SelectedRows(0).Cells(0).Value), Convert.ToInt32(Me.dgvTVEpisodes.SelectedRows(0).Cells(12).Value))
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuReloadSeason_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuReloadSeason.Click
Me.dgvTVShows.Cursor = Cursors.WaitCursor
Me.dgvTVSeasons.Cursor = Cursors.WaitCursor
Me.dgvTVEpisodes.Cursor = Cursors.WaitCursor
Me.SetControlsEnabled(False, True)
Dim doFill As Boolean = False
Dim tFill As Boolean = False
If Me.dgvTVSeasons.SelectedRows.Count > 0 Then
Using SQLTrans As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
For Each sRow As DataGridViewRow In Me.dgvTVSeasons.SelectedRows
doFill = Me.RefreshSeason(Convert.ToInt32(sRow.Cells(0).Value), Convert.ToInt32(sRow.Cells(2).Value), True)
Using SQLCommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
SQLCommand.CommandText = String.Concat("SELECT ID FROM TVEps WHERE TVShowID = ", sRow.Cells(0).Value, " AND Season = ", sRow.Cells(2).Value, " AND Missing = 0;")
Using SQLReader As SQLite.SQLiteDataReader = SQLCommand.ExecuteReader
While SQLReader.Read
tFill = Me.RefreshEpisode(Convert.ToInt64(SQLReader("ID")), True)
If tFill Then doFill = True
End While
End Using
End Using
Next
Master.DB.CleanSeasons(True)
SQLTrans.Commit()
End Using
End If
Me.dgvTVShows.Cursor = Cursors.Default
Me.dgvTVSeasons.Cursor = Cursors.Default
Me.dgvTVEpisodes.Cursor = Cursors.Default
Me.SetControlsEnabled(True)
If doFill Then Me.FillSeasons(Convert.ToInt32(Me.dgvTVSeasons.SelectedRows(0).Cells(0).Value))
End Sub
Private Sub cmnuReloadShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuReloadShow.Click
Try
Me.dgvTVShows.Cursor = Cursors.WaitCursor
Me.dgvTVSeasons.Cursor = Cursors.WaitCursor
Me.dgvTVEpisodes.Cursor = Cursors.WaitCursor
Me.SetControlsEnabled(False, True)
Dim doFill As Boolean = False
Dim tFill As Boolean = False
If Me.dgvTVShows.SelectedRows.Count > 1 Then
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
For Each sRow As DataGridViewRow In Me.dgvTVShows.SelectedRows
tFill = Me.RefreshShow(Convert.ToInt64(sRow.Cells(0).Value), True, True, False, True)
If tFill Then doFill = True
Next
SQLtransaction.Commit()
End Using
ElseIf Me.dgvTVShows.SelectedRows.Count = 1 Then
'seperate single refresh so we can have a progress bar
tFill = Me.RefreshShow(Convert.ToInt64(Me.dgvTVShows.SelectedRows(0).Cells(0).Value), False, True, False, True)
If tFill Then doFill = True
End If
Me.dgvTVShows.Cursor = Cursors.Default
Me.dgvTVSeasons.Cursor = Cursors.Default
Me.dgvTVEpisodes.Cursor = Cursors.Default
Me.SetControlsEnabled(True)
If doFill Then FillList(0)
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub cmnuRemoveSeasonFromDB_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmnuRemoveSeasonFromDB.Click
Me.ClearInfo(False)
Using SQLTrans As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
For Each sRow As DataGridViewRow In Me.dgvTVSeasons.SelectedRows
Master.DB.DeleteTVSeasonFromDB(Convert.ToInt32(sRow.Cells(0).Value), Convert.ToInt32(sRow.Cells(2).Value), True)
Next
SQLTrans.Commit()
End Using
Me.FillSeasons(Convert.ToInt32(Me.dgvTVSeasons.SelectedRows(0).Cells(0).Value))
Me.SetTVCount()
End Sub
Private Sub cmnuRemoveTVEp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuRemoveTVEp.Click
Me.ClearInfo(False)
Using SQLTrans As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.SelectedRows
Master.DB.DeleteTVEpFromDB(Convert.ToInt32(sRow.Cells(0).Value), True, False, True)
Next
Master.DB.CleanSeasons(True)
SQLTrans.Commit()
End Using
Dim cSeas As Integer = 0
If Not Me.currSeasonRow = -1 Then
cSeas = Me.currSeasonRow
End If
Me.FillEpisodes(Convert.ToInt32(Me.dgvTVSeasons.Item(0, cSeas).Value), Convert.ToInt32(Me.dgvTVSeasons.Item(2, cSeas).Value))
Me.SetTVCount()
End Sub
Private Sub cmnuRemoveTVShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuRemoveTVShow.Click
Me.ClearInfo()
Using SQLTrans As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
For Each sRow As DataGridViewRow In Me.dgvTVShows.SelectedRows
Master.DB.DeleteTVShowFromDB(Convert.ToInt32(sRow.Cells(0).Value), True)
Next
SQLTrans.Commit()
End Using
Me.FillList(0)
End Sub
Private Sub cmnuRescrapeEp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuRescrapeEp.Click
Me.SetControlsEnabled(False, True)
ModulesManager.Instance.TVScrapeEpisode(Convert.ToInt32(Me.dgvTVEpisodes.Item(1, Me.dgvTVEpisodes.SelectedRows(0).Index).Value), Me.tmpTitle, Me.tmpTVDB, Convert.ToInt32(Me.dgvTVEpisodes.Item(2, Me.dgvTVEpisodes.SelectedRows(0).Index).Value), Convert.ToInt32(Me.dgvTVEpisodes.Item(12, Me.dgvTVEpisodes.SelectedRows(0).Index).Value), Me.tmpLang, Me.tmpOrdering, Master.DefaultTVOptions)
End Sub
Private Sub cmnuRescrapeShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuRescrapeShow.Click
Me.SetControlsEnabled(False, True)
TVShowScrapeData()
End Sub
Sub TVShowScrapeData()
Me.SetControlsEnabled(False)
For Each s As DataGridViewRow In Me.dgvTVShows.SelectedRows
' Temporary Scratetype
Dim ScrapeType As Enums.ScrapeType
'If Me.dgvTVShows.SelectedRows.Count = 1 Then
'ScrapeType = Enums.ScrapeType.FullAsk
'Else
'ScrapeType = Enums.ScrapeType.FullAuto
'End If
ScrapeType = Enums.ScrapeType.FullAsk
Dim Lang As String = Me.dgvTVShows.Item(22, s.Index).Value.ToString
ModulesManager.Instance.TVScrapeOnly(Convert.ToInt32(Me.dgvTVShows.Item(0, s.Index).Value), Me.dgvTVShows.Item(1, s.Index).Value.ToString, Me.dgvTVShows.Item(9, s.Index).Value.ToString, If(String.IsNullOrEmpty(Lang), Master.eSettings.TVDBLanguage, Lang), DirectCast(Convert.ToInt32(Me.dgvTVShows.Item(23, s.Index).Value), Enums.Ordering), Master.DefaultTVOptions, ScrapeType, True)
Next
Me.SetControlsEnabled(True)
End Sub
Private Sub cmnuRescrape_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuRescrape.Click
If Me.dgvMediaList.SelectedRows.Count = 1 Then
Functions.SetScraperMod(Enums.ModType.All, True, True)
Me.MovieScrapeData(True, Enums.ScrapeType.SingleScrape, Master.DefaultOptions)
End If
End Sub
Private Sub cmnuSearchNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuSearchNew.Click
If Me.dgvMediaList.SelectedRows.Count > 1 Then Return
Functions.SetScraperMod(Enums.ModType.DoSearch, True)
Functions.SetScraperMod(Enums.ModType.All, True, False)
Me.MovieScrapeData(True, Enums.ScrapeType.SingleScrape, Master.DefaultOptions)
End Sub
Private Sub cmnuSeasonChangeImages_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmnuSeasonChangeImages.Click
Me.SetControlsEnabled(False)
Using dEditSeason As New dlgEditSeason
If dEditSeason.ShowDialog() = Windows.Forms.DialogResult.OK Then
If Me.RefreshSeason(Convert.ToInt32(Master.currShow.ShowID), Master.currShow.TVEp.Season, False) Then
Me.FillSeasons(Convert.ToInt32(Master.currShow.ShowID))
End If
End If
End Using
Me.SetControlsEnabled(True)
End Sub
Private Sub cmnuSeasonOpenFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuSeasonOpenFolder.Click
If Me.dgvTVSeasons.SelectedRows.Count > 0 Then
Dim doOpen As Boolean = True
Dim SeasonPath As String = String.Empty
If Me.dgvTVSeasons.SelectedRows.Count > 10 Then
If Not MsgBox(String.Format(Master.eLang.GetString(635, "You have selected {0} folders to open. Are you sure you want to do this?"), Me.dgvTVSeasons.SelectedRows.Count), MsgBoxStyle.YesNo Or MsgBoxStyle.Question, Master.eLang.GetString(104, "Are You Sure?")) = MsgBoxResult.Yes Then doOpen = False
End If
If doOpen Then
For Each sRow As DataGridViewRow In Me.dgvTVSeasons.SelectedRows
SeasonPath = Functions.GetSeasonDirectoryFromShowPath(Master.currShow.ShowPath, Convert.ToInt32(sRow.Cells(2).Value))
Using Explorer As New Diagnostics.Process
If Master.isWindows Then
Explorer.StartInfo.FileName = "explorer.exe"
If String.IsNullOrEmpty(SeasonPath) Then
Explorer.StartInfo.Arguments = String.Format("/root,""{0}""", Master.currShow.ShowPath)
Else
Explorer.StartInfo.Arguments = String.Format("/select,""{0}""", SeasonPath)
End If
Else
Explorer.StartInfo.FileName = "xdg-open"
If String.IsNullOrEmpty(SeasonPath) Then
Explorer.StartInfo.Arguments = String.Format("""{0}""", Master.currShow.ShowPath)
Else
Explorer.StartInfo.Arguments = String.Format("""{0}""", SeasonPath)
End If
End If
Explorer.Start()
End Using
Next
End If
End If
End Sub
Private Sub cmnuSeasonRescrape_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmnuSeasonRescrape.Click
Me.SetControlsEnabled(False, True)
ModulesManager.Instance.TVScrapeSeason(Convert.ToInt32(Me.dgvTVSeasons.Item(0, Me.dgvTVSeasons.SelectedRows(0).Index).Value), Me.tmpTitle, Me.tmpTVDB, Convert.ToInt32(Me.dgvTVSeasons.Item(2, Me.dgvTVSeasons.SelectedRows(0).Index).Value), Me.tmpLang, Me.tmpOrdering, Master.DefaultTVOptions)
End Sub
Private Sub ConvertFileSourceToFolderSourceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConvertFileSourceToFolderSourceToolStripMenuItem.Click, SortFilesIntoFoldersToolStripMenuItem.Click
Me.SetControlsEnabled(False)
Using dSortFiles As New dlgSortFiles
If dSortFiles.ShowDialog() = Windows.Forms.DialogResult.OK Then
Me.LoadMedia(New Structures.Scans With {.Movies = True})
Else
Me.SetControlsEnabled(True)
End If
End Using
End Sub
Private Sub CopyExistingFanartToBackdropsFolderToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyExistingFanartToBackdropsFolderToolStripMenuItem.Click, CopyExistingFanartToBackdropsFolderToolStripMenuItem1.Click
Me.NonScrape(Enums.ScrapeType.CopyBD, Nothing)
End Sub
Private Sub createGenreThumbs(ByVal strGenres As String)
'//
' Parse the genre string and create panels/pictureboxes for each one
'\\
Dim genreArray() As String
Try
genreArray = Microsoft.VisualBasic.Strings.Split(strGenres, " / ")
For i As Integer = 0 To UBound(genreArray)
ReDim Preserve Me.pnlGenre(i)
ReDim Preserve Me.pbGenre(i)
Me.pnlGenre(i) = New Panel()
Me.pnlGenre(i).Visible = False
Me.pbGenre(i) = New PictureBox()
Me.pbGenre(i).Name = genreArray(i).Trim.ToUpper
Me.pnlGenre(i).Size = New Size(68, 100)
Me.pbGenre(i).Size = New Size(62, 94)
Me.pnlGenre(i).BackColor = Me.GenrePanelColor
Me.pbGenre(i).BackColor = Me.GenrePanelColor
Me.pnlGenre(i).BorderStyle = BorderStyle.FixedSingle
Me.pbGenre(i).SizeMode = PictureBoxSizeMode.StretchImage
Me.pbGenre(i).Image = APIXML.GetGenreImage(genreArray(i).Trim)
Me.pnlGenre(i).Left = ((Me.pnlInfoPanel.Right) - (i * 73)) - 73
Me.pbGenre(i).Left = 2
Me.pnlGenre(i).Top = Me.pnlInfoPanel.Top - 105
Me.pbGenre(i).Top = 2
Me.scMain.Panel2.Controls.Add(Me.pnlGenre(i))
Me.pnlGenre(i).Controls.Add(Me.pbGenre(i))
Me.pnlGenre(i).BringToFront()
AddHandler Me.pbGenre(i).MouseEnter, AddressOf pbGenre_MouseEnter
AddHandler Me.pbGenre(i).MouseLeave, AddressOf pbGenre_MouseLeave
If Master.eSettings.AllwaysDisplayGenresText Then
Dim iLeft As Integer = 0
Me.GenreImage = pbGenre(i).Image
Dim bmGenre As New Bitmap(Me.GenreImage)
Dim grGenre As Graphics = Graphics.FromImage(bmGenre)
Dim drawString As String = pbGenre(i).Name
Dim drawFont As New Font("Microsoft Sans Serif", 14, FontStyle.Bold, GraphicsUnit.Pixel)
Dim drawBrush As New SolidBrush(Color.White)
Dim drawWidth As Single = grGenre.MeasureString(drawString, drawFont).Width
Dim drawSize As Integer = Convert.ToInt32((14 * (bmGenre.Width / drawWidth)) - 0.5)
drawFont = New Font("Microsoft Sans Serif", If(drawSize > 14, 14, drawSize), FontStyle.Bold, GraphicsUnit.Pixel)
Dim drawHeight As Single = grGenre.MeasureString(drawString, drawFont).Height
iLeft = Convert.ToInt32((bmGenre.Width - grGenre.MeasureString(drawString, drawFont).Width) / 2)
grGenre.DrawString(drawString, drawFont, drawBrush, iLeft, (bmGenre.Height - drawHeight))
pbGenre(i).Image = bmGenre
End If
Next
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub CustomUpdaterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomUpdaterToolStripMenuItem.Click, TrayCustomUpdaterToolStripMenuItem.Click
Me.SetControlsEnabled(False)
Using dUpdate As New dlgUpdateMedia
Dim CustomUpdater As Structures.CustomUpdaterStruct = Nothing
CustomUpdater = dUpdate.ShowDialog()
If Not CustomUpdater.Canceled Then
Me.MovieScrapeData(False, CustomUpdater.ScrapeType, CustomUpdater.Options)
Else
Me.SetControlsEnabled(True)
End If
End Using
End Sub
Private Sub DeleteMovieToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteMovieToolStripMenuItem.Click
Try
Dim MoviesToDelete As New Dictionary(Of Long, Long)
Dim MovieId As Int64 = -1
For Each sRow As DataGridViewRow In Me.dgvMediaList.SelectedRows
MovieId = Convert.ToInt64(sRow.Cells(0).Value)
If Not MoviesToDelete.ContainsKey(MovieId) Then
MoviesToDelete.Add(MovieId, 0)
End If
Next
If MoviesToDelete.Count > 0 Then
Using dlg As New dlgDeleteConfirm
If dlg.ShowDialog(MoviesToDelete, Enums.DelType.Movies) = Windows.Forms.DialogResult.OK Then
Me.FillList(0)
End If
End Using
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvMediaList_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvMediaList.CellClick
Try
If e.ColumnIndex = 3 OrElse Not Master.eSettings.ClickScrape Then 'Title
If Me.dgvMediaList.SelectedRows.Count > 0 Then
If Me.dgvMediaList.RowCount > 0 Then
If Me.dgvMediaList.SelectedRows.Count > 1 Then
Me.SetStatus(String.Format(Master.eLang.GetString(627, "Selected Items: {0}"), Me.dgvMediaList.SelectedRows.Count))
ElseIf Me.dgvMediaList.SelectedRows.Count = 1 Then
Me.SetStatus(Me.dgvMediaList.SelectedRows(0).Cells(1).Value.ToString)
End If
End If
Me.currRow = Me.dgvMediaList.SelectedRows(0).Index
End If
ElseIf Master.eSettings.ClickScrape AndAlso e.RowIndex >= 0 AndAlso e.ColumnIndex <> 8 AndAlso Not bwMovieScraper.IsBusy Then
Dim movie As Int32 = CType(Me.dgvMediaList.Rows(e.RowIndex).Cells(0).Value, Int32)
Dim objCell As DataGridViewCell = CType(Me.dgvMediaList.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewCell)
'EMM not able to scrape subtitles yet.
'So don't set status for it, but leave the option open for the future.
Me.dgvMediaList.ClearSelection()
Me.dgvMediaList.Rows(objCell.RowIndex).Selected = True
Me.currRow = objCell.RowIndex
Select Case e.ColumnIndex
Case 4 'Poster
Functions.SetScraperMod(Enums.ModType.Poster, True)
Case 5 'Fanart
Functions.SetScraperMod(Enums.ModType.Fanart, True)
Case 6 'Nfo
Functions.SetScraperMod(Enums.ModType.NFO, True)
Case 7 'Trailer
Functions.SetScraperMod(Enums.ModType.Trailer, True)
Case 8 'Subtitles
'Functions.SetScraperMod(Enums.ModType.Subtitles, True)
Case 9 'Extrathumbs
Functions.SetScraperMod(Enums.ModType.Extra, True)
Case 10 'Metadata - need to add this column to the view.
Functions.SetScraperMod(Enums.ModType.Meta, True)
End Select
If Master.eSettings.AskCheckboxScrape Then
MovieScrapeData(True, Enums.ScrapeType.FullAsk, Master.DefaultOptions)
Else
MovieScrapeData(True, Enums.ScrapeType.FullAuto, Master.DefaultOptions)
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvMediaList_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvMediaList.CellDoubleClick
Try
If e.RowIndex < 0 Then Exit Sub
If Me.fScanner.IsBusy OrElse Me.bwMediaInfo.IsBusy OrElse Me.bwLoadInfo.IsBusy OrElse Me.bwRefreshMovies.IsBusy OrElse Me.bwMovieScraper.IsBusy OrElse Me.bwCleanDB.IsBusy Then Return
Dim indX As Integer = Me.dgvMediaList.SelectedRows(0).Index
Dim ID As Integer = Convert.ToInt32(Me.dgvMediaList.Item(0, indX).Value)
Master.currMovie = Master.DB.LoadMovieFromDB(ID)
Using dEditMovie As New dlgEditMovie(Me)
AddHandler ModulesManager.Instance.GenericEvent, AddressOf dEditMovie.GenericRunCallBack
Select Case dEditMovie.ShowDialog()
Case Windows.Forms.DialogResult.OK
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.MovieScraperRDYtoSave, Nothing, Master.currMovie)
Me.SetListItemAfterEdit(ID, indX)
If Me.RefreshMovie(ID) Then
Me.FillList(0)
End If
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.MovieSync, Nothing, Master.currMovie)
Case Windows.Forms.DialogResult.Retry
Functions.SetScraperMod(Enums.ModType.All, True, True)
Me.MovieScrapeData(True, Enums.ScrapeType.SingleScrape, Master.DefaultOptions)
Case Windows.Forms.DialogResult.Abort
Functions.SetScraperMod(Enums.ModType.DoSearch, True)
Functions.SetScraperMod(Enums.ModType.All, True, False)
Me.MovieScrapeData(True, Enums.ScrapeType.SingleScrape, Master.DefaultOptions)
Case Else
If Me.InfoCleared Then Me.LoadInfo(ID, Me.dgvMediaList.Item(1, indX).Value.ToString, True, False)
End Select
RemoveHandler ModulesManager.Instance.GenericEvent, AddressOf dEditMovie.GenericRunCallBack
End Using
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvMediaList_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvMediaList.CellEnter
Try
If Not Me.tabsMain.SelectedIndex = 0 Then Return
Me.tmrWaitShow.Stop()
Me.tmrWaitSeason.Stop()
Me.tmrWaitEp.Stop()
Me.tmrWait.Stop()
Me.tmrLoadShow.Stop()
Me.tmrLoadSeason.Stop()
Me.tmrLoadEp.Stop()
Me.tmrLoad.Stop()
Me.currRow = e.RowIndex
Me.tmrWait.Start()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvMediaList_CellMouseEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvMediaList.CellMouseEnter
'EMM not able to scrape subtitles yet.
'So don't set status for it, but leave the option open for the future.
If Master.eSettings.ClickScrape AndAlso e.RowIndex > 0 AndAlso e.ColumnIndex > 3 AndAlso e.ColumnIndex < 11 AndAlso e.ColumnIndex <> 8 AndAlso Not bwMovieScraper.IsBusy Then
oldStatus = GetStatus()
Dim movieName As String = Me.dgvMediaList.Rows(e.RowIndex).Cells(15).Value.ToString
Dim scrapeFor As String = ""
Dim scrapeType As String = ""
Select Case e.ColumnIndex
Case 4
scrapeFor = Master.eLang.GetString(72, "Poster Only")
Case 5
scrapeFor = Master.eLang.GetString(73, "Fanart Only")
Case 6
scrapeFor = Master.eLang.GetString(71, "NFO Only")
Case 7
scrapeFor = Master.eLang.GetString(75, "Trailer Only")
Case 8
'scrapeFor = Master.eLang.GetString(00, "Subtitles")
Case 9
scrapeFor = Master.eLang.GetString(74, "Extrathumbs Only")
Case 10
scrapeFor = Master.eLang.GetString(76, "Meta Data Only")
End Select
If Master.eSettings.AskCheckboxScrape Then
scrapeType = Master.eLang.GetString(77, "Ask (Require Input If No Exact Match)")
Else
scrapeType = Master.eLang.GetString(69, "Automatic (Force Best Match)")
End If
Me.SetStatus(String.Format("Scrape ""{0}"" for {1} - {2}", movieName, scrapeFor, scrapeType))
Else
oldStatus = String.Empty
End If
End Sub
Private Sub dgvMediaList_CellMouseLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvMediaList.CellMouseLeave
If Not String.IsNullOrEmpty(oldStatus) Then Me.SetStatus(oldStatus)
End Sub
Private Sub dgvMediaList_CellPainting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles dgvMediaList.CellPainting
Try
If Master.isWindows AndAlso e.RowIndex >= 0 AndAlso Not Me.dgvMediaList.Item(e.ColumnIndex, e.RowIndex).Displayed Then
e.Handled = True
Return
End If
'icons
If e.ColumnIndex >= 4 AndAlso e.ColumnIndex <= 9 AndAlso e.RowIndex = -1 Then
e.PaintBackground(e.ClipBounds, False)
Dim pt As Point = e.CellBounds.Location
Dim offset As Integer = Convert.ToInt32((e.CellBounds.Width - Me.ilColumnIcons.ImageSize.Width) / 2)
pt.X += offset
pt.Y = 3
Me.ilColumnIcons.Draw(e.Graphics, pt, e.ColumnIndex - 4)
e.Handled = True
End If
If e.ColumnIndex = 3 AndAlso e.RowIndex >= 0 Then
If Convert.ToBoolean(Me.dgvMediaList.Item(11, e.RowIndex).Value) Then
e.CellStyle.ForeColor = Color.Crimson
e.CellStyle.Font = New Font("Segoe UI", 9, FontStyle.Bold)
e.CellStyle.SelectionForeColor = Color.Crimson
ElseIf Convert.ToBoolean(Me.dgvMediaList.Item(10, e.RowIndex).Value) Then
e.CellStyle.ForeColor = Color.Green
e.CellStyle.Font = New Font("Segoe UI", 9, FontStyle.Bold)
e.CellStyle.SelectionForeColor = Color.Green
Else
e.CellStyle.ForeColor = Color.Black
e.CellStyle.Font = New Font("Segoe UI", 8.25, FontStyle.Regular)
e.CellStyle.SelectionForeColor = Color.FromKnownColor(KnownColor.HighlightText)
End If
End If
If e.ColumnIndex >= 3 AndAlso e.ColumnIndex <= 9 AndAlso e.RowIndex >= 0 Then
If Convert.ToBoolean(Me.dgvMediaList.Item(14, e.RowIndex).Value) Then
e.CellStyle.BackColor = Color.LightSteelBlue
e.CellStyle.SelectionBackColor = Color.DarkTurquoise
ElseIf Convert.ToBoolean(Me.dgvMediaList.Item(43, e.RowIndex).Value) Then
e.CellStyle.BackColor = Color.MistyRose
e.CellStyle.SelectionBackColor = Color.DarkMagenta
Else
e.CellStyle.BackColor = Color.White
e.CellStyle.SelectionBackColor = Color.FromKnownColor(KnownColor.Highlight)
End If
If e.ColumnIndex >= 4 AndAlso e.ColumnIndex <= 9 Then
e.PaintBackground(e.ClipBounds, True)
Dim pt As Point = e.CellBounds.Location
Dim offset As Integer = Convert.ToInt32((e.CellBounds.Width - Me.ilColumnIcons.ImageSize.Width) / 2)
pt.X += offset
pt.Y = e.CellBounds.Top + 3
Me.ilColumnIcons.Draw(e.Graphics, pt, If(Convert.ToBoolean(e.Value), 6, 7))
e.Handled = True
End If
End If
Me.tabMovies.Text = String.Format("{0} ({1})", Master.eLang.GetString(36, "Movies"), Me.dgvMediaList.RowCount)
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvMediaList_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles dgvMediaList.KeyDown
'stop enter key from selecting next list item
e.Handled = (e.KeyCode = Keys.Enter)
If e.Modifiers = Keys.Control AndAlso e.KeyCode = Keys.S Then txtSearch.Focus()
End Sub
Private Sub dgvMediaList_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles dgvMediaList.KeyPress
Try
If Not StringUtils.AlphaNumericOnly(e.KeyChar) Then
KeyBuffer = String.Concat(KeyBuffer, e.KeyChar.ToString.ToLower)
tmrKeyBuffer.Start()
For Each drvRow As DataGridViewRow In Me.dgvMediaList.Rows
If drvRow.Cells(3).Value.ToString.ToLower.StartsWith(KeyBuffer) Then
drvRow.Selected = True
Me.dgvMediaList.CurrentCell = drvRow.Cells(3)
Exit For
End If
Next
ElseIf e.KeyChar = Chr(13) Then
If Me.fScanner.IsBusy OrElse Me.bwMediaInfo.IsBusy OrElse Me.bwLoadInfo.IsBusy OrElse _
Me.bwDownloadPic.IsBusy OrElse Me.bwMovieScraper.IsBusy OrElse Me.bwRefreshMovies.IsBusy _
OrElse Me.bwCleanDB.IsBusy Then Return
Dim indX As Integer = Me.dgvMediaList.SelectedRows(0).Index
Dim ID As Integer = Convert.ToInt32(Me.dgvMediaList.Item(0, indX).Value)
Master.currMovie = Master.DB.LoadMovieFromDB(ID)
Me.SetStatus(Master.currMovie.Filename)
Using dEditMovie As New dlgEditMovie(Me)
AddHandler ModulesManager.Instance.GenericEvent, AddressOf dEditMovie.GenericRunCallBack
Select Case dEditMovie.ShowDialog()
Case Windows.Forms.DialogResult.OK
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.MovieScraperRDYtoSave, Nothing, Master.currMovie)
Me.SetListItemAfterEdit(ID, indX)
If Me.RefreshMovie(ID) Then
Me.FillList(0)
End If
ModulesManager.Instance.RunGeneric(Enums.ModuleEventType.MovieSync, Nothing, Master.currMovie)
Case Windows.Forms.DialogResult.Retry
Functions.SetScraperMod(Enums.ModType.All, True, True)
Me.MovieScrapeData(True, Enums.ScrapeType.SingleScrape, Master.DefaultOptions)
Case Windows.Forms.DialogResult.Abort
Functions.SetScraperMod(Enums.ModType.DoSearch, True)
Functions.SetScraperMod(Enums.ModType.All, True, False)
Me.MovieScrapeData(True, Enums.ScrapeType.SingleScrape, Master.DefaultOptions)
Case Else
If Me.InfoCleared Then Me.LoadInfo(ID, Me.dgvMediaList.Item(1, indX).Value.ToString, True, False)
End Select
RemoveHandler ModulesManager.Instance.GenericEvent, AddressOf dEditMovie.GenericRunCallBack
End Using
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvMediaList_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgvMediaList.MouseDown
Try
If e.Button = Windows.Forms.MouseButtons.Right And Me.dgvMediaList.RowCount > 0 Then
If bwCleanDB.IsBusy OrElse bwMovieScraper.IsBusy OrElse bwNonScrape.IsBusy Then
Me.cmnuTitle.Text = Master.eLang.GetString(845, ">> No Item Selected <<")
Return
End If
Me.mnuMediaList.Enabled = False
Dim dgvHTI As DataGridView.HitTestInfo = dgvMediaList.HitTest(e.X, e.Y)
If dgvHTI.Type = DataGridViewHitTestType.Cell Then
If Me.dgvMediaList.SelectedRows.Count > 1 AndAlso Me.dgvMediaList.Rows(dgvHTI.RowIndex).Selected Then
Dim setMark As Boolean = False
Dim setLock As Boolean = False
Me.mnuMediaList.Enabled = True
Me.cmnuTitle.Text = Master.eLang.GetString(106, ">> Multiple <<")
Me.cmnuEditMovie.Visible = False
Me.ScrapingToolStripMenuItem.Visible = True
Me.cmnuRescrape.Visible = False
Me.cmnuSearchNew.Visible = False
'Me.cmuRenamer.Visible = False
Me.cmnuMetaData.Visible = False
Me.cmnuSep2.Visible = False
For Each sRow As DataGridViewRow In Me.dgvMediaList.SelectedRows
'if any one item is set as unmarked, set menu to mark
'else they are all marked, so set menu to unmark
If Not Convert.ToBoolean(sRow.Cells(11).Value) Then
setMark = True
If setLock Then Exit For
End If
'if any one item is set as unlocked, set menu to lock
'else they are all locked so set menu to unlock
If Not Convert.ToBoolean(sRow.Cells(14).Value) Then
setLock = True
If setMark Then Exit For
End If
Next
Me.cmnuMark.Text = If(setMark, Master.eLang.GetString(23, "Mark"), Master.eLang.GetString(107, "Unmark"))
Me.cmnuLock.Text = If(setLock, Master.eLang.GetString(24, "Lock"), Master.eLang.GetString(108, "Unlock"))
Me.GenreListToolStripComboBox.Items.Insert(0, Master.eLang.GetString(98, "Select Genre..."))
Me.GenreListToolStripComboBox.SelectedItem = Master.eLang.GetString(98, "Select Genre...")
Me.AddGenreToolStripMenuItem.Enabled = False
Me.SetGenreToolStripMenuItem.Enabled = False
Me.RemoveGenreToolStripMenuItem.Enabled = False
Else
Me.cmnuEditMovie.Visible = True
Me.ScrapingToolStripMenuItem.Visible = False
Me.cmnuRescrape.Visible = True
Me.cmnuSearchNew.Visible = True
Me.cmnuMetaData.Visible = True
Me.cmnuSep.Visible = True
Me.cmnuSep2.Visible = True
cmnuTitle.Text = String.Concat(">> ", Me.dgvMediaList.Item(3, dgvHTI.RowIndex).Value, " <<")
If Not Me.dgvMediaList.Rows(dgvHTI.RowIndex).Selected Then
Me.prevRow = -1
Me.dgvMediaList.CurrentCell = Nothing
Me.dgvMediaList.ClearSelection()
Me.dgvMediaList.Rows(dgvHTI.RowIndex).Selected = True
Me.dgvMediaList.CurrentCell = Me.dgvMediaList.Item(3, dgvHTI.RowIndex)
Else
Me.mnuMediaList.Enabled = True
End If
Me.cmnuMark.Text = If(Convert.ToBoolean(Me.dgvMediaList.Item(11, dgvHTI.RowIndex).Value), Master.eLang.GetString(107, "Unmark"), Master.eLang.GetString(23, "Mark"))
Me.cmnuLock.Text = If(Convert.ToBoolean(Me.dgvMediaList.Item(14, dgvHTI.RowIndex).Value), Master.eLang.GetString(108, "Unlock"), Master.eLang.GetString(24, "Lock"))
Me.GenreListToolStripComboBox.Tag = Me.dgvMediaList.Item(27, dgvHTI.RowIndex).Value
Me.GenreListToolStripComboBox.Items.Insert(0, Master.eLang.GetString(98, "Select Genre..."))
Me.GenreListToolStripComboBox.SelectedItem = Master.eLang.GetString(98, "Select Genre...")
Me.AddGenreToolStripMenuItem.Enabled = False
Me.SetGenreToolStripMenuItem.Enabled = False
Me.RemoveGenreToolStripMenuItem.Enabled = False
End If
Else
Me.mnuMediaList.Enabled = False
Me.cmnuTitle.Text = Master.eLang.GetString(845, ">> No Item Selected <<")
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvMediaList_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvMediaList.Resize
ResizeMediaList()
End Sub
Private Sub dgvMediaList_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvMediaList.Sorted
Me.prevRow = -1
If Me.dgvMediaList.RowCount > 0 Then
Me.dgvMediaList.CurrentCell = Nothing
Me.dgvMediaList.ClearSelection()
Me.dgvMediaList.Rows(0).Selected = True
Me.dgvMediaList.CurrentCell = Me.dgvMediaList.Rows(0).Cells(3)
End If
End Sub
Private Sub dgvTVEpisodes_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvTVEpisodes.CellClick
If Me.dgvTVEpisodes.SelectedRows.Count > 0 Then
If Me.dgvTVEpisodes.RowCount > 0 Then
If Me.dgvTVEpisodes.SelectedRows.Count > 1 Then
Me.SetStatus(String.Format(Master.eLang.GetString(627, "Selected Items: {0}"), Me.dgvTVEpisodes.SelectedRows.Count))
ElseIf Me.dgvTVEpisodes.SelectedRows.Count = 1 Then
Me.SetStatus(Me.dgvTVEpisodes.SelectedRows(0).Cells(3).Value.ToString)
End If
End If
Me.currEpRow = Me.dgvTVEpisodes.SelectedRows(0).Index
If Not Me.currList = 2 Then
Me.currList = 2
Me.prevEpRow = -1
Me.SelectEpisodeRow(Me.dgvTVEpisodes.SelectedRows(0).Index)
End If
End If
End Sub
Private Sub dgvTVEpisodes_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvTVEpisodes.CellDoubleClick
Try
If e.RowIndex < 0 Then Exit Sub
If Me.fScanner.IsBusy OrElse Me.bwMediaInfo.IsBusy OrElse Me.bwLoadShowInfo.IsBusy OrElse Me.bwLoadEpInfo.IsBusy OrElse Me.bwRefreshMovies.IsBusy OrElse Me.bwMovieScraper.IsBusy OrElse Me.bwCleanDB.IsBusy Then Return
Dim indX As Integer = Me.dgvTVEpisodes.SelectedRows(0).Index
Dim ID As Integer = Convert.ToInt32(Me.dgvTVEpisodes.Item(0, indX).Value)
Master.currShow = Master.DB.LoadTVEpFromDB(ID, True)
Using dEditEpisode As New dlgEditEpisode
AddHandler ModulesManager.Instance.GenericEvent, AddressOf dEditEpisode.GenericRunCallBack
Select Case dEditEpisode.ShowDialog()
Case Windows.Forms.DialogResult.OK
If Me.RefreshEpisode(ID) Then
Me.FillEpisodes(Convert.ToInt32(Master.currShow.ShowID), Master.currShow.TVEp.Season)
End If
End Select
RemoveHandler ModulesManager.Instance.GenericEvent, AddressOf dEditEpisode.GenericRunCallBack
End Using
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVEpisodes_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvTVEpisodes.CellEnter
Try
If Not Me.tabsMain.SelectedIndex = 1 OrElse Not Me.currList = 2 Then Return
Me.tmrWaitShow.Stop()
Me.tmrWaitSeason.Stop()
Me.tmrWait.Stop()
Me.tmrWaitEp.Stop()
Me.tmrLoadShow.Stop()
Me.tmrLoadSeason.Stop()
Me.tmrLoad.Stop()
Me.tmrLoadEp.Stop()
Me.currEpRow = e.RowIndex
Me.tmrWaitEp.Start()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVEpisodes_CellPainting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles dgvTVEpisodes.CellPainting
Try
If Master.isWindows AndAlso e.RowIndex >= 0 AndAlso Not Me.dgvTVEpisodes.Item(e.ColumnIndex, e.RowIndex).Displayed Then
e.Handled = True
Return
End If
'icons
If e.ColumnIndex >= 4 AndAlso e.ColumnIndex <= 6 AndAlso e.RowIndex = -1 Then
e.PaintBackground(e.ClipBounds, False)
Dim pt As Point = e.CellBounds.Location
Dim offset As Integer = Convert.ToInt32((e.CellBounds.Width - Me.ilColumnIcons.ImageSize.Width) / 2)
pt.X += offset
pt.Y = 1
Me.ilColumnIcons.Draw(e.Graphics, pt, e.ColumnIndex - 4)
e.Handled = True
End If
If (e.ColumnIndex = 2 OrElse e.ColumnIndex = 3) AndAlso e.RowIndex >= 0 Then
If Convert.ToBoolean(Me.dgvTVEpisodes.Item(22, e.RowIndex).Value) Then
e.CellStyle.ForeColor = Color.Gray
e.CellStyle.Font = New Font("Segoe UI", 9, FontStyle.Regular)
e.CellStyle.SelectionForeColor = Color.LightGray
ElseIf Convert.ToBoolean(Me.dgvTVEpisodes.Item(8, e.RowIndex).Value) Then
e.CellStyle.ForeColor = Color.Crimson
e.CellStyle.Font = New Font("Segoe UI", 9, FontStyle.Bold)
e.CellStyle.SelectionForeColor = Color.Crimson
ElseIf Convert.ToBoolean(Me.dgvTVEpisodes.Item(7, e.RowIndex).Value) Then
e.CellStyle.ForeColor = Color.Green
e.CellStyle.Font = New Font("Segoe UI", 9, FontStyle.Bold)
e.CellStyle.SelectionForeColor = Color.Green
Else
e.CellStyle.ForeColor = Color.Black
e.CellStyle.Font = New Font("Segoe UI", 8.25, FontStyle.Regular)
e.CellStyle.SelectionForeColor = Color.FromKnownColor(KnownColor.HighlightText)
End If
End If
If e.ColumnIndex >= 2 AndAlso e.ColumnIndex <= 6 AndAlso e.RowIndex >= 0 Then
If Convert.ToBoolean(Me.dgvTVEpisodes.Item(22, e.RowIndex).Value) Then
e.CellStyle.BackColor = Color.White
e.CellStyle.SelectionBackColor = Color.DarkGray
ElseIf Convert.ToBoolean(Me.dgvTVEpisodes.Item(11, e.RowIndex).Value) Then
e.CellStyle.BackColor = Color.LightSteelBlue
e.CellStyle.SelectionBackColor = Color.DarkTurquoise
Else
e.CellStyle.BackColor = Color.White
e.CellStyle.SelectionBackColor = Color.FromKnownColor(KnownColor.Highlight)
End If
If e.ColumnIndex >= 4 AndAlso e.ColumnIndex <= 6 Then
e.PaintBackground(e.ClipBounds, True)
Dim pt As Point = e.CellBounds.Location
Dim offset As Integer = Convert.ToInt32((e.CellBounds.Width - Me.ilColumnIcons.ImageSize.Width) / 2)
pt.X += offset
pt.Y = e.CellBounds.Top + 3
Me.ilColumnIcons.Draw(e.Graphics, pt, If(Convert.ToBoolean(e.Value), 6, 7))
e.Handled = True
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVEpisodes_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles dgvTVEpisodes.KeyDown
'stop enter key from selecting next list item
e.Handled = e.KeyCode = Keys.Enter
End Sub
Private Sub dgvTVEpisodes_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles dgvTVEpisodes.KeyPress
Try
If Not StringUtils.AlphaNumericOnly(e.KeyChar) Then
KeyBuffer = String.Concat(KeyBuffer, e.KeyChar.ToString.ToLower)
tmrKeyBuffer.Start()
For Each drvRow As DataGridViewRow In Me.dgvTVEpisodes.Rows
If drvRow.Cells(3).Value.ToString.ToLower.StartsWith(KeyBuffer) Then
drvRow.Selected = True
Me.dgvTVEpisodes.CurrentCell = drvRow.Cells(3)
Exit For
End If
Next
ElseIf e.KeyChar = Chr(13) Then
If Me.fScanner.IsBusy OrElse Me.bwMediaInfo.IsBusy OrElse Me.bwLoadShowInfo.IsBusy OrElse Me.bwLoadEpInfo.IsBusy OrElse Me.bwRefreshMovies.IsBusy OrElse Me.bwMovieScraper.IsBusy OrElse Me.bwCleanDB.IsBusy Then Return
Dim indX As Integer = Me.dgvTVEpisodes.SelectedRows(0).Index
Dim ID As Integer = Convert.ToInt32(Me.dgvTVEpisodes.Item(0, indX).Value)
Master.currShow = Master.DB.LoadTVEpFromDB(ID, True)
Using dEditEpisode As New dlgEditEpisode
AddHandler ModulesManager.Instance.GenericEvent, AddressOf dEditEpisode.GenericRunCallBack
Select Case dEditEpisode.ShowDialog()
Case Windows.Forms.DialogResult.OK
If Me.RefreshEpisode(ID) Then
Me.FillEpisodes(Convert.ToInt32(Master.currShow.ShowID), Master.currShow.TVEp.Season)
End If
End Select
RemoveHandler ModulesManager.Instance.GenericEvent, AddressOf dEditEpisode.GenericRunCallBack
End Using
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub ShowEpisodeMenuItems(ByVal Visible As Boolean)
Dim cMnu As ToolStripMenuItem
Dim cSep As ToolStripSeparator
Try
If Visible Then
For Each cMnuItem As Object In Me.mnuEpisodes.Items
If TypeOf cMnuItem Is ToolStripMenuItem Then
DirectCast(cMnuItem, ToolStripMenuItem).Visible = True
ElseIf TypeOf cMnuItem Is ToolStripSeparator Then
DirectCast(cMnuItem, ToolStripSeparator).Visible = True
End If
Next
Me.cmnuDeleteTVEp.Visible = True
Else
For Each cMnuItem As Object In Me.mnuEpisodes.Items
If TypeOf cMnuItem Is ToolStripMenuItem Then
cMnu = DirectCast(cMnuItem, ToolStripMenuItem)
If Not cMnu.Name = "RemoveEpToolStripMenuItem" AndAlso Not cMnu.Name = "cmnuEpTitle" Then
cMnu.Visible = False
End If
ElseIf TypeOf cMnuItem Is ToolStripSeparator Then
cSep = DirectCast(cMnuItem, ToolStripSeparator)
If Not cSep.Name = "ToolStripSeparator6" Then
cSep.Visible = False
End If
End If
Me.cmnuDeleteTVEp.Visible = False
Next
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVEpisodes_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgvTVEpisodes.MouseDown
Try
Dim hasMissing As Boolean = False
If e.Button = Windows.Forms.MouseButtons.Right And Me.dgvTVEpisodes.RowCount > 0 Then
Me.mnuEpisodes.Enabled = False
Dim dgvHTI As DataGridView.HitTestInfo = dgvTVEpisodes.HitTest(e.X, e.Y)
If dgvHTI.Type = DataGridViewHitTestType.Cell Then
If Me.dgvTVEpisodes.SelectedRows.Count > 1 AndAlso Me.dgvTVEpisodes.Rows(dgvHTI.RowIndex).Selected Then
Me.mnuEpisodes.Enabled = True
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.SelectedRows
If Convert.ToBoolean(sRow.Cells(22).Value) Then
hasMissing = True
Exit For
End If
Next
Me.cmnuEpTitle.Text = Master.eLang.GetString(106, ">> Multiple <<")
If hasMissing Then
Me.ShowEpisodeMenuItems(False)
Else
Dim setMark As Boolean = False
Dim setLock As Boolean = False
Me.ShowEpisodeMenuItems(True)
Me.ToolStripSeparator9.Visible = False
Me.cmnuEditEpisode.Visible = False
Me.ToolStripSeparator10.Visible = False
Me.cmnuRescrapeEp.Visible = False
Me.cmnuChangeEp.Visible = False
Me.ToolStripSeparator12.Visible = False
Me.cmnuEpOpenFolder.Visible = False
For Each sRow As DataGridViewRow In Me.dgvTVEpisodes.SelectedRows
'if any one item is set as unmarked, set menu to mark
'else they are all marked, so set menu to unmark
If Not Convert.ToBoolean(sRow.Cells(8).Value) Then
setMark = True
If setLock Then Exit For
End If
'if any one item is set as unlocked, set menu to lock
'else they are all locked so set menu to unlock
If Not Convert.ToBoolean(sRow.Cells(11).Value) Then
setLock = True
If setMark Then Exit For
End If
Next
Me.cmnuMarkEp.Text = If(setMark, Master.eLang.GetString(23, "Mark"), Master.eLang.GetString(107, "Unmark"))
Me.cmnuLockEp.Text = If(setLock, Master.eLang.GetString(24, "Lock"), Master.eLang.GetString(108, "Unlock"))
End If
Else
cmnuEpTitle.Text = String.Concat(">> ", Me.dgvTVEpisodes.Item(3, dgvHTI.RowIndex).Value, " <<")
If Not Me.dgvTVEpisodes.Rows(dgvHTI.RowIndex).Selected OrElse Not Me.currList = 2 Then
Me.prevEpRow = -1
Me.currList = 2
Me.dgvTVEpisodes.CurrentCell = Nothing
Me.dgvTVEpisodes.ClearSelection()
Me.dgvTVEpisodes.Rows(dgvHTI.RowIndex).Selected = True
Me.dgvTVEpisodes.CurrentCell = Me.dgvTVEpisodes.Item(3, dgvHTI.RowIndex)
Else
Me.mnuEpisodes.Enabled = True
End If
If Convert.ToBoolean(Me.dgvTVEpisodes.Item(22, dgvHTI.RowIndex).Value) Then hasMissing = True
If hasMissing Then
Me.ShowEpisodeMenuItems(False)
Else
Me.ShowEpisodeMenuItems(True)
Me.ToolStripSeparator9.Visible = True
Me.cmnuEditEpisode.Visible = True
Me.ToolStripSeparator10.Visible = True
Me.cmnuRescrapeEp.Visible = True
Me.cmnuChangeEp.Visible = True
Me.ToolStripSeparator12.Visible = True
Me.cmnuEpOpenFolder.Visible = True
Me.cmnuMarkEp.Text = If(Convert.ToBoolean(Me.dgvTVEpisodes.Item(8, dgvHTI.RowIndex).Value), Master.eLang.GetString(107, "Unmark"), Master.eLang.GetString(23, "Mark"))
Me.cmnuLockEp.Text = If(Convert.ToBoolean(Me.dgvTVEpisodes.Item(11, dgvHTI.RowIndex).Value), Master.eLang.GetString(108, "Unlock"), Master.eLang.GetString(24, "Lock"))
End If
End If
Else
Me.mnuEpisodes.Enabled = False
Me.cmnuEpTitle.Text = Master.eLang.GetString(845, ">> No Item Selected <<")
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVEpisodes_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvTVEpisodes.Resize
ResizeTVLists(3)
End Sub
Private Sub dgvTVEpisodes_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvTVEpisodes.Sorted
Me.prevEpRow = -1
If Me.dgvTVEpisodes.RowCount > 0 Then
Me.dgvTVEpisodes.CurrentCell = Nothing
Me.dgvTVEpisodes.ClearSelection()
Me.dgvTVEpisodes.Rows(0).Selected = True
Me.dgvTVEpisodes.CurrentCell = Me.dgvTVEpisodes.Rows(0).Cells(3)
End If
End Sub
Private Sub dgvTVSeasons_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvTVSeasons.CellClick
If Me.dgvTVSeasons.SelectedRows.Count > 0 Then
If Me.dgvTVSeasons.RowCount > 0 Then
If Me.dgvTVSeasons.SelectedRows.Count > 1 Then
Me.SetStatus(String.Format(Master.eLang.GetString(627, "Selected Items: {0}"), Me.dgvTVSeasons.SelectedRows.Count))
ElseIf Me.dgvTVSeasons.SelectedRows.Count = 1 Then
Me.SetStatus(Me.dgvTVSeasons.SelectedRows(0).Cells(1).Value.ToString)
End If
End If
Me.currSeasonRow = Me.dgvTVSeasons.SelectedRows(0).Index
If Not Me.currList = 1 Then
Me.currList = 1
Me.prevSeasonRow = -1
Me.SelectSeasonRow(Me.dgvTVSeasons.SelectedRows(0).Index)
End If
End If
End Sub
Private Sub dgvTVSeasons_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvTVSeasons.CellDoubleClick
Try
If e.RowIndex < 0 Then Exit Sub
If Me.fScanner.IsBusy OrElse Me.bwMediaInfo.IsBusy OrElse Me.bwLoadShowInfo.IsBusy OrElse Me.bwLoadSeasonInfo.IsBusy OrElse Me.bwLoadEpInfo.IsBusy OrElse Me.bwRefreshMovies.IsBusy OrElse Me.bwMovieScraper.IsBusy OrElse Me.bwCleanDB.IsBusy Then Return
Dim indX As Integer = Me.dgvTVSeasons.SelectedRows(0).Index
Dim ShowID As Integer = Convert.ToInt32(Me.dgvTVSeasons.Item(0, indX).Value)
Dim Season As Integer = Convert.ToInt32(Me.dgvTVSeasons.Item(2, indX).Value)
Master.currShow = Master.DB.LoadTVSeasonFromDB(ShowID, Season, True)
Using dEditSeason As New dlgEditSeason
If dEditSeason.ShowDialog() = Windows.Forms.DialogResult.OK Then
If Me.RefreshSeason(ShowID, Season, False) Then
Me.FillSeasons(ShowID)
End If
End If
End Using
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVSeasons_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvTVSeasons.CellEnter
Try
If Not Me.tabsMain.SelectedIndex = 1 OrElse Not Me.currList = 1 Then Return
Me.tmrWaitShow.Stop()
Me.tmrWait.Stop()
Me.tmrWaitEp.Stop()
Me.tmrWaitSeason.Stop()
Me.tmrLoadShow.Stop()
Me.tmrLoad.Stop()
Me.tmrLoadEp.Stop()
Me.tmrLoadSeason.Stop()
Me.currSeasonRow = e.RowIndex
Me.tmrWaitSeason.Start()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVSeasons_CellPainting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles dgvTVSeasons.CellPainting
Try
If Master.isWindows AndAlso e.RowIndex >= 0 AndAlso Not Me.dgvTVSeasons.Item(e.ColumnIndex, e.RowIndex).Displayed Then
e.Handled = True
Return
End If
'icons
If (e.ColumnIndex = 3 OrElse e.ColumnIndex = 4) AndAlso e.RowIndex = -1 Then
e.PaintBackground(e.ClipBounds, False)
Dim pt As Point = e.CellBounds.Location
Dim offset As Integer = Convert.ToInt32((e.CellBounds.Width - Me.ilColumnIcons.ImageSize.Width) / 2)
pt.X += offset
pt.Y = 1
Me.ilColumnIcons.Draw(e.Graphics, pt, e.ColumnIndex - 3)
e.Handled = True
End If
If e.ColumnIndex = 1 AndAlso e.RowIndex >= 0 Then
If Convert.ToBoolean(Me.dgvTVSeasons.Item(8, e.RowIndex).Value) Then
e.CellStyle.ForeColor = Color.Crimson
e.CellStyle.Font = New Font("Segoe UI", 9, FontStyle.Bold)
e.CellStyle.SelectionForeColor = Color.Crimson
ElseIf Convert.ToBoolean(Me.dgvTVSeasons.Item(9, e.RowIndex).Value) Then
e.CellStyle.ForeColor = Color.Green
e.CellStyle.Font = New Font("Segoe UI", 9, FontStyle.Bold)
e.CellStyle.SelectionForeColor = Color.Green
Else
e.CellStyle.ForeColor = Color.Black
e.CellStyle.Font = New Font("Segoe UI", 8.25, FontStyle.Regular)
e.CellStyle.SelectionForeColor = Color.FromKnownColor(KnownColor.HighlightText)
End If
End If
If e.ColumnIndex >= 1 AndAlso e.ColumnIndex <= 4 AndAlso e.RowIndex >= 0 Then
If Convert.ToBoolean(Me.dgvTVSeasons.Item(7, e.RowIndex).Value) Then
e.CellStyle.BackColor = Color.LightSteelBlue
e.CellStyle.SelectionBackColor = Color.DarkTurquoise
Else
e.CellStyle.BackColor = Color.White
e.CellStyle.SelectionBackColor = Color.FromKnownColor(KnownColor.Highlight)
End If
If e.ColumnIndex = 3 OrElse e.ColumnIndex = 4 Then
e.PaintBackground(e.ClipBounds, True)
Dim pt As Point = e.CellBounds.Location
Dim offset As Integer = Convert.ToInt32((e.CellBounds.Width - Me.ilColumnIcons.ImageSize.Width) / 2)
pt.X += offset
pt.Y = e.CellBounds.Top + 3
Me.ilColumnIcons.Draw(e.Graphics, pt, If(Convert.ToBoolean(e.Value), 6, 7))
e.Handled = True
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVSeasons_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles dgvTVSeasons.KeyDown
'stop enter key from selecting next list item
e.Handled = e.KeyCode = Keys.Enter
End Sub
Private Sub dgvTVSeasons_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles dgvTVSeasons.KeyPress
Try
If Not StringUtils.AlphaNumericOnly(e.KeyChar) Then
KeyBuffer = String.Concat(KeyBuffer, e.KeyChar.ToString.ToLower)
tmrKeyBuffer.Start()
For Each drvRow As DataGridViewRow In Me.dgvTVSeasons.Rows
If drvRow.Cells(2).Value.ToString.StartsWith(KeyBuffer) Then
drvRow.Selected = True
Me.dgvTVSeasons.CurrentCell = drvRow.Cells(1)
Exit For
End If
Next
ElseIf e.KeyChar = Chr(13) Then
If Me.fScanner.IsBusy OrElse Me.bwMediaInfo.IsBusy OrElse Me.bwLoadShowInfo.IsBusy OrElse Me.bwLoadSeasonInfo.IsBusy OrElse Me.bwLoadEpInfo.IsBusy OrElse Me.bwRefreshMovies.IsBusy OrElse Me.bwMovieScraper.IsBusy OrElse Me.bwCleanDB.IsBusy Then Return
Dim indX As Integer = Me.dgvTVSeasons.SelectedRows(0).Index
Dim ShowID As Integer = Convert.ToInt32(Me.dgvTVSeasons.Item(0, indX).Value)
Dim Season As Integer = Convert.ToInt32(Me.dgvTVSeasons.Item(2, indX).Value)
Master.currShow = Master.DB.LoadTVSeasonFromDB(ShowID, Season, True)
Using dEditSeason As New dlgEditSeason
If dEditSeason.ShowDialog() = Windows.Forms.DialogResult.OK Then
If Me.RefreshSeason(ShowID, Season, False) Then
Me.FillSeasons(ShowID)
End If
End If
End Using
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVSeasons_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgvTVSeasons.MouseDown
Try
If e.Button = Windows.Forms.MouseButtons.Right And Me.dgvTVSeasons.RowCount > 0 Then
Me.mnuSeasons.Enabled = False
Dim dgvHTI As DataGridView.HitTestInfo = dgvTVSeasons.HitTest(e.X, e.Y)
If dgvHTI.Type = DataGridViewHitTestType.Cell Then
If Me.dgvTVSeasons.SelectedRows.Count > 1 AndAlso Me.dgvTVSeasons.Rows(dgvHTI.RowIndex).Selected Then
Dim setMark As Boolean = False
Dim setLock As Boolean = False
Me.mnuSeasons.Enabled = True
Me.cmnuSeasonTitle.Text = Master.eLang.GetString(106, ">> Multiple <<")
Me.ToolStripSeparator16.Visible = False
Me.cmnuSeasonChangeImages.Visible = False
Me.ToolStripSeparator14.Visible = False
Me.cmnuSeasonRescrape.Visible = False
Me.ToolStripSeparator15.Visible = False
Me.cmnuSeasonOpenFolder.Visible = False
For Each sRow As DataGridViewRow In Me.dgvTVSeasons.SelectedRows
'if any one item is set as unmarked, set menu to mark
'else they are all marked, so set menu to unmark
If Not Convert.ToBoolean(sRow.Cells(8).Value) Then
setMark = True
If setLock Then Exit For
End If
'if any one item is set as unlocked, set menu to lock
'else they are all locked so set menu to unlock
If Not Convert.ToBoolean(sRow.Cells(7).Value) Then
setLock = True
If setMark Then Exit For
End If
Next
Me.cmnuMarkSeason.Text = If(setMark, Master.eLang.GetString(23, "Mark"), Master.eLang.GetString(107, "Unmark"))
Me.cmnuLockSeason.Text = If(setLock, Master.eLang.GetString(24, "Lock"), Master.eLang.GetString(108, "Unlock"))
Else
Me.ToolStripSeparator16.Visible = True
Me.cmnuSeasonChangeImages.Visible = True
Me.ToolStripSeparator14.Visible = True
Me.cmnuSeasonRescrape.Visible = True
Me.ToolStripSeparator15.Visible = True
Me.cmnuSeasonOpenFolder.Visible = True
Me.cmnuSeasonTitle.Text = String.Concat(">> ", Me.dgvTVSeasons.Item(1, dgvHTI.RowIndex).Value, " <<")
Me.cmnuMarkSeason.Text = If(Convert.ToBoolean(Me.dgvTVSeasons.Item(8, dgvHTI.RowIndex).Value), Master.eLang.GetString(107, "Unmark"), Master.eLang.GetString(23, "Mark"))
Me.cmnuLockSeason.Text = If(Convert.ToBoolean(Me.dgvTVSeasons.Item(7, dgvHTI.RowIndex).Value), Master.eLang.GetString(108, "Unlock"), Master.eLang.GetString(24, "Lock"))
Me.cmnuSeasonChangeImages.Enabled = Convert.ToInt32(Me.dgvTVSeasons.Item(2, dgvHTI.RowIndex).Value) >= 0
If Not Me.dgvTVSeasons.Rows(dgvHTI.RowIndex).Selected OrElse Not Me.currList = 1 Then
Me.prevSeasonRow = -1
Me.currList = 1
Me.dgvTVSeasons.CurrentCell = Nothing
Me.dgvTVSeasons.ClearSelection()
Me.dgvTVSeasons.Rows(dgvHTI.RowIndex).Selected = True
Me.dgvTVSeasons.CurrentCell = Me.dgvTVSeasons.Item(1, dgvHTI.RowIndex)
Else
Me.mnuSeasons.Enabled = True
End If
End If
Else
Me.mnuSeasons.Enabled = False
Me.cmnuSeasonTitle.Text = Master.eLang.GetString(845, ">> No Item Selected <<")
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVSeasons_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvTVSeasons.Sorted
Me.prevSeasonRow = -1
If Me.dgvTVSeasons.RowCount > 0 Then
Me.dgvTVSeasons.CurrentCell = Nothing
Me.dgvTVSeasons.ClearSelection()
Me.dgvTVSeasons.Rows(0).Selected = True
Me.dgvTVSeasons.CurrentCell = Me.dgvTVSeasons.Rows(0).Cells(1)
End If
End Sub
Private Sub dgvTVSeason_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvTVSeasons.Resize
ResizeTVLists(2)
End Sub
Private Sub dgvTVShows_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvTVShows.CellClick
If Me.dgvTVShows.SelectedRows.Count > 0 Then
If Me.dgvTVShows.RowCount > 0 Then
Me.tmpTitle = Me.dgvTVShows.SelectedRows(0).Cells(1).Value.ToString
Me.tmpTVDB = Me.dgvTVShows.SelectedRows(0).Cells(9).Value.ToString
Me.tmpLang = Me.dgvTVShows.SelectedRows(0).Cells(22).Value.ToString
Me.tmpOrdering = DirectCast(Convert.ToInt32(Me.dgvTVShows.SelectedRows(0).Cells(23).Value), Enums.Ordering)
If Me.dgvTVShows.SelectedRows.Count > 1 Then
Me.SetStatus(String.Format(Master.eLang.GetString(627, "Selected Items: {0}"), Me.dgvTVShows.SelectedRows.Count))
ElseIf Me.dgvTVShows.SelectedRows.Count = 1 Then
Me.SetStatus(Me.dgvTVShows.SelectedRows(0).Cells(1).Value.ToString)
End If
End If
Me.currShowRow = Me.dgvTVShows.SelectedRows(0).Index
If Not Me.currList = 0 Then
Me.currList = 0
Me.prevShowRow = -1
Me.SelectShowRow(Me.dgvTVShows.SelectedRows(0).Index)
End If
End If
End Sub
Private Sub dgvTVShows_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvTVShows.CellDoubleClick
Try
If e.RowIndex < 0 Then Exit Sub
If Me.fScanner.IsBusy OrElse Me.bwMediaInfo.IsBusy OrElse Me.bwLoadShowInfo.IsBusy OrElse Me.bwLoadSeasonInfo.IsBusy OrElse Me.bwLoadEpInfo.IsBusy OrElse Me.bwRefreshMovies.IsBusy OrElse Me.bwMovieScraper.IsBusy OrElse Me.bwCleanDB.IsBusy Then Return
Dim indX As Integer = Me.dgvTVShows.SelectedRows(0).Index
Dim ID As Integer = Convert.ToInt32(Me.dgvTVShows.Item(0, indX).Value)
Master.currShow = Master.DB.LoadTVFullShowFromDB(ID)
Using dEditShow As New dlgEditShow
Select Case dEditShow.ShowDialog()
Case Windows.Forms.DialogResult.OK
Me.SetShowListItemAfterEdit(ID, indX)
If Me.RefreshShow(ID, False, True, False, False) Then
Me.FillList(0)
End If
End Select
End Using
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVShows_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvTVShows.CellEnter
Try
If Not Me.tabsMain.SelectedIndex = 1 OrElse Not Me.currList = 0 Then Return
Me.tmrWait.Stop()
Me.tmrWaitSeason.Stop()
Me.tmrWaitEp.Stop()
Me.tmrWaitShow.Stop()
Me.tmrLoad.Stop()
Me.tmrLoadSeason.Stop()
Me.tmrLoadEp.Stop()
Me.tmrLoadShow.Stop()
Me.currShowRow = e.RowIndex
Me.tmrWaitShow.Start()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVShows_CellPainting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles dgvTVShows.CellPainting
Try
If Master.isWindows AndAlso e.RowIndex >= 0 AndAlso Not Me.dgvTVShows.Item(e.ColumnIndex, e.RowIndex).Displayed Then
e.Handled = True
Return
End If
'icons
If e.ColumnIndex >= 2 AndAlso e.ColumnIndex <= 4 AndAlso e.RowIndex = -1 Then
e.PaintBackground(e.ClipBounds, False)
Dim pt As Point = e.CellBounds.Location
Dim offset As Integer = Convert.ToInt32((e.CellBounds.Width - Me.ilColumnIcons.ImageSize.Width) / 2)
pt.X += offset
pt.Y = 1
Me.ilColumnIcons.Draw(e.Graphics, pt, e.ColumnIndex - 2)
e.Handled = True
End If
If e.ColumnIndex = 1 AndAlso e.RowIndex >= 0 Then
If Convert.ToBoolean(Me.dgvTVShows.Item(6, e.RowIndex).Value) Then
e.CellStyle.ForeColor = Color.Crimson
e.CellStyle.Font = New Font("Segoe UI", 9, FontStyle.Bold)
e.CellStyle.SelectionForeColor = Color.Crimson
ElseIf Convert.ToBoolean(Me.dgvTVShows.Item(5, e.RowIndex).Value) Then
e.CellStyle.ForeColor = Color.Green
e.CellStyle.Font = New Font("Segoe UI", 9, FontStyle.Bold)
e.CellStyle.SelectionForeColor = Color.Green
Else
e.CellStyle.ForeColor = Color.Black
e.CellStyle.Font = New Font("Segoe UI", 8.25, FontStyle.Regular)
e.CellStyle.SelectionForeColor = Color.FromKnownColor(KnownColor.HighlightText)
End If
End If
If e.ColumnIndex >= 1 AndAlso e.ColumnIndex <= 4 AndAlso e.RowIndex >= 0 Then
If Convert.ToBoolean(Me.dgvTVShows.Item(10, e.RowIndex).Value) Then
e.CellStyle.BackColor = Color.LightSteelBlue
e.CellStyle.SelectionBackColor = Color.DarkTurquoise
Else
e.CellStyle.BackColor = Color.White
e.CellStyle.SelectionBackColor = Color.FromKnownColor(KnownColor.Highlight)
End If
If e.ColumnIndex >= 2 AndAlso e.ColumnIndex <= 4 Then
e.PaintBackground(e.ClipBounds, True)
Dim pt As Point = e.CellBounds.Location
Dim offset As Integer = Convert.ToInt32((e.CellBounds.Width - Me.ilColumnIcons.ImageSize.Width) / 2)
pt.X += offset
pt.Y = e.CellBounds.Top + 3
Me.ilColumnIcons.Draw(e.Graphics, pt, If(Convert.ToBoolean(e.Value), 6, 7))
e.Handled = True
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVShows_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles dgvTVShows.KeyDown
'stop enter key from selecting next list item
e.Handled = e.KeyCode = Keys.Enter
End Sub
Private Sub dgvTVShows_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles dgvTVShows.KeyPress
Try
If Not StringUtils.AlphaNumericOnly(e.KeyChar) Then
KeyBuffer = String.Concat(KeyBuffer, e.KeyChar.ToString.ToLower)
tmrKeyBuffer.Start()
For Each drvRow As DataGridViewRow In Me.dgvTVShows.Rows
If drvRow.Cells(1).Value.ToString.ToLower.StartsWith(KeyBuffer) Then
drvRow.Selected = True
Me.dgvTVShows.CurrentCell = drvRow.Cells(1)
Exit For
End If
Next
ElseIf e.KeyChar = Chr(13) Then
If Me.fScanner.IsBusy OrElse Me.bwMediaInfo.IsBusy OrElse Me.bwLoadShowInfo.IsBusy OrElse Me.bwLoadSeasonInfo.IsBusy OrElse Me.bwLoadEpInfo.IsBusy OrElse Me.bwRefreshMovies.IsBusy OrElse Me.bwMovieScraper.IsBusy OrElse Me.bwCleanDB.IsBusy Then Return
Dim indX As Integer = Me.dgvTVShows.SelectedRows(0).Index
Dim ID As Integer = Convert.ToInt32(Me.dgvTVShows.Item(0, indX).Value)
Master.currShow = Master.DB.LoadTVFullShowFromDB(ID)
Using dEditShow As New dlgEditShow
Select Case dEditShow.ShowDialog()
Case Windows.Forms.DialogResult.OK
Me.SetShowListItemAfterEdit(ID, indX)
If Me.RefreshShow(ID, False, True, False, False) Then
Me.FillList(0)
End If
End Select
End Using
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVShows_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgvTVShows.MouseDown
Try
If e.Button = Windows.Forms.MouseButtons.Right And Me.dgvTVShows.RowCount > 0 Then
Me.mnuShows.Enabled = False
Dim dgvHTI As DataGridView.HitTestInfo = dgvTVShows.HitTest(e.X, e.Y)
If dgvHTI.Type = DataGridViewHitTestType.Cell Then
Me.tmpTitle = Me.dgvTVShows.Item(1, dgvHTI.RowIndex).Value.ToString
Me.tmpTVDB = Me.dgvTVShows.Item(9, dgvHTI.RowIndex).Value.ToString
Me.tmpLang = Me.dgvTVShows.Item(22, dgvHTI.RowIndex).Value.ToString
Me.tmpOrdering = DirectCast(Convert.ToInt32(Me.dgvTVShows.Item(23, dgvHTI.RowIndex).Value), Enums.Ordering)
If Me.dgvTVShows.SelectedRows.Count > 1 AndAlso Me.dgvTVShows.Rows(dgvHTI.RowIndex).Selected Then
Dim setMark As Boolean = False
Dim setLock As Boolean = False
Me.mnuShows.Enabled = True
Me.cmnuShowTitle.Text = Master.eLang.GetString(106, ">> Multiple <<")
Me.ToolStripSeparator8.Visible = False
Me.cmnuEditShow.Visible = False
Me.ToolStripSeparator7.Visible = False
' Me.cmnuRescrapeShow.Visible = False
Me.cmnuChangeShow.Visible = False
Me.cmnuShowOpenFolder.Visible = False
Me.ToolStripSeparator20.Visible = False
For Each sRow As DataGridViewRow In Me.dgvTVShows.SelectedRows
'if any one item is set as unmarked, set menu to mark
'else they are all marked, so set menu to unmark
If Not Convert.ToBoolean(sRow.Cells(6).Value) Then
setMark = True
If setLock Then Exit For
End If
'if any one item is set as unlocked, set menu to lock
'else they are all locked so set menu to unlock
If Not Convert.ToBoolean(sRow.Cells(10).Value) Then
setLock = True
If setMark Then Exit For
End If
Next
Me.cmnuMarkShow.Text = If(setMark, Master.eLang.GetString(23, "Mark"), Master.eLang.GetString(107, "Unmark"))
Me.cmnuLockShow.Text = If(setLock, Master.eLang.GetString(24, "Lock"), Master.eLang.GetString(108, "Unlock"))
Else
Me.ToolStripSeparator8.Visible = True
Me.cmnuEditShow.Visible = True
Me.ToolStripSeparator7.Visible = True
Me.cmnuRescrapeShow.Visible = True
Me.cmnuChangeShow.Visible = True
Me.cmnuShowOpenFolder.Visible = True
Me.ToolStripSeparator20.Visible = True
Me.cmnuShowTitle.Text = String.Concat(">> ", Me.dgvTVShows.Item(1, dgvHTI.RowIndex).Value, " <<")
Me.cmnuMarkShow.Text = If(Convert.ToBoolean(Me.dgvTVShows.Item(6, dgvHTI.RowIndex).Value), Master.eLang.GetString(107, "Unmark"), Master.eLang.GetString(23, "Mark"))
Me.cmnuLockShow.Text = If(Convert.ToBoolean(Me.dgvTVShows.Item(10, dgvHTI.RowIndex).Value), Master.eLang.GetString(108, "Unlock"), Master.eLang.GetString(24, "Lock"))
If Not Me.dgvTVShows.Rows(dgvHTI.RowIndex).Selected OrElse Not Me.currList = 0 Then
Me.prevShowRow = -1
Me.currList = 0
Me.dgvTVShows.CurrentCell = Nothing
Me.dgvTVShows.ClearSelection()
Me.dgvTVShows.Rows(dgvHTI.RowIndex).Selected = True
Me.dgvTVShows.CurrentCell = Me.dgvTVShows.Item(3, dgvHTI.RowIndex)
Else
Me.mnuShows.Enabled = True
End If
End If
Else
Me.mnuShows.Enabled = False
Me.cmnuShowTitle.Text = Master.eLang.GetString(845, ">> No Item Selected <<")
End If
End If
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Private Sub dgvTVShows_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvTVShows.Resize
ResizeTVLists(1)
End Sub
Private Sub dgvTVShows_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvTVShows.Sorted
Me.prevShowRow = -1
If Me.dgvTVShows.RowCount > 0 Then
Me.dgvTVShows.CurrentCell = Nothing
Me.dgvTVShows.ClearSelection()
Me.dgvTVShows.Rows(0).Selected = True
Me.dgvTVShows.CurrentCell = Me.dgvTVShows.Rows(0).Cells(1)
End If
End Sub
Private Sub DonateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DonateToolStripMenuItem.Click
If Master.isWindows Then
Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=G4WN5KRET4K48")
Else
Using Explorer As New Process
Explorer.StartInfo.FileName = "xdg-open"
Explorer.StartInfo.Arguments = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=G4WN5KRET4K48"
Explorer.Start()
End Using
End If
End Sub
Private Sub DoTitleCheck()
Try
Using SQLtransaction As SQLite.SQLiteTransaction = Master.DB.MediaDBConn.BeginTransaction()
Using SQLcommand As SQLite.SQLiteCommand = Master.DB.MediaDBConn.CreateCommand()
SQLcommand.CommandText = "UPDATE movies SET OutOfTolerance = (?) WHERE ID = (?);"
Dim parOutOfTolerance As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parOutOfTolerance", DbType.Boolean, 0, "OutOfTolerance")
Dim parID As SQLite.SQLiteParameter = SQLcommand.Parameters.Add("parID", DbType.Int32, 0, "ID")
Dim LevFail As Boolean = False
Dim pTitle As String = String.Empty
For Each drvRow As DataGridViewRow In Me.dgvMediaList.Rows
If Master.eSettings.LevTolerance > 0 Then
If FileUtils.Common.isVideoTS(drvRow.Cells(1).Value.ToString) Then
pTitle = Directory.GetParent(Directory.GetParent(drvRow.Cells(1).Value.ToString).FullName).Name
ElseIf FileUtils.Common.isBDRip(drvRow.Cells(1).Value.ToString) Then
pTitle = Directory.GetParent(Directory.GetParent(Directory.GetParent(drvRow.Cells(1).Value.ToString).FullName).FullName).Name
Else
If Convert.ToBoolean(drvRow.Cells(42).Value) AndAlso Convert.ToBoolean(drvRow.Cells(2).Value) Then
pTitle = Directory.GetParent(drvRow.Cells(1).Value.ToString).Name
Else
pTitle = Path.GetFileNameWithoutExtension(drvRow.Cells(1).Value.ToString)
End If
End If
LevFail = StringUtils.ComputeLevenshtein(StringUtils.FilterName(drvRow.Cells(15).Value.ToString, False, True).ToLower, StringUtils.FilterName(pTitle, False, True).ToLower) > Master.eSettings.LevTolerance
parOutOfTolerance.Value = LevFail
drvRow.Cells(43).Value = LevFail
parID.Value = drvRow.Cells(0).Value
Else
parOutOfTolerance.Value = False
drvRow.Cells(43).Value = False
parID.Value = drvRow.Cells(0).Value
End If
SQLcommand.ExecuteNonQuery()
Next
End Using
SQLtransaction.Commit()
End Using
Me.dgvMediaList.Invalidate()
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
End Sub
Sub dtListUpdate(ByVal drow As DataRow, ByVal i As Integer, ByVal v As Object)
drow.Item(i) = v
End Sub
Private Sub EnableFilters(ByVal isEnabled As Boolean)
Me.txtSearch.Enabled = isEnabled
Me.cbSearch.Enabled = isEnabled
Me.chkFilterDupe.Enabled = isEnabled
Me.chkFilterTolerance.Enabled = If(Master.eSettings.LevTolerance > 0, isEnabled, False)
Me.chkFilterMissing.Enabled = isEnabled
Me.chkFilterMark.Enabled = isEnabled
Me.chkFilterNew.Enabled = isEnabled
Me.chkFilterLock.Enabled = isEnabled
Me.rbFilterOr.Enabled = isEnabled
Me.rbFilterAnd.Enabled = isEnabled
Me.txtFilterSource.Enabled = isEnabled
Me.cbFilterFileSource.Enabled = isEnabled
Me.txtFilterGenre.Enabled = isEnabled
Me.cbFilterYearMod.Enabled = isEnabled
Me.cbFilterYear.Enabled = isEnabled
Me.btnClearFilters.Enabled = isEnabled
End Sub
Private Sub ErrorOccurred()
Me.ErrorToolStripMenuItem.Visible = True
If dlgErrorViewer.Visible Then dlgErrorViewer.UpdateLog()
End Sub
Private Sub ErrorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ErrorToolStripMenuItem.Click
dlgErrorViewer.Show(Me)
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click, cmnuTrayIconExit.Click
If isCL Then
'fLoading.SetLoadingMesg("Canceling ...")
fLoading.SetLoadingMesg(Master.eLang.GetString(370, "Canceling Load..."))
If Me.bwMovieScraper.IsBusy Then Me.bwMovieScraper.CancelAsync()
If Me.bwRefreshMovies.IsBusy Then Me.bwRefreshMovies.CancelAsync()
While Me.bwMovieScraper.IsBusy OrElse Me.bwRefreshMovies.IsBusy OrElse Me.bwMovieScraper.IsBusy
Application.DoEvents()
Threading.Thread.Sleep(50)
End While
Else
Me.Close()
Application.Exit()
End If
End Sub
Private Sub FillEpisodes(ByVal ShowID As Integer, ByVal Season As Integer)
Me.bsEpisodes.DataSource = Nothing
Me.dgvTVEpisodes.DataSource = Nothing
Application.DoEvents()
Me.dgvTVEpisodes.Enabled = False
Master.DB.FillDataTable(Me.dtEpisodes, String.Concat("SELECT * FROM TVEps WHERE TVShowID = ", ShowID, " AND Season = ", Season, " ORDER BY Episode;"))
If Me.dtEpisodes.Rows.Count > 0 Then
With Me
.bsEpisodes.DataSource = .dtEpisodes
.dgvTVEpisodes.DataSource = .bsEpisodes
.dgvTVEpisodes.Columns(0).Visible = False
.dgvTVEpisodes.Columns(1).Visible = False
.dgvTVEpisodes.Columns(2).Resizable = DataGridViewTriState.False
.dgvTVEpisodes.Columns(2).ReadOnly = True
.dgvTVEpisodes.Columns(2).Width = 40
.dgvTVEpisodes.Columns(2).SortMode = DataGridViewColumnSortMode.Automatic
.dgvTVEpisodes.Columns(2).ToolTipText = Master.eLang.GetString(755, "Episode #")
.dgvTVEpisodes.Columns(2).HeaderText = "#"
.dgvTVEpisodes.Columns(3).Resizable = DataGridViewTriState.True
.dgvTVEpisodes.Columns(3).ReadOnly = True
.dgvTVEpisodes.Columns(3).MinimumWidth = 83
.dgvTVEpisodes.Columns(3).SortMode = DataGridViewColumnSortMode.Automatic
.dgvTVEpisodes.Columns(3).ToolTipText = Master.eLang.GetString(21, "Title")
.dgvTVEpisodes.Columns(3).HeaderText = Master.eLang.GetString(21, "Title")
.dgvTVEpisodes.Columns(4).Width = 20
.dgvTVEpisodes.Columns(4).Resizable = DataGridViewTriState.False
.dgvTVEpisodes.Columns(4).ReadOnly = True
.dgvTVEpisodes.Columns(4).SortMode = DataGridViewColumnSortMode.Automatic
.dgvTVEpisodes.Columns(4).Visible = Not Master.eSettings.EpisodePosterCol
.dgvTVEpisodes.Columns(4).ToolTipText = Master.eLang.GetString(148, "Poster")
.dgvTVEpisodes.Columns(5).Width = 20
.dgvTVEpisodes.Columns(5).Resizable = DataGridViewTriState.False
.dgvTVEpisodes.Columns(5).ReadOnly = True
.dgvTVEpisodes.Columns(5).SortMode = DataGridViewColumnSortMode.Automatic
.dgvTVEpisodes.Columns(5).Visible = Not Master.eSettings.EpisodeFanartCol
.dgvTVEpisodes.Columns(5).ToolTipText = Master.eLang.GetString(149, "Fanart")
.dgvTVEpisodes.Columns(6).Width = 20
.dgvTVEpisodes.Columns(6).Resizable = DataGridViewTriState.False
.dgvTVEpisodes.Columns(6).ReadOnly = True
.dgvTVEpisodes.Columns(6).SortMode = DataGridViewColumnSortMode.Automatic
.dgvTVEpisodes.Columns(6).Visible = Not Master.eSettings.EpisodeNfoCol
.dgvTVEpisodes.Columns(6).ToolTipText = Master.eLang.GetString(150, "Nfo")
For i As Integer = 7 To .dgvTVEpisodes.Columns.Count - 1
.dgvTVEpisodes.Columns(i).Visible = False
Next
.dgvTVEpisodes.Columns(0).ValueType = GetType(Int32)
.dgvTVEpisodes.Columns(2).ValueType = GetType(Int32)
If Master.isWindows Then .dgvTVEpisodes.Columns(3).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
ResizeTVLists(3)
.dgvTVEpisodes.Sort(.dgvTVEpisodes.Columns(2), ComponentModel.ListSortDirection.Ascending)
.dgvTVEpisodes.ClearSelection()
.dgvTVEpisodes.CurrentCell = Nothing
End With
End If
Me.dgvTVEpisodes.Enabled = True
End Sub
Private Sub FillList(ByVal iIndex As Integer)
Try
Me.bsMedia.DataSource = Nothing
Me.dgvMediaList.DataSource = Nothing
Me.bsShows.DataSource = Nothing
Me.dgvTVShows.DataSource = Nothing
Me.bsSeasons.DataSource = Nothing
Me.dgvTVSeasons.DataSource = Nothing
Me.bsEpisodes.DataSource = Nothing
Me.dgvTVEpisodes.DataSource = Nothing
Me.ClearInfo()
If Not String.IsNullOrEmpty(Me.filSearch) AndAlso Me.cbSearch.Text = Master.eLang.GetString(100, "Actor") Then
Master.DB.FillDataTable(Me.dtMedia, String.Concat("SELECT * FROM movies WHERE ID IN (SELECT MovieID FROM MoviesActors WHERE ActorName LIKE '%", Me.filSearch, "%') ORDER BY ListTitle COLLATE NOCASE;"))
Else
If Me.chkFilterDupe.Checked Then
Master.DB.FillDataTable(Me.dtMedia, "SELECT * FROM movies WHERE imdb IN (SELECT imdb FROM movies WHERE imdb IS NOT NULL AND LENGTH(imdb) > 0 GROUP BY imdb HAVING ( COUNT(imdb) > 1 )) ORDER BY ListTitle COLLATE NOCASE;")
Else
Master.DB.FillDataTable(Me.dtMedia, "SELECT * FROM movies ORDER BY ListTitle COLLATE NOCASE;")
End If
End If
Master.DB.FillDataTable(Me.dtShows, "SELECT * FROM TVShows ORDER BY Title COLLATE NOCASE;")
If isCL Then
Me.LoadingDone = True
Else
If Me.dtMedia.Rows.Count > 0 Then
With Me
.bsMedia.DataSource = .dtMedia
.dgvMediaList.DataSource = .bsMedia
.dgvMediaList.Columns(0).Visible = False
.dgvMediaList.Columns(1).Visible = False
.dgvMediaList.Columns(2).Visible = False
.dgvMediaList.Columns(3).Resizable = DataGridViewTriState.True
.dgvMediaList.Columns(3).ReadOnly = True
.dgvMediaList.Columns(3).MinimumWidth = 83
.dgvMediaList.Columns(3).SortMode = DataGridViewColumnSortMode.Automatic
.dgvMediaList.Columns(3).ToolTipText = Master.eLang.GetString(21, "Title")
.dgvMediaList.Columns(3).HeaderText = Master.eLang.GetString(21, "Title")
.dgvMediaList.Columns(4).Width = 20
.dgvMediaList.Columns(4).Resizable = DataGridViewTriState.False
.dgvMediaList.Columns(4).ReadOnly = True
.dgvMediaList.Columns(4).SortMode = DataGridViewColumnSortMode.Automatic
.dgvMediaList.Columns(4).Visible = Not Master.eSettings.MoviePosterCol
.dgvMediaList.Columns(4).ToolTipText = Master.eLang.GetString(148, "Poster")
.dgvMediaList.Columns(5).Width = 20
.dgvMediaList.Columns(5).Resizable = DataGridViewTriState.False
.dgvMediaList.Columns(5).ReadOnly = True
.dgvMediaList.Columns(5).SortMode = DataGridViewColumnSortMode.Automatic
.dgvMediaList.Columns(5).Visible = Not Master.eSettings.MovieFanartCol
.dgvMediaList.Columns(5).ToolTipText = Master.eLang.GetString(149, "Fanart")
.dgvMediaList.Columns(6).Width = 20
.dgvMediaList.Columns(6).Resizable = DataGridViewTriState.False
.dgvMediaList.Columns(6).ReadOnly = True
.dgvMediaList.Columns(6).SortMode = DataGridViewColumnSortMode.Automatic
.dgvMediaList.Columns(6).Visible = Not Master.eSettings.MovieInfoCol
.dgvMediaList.Columns(6).ToolTipText = Master.eLang.GetString(150, "Nfo")
.dgvMediaList.Columns(7).Width = 20
.dgvMediaList.Columns(7).Resizable = DataGridViewTriState.False
.dgvMediaList.Columns(7).ReadOnly = True
.dgvMediaList.Columns(7).SortMode = DataGridViewColumnSortMode.Automatic
.dgvMediaList.Columns(7).Visible = Not Master.eSettings.MovieTrailerCol
.dgvMediaList.Columns(7).ToolTipText = Master.eLang.GetString(151, "Trailer")
.dgvMediaList.Columns(8).Width = 20
.dgvMediaList.Columns(8).Resizable = DataGridViewTriState.False
.dgvMediaList.Columns(8).ReadOnly = True
.dgvMediaList.Columns(8).SortMode = DataGridViewColumnSortMode.Automatic
.dgvMediaList.Columns(8).Visible = Not Master.eSettings.MovieSubCol
.dgvMediaList.Columns(8).ToolTipText = Master.eLang.GetString(152, "Subtitles")
.dgvMediaList.Columns(9).Width = 20
.dgvMediaList.Columns(9).Resizable = DataGridViewTriState.False
.dgvMediaList.Columns(9).ReadOnly = True
.dgvMediaList.Columns(9).SortMode = DataGridViewColumnSortMode.Automatic
.dgvMediaList.Columns(9).Visible = Not Master.eSettings.MovieExtraCol
.dgvMediaList.Columns(9).ToolTipText = Master.eLang.GetString(153, "Extrathumbs")
For i As Integer = 10 To .dgvMediaList.Columns.Count - 1
.dgvMediaList.Columns(i).Visible = False
Next
.dgvMediaList.Columns(0).ValueType = GetType(Int32)
If Master.isWindows Then .dgvMediaList.Columns(3).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
ResizeMediaList()
If .dgvMediaList.RowCount > 0 AndAlso Me.tabsMain.SelectedIndex = 0 Then
.dgvMediaList.Sort(.dgvMediaList.Columns(3), ComponentModel.ListSortDirection.Ascending)
.SetControlsEnabled(True)
End If
End With
End If
Me.dgvTVShows.Enabled = False
If Me.dtShows.Rows.Count > 0 Then
With Me
.bsShows.DataSource = .dtShows
.dgvTVShows.DataSource = .bsShows
.dgvTVShows.Columns(0).Visible = False
.dgvTVShows.Columns(1).Resizable = DataGridViewTriState.True
.dgvTVShows.Columns(1).ReadOnly = True
.dgvTVShows.Columns(1).MinimumWidth = 83
.dgvTVShows.Columns(1).SortMode = DataGridViewColumnSortMode.Automatic
.dgvTVShows.Columns(1).ToolTipText = Master.eLang.GetString(21, "Title")
.dgvTVShows.Columns(1).HeaderText = Master.eLang.GetString(21, "Title")
.dgvTVShows.Columns(2).Width = 20
.dgvTVShows.Columns(2).Resizable = DataGridViewTriState.False
.dgvTVShows.Columns(2).ReadOnly = True
.dgvTVShows.Columns(2).SortMode = DataGridViewColumnSortMode.Automatic
.dgvTVShows.Columns(2).Visible = Not Master.eSettings.ShowPosterCol
.dgvTVShows.Columns(2).ToolTipText = Master.eLang.GetString(148, "Poster")
.dgvTVShows.Columns(3).Width = 20
.dgvTVShows.Columns(3).Resizable = DataGridViewTriState.False
.dgvTVShows.Columns(3).ReadOnly = True
.dgvTVShows.Columns(3).SortMode = DataGridViewColumnSortMode.Automatic
.dgvTVShows.Columns(3).Visible = Not Master.eSettings.ShowFanartCol
.dgvTVShows.Columns(3).ToolTipText = Master.eLang.GetString(149, "Fanart")
.dgvTVShows.Columns(4).Width = 20
.dgvTVShows.Columns(4).Resizable = DataGridViewTriState.False
.dgvTVShows.Columns(4).ReadOnly = True
.dgvTVShows.Columns(4).SortMode = DataGridViewColumnSortMode.Automatic
.dgvTVShows.Columns(4).Visible = Not Master.eSettings.ShowNfoCol
.dgvTVShows.Columns(4).ToolTipText = Master.eLang.GetString(150, "Nfo")
For i As Integer = 5 To .dgvTVShows.Columns.Count - 1
.dgvTVShows.Columns(i).Visible = False
Next
.dgvTVShows.Columns(0).ValueType = GetType(Int32)
If Master.isWindows Then .dgvTVShows.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
ResizeTVLists(1)
If .dgvTVShows.RowCount > 0 Then
.dgvTVShows.Sort(.dgvTVShows.Columns(1), ComponentModel.ListSortDirection.Ascending)
.SetControlsEnabled(True)
End If
End With
End If
Me.dgvTVShows.Enabled = True
End If
If Me.dtMedia.Rows.Count = 0 AndAlso Me.dtShows.Rows.Count = 0 Then
Me.SetControlsEnabled(False, False, False)
Me.SetStatus(String.Empty)
Me.ClearInfo()
End If
Catch ex As Exception
Me.LoadingDone = True
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
If Not isCL Then
Me.tsbRefreshMedia.Enabled = True
Me.cmnuTrayIconExit.Enabled = True
Me.cmnuTrayIconSettings.Enabled = True
Me.EditToolStripMenuItem.Enabled = True
Me.cmnuTrayIconUpdateMedia.Enabled = True
Me.HelpToolStripMenuItem.Enabled = True
Me.tslLoading.Visible = False
Me.tspbLoading.Visible = False
Me.tspbLoading.Value = 0
Me.tabsMain.Enabled = True
Me.DoTitleCheck()
Me.EnableFilters(True)
Me.SetTVCount()
End If
End Sub
Private Sub fillScreenInfoWithEpisode()
Dim g As Graphics
Dim strSize As String
Dim lenSize As Integer
Dim rect As Rectangle
Try
Me.SuspendLayout()
Me.lblTitle.Text = If(String.IsNullOrEmpty(Master.currShow.Filename), String.Concat(Master.currShow.TVEp.Title, Master.eLang.GetString(689, " [MISSING]")), Master.currShow.TVEp.Title)
Me.txtPlot.Text = Master.currShow.TVEp.Plot
Me.lblDirector.Text = Master.currShow.TVEp.Director
Me.txtFilePath.Text = Master.currShow.Filename
Me.lblRuntime.Text = String.Format(Master.eLang.GetString(647, "Aired: {0}"), If(String.IsNullOrEmpty(Master.currShow.TVEp.Aired), "?", Master.currShow.TVEp.Aired))
Me.lblTagline.Text = String.Format(Master.eLang.GetString(648, "Season: {0}, Episode: {1}"), _
If(String.IsNullOrEmpty(Master.currShow.TVEp.Season.ToString), "?", Master.currShow.TVEp.Season.ToString), _
If(String.IsNullOrEmpty(Master.currShow.TVEp.Episode.ToString), "?", Master.currShow.TVEp.Episode.ToString))
Me.alActors = New List(Of String)
If Master.currShow.TVEp.Actors.Count > 0 Then
Me.pbActors.Image = My.Resources.actor_silhouette
For Each imdbAct As MediaContainers.Person In Master.currShow.TVEp.Actors
If Not String.IsNullOrEmpty(imdbAct.Thumb) Then
If Not imdbAct.Thumb.ToLower.IndexOf("addtiny.gif") > 0 AndAlso Not imdbAct.Thumb.ToLower.IndexOf("no_photo") > 0 Then
Me.alActors.Add(imdbAct.Thumb)
Else
Me.alActors.Add("none")
End If
Else
Me.alActors.Add("none")
End If
If String.IsNullOrEmpty(imdbAct.Role.Trim) Then
Me.lstActors.Items.Add(imdbAct.Name.Trim)
Else
Me.lstActors.Items.Add(String.Format(Master.eLang.GetString(131, "{0} as {1}"), imdbAct.Name.Trim, imdbAct.Role.Trim))
End If
Next
Me.lstActors.SelectedIndex = 0
End If
If Not String.IsNullOrEmpty(Master.currShow.TVShow.MPAA) Then
Dim tmpRatingImg As Image = APIXML.GetTVRatingImage(Master.currShow.TVShow.MPAA)
If Not IsNothing(tmpRatingImg) Then
Me.pbMPAA.Image = tmpRatingImg
Me.MoveMPAA()
End If
End If
Dim tmpRating As Single = NumUtils.ConvertToSingle(Master.currShow.TVEp.Rating)
If tmpRating > 0 Then
Me.BuildStars(tmpRating)
End If
If Not String.IsNullOrEmpty(Master.currShow.TVShow.Genre) Then
Me.createGenreThumbs(Master.currShow.TVShow.Genre)
End If
If Not String.IsNullOrEmpty(Master.currShow.TVShow.Studio) Then
Me.pbStudio.Image = APIXML.GetStudioImage(Master.currShow.TVShow.Studio)
Me.pbStudio.Tag = Master.currShow.TVShow.Studio
Else
Me.pbStudio.Image = APIXML.GetStudioImage("####")
Me.pbStudio.Tag = String.Empty
End If
If AdvancedSettings.GetBooleanSetting("StudioTagAlwaysOn", False) Then
lblStudio.Text = pbStudio.Tag.ToString
End If
If Master.eSettings.ScanTVMediaInfo AndAlso Not String.IsNullOrEmpty(Master.currShow.Filename) Then
Me.SetAVImages(APIXML.GetAVImages(Master.currShow.TVEp.FileInfo, Master.currShow.Filename, True, APIXML.GetFileSource(Master.currShow.Filename)))
Me.pnlInfoIcons.Width = pbVideo.Width + pbVType.Width + pbResolution.Width + pbAudio.Width + pbChannels.Width + pbStudio.Width + 6
Me.pbStudio.Left = pbVideo.Width + pbVType.Width + pbResolution.Width + pbAudio.Width + pbChannels.Width + 5
Else
Me.pnlInfoIcons.Width = pbStudio.Width + 1
Me.pbStudio.Left = 0
End If
Me.txtMetaData.Text = NFO.FIToString(Master.currShow.TVEp.FileInfo, True)
If Not IsNothing(Me.MainPoster.Image) Then
Me.pbPosterCache.Image = Me.MainPoster.Image
ImageUtils.ResizePB(Me.pbPoster, Me.pbPosterCache, Me.PosterMaxHeight, Me.PosterMaxWidth)
If AdvancedSettings.GetBooleanSetting("PosterGlassOverlay", True) Then ImageUtils.SetGlassOverlay(Me.pbPoster)
Me.pnlPoster.Size = New Size(Me.pbPoster.Width + 10, Me.pbPoster.Height + 10)
If Master.eSettings.ShowDims Then
g = Graphics.FromImage(pbPoster.Image)
g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
strSize = String.Format("{0} x {1}", Me.MainPoster.Image.Width, Me.MainPoster.Image.Height)
lenSize = Convert.ToInt32(g.MeasureString(strSize, New Font("Arial", 8, FontStyle.Bold)).Width)
rect = New Rectangle(Convert.ToInt32((pbPoster.Image.Width - lenSize) / 2 - 15), Me.pbPoster.Height - 25, lenSize + 30, 25)
ImageUtils.DrawGradEllipse(g, rect, Color.FromArgb(250, 120, 120, 120), Color.FromArgb(0, 255, 255, 255))
g.DrawString(strSize, New Font("Arial", 8, FontStyle.Bold), New SolidBrush(Color.White), Convert.ToInt32((pbPoster.Image.Width - lenSize) / 2), Me.pbPoster.Height - 20)
End If
Me.pbPoster.Location = New Point(4, 4)
Else
If Not IsNothing(Me.pbPoster.Image) Then
Me.pbPoster.Image.Dispose()
Me.pbPoster.Image = Nothing
End If
End If
If Not IsNothing(Me.MainFanart.Image) Then
Me.pbFanartCache.Image = Me.MainFanart.Image
ImageUtils.ResizePB(Me.pbFanart, Me.pbFanartCache, Me.scMain.Panel2.Height - 90, Me.scMain.Panel2.Width)
Me.pbFanart.Left = Convert.ToInt32((Me.scMain.Panel2.Width - Me.pbFanart.Width) / 2)
If Not IsNothing(pbFanart.Image) AndAlso Master.eSettings.ShowDims Then
g = Graphics.FromImage(pbFanart.Image)
g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
strSize = String.Format("{0} x {1}", Me.MainFanart.Image.Width, Me.MainFanart.Image.Height)
lenSize = Convert.ToInt32(g.MeasureString(strSize, New Font("Arial", 8, FontStyle.Bold)).Width)
rect = New Rectangle(Convert.ToInt32((pbFanart.Image.Width - lenSize) / 2 - 15), Me.pbFanart.Height - 25, lenSize + 30, 25)
ImageUtils.DrawGradEllipse(g, rect, Color.FromArgb(250, 120, 120, 120), Color.FromArgb(0, 255, 255, 255))
g.DrawString(strSize, New Font("Arial", 8, FontStyle.Bold), New SolidBrush(Color.White), Convert.ToInt32((Me.pbFanart.Image.Width - lenSize) / 2), Me.pbFanart.Height - 20)
End If
Else
If Not IsNothing(Me.pbFanartCache.Image) Then
Me.pbFanartCache.Image.Dispose()
Me.pbFanartCache.Image = Nothing
End If
If Not IsNothing(Me.pbFanart.Image) Then
Me.pbFanart.Image.Dispose()
Me.pbFanart.Image = Nothing
End If
End If
Me.InfoCleared = False
If Not bwMovieScraper.IsBusy AndAlso Not bwRefreshMovies.IsBusy AndAlso Not bwCleanDB.IsBusy Then
Me.SetControlsEnabled(True)
Me.dgvTVEpisodes.Focus()
Else
Me.dgvTVEpisodes.Enabled = True
Me.dgvTVSeasons.Enabled = True
Me.dgvTVShows.Enabled = True
Me.dgvTVEpisodes.Focus()
End If
Application.DoEvents()
Me.pnlTop.Visible = True
If Not IsNothing(Me.pbAllSeason.Image) Then Me.pnlAllSeason.Visible = True
If Not IsNothing(Me.pbPoster.Image) Then Me.pnlPoster.Visible = True
If Not IsNothing(Me.pbMPAA.Image) Then Me.pnlMPAA.Visible = True
For i As Integer = 0 To UBound(Me.pnlGenre)
Me.pnlGenre(i).Visible = True
Next
Catch ex As Exception
Master.eLog.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
Me.ResumeLayout()
End Sub
Private Sub fillScreenInfoWithMovie()
Dim g As Graphics
Dim strSize As String
Dim lenSize As Integer
Dim rect As Rectangle
Try
Me.SuspendLayout()
If Not String.IsNullOrEmpty(Master.currMovie.Movie.Title) AndAlso Not String.IsNullOrEmpty(Master.currMovie.Movie.Year) Then
Me.lblTitle.Text = String.Format("{0} ({1})", Master.currMovie.Movie.Title, Master.currMovie.Movie.Yea