Kodi Community Forum

Full Version: Developer Area
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Try to compile the UnitTesting manually first.
Actually, I'm just finalizing a Push to resolve those issues. The updated .vbproj files should gracefully handle developers in VS2010 and above.

Just going through some compile-and-trials now.
OK, unit test mod is now in my latest pull request. Also added was configuration for "x86" and "Any CPU". Note that for now, releases should only target x86 because AnyCPU has not been thoroughly tested yet. I need to setup some virtual machines (?) to properly test that.

For the unit tests, if you are using VS 2010, please ensure you have SP1 installed, or it may break the project definitions! (I think that is what happened before)

======================

I have noticed in v1.4 that I can not work with the trailer dialog because of the axShockwaveFlashObjects dlls. Here is a build error:

COM Reference 'ShockwaveFlashObjects' is the interop assembly for ActiveX control 'AxShockwaveFlashObjects' but was marked to be linked by the compiler with the /link flag. This COM reference will be treated as a reference and will not be linked.

When I try to open the movie trailer dialog, it fails when attempting to initialize the flash DLL. More specifically, when it is attempting to query the version number. See log entry below.

I am running Windows 7 Home Premium SP1, 64-bit.

Anyone else getting a similar problem? I re-installed Shockwave just in case... but I'll try next week to explicitely install the 32-bit version (instead of 64-bit)


Code:
2014-01-10 09:09:00.9894,Ember_Media_Manager.frmMain,EmberAPI.ErrorLogger.Error,8,ERROR,"Could not load file or assembly 'AxInterop.ShockwaveFlashObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
   at Ember_Media_Manager.dlgTrailerSelect.InitializeComponent()
   at Ember_Media_Manager.dlgTrailerSelect..ctor() in \Visual Studio 2012\Projects\Ember-MM-Newscraper\EmberMediaManager\dlgTrailerSelect.vb:line 36
   at Ember_Media_Manager.dlgEditMovie.btnDLTrailer_Click(Object sender, EventArgs e) in \Visual Studio 2012\Projects\Ember-MM-Newscraper\EmberMediaManager\dlgEditMovie.vb:line 230
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
   at Ember_Media_Manager.frmMain.dgvMediaList_CellDoubleClick(Object sender, DataGridViewCellEventArgs e) in \Visual Studio 2012\Projects\Ember-MM-Newscraper\EmberMediaManager\frmMain.vb:line 3519"
(2014-01-10, 22:35)Dekker500 Wrote: [ -> ]I have noticed in v1.4 that I can not work with the trailer dialog because of the axShockwaveFlashObjects dlls. Here is a build error:

COM Reference 'ShockwaveFlashObjects' is the interop assembly for ActiveX control 'AxShockwaveFlashObjects' but was marked to be linked by the compiler with the /link flag. This COM reference will be treated as a reference and will not be linked.

You need the standard Adobe Flash Player. But i try to made an option/check for users they don't have installed flash.
The DLL is actually there, it gets loaded, but the 64-bit process calls are formatted differently so they fail. In my research to resolve it, it looks like the solution is to not use the quick and easy DLLImport call, and do the load and unload manually the old fashioned way, and if 64-bit make the call one way, and if 32-bit make the call the other way... But for now I can't put more time into that but thought I'd mention the above for anyone else who wants to take up the reigns.
Error on close:
2014-01-12 17:19:40.8686,Ember_Media_Manager.dlgSettings,EmberAPI.ErrorLogger.Error,1,ERROR,"Object reference not set to an instance of an object.
at generic.EmberCore.MovieExporter.MovieExporterModule.Disable() in C:\Users\Massimo\Documents\GitHub\Ember-MM-Newscraper\Addons\generic.EmberCore.MovieExport\Module.MovieExporter.vb:line 101
at generic.EmberCore.MovieExporter.MovieExporterModule.set_Enabled(Boolean value) in C:\Users\Massimo\Documents\GitHub\Ember-MM-Newscraper\Addons\generic.EmberCore.MovieExport\Module.MovieExporter.vb:line 65
at generic.EmberCore.MovieExporter.MovieExporterModule.SaveSetup(Boolean DoDispose) in C:\Users\Massimo\Documents\GitHub\Ember-MM-Newscraper\Addons\generic.EmberCore.MovieExport\Module.MovieExporter.vb:line 156
at Ember_Media_Manager.dlgSettings.SaveSettings(Boolean isApply) in C:\Users\Massimo\Documents\GitHub\Ember-MM-Newscraper\EmberMediaManager\dlgSettings.vb:line 4111"
2014-01-12


