public int GetMovieStopTimeAndResumeData(int movieId, int userId, out string fileName, out byte[] resumeData) { // Only compare the file as only the the path is not stored. resumeData = null; StopTimeResumeData stopTimeResumeData = new StopTimeResumeData(); stopTimeResumeData.stopTime = -1; stopTimeResumeData.fileName = string.Empty; try { QueryReader<StopTimeResumeData> resume = new QueryReader<StopTimeResumeData>(string.Format("SELECT * FROM tblResume where intId={0} AND intUserId={1}", movieId, userId)); resume.OnRow += new QueryReader<StopTimeResumeData>.Row(ResumeData_OnRow); resume.Execute(_connection, stopTimeResumeData); if (stopTimeResumeData.stopTime != 0) { resumeData = new byte[stopTimeResumeData.resumeString.Length / 2]; FromHexString(stopTimeResumeData.resumeString).CopyTo(resumeData, 0); } } catch (Exception ex) { Log.Error("MyMovies::GetMovieStopTimeAndResumeData - exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } fileName = stopTimeResumeData.fileName; return stopTimeResumeData.stopTime; }
private void LoadMovieActors(int movieID) { GUIWaitCursor.Show(); GUIControl.ClearControl(GetID, facadeView.GetID); ArrayList itemlist = new ArrayList(); QueryReader<ArrayList> sql = new QueryReader<ArrayList>(string.Format(_movieActorsSQL, movieID)); sql.OnRow += new QueryReader<ArrayList>.Row(OnRow_Actor); sql.OnConnection += new Sql.ConnectionEvent(Movies.sql_OnConnection); sql.Execute(Movies.ConnectionString, itemlist); foreach (GUIListItem item in itemlist) { facadeView.Add(item); } //set object count label GUIPropertyManager.SetProperty("#itemcount", MediaPortal.Util.Utils.GetObjectCountLabel(itemlist.Count)); GUIPropertyManager.SetProperty("#currentmodule", "MyMovies Artists"); facadeView.CurrentLayout = GUIFacadeControl.Layout.List; facadeView.SelectedListItemIndex = _currentSelectionIndex; GUIWaitCursor.Hide(); }
private void OnGenre() { List<Item> availableGenre = new List<Item>(); // Based upon the current view (All, Last played, Last Added) QueryReader<List<Item>> sql = new QueryReader<List<Item>>(SqlGenres); sql.OnRow += new QueryReader<List<Item>>.Row(OnRow_Genre); sql.OnConnection += new Sql.ConnectionEvent(sql_OnConnection); sql.Execute(ConnectionString, availableGenre); Filter dialog = new Filter(135, _currentGenres, availableGenre); dialog.DoModal(true); }
private void OnYears() { List<Item> availableYears = new List<Item>(); // Based upon the current view (All, Last played, Last Added) QueryReader<List<Item>> sql = new QueryReader<List<Item>>(SqlYears); sql.OnRow += new QueryReader<List<Item>>.Row(OnRow_Year); sql.OnConnection += new Sql.ConnectionEvent(sql_OnConnection); sql.Execute(ConnectionString, availableYears); Filter dialog = new Filter("Production Years", _currentYears, availableYears); dialog.DoModal(); }
private void OnCertification() { List<Item> availableCertifications = new List<Item>(); // Based upon the current view (All, Last played, Last Added) QueryReader<List<Item>> sql = new QueryReader<List<Item>>(SqlRating); sql.OnRow += new QueryReader<List<Item>>.Row(OnRow_Rating); sql.OnConnection += new Sql.ConnectionEvent(sql_OnConnection); sql.Execute(ConnectionString, availableCertifications); Filter dialog = new Filter("Certifications", _currentCertifications, availableCertifications); dialog.DoModal(); }
/// <summary> /// Read the data from SQL using the current settings. /// </summary> private void LoadCurrentSettings() { GUIWaitCursor.Show(); try { ArrayList itemlist = new ArrayList(); QueryReader<ArrayList> sql = new QueryReader<ArrayList>(SqlMovies); sql.OnRow += new QueryReader<ArrayList>.Row(OnRow_Movie); sql.OnConnection += new Sql.ConnectionEvent(sql_OnConnection); sql.Execute(ConnectionString, itemlist); LoadItems(itemlist, _currentSelectionIndex); GUIWaitCursor.Hide(); } catch (Exception ex) { Log.Error("MyMovies::LoadCurrentSettings - Error loading movies"); Log.Error(ex); GUIWaitCursor.Hide(); GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); dlgOk.SetHeading(342);//Movies dlgOk.SetLine(1, 315);//Database error dlgOk.DoModal(GetID); } }
/// <summary> /// Create a CSV of the studios associated with the specified movie. /// </summary> /// <param name="movieId">int movie ID</param> /// <returns>csv of studio names</returns> private string GetStudios(int movieId) { StringBuilder studios = new StringBuilder(); QueryReader<StringBuilder> sql = new QueryReader<StringBuilder>(string.Format("{0} WHERE intTitle = {1}", _studiosSQL, movieId)); sql.OnRow += new QueryReader<StringBuilder>.Row(OnRow_CSV); sql.Execute(ConnectionString, studios); return studios.ToString(); }
/// <summary> /// Create a CSV of the genres associated with the specified movie. /// </summary> /// <param name="movieId">int movie ID</param> /// <returns>csv of Genres</returns> private string GetMovieGenres(int movieId) { StringBuilder genres = new StringBuilder(); QueryReader<StringBuilder> sql = new QueryReader<StringBuilder>(string.Format("SELECT g.nvcName FROM tblTitleGenre tg INNER JOIN tblGenres g ON tg.intGenre = g.intId WHERE intTitle = {0}", movieId)); sql.OnRow += new QueryReader<StringBuilder>.Row(OnRow_CSV); sql.Execute(ConnectionString, genres); return genres.ToString(); }
/// <summary> /// Create a CSV of the directors associated with the specified movie. /// </summary> /// <param name="movieId">int movie ID</param> /// <returns>csv of directors names</returns> private string GetMovieDirectors(int movieId) { StringBuilder directors = new StringBuilder(); QueryReader<StringBuilder> sql = new QueryReader<StringBuilder>(string.Format("{0} WHERE intTitle = {1}", _directorsSQL, movieId)); sql.OnRow += new QueryReader<StringBuilder>.Row(OnRow_CSV); sql.Execute(ConnectionString, directors); return directors.ToString(); }