Skip to content

Commit

Permalink
fixed: Theme scraping
Browse files Browse the repository at this point in the history
  • Loading branch information
DanCooper committed Jul 28, 2016
1 parent d353ca9 commit 4c64792
Show file tree
Hide file tree
Showing 24 changed files with 1,271 additions and 449 deletions.
4 changes: 2 additions & 2 deletions Addons/generic.EmberCore.BulkRename/clsAPIRenamer.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,7 @@ Public Class FileFolderRenamer
If _DBM.ImagesContainer.Landscape.LocalFilePathSpecified Then _DBM.ImagesContainer.Landscape.LocalFilePath = Path.Combine(Directory.GetParent(_DBM.ImagesContainer.Landscape.LocalFilePath).FullName.Replace(oldPath, newPath), Path.GetFileName(_DBM.ImagesContainer.Landscape.LocalFilePath).Replace(oldFile, newFile))
If _DBM.ImagesContainer.Poster.LocalFilePathSpecified Then _DBM.ImagesContainer.Poster.LocalFilePath = Path.Combine(Directory.GetParent(_DBM.ImagesContainer.Poster.LocalFilePath).FullName.Replace(oldPath, newPath), Path.GetFileName(_DBM.ImagesContainer.Poster.LocalFilePath).Replace(oldFile, newFile))
If _DBM.NfoPathSpecified Then _DBM.NfoPath = Path.Combine(Directory.GetParent(_DBM.NfoPath).FullName.Replace(oldPath, newPath), Path.GetFileName(_DBM.NfoPath).Replace(oldFile, newFile))
If _DBM.ThemePathSpecified Then _DBM.ThemePath = Path.Combine(Directory.GetParent(_DBM.ThemePath).FullName.Replace(oldPath, newPath), Path.GetFileName(_DBM.ThemePath).Replace(oldFile, newFile))
If Not String.IsNullOrEmpty(_DBM.Theme.LocalFilePath) Then _DBM.Theme.LocalFilePath = Path.Combine(Directory.GetParent(_DBM.Theme.LocalFilePath).FullName.Replace(oldPath, newPath), Path.GetFileName(_DBM.Theme.LocalFilePath).Replace(oldFile, newFile))
If Not String.IsNullOrEmpty(_DBM.Trailer.LocalFilePath) Then _DBM.Trailer.LocalFilePath = Path.Combine(Directory.GetParent(_DBM.Trailer.LocalFilePath).FullName.Replace(oldPath, newPath), Path.GetFileName(_DBM.Trailer.LocalFilePath).Replace(oldFile, newFile))
If _DBM.ImagesContainer.Extrafanarts.Count > 0 Then
For Each eImg In _DBM.ImagesContainer.Extrafanarts.Where(Function(f) f.LocalFilePathSpecified)
Expand Down Expand Up @@ -1800,7 +1800,7 @@ Public Class FileFolderRenamer
If _DBE.ImagesContainer.Poster.LocalFilePathSpecified Then _DBE.ImagesContainer.Poster.LocalFilePath = _DBE.ImagesContainer.Poster.LocalFilePath.Replace(oldPath, newPath)
If _DBE.NfoPathSpecified Then _DBE.NfoPath = _DBE.NfoPath.Replace(oldPath, newPath)
If _DBE.ShowPathSpecified Then _DBE.ShowPath = _DBE.ShowPath.Replace(oldPath, newPath)
If _DBE.ThemePathSpecified Then _DBE.ThemePath = _DBE.ThemePath.Replace(oldPath, newPath)
If Not String.IsNullOrEmpty(_DBE.Theme.LocalFilePath) Then _DBE.Theme.LocalFilePath = _DBE.Theme.LocalFilePath.Replace(oldPath, newPath)
If _DBE.SubtitlesSpecified Then
For Each subtitle In _DBE.Subtitles.Where(Function(f) f.SubsPathSpecified)
subtitle.SubsPath = subtitle.SubsPath.Replace(oldPath, newPath)
Expand Down
2 changes: 1 addition & 1 deletion Addons/scraper.GoEar.Theme/GoEar_Theme.vb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Public Class GoEar_Theme
End If
End Sub