I do disable the module and get this errors.
Massimo, do you have skills with "Nullable (of Integer)"?

I can't send null to the WatTMDb plugin, only 0. But the API needs "null" if no movie year is existing. I have build a workarount, but it's not really nice =)
(2014-01-16, 17:23)DanCooper Wrote: [ -> ]Massimo, do you have skills with "Nullable (of Integer)"?

I can't send null to the WatTMDb plugin, only 0. But the API needs "null" if no movie year is existing. I have build a workarount, but it's not really nice =)

Let me look into it, which call you need to do? where?

can you send me via PM the code?
It's now commited on GitHub.
It works, but i'm not lucky with the solution.

I have not found the right way to send "null" instead of "0" to WatTMDb.
My solution is If sYear > 0 but i don't like it Smile


Please check Private Function SearchMovie Addons/scraper.TMDB.Data/Scraper/clsScrapeTMDBg.vb, Lines 657 - 705.

Code:
Private Function SearchMovie(ByVal sMovie As String, Optional ByVal sYear As Integer = 0) As MovieSearchResults
            Try
                Dim R As New MovieSearchResults
                Dim Page As Integer = 1
                Dim Movies As WatTmdb.V3.TmdbMovieSearch
                Dim TotP As Integer
                Dim aE As Boolean
                If sYear > 0 Then
                    Movies = _TMDBApi.SearchMovie(sMovie, Page, _MySettings.TMDBLanguage, , sYear)
                Else
                    Movies = _TMDBApi.SearchMovie(sMovie, Page, _MySettings.TMDBLanguage)
                End If
                If Movies.total_results = 0 And _MySettings.FallBackEng Then
                    If sYear > 0 Then
                        Movies = _TMDBApiE.SearchMovie(sMovie, Page, , , sYear)
                    Else
                        Movies = _TMDBApiE.SearchMovie(sMovie, Page)
                    End If
                    aE = True
                End If
                If Movies.total_results > 0 Then
                    Dim t1 As String
                    Dim t2 As String
                    Dim t3 As String
                    TotP = Movies.total_pages
                    While Page <= TotP And Page <= 3
                        For Each aMovie In Movies.results
                            Dim aMI As WatTmdb.V3.TmdbMovie
                            aMI = _TMDBApi.GetMovieInfo(aMovie.id)
                            If IsNothing(aMI) Then
                                aMI = _TMDBApiE.GetMovieInfo(aMovie.id)
                            End If
                            If IsNothing(aMI.imdb_id) Then
                                t1 = ""
                            Else
                                t1 = aMI.imdb_id.ToString
                            End If
                            t2 = CStr(IIf(String.IsNullOrEmpty(aMovie.title), "", aMovie.title))
                            t3 = Left(CStr(IIf(String.IsNullOrEmpty(aMovie.release_date), "", aMovie.release_date)), 4)
                            Dim lNewMovie As MediaContainers.Movie = New MediaContainers.Movie(t1, t2, t3, 0)
                            lNewMovie.TMDBID = aMI.id.ToString
                            R.Matches.Add(lNewMovie)
                        Next
                        Page = Page + 1
                        If aE Then
                            If sYear > 0 Then
                                Movies = _TMDBApiE.SearchMovie(sMovie, Page, , , sYear)
                            Else
                                Movies = _TMDBApiE.SearchMovie(sMovie, Page)
                            End If
                        Else
                            If sYear > 0 Then
                                Movies = _TMDBApi.SearchMovie(sMovie, Page, _MySettings.TMDBLanguage, , sYear)
                            Else
                                Movies = _TMDBApi.SearchMovie(sMovie, Page, _MySettings.TMDBLanguage)
                            End If
                        End If

                    End While
                End If

                Return R
            Catch ex As Exception
                Master.eLog.Error(Me.GetType(), ex.Message, ex.StackTrace, "Error")
                Return Nothing
            End Try
        End Function
Btw. now on database update, if a movie don't have a NFO, Ember try to get the movie year from foldername or filename (only if year in brackets) and add it to the database for a better search result.
(2014-01-17, 21:34)DanCooper Wrote: [ -> ]It's now commited on GitHub.
It works, but i'm not lucky with the solution.

I have not found the right way to send "null" instead of "0" to WatTMDb.
My solution is If sYear > 0 but i don't like it Smile


