/Forms/Form1/Form1.Tv.vb
Visual Basic | 5202 lines | 4859 code | 206 blank | 137 comment | 11 complexity | 106a7c2f120c9004f75190cd6156e3c1 MD5 | raw file
Possible License(s): GPL-2.0
Large files files are truncated, but you can click here to view the full file
- Imports System.Net
- Imports System.IO
- Imports System.Text.RegularExpressions
- Imports System.Text
- Imports Media_Companion.WorkingWithNfoFiles
- Imports System.Xml
- Imports Media_Companion
- Imports Media_Companion.Pref
- Imports System.Linq
-
- Partial Public Class Form1
- Dim newEpisodeList As New List(Of TvEpisode)
- Public languageList As New List(Of Tvdb.Language)
- Dim listOfShows As New List(Of str_PossibleShowList)
-
- Dim tvdbposterlist As New List(Of TvBanners)
- Dim imdbposterlist As New List(Of TvBanners)
- Dim tvdbmode As Boolean = False
- Dim usedlist As New List(Of TvBanners)
-
- Dim tvobjects As New List(Of String)
-
- #Region "Tv Treeview Routines"
- Public Sub tv_ViewReset()
- btn_SaveTvShowOrEpisode.Enabled = True
- Tv_TreeViewContext_RefreshShow.Enabled = False
- Tv_TreeViewContext_RefreshShow.Visible = False
- Tv_TreeViewContext_ShowMissEps.Enabled = False
- Tv_TreeViewContext_ShowMissEps.Visible = False
- Tv_TreeViewContext_DispByAiredDate.Enabled = False
- Tv_TreeViewContext_DispByAiredDate.Visible = False
- Tv_TreeViewContext_SearchNewEp.Enabled = False
- Tv_TreeViewContext_SearchNewEp.Visible = False
- Tv_TreeViewContext_FindMissArt.Enabled = False
- Tv_TreeViewContext_FindMissArt.Visible = False
-
- Tv_TreeViewContext_ViewNfo.Enabled = False
- ExpandSelectedShowToolStripMenuItem.Enabled = False
- CollapseSelectedShowToolStripMenuItem.Enabled = False
- ExpandAllToolStripMenuItem.Enabled = False
- CollapseAllToolStripMenuItem.Enabled = False
- Tv_TreeViewContext_ReloadFromCache.Enabled = False
- Tv_TreeViewContext_OpenFolder.Enabled = False
-
- tb_ShPremiered.Text = ""
- tb_ShGenre.Text = ""
- tb_ShTvdbId.Text = ""
- tb_ShImdbId.Text = ""
- tb_ShRating.Text = ""
- tb_ShVotes.Text = ""
- tb_ShCert.Text = ""
- tb_ShRunTime.Text = ""
- tb_ShStudio.Text = ""
- cbTvActorRole.Items.Clear()
- cbTvActorRole.Text = ""
-
- cbTvActor.Items.Clear()
- cbTvActor.Text = ""
- PictureBox6.Image = Nothing
-
- tvdbposterlist.Clear()
- PictureBox6.Image = Nothing
- tv_PictureBoxLeft.Image = Nothing
- tv_PictureBoxRight.Image = Nothing
- tv_PictureBoxBottom.Image = Nothing
- tb_ShPremiered.Text = ""
- tb_ShGenre.Text = ""
- tb_ShTvdbId.Text = ""
- tb_ShImdbId.Text = ""
- tb_ShRating.Text = ""
- tb_ShVotes.Text = ""
- tb_ShCert.Text = ""
- tb_ShRunTime.Text = ""
- tb_ShStudio.Text = ""
- cbTvActorRole.Items.Clear()
- cbTvActorRole.Text = ""
- tb_ShPlot.Text = ""
- cbTvActor.Items.Clear()
- cbTvActor.Text = ""
-
- tb_Sh_Ep_Title.Text = ""
- tb_ShPremiered.Text = ""
- tb_ShGenre.Text = ""
- tb_ShTvdbId.Text = ""
- tb_ShImdbId.Text = ""
- tb_ShRating.Text = ""
- tb_ShVotes.Text = ""
- tb_ShCert.Text = ""
- tb_ShRunTime.Text = ""
- tb_ShStudio.Text = ""
- cbTvActorRole.Items.Clear()
- cbTvActorRole.Text = ""
- tb_ShPlot.Text = ""
- cbTvActor.Items.Clear()
- cbTvActor.Text = ""
-
- cbTvActor.Items.Clear()
- cbTvActor.Text = ""
- For i = Panel13.Controls.Count - 1 To 0 Step -1
- Panel13.Controls.RemoveAt(i)
- Next
- End Sub
-
- Private Sub TvTreeview_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TvTreeview.AfterSelect
- TvTreeview_AfterSelect_Do() 'moved this to seperate sub so we can also call this from other locations.
- End Sub
-
- Private Sub TvTreeview_AfterSelect_Do()
- Try
- 'chooses which sub is run to load the relavent tv data to the screen
- 'note: context menu items are set during TvTreeView_MouseUp event because we only need to update if right click is done which we check in the mouseup sub
- 'mouseup sub selects the node underneath the mouse & then this runs since its an event 'AfterSelect'
-
- If TvTreeview.SelectedNode Is Nothing Then Exit Sub
- If TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvShow Then
- tv_ShowLoad(TvTreeview.SelectedNode.Tag)
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvSeason Then
- tv_SeasonSelected(TvTreeview.SelectedNode.Tag)
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvEpisode Then
- tv_EpisodeSelected(TvTreeview.SelectedNode.Tag)
- Else
- MsgBox("None")
- End If
-
- 'tv_SplitContainerAutoPosition() 'auto set container splits....after we have loaded data & pictures....
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub TvTreeview_DragDrop(sender As Object, e As DragEventArgs) Handles TvTreeview.DragDrop
- Dim files() As String
- files = e.Data.GetData(DataFormats.FileDrop)
- For f = 0 To UBound(files)
- If IO.Directory.Exists(files(f)) Then
- If files(f).ToLower.Contains(".actors") Or files(f).ToLower.Contains("season") Then Continue For
- For each fol In Pref.tvRootFolders
- If fol.rpath = files(f) Then Continue For
- If files(f).Contains(fol.rpath) AndAlso Not fol.selected Then
- Dim msg As String = "The series dropped is in a root folder that has been unselected"
- msg &= "To avoid catastrophic failure, please re-select"
- msg &= "root folder: " & fol.rpath
- msg &= "and attempt again"
- MsgBox (msg)
- Continue For
- End If
- Next
- 'If Pref.tvRootFolders.Contains(files(f)) Then Continue For
- Dim di As New IO.DirectoryInfo(files(f))
- If Pref.tvFolders.Contains(files(f)) Then Continue For
- Dim skip As Boolean = False
- For Each item In droppedItems
- If item = files(f) Then
- skip = True
- Exit For
- End If
- Next
- If Not skip Then droppedItems.Add(files(f))
- End If
- Next
- If droppedItems.Count < 1 Then Exit Sub
- Dim droppedmsg As String = "You have dropped the following folders onto TV," &vbCrLf & "Are you sure you wish to add these as TvShows?" & vbCrLf
- For Each item In droppedItems
- droppedmsg &= item & vbcrlf
- Next
- Dim x = MsgBox(droppedmsg, MsgBoxStyle.YesNo)
- If x = MsgBoxResult.No Then
- droppedItems.Clear()
- Exit Sub
- End If
- For Each item In droppedItems
- Pref.tvFolders.add(item)
- newTvFolders.Add(item)
- Next
- droppedItems.Clear()
- Pref.ConfigSave()
- tv_ShowScrape()
- End Sub
-
- Private Sub TvTreeview_DragEnter(sender As Object, e As DragEventArgs) Handles TvTreeview.DragEnter
- Try
- e.Effect = DragDropEffects.Copy
- Catch ex As Exception
- ExceptionHandler.LogError(ex)
- End Try
- End Sub
-
- Private Sub TvTreeviewRebuild()
- TvTreeview.BeginUpdate()
- Try
- Dim shcount As Integer = 0
- Dim epcount As Integer = 0
- TvTreeview.Nodes.Clear() 'clear the treeview of old data
- ''Dirty work around until TvShows is repalced with TvCache.Shows universally
- For Each TvShow As Media_Companion.TvShow In Cache.TvCache.Shows
- If Not String.IsNullOrEmpty(TvShow.Hidden.Value) AndAlso TvShow.Hidden.Value = True Then Continue For
- 'TvShow.UpdateTreenode()
- shcount += 1
- epcount += TvShow.Episodes.Count
- TvTreeview.Nodes.Add(TvShow.ShowNode)
- TvShow.UpdateTreenode()
- Next
-
- If rbTvListAll.Checked Then TvTreeview.BackColor = Color.white
- If rbTvListEnded.Checked Then TvTreeview.BackColor = Color.lightpink
- If rbTvListContinuing.Checked Then TvTreeview.BackColor = Color.LightSeaGreen
- If rbTvListUnKnown.Checked Then TvTreeview.BackColor = Color.LightYellow
-
- TextBox_TotTVShowCount.Text = shcount.ToString 'Cache.TvCache.Shows.Count
- TextBox_TotEpisodeCount.Text = epcount.ToString 'Cache.TvCache.Episodes.Count
- TvTreeview.Sort()
- Finally
- TvTreeview.EndUpdate()
- End Try
- End Sub
-
- Private Sub Tv_TreeViewContextMenuItemsEnable() 'enable/disable right click context menu items depending on if its show/season/episode
- ' 'called from tv_treeview mouseup event where we check for a right click
- If TvTreeview.SelectedNode Is Nothing Then Return
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview) 'set WORKINGTVSHOW to show obj irrelavent if we have selected show/season/episode
- Dim showtitle As String = WorkingTvShow.Title.Value 'set our show title
-
-
-
- 'now we set the items that have variable text in the context menu using the 'show' text set above
- Tv_TreeViewContext_ShowTitle.BackColor = Color.Honeydew 'SK - same color as the refresh tv show splash - comments required to see if it works or not....
-
- If TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvShow Then
- Tv_TreeViewContext_ShowTitle.Text = "'" & showtitle & "'"
- Tv_TreeViewContext_ShowTitle.Font = New Font("Arial", 10, FontStyle.Bold)
- Tv_TreeViewContext_Play_Episode.Enabled = False
- Tv_TreeViewContext_ViewNfo.Text = "View TVShow .nfo"
- Tv_TreeViewContext_RescrapeShowOrEpisode.Text = "Rescrape TVShow"
- Tv_TreeViewContext_WatchedShowOrEpisode.Text = "Mark This Show as Watched"
- Tv_TreeViewContext_UnWatchedShowOrEpisode.Text = "Mark This Show as UnWatched"
-
- Tv_TreeViewContext_OpenFolder.Enabled = True
- Tv_TreeViewContext_ViewNfo.Enabled = True
- Tv_TreeViewContext_RescrapeShowOrEpisode.Enabled = True
- Tv_TreeViewContext_WatchedShowOrEpisode.Enabled = True
- Tv_TreeViewContext_UnWatchedShowOrEpisode.Enabled = True
- Tv_TreeViewContext_RescrapeWizard.Enabled = True
- Tv_TreeViewContext_FindMissArt.Enabled = True
- Tv_TreeViewContext_RefreshShow.Enabled = True
- Tv_TreeViewContext_RefreshShow.Visible = True
- Tv_TreeViewContext_MissingEpThumbs.Enabled = True
- Tv_TreeViewContext_MissingEpThumbs.Visible = True
- Tv_TreeViewContext_ReloadFromCache.Enabled = True
- Tv_TreeViewContext_RenameEp.Enabled = rbTvListAll.Checked 'Only show if Treeview set to 'List All'
- Tv_TreeViewContext_ShowMissEps.Enabled = True
- Tv_TreeViewContext_DispByAiredDate.Enabled = True
- tsmiTvDelShowNfoArt.Enabled = True
- tsmiTvDelShowEpNfoArt.Enabled = True
-
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvSeason Then
- Tv_TreeViewContext_ShowTitle.Text = "'" & showtitle & "' - " & tv_SeasonSelectedCurrently(TvTreeview).SeasonLabel
- Tv_TreeViewContext_ShowTitle.Font = New Font("Arial", 10, FontStyle.Bold)
- Tv_TreeViewContext_Play_Episode.Enabled = False
- Tv_TreeViewContext_ViewNfo.Text = "View Season .nfo"
- Tv_TreeViewContext_RescrapeShowOrEpisode.Text = "Rescrape Season"
- Tv_TreeViewContext_WatchedShowOrEpisode.Text = "Mark This Season as Watched"
- Tv_TreeViewContext_UnWatchedShowOrEpisode.Text = "Mark This Season as UnWatched"
-
- Tv_TreeViewContext_OpenFolder.Enabled = True
- Tv_TreeViewContext_ViewNfo.Enabled = False
- Tv_TreeViewContext_RescrapeShowOrEpisode.Enabled = False
- Tv_TreeViewContext_WatchedShowOrEpisode.Enabled = True
- Tv_TreeViewContext_UnWatchedShowOrEpisode.Enabled = True
- Tv_TreeViewContext_RescrapeWizard.Enabled = False
- Tv_TreeViewContext_FindMissArt.Enabled = False
- Tv_TreeViewContext_RefreshShow.Enabled = False
- Tv_TreeViewContext_RefreshShow.Visible = False
- Tv_TreeViewContext_MissingEpThumbs.Enabled = True
- Tv_TreeViewContext_MissingEpThumbs.Visible = True
- Tv_TreeViewContext_ReloadFromCache.Enabled = False
- Tv_TreeViewContext_RenameEp.Enabled = rbTvListAll.Checked 'Only show if Treeview set to 'List All'
- Tv_TreeViewContext_ShowMissEps.Enabled = True
- Tv_TreeViewContext_DispByAiredDate.Enabled = True
- tsmiTvDelShowNfoArt.Enabled = False
- tsmiTvDelShowEpNfoArt.Enabled = False
-
- ElseIf TypeOf TvTreeview.SelectedNode.Tag Is Media_Companion.TvEpisode Then
- Tv_TreeViewContext_ShowTitle.Text = "'" & showtitle & "' - S" & Utilities.PadNumber(ep_SelectedCurrently(TvTreeview).Season.Value, 2) & "E" & Utilities.PadNumber(ep_SelectedCurrently(TvTreeview).Episode.Value, 2) & " '" & ep_SelectedCurrently(TvTreeview).Title.Value & "'"
- Tv_TreeViewContext_ShowTitle.Font = New Font("Arial", 10, FontStyle.Bold)
- Tv_TreeViewContext_Play_Episode.Enabled = Not DirectCast(TvTreeview.SelectedNode.Tag, Media_Companion.TvEpisode).Ismissing
- Tv_TreeViewContext_ViewNfo.Text = "View Episode .nfo"
- Tv_TreeViewContext_RescrapeShowOrEpisode.Text = "Rescrape Episode"
- Tv_TreeViewContext_WatchedShowOrEpisode.Text = "Mark Episode as Watched"
- Tv_TreeViewContext_UnWatchedShowOrEpisode.Text = "Mark Episode as UnWatched"
-
- Tv_TreeViewContext_OpenFolder.Enabled = True
- Tv_TreeViewContext_ViewNfo.Enabled = True
- Tv_TreeViewContext_RescrapeShowOrEpisode.Enabled = Not DirectCast(TvTreeview.SelectedNode.Tag, Media_Companion.TvEpisode).Ismissing
- Tv_TreeViewContext_WatchedShowOrEpisode.Enabled = True
- Tv_TreeViewContext_UnWatchedShowOrEpisode.Enabled = True
- Tv_TreeViewContext_RescrapeWizard.Enabled = False
- Tv_TreeViewContext_FindMissArt.Enabled = False
- Tv_TreeViewContext_RefreshShow.Enabled = False
- Tv_TreeViewContext_RefreshShow.Visible = False
- Tv_TreeViewContext_MissingEpThumbs.Enabled = False
- Tv_TreeViewContext_MissingEpThumbs.Visible = False
- Tv_TreeViewContext_ReloadFromCache.Enabled = False
- Tv_TreeViewContext_RenameEp.Enabled = Not DirectCast(TvTreeview.SelectedNode.Tag, Media_Companion.TvEpisode).Ismissing
- Tv_TreeViewContext_ShowMissEps.Enabled = True
- Tv_TreeViewContext_DispByAiredDate.Enabled = True
- tsmiTvDelShowNfoArt.Enabled = False
- tsmiTvDelShowEpNfoArt.Enabled = False
-
- Else
- MsgBox("None")
- End If
-
- 'these are the four items at the bottom of the menu to control Expand/Colapse the tv_treeview (always shown)
- ExpandSelectedShowToolStripMenuItem.Enabled = True
- ExpandAllToolStripMenuItem.Enabled = True
- CollapseAllToolStripMenuItem.Enabled = True
- CollapseSelectedShowToolStripMenuItem.Enabled = True
- End Sub
-
- #End Region
-
- Sub tv_Rescrape_Show(ByVal WorkingTvShow)
- Dim tempint As Integer = 0
- Dim tempstring As String = ""
- tempint = MessageBox.Show("Rescraping the TV Show will Overwrite all the current details" & vbCrLf & "Do you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
- If tempint = DialogResult.No Then
- Exit Sub
- End If
- Dim messbox As frmMessageBox = New frmMessageBox("The Selected TV Show is being Rescraped", "", "Please Wait")
- System.Windows.Forms.Cursor.Current = Cursors.WaitCursor
- messbox.Show()
- messbox.Refresh()
- Application.DoEvents()
- Dim selectedLang As String = WorkingTvShow.Language.Value
- If selectedLang = "" Then selectedLang = "en"
-
- If Pref.tvshow_useXBMC_Scraper = True Then
- Dim TVShowNFOContent As String = XBMCScrape_TVShow_General_Info("metadata.tvdb.com", WorkingTvShow.TvdbId.Value, selectedLang, WorkingTvShow.NfoFilePath)
- If TVShowNFOContent <> "error" Then CreateMovieNfo(WorkingTvShow.NfoFilePath, TVShowNFOContent)
- Dim newshow As TvShow = nfoFunction.tvshow_NfoLoad(WorkingTvShow.NfoFilePath)
- newshow.ListActors.Clear()
- If Pref.TvdbActorScrape = 0 Or Pref.TvdbActorScrape = 3 Or NewShow.ImdbId.Value = Nothing Then
- TvGetActorTvdb(NewShow)
- ElseIf (Pref.TvdbActorScrape = 1 Or Pref.TvdbActorScrape = 2) And NewShow.ImdbId.Value <> Nothing Then
- TvGetActorImdb(NewShow)
- End If
- If Pref.tvdbIMDbRating Then
- Dim rating As String = ""
- Dim votes As String = ""
- If ep_getIMDbRating(newshow.ImdbId.Value, rating, votes) Then
- newshow.Rating.Value = rating
- newshow.Votes.Value = votes
- End If
- End If
- nfoFunction.tvshow_NfoSave(newshow, True)
- Call tv_ShowLoad(WorkingTvShow)
- Else
- For Each episode In WorkingTvShow.Episodes
- If Pref.displayMissingEpisodes AndAlso episode.IsMissing = True Then
- Cache.TvCache.Remove(episode)
- Else
- Cache.TvCache.Remove(episode)
- End If
- Next
- Cache.TvCache.Remove(WorkingTvShow)
- newTvFolders.Add(WorkingTvShow.FolderPath.Substring(0, WorkingTvShow.FolderPath.LastIndexOf("\")))
- Dim args As TvdbArgs = New TvdbArgs(WorkingTvShow.TvdbId.Value, selectedLang)
- bckgrnd_tvshowscraper.RunWorkerAsync(args)
- While bckgrnd_tvshowscraper.IsBusy
- Application.DoEvents()
- End While
- End If
- messbox.Close()
- TabControl3.SelectedIndex = 0
- End Sub
-
-
- Private Sub tv_ShowLoad(ByVal Show As Media_Companion.TvShow)
- Show.ListActors.Clear()
- 'Dim ShowTemp As TvShow = nfoFunction.tvshow_NfoLoad(Show.NfoFilePath)
- Show.Load()
- Show = nfoFunction.tvshow_NfoLoad(Show.NfoFilePath) '.Load()
- 'Show.UpdateTreenode()
-
-
- 'Fix episodeguide tag
- Dim lang As String = Show.EpisodeGuideUrl.Value
- If String.IsNullOrEmpty(lang) Then
- lang = "en"
- Else
- lang = lang.Substring((lang.LastIndexOf("/")+1)).Replace(".zip","")
- End If
-
- If Not Show.TvdbId.Value = "" Then
- Show.EpisodeGuideUrl.Value = ""
- Show.Url.Value = URLs.EpisodeGuide(Show.TvdbId.Value, lang) 'Show.Language.Value)
- Show.Url.Node.SetAttributeValue("cache", Show.TvdbId.Value)
- End If
- 'end fix
-
- Dim hg As New IO.DirectoryInfo(Show.FolderPath)
- If Not hg.Exists Then
- tb_ShPlot.Text = "Unable to find folder: " & Show.FolderPath
- tb_Sh_Ep_Title.Text = "Unable to find folder: " & Show.FolderPath
- Else
- If TabControl3.TabPages(1).Text = "Screenshot" Then
- TabControl3.TabPages.RemoveAt(1)
- End If
-
- 'load tvshow.nfo
- ListBox3.Items.Clear()
- TextBox26.Text = ""
- Dim todo As Boolean = False
-
- If Show.State = Media_Companion.ShowState.Locked Then
- btn_TvShState.Text = "Locked"
- btn_TvShState.BackColor = Color.Red
- ElseIf Show.State = Media_Companion.ShowState.Open Then
- btn_TvShState.Text = "Open"
- btn_TvShState.BackColor = Color.LawnGreen
- ElseIf Show.State = Media_Companion.ShowState.Unverified Then
- btn_TvShState.Text = "Un-Verified"
- btn_TvShState.BackColor = Color.Yellow
- Else
- btn_TvShState.Text = "Error"
- btn_TvShState.BackColor = Color.Gray
- End If
- btn_TvShState.Tag = Show
-
- If Show.Status.Value = "Ended" Then
- bnt_TvSeriesStatus.Text = "Ended"
- bnt_TvSeriesStatus.BackColor = Color.LightPink
- ElseIf Show.Status.Value = "Continuing" Then
- bnt_TvSeriesStatus.Text = "Continuing"
- bnt_TvSeriesStatus.BackColor = Color.LightSeaGreen
- Else
- bnt_TvSeriesStatus.Text = "Unknown"
- bnt_TvSeriesStatus.BackColor = Color.LightYellow
- End If
- Dim tvpbright As String = Utilities.DefaultTvPosterPath
- Dim tvpbbottom As String = Utilities.DefaultTvBannerPath
-
- If Pref.EdenEnabled AndAlso Not Pref.FrodoEnabled Then
- If Pref.postertype = "banner" Then
- If Utilities.IsBanner(Show.FolderPath & "folder.jpg") Then
- tvpbbottom = Show.FolderPath & "folder.jpg"
- Else
- tvpbright = Show.ImagePoster.path
- End If
- Else
- tvpbright = Show.ImagePoster.path
- End If
- End If
- If Pref.FrodoEnabled Then
- Show.ImagePoster.FileName = "poster.jpg"
- Show.ImageBanner.FileName = "banner.jpg"
- tvpbbottom = Show.ImageBanner.Path
- tvpbright = Show.ImagePoster.path
- End If
- util_ImageLoad(tv_PictureBoxRight, tvpbright, Utilities.DefaultTvPosterPath)
- util_ImageLoad(tv_PictureBoxBottom, tvpbbottom, Utilities.DefaultTvBannerPath)
- util_ImageLoad(tv_PictureBoxLeft, Show.ImageFanart.Path, Utilities.DefaultTvFanartPath)
-
- Panel_EpisodeInfo.Visible = False
- Panel_EpisodeActors.Visible = False
- lbl_sorttitle.Visible = True
- TextBox_Sorttitle.Visible = True
-
- tb_Sh_Ep_Title.BackColor = Color.White
- If Show.Title.Value <> Nothing Then
- tb_Sh_Ep_Title.Text = Show.Title.Value
-
- End If
-
- ' changed indication of an issue, setting the title means that the title is saved to the nfo if the user exits. Yellow is the same colour as the unverified Button
- If Show.State = ShowState.Unverified Then tb_Sh_Ep_Title.BackColor = Color.Yellow
- If Show.State = ShowState.Error Then tb_Sh_Ep_Title.BackColor = Color.Red
-
- tb_ShPremiered.Text = Utilities.ReplaceNothing(Show.Premiered.Value)
- tb_ShGenre.Text = Utilities.ReplaceNothing(Show.Genre.Value)
- tb_ShTvdbId.Text = Utilities.ReplaceNothing(Show.TvdbId.Value)
- tb_ShImdbId.Text = Utilities.ReplaceNothing(Show.ImdbId.Value)
- tb_ShRating.Text = Utilities.ReplaceNothing(Show.Rating.Value)
- tb_ShVotes.Text = Utilities.ReplaceNothing(Show.Votes.Value)
- tb_ShCert.Text = Utilities.ReplaceNothing(Show.Mpaa.Value)
- tb_ShRunTime.Text = Utilities.ReplaceNothing(Show.Runtime.Value)
- tb_ShStudio.Text = Utilities.ReplaceNothing(Show.Studio.Value)
- tb_ShPlot.Text = Utilities.ReplaceNothing(Show.Plot.Value)
- TextBox_Sorttitle.Text = Utilities.ReplaceNothing(If(String.IsNullOrEmpty(Show.SortTitle.Value ), Show.Title.Value, Show.SortTitle.Value))
-
- If String.IsNullOrEmpty(Show.SortOrder.Value) Then Show.SortOrder.Value = Pref.sortorder
- If Show.SortOrder.Value = "dvd" Then
- btn_TvShSortOrder.Text = "DVD"
- ElseIf Show.SortOrder.Value = "default" Then
- btn_TvShSortOrder.Text = "Default"
- End If
- '0 - all from tvdb
- '1 - all from imdb
- '2 - tv imdb, eps tvdb
- '3 - tv TVDB, eps IMDB
-
- If String.IsNullOrEmpty(Show.EpisodeActorSource.Value) Then
- If Pref.TvdbActorScrape = "0" Or Pref.TvdbActorScrape = "2" Then
- Show.EpisodeActorSource.Value = "tvdb"
- Else
- Show.EpisodeActorSource.Value = "imdb"
- End If
- End If
-
- Button46.Text = Show.EpisodeActorSource.Value.ToUpper
- If String.IsNullOrEmpty(Show.TvShowActorSource.Value) Then
- If Pref.TvdbActorScrape = "0" Or Pref.TvdbActorScrape = "3" Then
- Show.TvShowActorSource.Value = "tvdb"
- Else
- Show.TvShowActorSource.Value = "imdb"
- End If
- End If
-
- TvPanel7Update(Show.FolderPath)
- Button45.Text = Show.TvShowActorSource.Value.ToUpper
- Call tv_ActorsLoad(Show.ListActors)
- 'Show.UpdateTreenode()
- End If
- Panel_EpisodeInfo.Visible = False
- Panel_EpisodeActors.Visible = False
- End Sub
-
- Private Sub tb_ShGenre_MouseDown(sender As Object, e As MouseEventArgs) Handles tb_ShGenre.MouseDown
- If e.Button = Windows.Forms.MouseButtons.Right Then
- Try
- Dim thisshow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim item() As String = thisshow.Genre.Value.Split("/")
- Dim genre As String = ""
- Dim listof As New List(Of str_genre)
- listof.Clear()
- For Each i In item
- Dim g As str_genre
- g.genre = i.Trim
- g.count = 1
- listof.Add(g)
- Next
- Dim frm As New frmGenreSelect
- frm.multicount = 1
- frm.SelectedGenres = listof
- frm.Init()
- If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then
- listof.Clear()
- listof.AddRange(frm.SelectedGenres)
- For each g In listof
- If g.count = 0 Then Continue For
- If genre = "" Then
- genre = g.genre
- Else
- genre += " / " & g.genre
- End If
- Next
- thisshow.Genre.Value = genre
- tb_ShGenre.Text = genre
- nfoFunction.tvshow_NfoSave(thisshow, True) 'thisshow.Save()
- End If
- Catch
- End Try
- End If
- End Sub
-
- Public Sub tv_ActorsLoad(ByVal listActors As Media_Companion.ActorList)
- cbTvActor.Items.Clear()
- cbTvActorRole.Items.Clear()
- For Each actor In ListActors
- If actor.actorname <> Nothing AndAlso Not cbTvActor.Items.Contains(actor.actorname) Then
- cbTvActor.Items.Add(actor.actorname)
- Dim role As String = actor.actorrole
- If String.IsNullOrEmpty(role) Or role = Nothing Then role = actor.actorname
- cbTvActorRole.Items.Add(role)
- End If
- Next
-
- If cbTvActor.Items.Count = 0 Then
- actorflag = true
- cbTvActorRole.Items.Add("")
- cbTvActorRole.SelectedIndex = 0
- Call tv_ActorDisplay(True)
- Else
- cbTvActor.SelectedIndex = 0
- 'Call tv_ActorDisplay()
- End If
- End Sub
-
- Public Sub tv_ActorDisplay(Optional ByVal useDefault As Boolean = False)
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- If WorkingTvShow Is Nothing Then Exit Sub
- Dim imgLocation As String = Utilities.DefaultActorPath
- Dim eden As Boolean = Pref.EdenEnabled
- Dim frodo As Boolean = Pref.FrodoEnabled
- PictureBox6.Image = Nothing
- If useDefault Then
- imgLocation = Utilities.DefaultActorPath
- Else
- For Each actor In WorkingTvShow.ListActors
- If actor.actorname = cbTvActor.Text Then
- Dim temppath As String = Pref.GetActorPath(WorkingTvShow.NfoFilePath, actor.actorname, actor.ID.Value)
- If IO.File.Exists(temppath) Then
- imgLocation = temppath
- ElseIf (Not Pref.LocalActorImage) AndAlso actor.actorthumb <> Nothing AndAlso (actor.actorthumb.IndexOf("http") <> -1 OrElse IO.File.Exists(actor.actorthumb)) Then
- imgLocation = actor.actorthumb
- End If
- Exit For
- End If
- Next
- End If
- Try
- util_ImageLoad(PictureBox6, imgLocation, Utilities.DefaultActorPath)
- PictureBox6.SizeMode = PictureBoxSizeMode.Zoom
- Catch
- End Try
- End Sub
-
- Public Sub tv_ActorRoleDisplay(Optional ByVal useDefault As Boolean = False)
- Dim WorkingTvShow As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- If WorkingTvShow Is Nothing Then Exit Sub
- Dim imgLocation As String = Utilities.DefaultActorPath
- Dim eden As Boolean = Pref.EdenEnabled
- Dim frodo As Boolean = Pref.FrodoEnabled
- PictureBox6.Image = Nothing
- If useDefault Then
- imgLocation = Utilities.DefaultActorPath
- Else
- For Each actor In WorkingTvShow.ListActors
- If actor.actorrole = cbTvActorRole.Text Then
- Dim temppath As String = Pref.GetActorPath(WorkingTvShow.NfoFilePath, actor.actorname, actor.ID.Value)
- If IO.File.Exists(temppath) Then
- imgLocation = temppath
- ElseIf (Not Pref.LocalActorImage) AndAlso actor.actorthumb <> Nothing AndAlso (actor.actorthumb.IndexOf("http") <> -1 OrElse IO.File.Exists(actor.actorthumb)) Then
- imgLocation = actor.actorthumb
- End If
- Exit For
- End If
- Next
- End If
- Try
- util_ImageLoad(PictureBox6, imgLocation, Utilities.DefaultActorPath)
- PictureBox6.SizeMode = PictureBoxSizeMode.Zoom
- Catch
- End Try
- End Sub
-
- Public Function TvCheckforExtraArt(ByVal Showpath As String) As Boolean
- Dim confirmedpresent As Boolean = False
- If Directory.Exists(Showpath) Then
- If File.Exists(Showpath & "clearart.png") Then tvFanlistbox.Items.Add("ClearArt") : confirmedpresent = True
- If File.Exists(Showpath & "logo.png") Then tvFanlistbox.Items.Add("Logo") : confirmedpresent = True
- If File.Exists(Showpath & "landscape.jpg") Then tvFanlistbox.Items.Add("Landscape") : confirmedpresent = True
- If File.Exists(Showpath & "character.png") Then tvFanlistbox.Items.Add("Character") : confirmedpresent = True
- End If
- Return confirmedpresent
- End Function
-
- Public Sub TvPanel7Update(ByVal TvShPath As String)
- tvFanlistbox.Items.Clear()
- Panel_TvShowExtraArtwork.Visible = TvCheckforExtraArt(TvShPath)
- End Sub
-
- Private Sub tvFanlistbox_Mouse(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tvFanlistbox.MouseDown
- Dim imagepath As String = Nothing
- Dim item As String = Nothing
- If e.button = Windows.Forms.MouseButtons.Right Then
- Dim index As Integer = tvFanlistbox.IndexFromPoint(New Point(e.X, e.Y))
- If index >= 0 Then tvFanlistbox.SelectedItem = tvFanlistbox.Items(index)
- End If
- If IsNothing(tvFanlistbox.SelectedItem) Then Exit Sub
- item = tvFanlistbox.SelectedItem.ToString.ToLower
- If Not String.IsNullOrEmpty(item) Then
- Dim tmpsh As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- imagepath = tmpsh.FolderPath
- Dim suffix As String = If((item = "clearart" or item = "logo" or item = "character"),".png", ".jpg")
- imagepath &= item & suffix
- End If
- If e.Button = Windows.Forms.MouseButtons.Left Then
- pbtvfanarttv.Visible = True
- If Not IsNothing(imagepath) Then util_ImageLoad(pbtvfanarttv, imagepath, "")
- ElseIf e.button = Windows.Forms.MouseButtons.Right Then
- Dim tempint = MessageBox.show("Do you wish to delete this image from" & vbCrLf & "this Tv Show?", "Fanart.Tv Artwork Delete", MessageBoxButtons.YesNoCancel)
- If tempint = Windows.Forms.DialogResult.No or tempint = DialogResult.Cancel Then Exit Sub
- If tempint = Windows.Forms.DialogResult.Yes Then
- Utilities.SafeDeleteFile(imagepath)
- TvPanel7Update(tv_ShowSelectedCurrently(TvTreeview).FolderPath)
- End If
- End If
- End Sub
-
- Private Sub tvFanlistbox_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tvFanlistbox.MouseLeave
- tvFanlistbox.ClearSelected()
- pbtvfanarttv.Image = Nothing
- pbtvfanarttv.Visible = False
- End Sub
-
- Public Sub tv_SeasonSelected(ByRef SelectedSeason As Media_Companion.TvSeason)
- SelectedSeason.ShowObj.ListActors.Clear()
- SelectedSeason.ShowObj.Load()
- Panel_TvShowExtraArtwork.Visible = False
- Dim Show As Media_Companion.TvShow
- If SelectedSeason.SeasonNode.Parent.Tag IsNot Nothing Then
- Show = SelectedSeason.SeasonNode.Parent.Tag
- Else
- MsgBox("Show tag not set")
- Exit Sub
- End If
- tb_Sh_Ep_Title.BackColor = Color.White
- If Show.Title.Value <> Nothing Then
- If SelectedSeason.SeasonNumber = 0 Then
- tb_Sh_Ep_Title.Text = Utilities.ReplaceNothing(Show.Title.Value) & " - Specials"
- Else
- tb_Sh_Ep_Title.Text = Utilities.ReplaceNothing(Show.Title.Value) & " - " & Utilities.ReplaceNothing(SelectedSeason.SeasonNode.Text)
- End If
- End If
- If TabControl3.TabPages(1).Text = "Screenshot" Then
- TabControl3.TabPages.RemoveAt(1)
- End If
-
- ' changed indication of an issue, setting the title means that the title is saved to the nfo if the user exits. Yellow is the same colour as the unverified Button
- If Show.State = ShowState.Unverified Then tb_Sh_Ep_Title.BackColor = Color.Yellow
- If Show.State = ShowState.Error Then tb_Sh_Ep_Title.BackColor = Color.Red
-
- tb_ShPremiered.Text = Utilities.ReplaceNothing(Show.Premiered.Value)
- tb_ShGenre.Text = Utilities.ReplaceNothing(Show.Genre.Value)
- tb_ShTvdbId.Text = Utilities.ReplaceNothing(Show.TvdbId.Value)
- tb_ShImdbId.Text = Utilities.ReplaceNothing(Show.ImdbId.Value)
- tb_ShRating.Text = Utilities.ReplaceNothing(Show.Rating.Value)
- tb_ShVotes.Text = Utilities.ReplaceNothing(Show.Votes.Value)
- tb_ShCert.Text = Utilities.ReplaceNothing(Show.Mpaa.Value)
- tb_ShRunTime.Text = Utilities.ReplaceNothing(Show.Runtime.Value)
- tb_ShStudio.Text = Utilities.ReplaceNothing(Show.Studio.Value)
- tb_ShPlot.Text = Utilities.ReplaceNothing(Show.Plot.Value)
- Panel_EpisodeInfo.Visible = False
- Panel_EpisodeActors.Visible = False
- lbl_sorttitle.Visible = True
- TextBox_Sorttitle.Visible = True
- TextBox_Sorttitle.Text = Utilities.ReplaceNothing(If(String.IsNullOrEmpty(Show.SortTitle.Value ), Show.Title.Value, Show.SortTitle.Value))
- ExpandSelectedShowToolStripMenuItem.Enabled = True
- ExpandAllToolStripMenuItem.Enabled = True
- CollapseAllToolStripMenuItem.Enabled = True
- CollapseSelectedShowToolStripMenuItem.Enabled = True
- Tv_TreeViewContext_RenameEp.Enabled = True
- Tv_TreeViewContext_RenameEp.Visible = True
-
- 'MsgBox("Season")
- Dim season As String = SelectedSeason.SeasonLabel
- Dim trueseason As Integer = SelectedSeason.SeasonNumber
- Dim PaddedSeason As String = Utilities.PadNumber(SelectedSeason.SeasonNumber, 2)
- Dim tvpbright As String = Utilities.DefaultTvPosterPath
- Dim tvpbbottom As String = Utilities.DefaultTvBannerPath
- If trueseason = -1 Then
- If SelectedSeason.Poster.Image IsNot Nothing Then
- tvpbright = SelectedSeason.Poster.Path
- Else
- If Pref.postertype = "banner" Then
- tvpbright = Show.ImagePoster.Path
- Else
- tvpbbottom = Show.ImageBanner.Path
- End If
- End If
- ElseIf trueseason = 0 Then 'Specials
- If Pref.EdenEnabled AndAlso Not Pref.FrodoEnabled Then
- tvpbright = Show.FolderPath & "season-specials.tbn"
- If Not File.Exists(tvpbright) Then tvpbright = Show.FolderPath & "folder.jpg"
- End If
- If Pref.FrodoEnabled Then
- tvpbright = Show.FolderPath & "season-specials-poster.jpg"
- If Not File.Exists(tvpbright) Then tvpbright = Show.FolderPath & "folder.jpg"
- tvpbbottom = Show.FolderPath & "season-specials-banner.jpg"
- If Not File.Exists(tvpbbottom) Then tvpbbottom = Show.FolderPath & "banner.jpg"
- End If
- Else 'Season01 & up
- tvpbright = SelectedSeason.Poster.Path
- If Pref.FrodoEnabled Then tvpbbottom = SelectedSeason.Banner.Path
- End If
-
- util_ImageLoad(tv_PictureBoxRight, tvpbright, Utilities.DefaultTvPosterPath)
- util_ImageLoad(tv_PictureBoxBottom, tvpbbottom, Utilities.DefaultTvBannerPath)
-
- If Show.NfoFilePath <> Nothing Then util_ImageLoad(tv_PictureBoxLeft, Show.FolderPath & "fanart.jpg", Utilities.DefaultTvFanartPath)
-
- Call tv_ActorsLoad(Show.ListActors)
- Show.UpdateTreenode()
- End Sub
-
- Public Sub tv_EpisodeSelected(ByRef SelectedEpisode As Media_Companion.TvEpisode, Optional ByVal Force As Boolean = False)
- If TabControl3.TabPages(1).Text <> "Screenshot" Then
- If screenshotTab IsNot Nothing Then
- TabControl3.TabPages.Insert(1, screenshotTab)
- TabControl3.Refresh()
- End If
- End If
- Panel_EpisodeInfo.Visible = True
- Panel_EpisodeActors.Visible = True 'set ep actor panel visible, we'll hide later if no actor's in episode.
- cmbxEpActor.Items.Clear()
- tbEpRole.Text = ""
-
- Dim Show As TvShow = tv_ShowSelectedCurrently(TvTreeview)
- Dim season As Integer = SelectedEpisode.Season.Value
- Dim episode As Integer = SelectedEpisode.Episode.Value
- Dim SeasonObj As New Media_Companion.TvSeason
- If SelectedEpisode.EpisodeNode.Parent IsNot Nothing Then
- SeasonObj = SelectedEpisode.EpisodeNode.Parent.Tag
- If season = -1 Then season = SeasonObj.SeasonLabel
- End If
-
- Call ep_Load(SeasonObj, SelectedEpisode, Force)
-
- lbl_sorttitle.Visible = False
- TextBox_Sorttitle.Visible = false
- Tv_TreeViewContext_ViewNfo.Enabled = True
- ExpandSelectedShowToolStripMenuItem.Enabled = True
- ExpandAllToolStripMenuItem.Enabled = True
- CollapseAllToolStripMenuItem.Enabled = True
- CollapseSelectedShowToolStripMenuItem.Enabled = True
- Tv_TreeViewContext_ReloadFromCache.Enabled = True
- Tv_TreeViewContext_OpenFolder.Enabled = True
-
- If SelectedEpisode.ListActors.Count < 1 Then 'If episode actors, don't load show's actors. (save some time)
- If SeasonObj.ShowObj.ListActors.Count = 0 Then Show.Load()
- Call tv_ActorsLoad(Show.ListActors)
- End If
- End Sub
-
- Private Function TestForMultiepisode(ByVal path As String)
- Dim multiepisode As Boolean = False
- Try
- Dim firstline As String = ""
- If IO.File.Exists(path) Then
- Dim listText As New List(Of String)
- Dim objLine As String = ""
- Using objReader As StreamReader = New StreamReader(path)
- Do
- objLine = objReader.ReadLine()
- If objLine.IndexOf("<multiepisodenfo>") <> -1 Then
- multiepisode = True
- Exit Do
- ElseIf objLine.IndexOf("<episodedetails>") <> -1 Then
- multiepisode = False
- Exit Do
- End If
- Loop Until objLine Is Nothing
- End Using
- End If
- Catch
- End Try
- Return multiepisode
- End Function
-
- Private Sub ep_Load(ByRef Season As Media_Companion.TvSeason, ByRef Episode As Media_Companion.TvEpisode, Optional ByVal epupdate As Boolean = False)
- Panel_TvShowExtraArtwork.Visible = False
-
- 'test if already loaded nfo into treeview, if so, then no need to reload
- 'If IsNothing(Episode.Plot.Value) OrElse epupdate Then
- Episode.ListActors.Clear()
- Dim episodelist As New List(Of TvEpisode)
- episodelist = WorkingWithNfoFiles.ep_NfoLoad(Episode.NfoFilePath)
- 'test for multiepisodenfo
- If episodelist.Count = 1 Then
- Episode.AbsorbTvEpisode(episodelist(0))
- Else
- For Each Ep In episodelist
- If Ep.Season.Value = Episode.Season.Value AndAlso Ep.Episode.Value = Episode.Episode.Value Then
- Episode.AbsorbTvEpisode(Ep) 'update treenode
- Exit For
- End If
- Next
- End If
- 'End If
-
- Dim tempstring As String = ""
- lb_EpDetails.Items.Clear()
-
- cmbxEpActor.Items.Clear()
- tb_EpFilename.Text = Utilities.ReplaceNothing(IO.Path.GetFileName(Episode.NfoFilePath))
- tb_EpPath.Text = Utilities.ReplaceNothing(Episode.FolderPath)
- If Not IO.File.Exists(Episode.NfoFilePath) Then
- tb_Sh_Ep_Title.Text = "Unable to find episode: " & Episode.NfoFilePath
- Panel_EpisodeInfo.Visible = True
- Panel_EpisodeActors.Visible = True
- cmbxEpActor.Items.Clear()
- tbEpRole.Text = ""
- Episode.EpisodeNode.BackColor = Color.Red
- Exit Sub
- Else
- Episode.EpisodeNode.BackColor = Color.Transparent 'i.e. back to normal
- End If
-
- tb_Sh_Ep_Title.Text ="'" & Utilities.ReplaceNothing(Episode.Title.Value, "?") & "'"
- tb_EpRating.Text = Utilities.ReplaceNothing(Episode.Rating.Value)
- tb_EpVotes.Text = Utilities.ReplaceNothing(Episode.Votes.Value)
- tb_EpPlot.Text = Utilities.ReplaceNothing(Episode.Plot.Value)
- tb_EpDirector.Text = Utilities.ReplaceNothing(Episode.Director.Value)
- tb_EpCredits.Text = Utilities.ReplaceNothing(Episode.Credits.Value)
- tb_EpAired.Text = Utilities.ReplaceNothing(Episode.Aired.Value)
- For f = 0 To cbTvSource.Items.Count - 1
- If cbTvSource.Items(f) = Episode.Source.value Then
- cbTvSource.SelectedIndex = f
- Exit For
- End If
- Next
- If Episode.Season.Value = "0" Then
- lbl_EpAirBefore.Visible = True
- lbl_EpAirSeason.Visible = True
- lbl_EPAirEpisode.Visible = True
- tb_EpAirEpisode.Visible = True
- tb_EpAirSeason.Visible = True
- tb_EpAirSeason.Text = Episode.DisplaySeason.Value
- tb_EpAirEpisode.Text = Episode.DisplayEpisode.Value
- Else
- lbl_EpAirBefore.Visible = False
- lbl_EpAirSeason.Visible = False
- lbl_EPAirEpisode.Visible = False
- tb_EpAirEpisode.Visible = False
- tb_EpAirSeason.Visible = False
- tb_EpAirEpisode.Text = ""
- tb_EpAirSeason.Text = ""
- End If
-
- util_EpisodeSetWatched(Episode.PlayCount.Value)
-
- Dim epdetails As String = ""
- epdetails += "Video: " & Utilities.ReplaceNothing(Episode.Details.StreamDetails.Video.Width.Value, "?") & "x" & Utilities.ReplaceNothing(Episode.Details.StreamDetails.Video.Height.Value, "?")
- epdetails += ", (" & Utilities.ReplaceNothing(Episode.Details.StreamDetails.Video.Aspect.Value, "?") & ")"
- lb_EpDetails.Items.Add(epdetails)
- epdetails = " :- " & Utilities.ReplaceNothing(Episode.Details.StreamDetails.Video.Codec.Value, "?")
- epdetails += ", @ " & Utilities.ReplaceNothing(Episode.Details.StreamDetails.Video.Bitrate.Value, "?")
- lb_EpDetails.Items.Add(epdetails)
-
- If Episode.Details.StreamDetails.Audio.Count > 0 Then
- epdetails = "Audio: " & Utilities.ReplaceNothing(Episode.Details.StreamDetails.Audio(0).Codec.Value, "?")
- lb_EpDetails.Items.Add(epdetails)
- epdetails = Utilities.ReplaceNothing(Episode.Details.StreamDetails.Audio(0).Bitrate.Value, "?")
- epdetails += ", " & Utilities.ReplaceNothing(Episode.Details.StreamDetails.Audio(0).Channels.Value, "?") & " Ch"
- lb_EpDetails.Items.Add(epdetails)
- End If
-
- Dim aActor As Boolean = False
- For Each actor In Episode.ListActors
- If Not String.IsNullOrEmpty(actor.actorname) Then
- cmbxEpActor.Items.Add(Utilities.ReplaceNothing(actor.actorname))
- aActor = True
- End If
- Next
- If aActor Then
- cmbxEpActor.SelectedIndex = 0
- Else
- cmbxEpActor.Items.Clear()
- cmbxEpActor.Items.Add("")
- cmbxEpActor.SelectedIndex = 0
- Panel_EpisodeActors.Visible = False
- End If
-
- If (Episode IsNot Nothing AndAlso Episode.Thumbnail IsNot Nothing) Then
- Dim eptvleft As String = Episode.Thumbnail.Path
- If Pref.FrodoEnabled Then eptvleft = Episode.Thumbnail.Path.Replace(".tbn", "-thumb.jpg")
- util_ImageLoad(tv_PictureBoxLeft, eptvleft, Utilities.DefaultTvFanartPath)
- End If
- If (Season IsNot Nothing AndAlso Season.Poster IsNot Nothing) Then
- util_ImageLoad(tv_PictureBoxRight, Season.Poster.Path, Utilities.DefaultTvPosterPath)
- If Pref.FrodoEnabled Then
- util_ImageLoad(tv_PictureBoxBottom, Season.Banner.Path, Utilities.DefaultTvBannerPath)
- End If
- End If
-
- Dim video_flags = GetEpMediaFlags()
- movieGraphicInfo.OverlayInfo(tv_PictureBoxLeft, tb_EpRating.Text, video_flags)
- Panel_EpisodeInfo.Visible = True
-
- End Sub
-
- Public Function ep_Get(ByVal tvdbid As String, ByVal sortorder As String, ByRef seasonno As String, ByRef episodeno As String, ByVal language As String, ByVal aired As String)
- Dim episodestring As String = ""
- Dim episodeurl As String = ""
- Dim episodeurl2 As String = ""
- Dim xmlfile As String = ""
-
- If language.ToLower.IndexOf(".xml") = -1 Then
- language = language & ".xml"
- End If
- episodeurl2 = "http://thetvdb.com/api/6E82FED600783400/series/" & tvdbid & "/" & sortorder & "/" & seasonno & "/" & episodeno & "/" & language
- If aired = Nothing Then
- episodeurl = "http://thetvdb.com/api/6E82FED600783400/series/" & tvdbid & "/" & sortorder & "/" & seasonno & "/" & episodeno & "/" & language
- Else
- episodeurl = String.Format("http://thetvdb.com/api/GetEpisodeByAirDate.php?apikey=6E82FED600783400&seriesid={0}&airdate={1}&language={2}", tvdbid, aired, language)
- End If
- 'First try seriesxml data
- 'check if present, download if not
- Dim gotseriesxml As Boolean = False
- Dim url As String = "http://www.thetvdb.com/api/6E82FED600783400/series/" & tvdbid & "/all/" & language
- Dim xmlfile2 As String = SeriesXmlPath & tvdbid & ".xml"
- Dim SeriesInfo As New Tvdb.ShowData
- If Not File.Exists(SeriesXmlPath & tvdbid & ".xml") Then
- gotseriesxml = DownloadCache.Savexmltopath(url, SeriesXmlPath, tvdbid & ".xml", True)
- Else
- 'Check series xml isn't older than Five days. If so, re-download it.
- Dim dtCreationDate As DateTime = File.GetLastWriteTime(xmlfile2)
- Dim datenow As DateTime = Date.Now()
- Dim dif As Long = DateDiff(DateInterval.Day, dtCreationDate, datenow)
- If dif > If(aired <> Nothing, 1, 5) Then
- gotseriesxml = DownloadCache.Savexmltopath(url, SeriesXmlPath, tvdbid & ".xml", True)
- Else
- gotseriesxml = True
- End If
- End If
-
- If Not gotseriesxml then
- xmlfile = Utilities.DownloadTextFiles(episodeurl)
- If xmlfile.Contains("No Results from SP") AndAlso (seasonno <> "-1" And epis…
Large files files are truncated, but you can click here to view the full file