Function Scraper_Movie(ByVal DBMovie As Database.DBElement, ByRef ThemeList As List(Of Themes)) As Interfaces.ModuleResult Implements Interfaces.ScraperModule_Theme_Movie.Scraper
Function Scraper_Movie(ByRef DBMovie As Database.DBElement, ByVal Type As Enums.ModifierType, ByRef ThemeList As List(Of MediaContainers.Theme)) As Interfaces.ModuleResult Implements Interfaces.ScraperModule_Theme_Movie.Scraper
logger.Trace("[GoEar_Theme] [Scraper_Movie] [Start]")

Dim tGoEar As New GoEar.Scraper(DBMovie.Movie.OriginalTitle, DBMovie.ListTitle)
Expand Down
10 changes: 5 additions & 5 deletions Addons/scraper.GoEar.Theme/Scraper/clsScrapeGoEar.vb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Namespace GoEar
Shared logger As Logger = NLog.LogManager.GetCurrentClassLogger()
Private originaltitle As String
Private listtitle As String
Private _themelist As New List(Of Themes)
Private _themelist As New List(Of MediaContainers.Theme)

#End Region 'Fields

Expand All @@ -51,11 +51,11 @@ Namespace GoEar

#Region "Properties"

Public Property ThemeList() As List(Of Themes)
Public Property ThemeList() As List(Of MediaContainers.Theme)
Get
Return _themelist
End Get
Set(ByVal value As List(Of Themes))
Set(ByVal value As List(Of MediaContainers.Theme))
_themelist = value
End Set
End Property
Expand All @@ -65,7 +65,7 @@ Namespace GoEar
#Region "Methods"

Private Sub Clear()
_themelist = New List(Of Themes)
_themelist = New List(Of MediaContainers.Theme)
End Sub

Private Sub GetMovieThemes()
Expand Down Expand Up @@ -119,7 +119,7 @@ Namespace GoEar
tURL = String.Concat(DownloadURL, tID).Trim

If Not String.IsNullOrEmpty(tID) Then
_themelist.Add(New Themes With {.Title = tTitle, .ID = tID, .URL = tURL, .Description = tDescription, .Duration = tDuration, .Bitrate = tBitrate, .WebURL = tWebURL})
_themelist.Add(New MediaContainers.Theme With {.URLAudioStream = tURL, .Description = tTitle, .Duration = tDuration, .Bitrate = tBitrate, .URLWebsite = tWebURL, .Scraper = "GoEar"})
End If
Next
End If
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Namespace TelevisionTunes
Public Class Scraper

#Region "Fields"
Shared logger As Logger = NLog.LogManager.GetCurrentClassLogger()
Shared logger As Logger = LogManager.GetCurrentClassLogger()
Private originaltitle As String
Private _themelist As New List(Of Themes)
Private _themelist As New List(Of MediaContainers.Theme)

#End Region 'Fields

Expand All @@ -49,11 +49,11 @@ Namespace TelevisionTunes

#Region "Properties"

Public Property ThemeList() As List(Of Themes)
Public Property ThemeList() As List(Of MediaContainers.Theme)
Get
Return _themelist
End Get
Set(ByVal value As List(Of Themes))
Set(ByVal value As List(Of MediaContainers.Theme))
_themelist = value
End Set
End Property
Expand All @@ -63,7 +63,7 @@ Namespace TelevisionTunes
#Region "Methods"

Private Sub Clear()
_themelist = New List(Of Themes)
_themelist = New List(Of MediaContainers.Theme)
End Sub

Private Sub GetThemes()
Expand All @@ -85,7 +85,6 @@ Namespace TelevisionTunes
Dim tID As String = String.Empty
Dim tWebURL As String = String.Empty
Dim tURL As String = String.Empty
Dim tDescription As String = String.Empty
Dim tLength As String = String.Empty
Dim tBitrate As String = String.Empty

Expand All @@ -105,7 +104,7 @@ Namespace TelevisionTunes
tURL = GetDownloadURL(tWebURL)

If Not String.IsNullOrEmpty(tURL) Then
_themelist.Add(New Themes With {.Title = tTitle, .URL = tURL, .Description = tDescription, .Duration = tLength, .Bitrate = tBitrate, .WebURL = tWebURL})
_themelist.Add(New MediaContainers.Theme With {.URLAudioStream = tURL, .Description = tTitle, .Duration = tLength, .Bitrate = tBitrate, .URLWebsite = tWebURL, .Scraper = "TelevisionTunes"})
End If
Next

Expand Down
4 changes: 2 additions & 2 deletions Addons/scraper.TelevisionTunes.Theme/TelevisionTunes_Theme.vb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Public Class TelevisionTunes_Theme
End If
End Sub