Please check Private Function SearchMovie Addons/scraper.TMDB.Data/Scraper/clsScrapeTMDBg.vb, Lines 657 - 705.

Code:
Private Function SearchMovie(ByVal sMovie As String, Optional ByVal sYear As Integer = 0) As MovieSearchResults
            Try
                Dim R As New MovieSearchResults
                Dim Page As Integer = 1
                Dim Movies As WatTmdb.V3.TmdbMovieSearch
                Dim TotP As Integer
                Dim aE As Boolean
                If sYear > 0 Then
                    Movies = _TMDBApi.SearchMovie(sMovie, Page, _MySettings.TMDBLanguage, , sYear)
                Else
                    Movies = _TMDBApi.SearchMovie(sMovie, Page, _MySettings.TMDBLanguage)
                End If
                If Movies.total_results = 0 And _MySettings.FallBackEng Then
                    If sYear > 0 Then
                        Movies = _TMDBApiE.SearchMovie(sMovie, Page, , , sYear)
                    Else
                        Movies = _TMDBApiE.SearchMovie(sMovie, Page)
                    End If
                    aE = True
                End If
                If Movies.total_results > 0 Then
                    Dim t1 As String
                    Dim t2 As String
                    Dim t3 As String
                    TotP = Movies.total_pages
                    While Page <= TotP And Page <= 3
                        For Each aMovie In Movies.results
                            Dim aMI As WatTmdb.V3.TmdbMovie
                            aMI = _TMDBApi.GetMovieInfo(aMovie.id)
                            If IsNothing(aMI) Then
                                aMI = _TMDBApiE.GetMovieInfo(aMovie.id)
                            End If
                            If IsNothing(aMI.imdb_id) Then
                                t1 = ""
                            Else
                                t1 = aMI.imdb_id.ToString
                            End If
                            t2 = CStr(IIf(String.IsNullOrEmpty(aMovie.title), "", aMovie.title))
                            t3 = Left(CStr(IIf(String.IsNullOrEmpty(aMovie.release_date), "", aMovie.release_date)), 4)
                            Dim lNewMovie As MediaContainers.Movie = New MediaContainers.Movie(t1, t2, t3, 0)
                            lNewMovie.TMDBID = aMI.id.ToString
                            R.Matches.Add(lNewMovie)
                        Next
                        Page = Page + 1
                        If aE Then
                            If sYear > 0 Then
                                Movies = _TMDBApiE.SearchMovie(sMovie, Page, , , sYear)
                            Else
                                Movies = _TMDBApiE.SearchMovie(sMovie, Page)
                            End If
                        Else
                            If sYear > 0 Then
                                Movies = _TMDBApi.SearchMovie(sMovie, Page, _MySettings.TMDBLanguage, , sYear)
                            Else
                                Movies = _TMDBApi.SearchMovie(sMovie, Page, _MySettings.TMDBLanguage)
                            End If
                        End If

                    End While
                End If

                Return R
            Catch ex As Exception
                Master.eLog.Error(Me.GetType(), ex.Message, ex.StackTrace, "Error")
                Return Nothing
            End Try
        End Function

DanCooper,
the module should already work correctly. If sYear does not exeist is not added in the query. If sYear exists (therfore must NOT be null) is added to the parameter.


Code:
public TmdbMovieSearch SearchMovie(string query, int page, string language = "", bool? includeAdult = null, int? year = null)
...
            return ProcessRequest<TmdbMovieSearch>(Generator.SearchMovie(query, page, language, includeAdult, year));
        }

then
Code:
public RequestBuilder AddParameter(string name, int? value)
        {
            if (!value.HasValue) return this;

            Request.AddParameter(name, value.Value);
            return this;
        }

why you say is not working?

How you test it?
Anyway I updated a version with the nullable form for sYear and the check on Nullable
You have misunderstood me. I have code it yesterday and found no errors.
But I think it's possible without "If sYear> 0" when "sYear = null" is. But I did not know how I have to program it.

I will check out your solution, thx.
now should be with the null Smile

Let me know if it works Big Grin
This is actually the same solution as that of me.

I want that "sYear = null" is. "Nothing" corresponds to "0".

If "sYear = null" we could do without "If ... else" and always use
Code:
Movies = _TMDBApi.SearchMovie (sMovie, Page, _MySettings.TMDBLanguage, , sYear)

Do you know what i mean?
WatTMDb only allows "null". So I had to use "If ... else".
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24