Function Scraper_Movie(ByVal DBMovie As Database.DBElement, ByRef ThemeList As List(Of Themes)) As Interfaces.ModuleResult Implements Interfaces.ScraperModule_Theme_Movie.Scraper
Function Scraper_Movie(ByRef DBMovie As Database.DBElement, ByVal Type As Enums.ModifierType, ByRef ThemeList As List(Of MediaContainers.Theme)) As Interfaces.ModuleResult Implements Interfaces.ScraperModule_Theme_Movie.Scraper
logger.Trace("[TelevisionTunes_Theme] [Scraper_Movie] [Start]")

Dim tTelevisionTunes As New TelevisionTunes.Scraper(DBMovie.Movie.OriginalTitle)
Expand All @@ -221,7 +221,7 @@ Public Class TelevisionTunes_Theme
Return New Interfaces.ModuleResult With {.breakChain = False}
End Function

Function Scraper_TV(ByVal DBTV As Database.DBElement, ByRef ThemeList As List(Of Themes)) As Interfaces.ModuleResult Implements Interfaces.ScraperModule_Theme_TV.Scraper
Function Scraper_TV(ByRef DBTV As Database.DBElement, ByVal Type As Enums.ModifierType, ByRef ThemeList As List(Of MediaContainers.Theme)) As Interfaces.ModuleResult Implements Interfaces.ScraperModule_Theme_TV.Scraper
logger.Trace("[TelevisionTunes_Theme] [Scraper_TV] [Start]")

Dim tTelevisionTunes As New TelevisionTunes.Scraper(DBTV.TVShow.Title)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Namespace ThemeLibrary

Shared logger As Logger = LogManager.GetCurrentClassLogger()

Private _themelist As New List(Of Themes)
Private _themelist As New List(Of MediaContainers.Theme)

#End Region 'Fields

Expand All @@ -48,11 +48,11 @@ Namespace ThemeLibrary

#Region "Properties"

Public Property ThemeList() As List(Of Themes)
Public Property ThemeList() As List(Of MediaContainers.Theme)
Get
Return _themelist
End Get
Set(ByVal value As List(Of Themes))
Set(ByVal value As List(Of MediaContainers.Theme))
_themelist = value
End Set
End Property
Expand All @@ -62,7 +62,7 @@ Namespace ThemeLibrary
#Region "Methods"

Private Sub Clear()
_themelist = New List(Of Themes)
_themelist = New List(Of MediaContainers.Theme)
End Sub

Private Sub GetThemes(ByVal tDBElement As Database.DBElement)
Expand Down Expand Up @@ -118,7 +118,7 @@ Namespace ThemeLibrary
For ctr As Integer = 0 To sResult.Count - 1
If Master.eSettings.FileSystemValidThemeExts.Contains(Path.GetExtension(sResult.Item(ctr).Groups("URL").Value.Trim)) Then
Dim strURL As String = String.Concat(strSearchURL, "/", sResult.Item(ctr).Groups("URL").Value.Trim)
_themelist.Add(New Themes With {.Title = tInfo.Name, .URL = strURL, .WebURL = strURL})
_themelist.Add(New MediaContainers.Theme With {.Description = tInfo.Name, .URLAudioStream = strURL, .URLWebsite = strURL, .Scraper = "ThemeLibrary"})
End If
Next
End If
Expand Down
4 changes: 2 additions & 2 deletions Addons/scraper.Theme.ThemeLibrary/ThemeLibrary_Theme.vb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Public Class ThemeLibrary_Theme
End If
End Sub

Function Scraper_Movie(ByVal DBMovie As Database.DBElement, ByRef ThemeList As List(Of Themes)) As Interfaces.ModuleResult Implements Interfaces.ScraperModule_Theme_Movie.Scraper
Function Scraper_Movie(ByRef DBMovie As Database.DBElement, ByVal Type As Enums.ModifierType, ByRef ThemeList As List(Of MediaContainers.Theme)) As Interfaces.ModuleResult Implements Interfaces.ScraperModule_Theme_Movie.Scraper
logger.Trace("[ThemeLibrary_Theme] [Scraper_Movie] [Start]")

Dim tScraper As New ThemeLibrary.Scraper(DBMovie)
Expand All @@ -220,7 +220,7 @@ Public Class ThemeLibrary_Theme
Return New Interfaces.ModuleResult With {.breakChain = False}
End Function

Function Scraper_TV(ByVal DBTV As Database.DBElement, ByRef ThemeList As List(Of Themes)) As Interfaces.ModuleResult Implements Interfaces.ScraperModule_Theme_TV.Scraper
Function Scraper_TV(ByRef DBTV As Database.DBElement, ByVal Type As Enums.ModifierType, ByRef ThemeList As List(Of MediaContainers.Theme)) As Interfaces.ModuleResult Implements Interfaces.ScraperModule_Theme_TV.Scraper
logger.Trace("[ThemeLibrary_Theme] [Scraper_TV] [Start]")

Dim tScraper As New ThemeLibrary.Scraper(DBTV)
Expand Down
26 changes: 14 additions & 12 deletions EmberAPI/clsAPIDatabase.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,7 @@ Public Class Database
If Not DBNull.Value.Equals(SQLreader("NfoPath")) Then _movieDB.NfoPath = SQLreader("NfoPath").ToString
If Not DBNull.Value.Equals(SQLreader("EThumbsPath")) Then _movieDB.ExtrathumbsPath = SQLreader("EThumbsPath").ToString
If Not DBNull.Value.Equals(SQLreader("EFanartsPath")) Then _movieDB.ExtrafanartsPath = SQLreader("EFanartsPath").ToString
If Not DBNull.Value.Equals(SQLreader("ThemePath")) Then _movieDB.ThemePath = SQLreader("ThemePath").ToString
If Not DBNull.Value.Equals(SQLreader("ThemePath")) Then _movieDB.Theme.LocalFilePath = SQLreader("ThemePath").ToString

_movieDB.Source = Load_Source_Movie(Convert.ToInt64(SQLreader("idSource")))

Expand Down Expand Up @@ -2507,7 +2507,7 @@ Public Class Database
If Not DBNull.Value.Equals(SQLreader("Language")) Then _TVDB.Language = SQLreader("Language").ToString
If Not DBNull.Value.Equals(SQLreader("NfoPath")) Then _TVDB.NfoPath = SQLreader("NfoPath").ToString
If Not DBNull.Value.Equals(SQLreader("TVShowPath")) Then _TVDB.ShowPath = SQLreader("TVShowPath").ToString
If Not DBNull.Value.Equals(SQLreader("ThemePath")) Then _TVDB.ThemePath = SQLreader("ThemePath").ToString
If Not DBNull.Value.Equals(SQLreader("ThemePath")) Then _TVDB.Theme.LocalFilePath = SQLreader("ThemePath").ToString

_TVDB.Source = Load_Source_TVShow(Convert.ToInt64(SQLreader("idSource")))

Expand Down Expand Up @@ -3545,6 +3545,7 @@ Public Class Database
If ToDisk Then
_movieDB.ImagesContainer.SaveAllImages(_movieDB, ForceFileCleanup)
_movieDB.Movie.SaveAllActorThumbs(_movieDB)
_movieDB.Theme.SaveAllThemes(_movieDB, ForceFileCleanup)
_movieDB.Trailer.SaveAllTrailers(_movieDB, ForceFileCleanup)
End If

Expand All @@ -3555,7 +3556,7 @@ Public Class Database
par_movie_ExtrafanartsPath.Value = _movieDB.ExtrafanartsPath
par_movie_ExtrathumbsPath.Value = _movieDB.ExtrathumbsPath
par_movie_NfoPath.Value = _movieDB.NfoPath
par_movie_ThemePath.Value = _movieDB.ThemePath
par_movie_ThemePath.Value = If(Not String.IsNullOrEmpty(_movieDB.Theme.LocalFilePath), _movieDB.Theme.LocalFilePath, String.Empty)
par_movie_TrailerPath.Value = If(Not String.IsNullOrEmpty(_movieDB.Trailer.LocalFilePath), _movieDB.Trailer.LocalFilePath, String.Empty)

If Not Master.eSettings.MovieImagesNotSaveURLToNfo Then
Expand Down Expand Up @@ -4888,13 +4889,14 @@ Public Class Database
If ToNFO Then NFO.SaveToNFO_TVShow(_show)
If ToDisk Then
_show.ImagesContainer.SaveAllImages(_show, False)
_show.Theme.SaveAllThemes(_show, False)
_show.TVShow.SaveAllActorThumbs(_show)
End If

parExtrafanartsPath.Value = _show.ExtrafanartsPath
parNfoPath.Value = _show.NfoPath
parTVShowPath.Value = _show.ShowPath
parThemePath.Value = _show.ThemePath
parThemePath.Value = If(Not String.IsNullOrEmpty(_show.Theme.LocalFilePath), _show.Theme.LocalFilePath, String.Empty)

parNew.Value = Not _show.IDSpecified
parListTitle.Value = _show.ListTitle
Expand Down Expand Up @@ -5297,7 +5299,7 @@ Public Class Database
Private _sortmethod As Enums.SortMethod_MovieSet
Private _source As New DBSource
Private _subtitles As New List(Of MediaContainers.Subtitle)
Private _themepath As String
Private _theme As New MediaContainers.Theme
Private _trailer As New MediaContainers.Trailer
Private _tvepisode As MediaContainers.EpisodeDetails
Private _tvseason As MediaContainers.SeasonDetails
Expand Down Expand Up @@ -5734,18 +5736,18 @@ Public Class Database
End Get
End Property

Public Property ThemePath() As String
Public Property Theme() As MediaContainers.Theme
Get
Return _themepath
Return _theme
End Get
Set(ByVal value As String)
_themepath = value
Set(ByVal value As MediaContainers.Theme)
_theme = value
End Set
End Property

Public ReadOnly Property ThemePathSpecified() As Boolean
Public ReadOnly Property ThemeSpecified() As Boolean
Get
Return Not String.IsNullOrEmpty(_themepath)
Return _theme.ThemeOriginal IsNot Nothing AndAlso _theme.ThemeOriginal.hasMemoryStream
End Get
End Property

Expand Down Expand Up @@ -5858,7 +5860,7 @@ Public Class Database
_sortmethod = Enums.SortMethod_MovieSet.Year
_source = New DBSource
_subtitles = New List(Of MediaContainers.Subtitle)
_themepath = String.Empty
_theme = New MediaContainers.Theme
_trailer = New MediaContainers.Trailer
_tvepisode = Nothing
_tvseason = Nothing
Expand Down
20 changes: 20 additions & 0 deletions EmberAPI/clsAPIFileUtils.vb
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,26 @@ Namespace FileUtils
End If
End Function

Public Shared Function GetOpenFileDialogFilter_Theme() As String
Dim lstValidExtensions As New List(Of String)

For Each nExtension In Master.eSettings.FileSystemValidThemeExts
lstValidExtensions.Add(String.Concat("*", nExtension))
Next

Return String.Concat(Master.eLang.GetString(1285, "Themes"), "|", String.Join(";", lstValidExtensions.ToArray))
End Function

Public Shared Function GetOpenFileDialogFilter_Video(ByVal strDescription As String) As String
Dim lstValidExtensions As New List(Of String)

For Each nExtension In Master.eSettings.FileSystemValidExts
lstValidExtensions.Add(String.Concat("*", nExtension))
Next

Return String.Concat(strDescription, "|", String.Join(";", lstValidExtensions.ToArray))
End Function

''' <summary>
''' Determine whether the path provided contains a Blu-Ray image
''' </summary>
Expand Down
4 changes: 2 additions & 2 deletions EmberAPI/clsAPIInterfaces.vb
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ Public Class Interfaces
Sub ScraperOrderChanged()
Sub Init(ByVal sAssemblyName As String)
Function InjectSetupScraper() As Containers.SettingsPanel
Function Scraper(ByVal DBMovie As Database.DBElement, ByRef URLList As List(Of Themes)) As ModuleResult
Function Scraper(ByRef DBMovie As Database.DBElement, ByVal Type As Enums.ModifierType, ByRef ThemeList As List(Of MediaContainers.Theme)) As Interfaces.ModuleResult
Sub SaveSetupScraper(ByVal DoDispose As Boolean)

#End Region 'Methods
Expand Down Expand Up @@ -349,7 +349,7 @@ Public Class Interfaces
Sub ScraperOrderChanged()
Sub Init(ByVal sAssemblyName As String)
Function InjectSetupScraper() As Containers.SettingsPanel
Function Scraper(ByVal DBTV As Database.DBElement, ByRef URLList As List(Of Themes)) As ModuleResult
Function Scraper(ByRef DBTV As Database.DBElement, ByVal Type As Enums.ModifierType, ByRef ThemeList As List(Of MediaContainers.Theme)) As Interfaces.ModuleResult
Sub SaveSetupScraper(ByVal DoDispose As Boolean)

#End Region 'Methods
Expand Down

0 comments on commit 4c64792

Please sign in to comment.