private string GetFanart(string title, int id) { string fanart = string.Empty; if (Utils.FanartHandler) { string _movieid = id.ToString(); fanart = UtilsFanartHandler.GetMyVideoFanartForLatest(_movieid); if (String.IsNullOrEmpty(fanart)) { fanart = UtilsFanartHandler.GetMyVideoFanartForLatest(title); } } if (String.IsNullOrEmpty(fanart)) { for (int i = 0; i < 3; i++) { string fanartFilename = FanArt.SetFanArtFileName(id, i); if (!string.IsNullOrEmpty(fanartFilename) && File.Exists(fanartFilename)) { fanart = fanartFilename; break; } } } return(fanart); }
// // GET: /FanArt/Create public ActionResult Index(string id_FanArt) { FanArt f = new FanArt(); List <FanArt> FanArt = new List <FanArt>(); int id; int.TryParse(id_FanArt, out id); if (id != 0) { FanArtVM nvm; Admin a; f = _FanArtBLL.FanArtSelect(id); a = _adminBLL.SelectByNick(f.Author); nvm = new FanArtVM(f, a); return(View("FanArt", nvm)); } else { FanArt = _FanArtBLL.FanArtList(); return(View("index", FanArt)); } }
private void DoDeleteItem(GUIListItem item) { IMDBMovie movie = item.AlbumInfoTag as IMDBMovie; if (movie == null) { return; } if (movie.ID < 0) { return; } if (item.IsFolder) { return; } if (!item.IsRemote) { // Delete covers FanArt.DeleteCovers(movie.Title, movie.ID); // Delete fanarts FanArt.DeleteFanarts(movie.File, movie.Title); VideoDatabase.DeleteMovieInfoById(movie.ID); } }
public static Hashtable ParseArtist(string id) { Hashtable objResuls = new Hashtable(); try { Uri strUrl = new Uri(string.Format(@"http://api.fanart.tv/webservice/album/{0}/{1}/{2}/{3}/{4}/{5}/", key, id, "JSON", "all", 1, 1)); string results = Util.GetRest(strUrl); if (string.IsNullOrWhiteSpace(results) == false) { JObject restResponse = JObject.Parse(results); FanArt album = FanArt.AlbumToObject(restResponse); if (string.IsNullOrWhiteSpace(album.ArtistId) == false) { ParseArtist(album); } // if (string.IsNullOrWhiteSpace(musicbrainz.GroupID) == false) } return(objResuls); } catch (Exception ex) { Util.LogException(ex, id); return(null); } }
public bool FanArtCreate(FanArt f) { bool result = false; MySqlCommand cmd = new MySqlCommand("proc_fanart_create", conn); MySqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new MySqlParameter("p_title", f.Title)); cmd.Parameters.Add(new MySqlParameter("p_date", f.Date)); cmd.Parameters.Add(new MySqlParameter("p_url", f.Url)); cmd.Parameters.Add(new MySqlParameter("p_author", f.Author)); try { conn.Open(); reader = cmd.ExecuteReader(); result = true; } catch (Exception e) { } finally { conn.Close(); } return(result); }
public ActionResult Create(string title, string url, string author) { FanArt f = new FanArt(title, url, author); bool result = _FanArtBLL.FanArtCreate(f); return(Json(result)); }
public ActionResult Update(int id_FanArt, string title, string url, string author) { FanArt n = new FanArt(title, url, author); n.Id = id_FanArt; bool result = _FanArtBLL.SpotlightUpdate(n); return(Json(result)); }
public static void ParseArtist(FanArt fanArt) { try { Uri strUrl = new Uri(string.Format(@"http://api.fanart.tv/webservice/artist/{0}/{1}/{2}/{3}/{4}/{5}/", key, fanArt.ArtistId, "JSON", "all", 1, 1)); string results = Util.GetRest(strUrl); if (string.IsNullOrWhiteSpace(results) == false) { JObject restResponse = JObject.Parse(results); FanArt.ArtistToObject(restResponse, fanArt); } } catch (Exception ex) { Util.LogException(ex); } }
public List <FanArt> FanArtList() { CreateView("/fanarts", DateTime.Now, "Fanart"); MySqlCommand cmd = new MySqlCommand("proc_fanart_list", conn); MySqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; List <FanArt> FanArts = new List <FanArt>(); FanArt FanArt = new FanArt(); try { conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { FanArt.Id = int.Parse(reader.GetString(0)); FanArt.Title = reader.GetValue(1).ToString(); FanArt.Date = DateTime.Parse(reader.GetValue(2).ToString()); FanArt.Url = reader.GetValue(3).ToString(); FanArt.Author = reader.GetValue(4).ToString(); FanArt.Date.AddHours(4); FanArts.Add(FanArt); FanArt = new FanArt(); } } catch (Exception e) { } finally { conn.Close(); } return(FanArts); }
public static FanArt ParseArtist(string id, string albumId) { FanArt fanArt = null; try { Uri strUrl = new Uri(string.Format(@"http://api.fanart.tv/webservice/artist/{0}/{1}/{2}/{3}/{4}/{5}/", key, id, "JSON", "all", 1, 1)); string results = Util.GetRest(strUrl); if (string.IsNullOrWhiteSpace(results) == false) { JObject restResponse = JObject.Parse(results); fanArt = FanArt.ArtistToObject(restResponse, albumId); } return(fanArt); } catch (Exception ex) { Util.LogException(ex, id); return(null); } }
public List <FanArt> FanArtSelectHome(int views) { MySqlCommand cmd = new MySqlCommand("proc_FanArt_select_home", conn); MySqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new MySqlParameter("p_views", views)); List <FanArt> FanArts = new List <FanArt>(); FanArt FanArt = new FanArt(); try { conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { FanArt.Id = int.Parse(reader.GetString(0)); FanArt.Title = reader.GetValue(1).ToString(); FanArt.Date = DateTime.Parse(reader.GetValue(2).ToString()); FanArt.Url = reader.GetValue(3).ToString(); FanArt.Author = reader.GetValue(4).ToString(); FanArt.Date.AddHours(4); FanArts.Add(FanArt); FanArt = new FanArt(); } } catch (Exception e) { } finally { conn.Close(); } return(FanArts); }
public FanArt FanArtSelect(int id_FanArt) { CreateView("/fanart?id_fanart=" + id_FanArt, DateTime.Now, "Fanart"); MySqlCommand cmd = new MySqlCommand("proc_fanart_select", conn); MySqlDataReader reader; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new MySqlParameter("p_id_fanart", id_FanArt)); FanArt FanArt = new FanArt(); try { conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { FanArt.Id = int.Parse(reader.GetString(0)); FanArt.Title = reader.GetValue(1).ToString(); FanArt.Date = DateTime.Parse(reader.GetValue(2).ToString()); FanArt.Url = reader.GetValue(3).ToString(); FanArt.Author = reader.GetValue(4).ToString(); FanArt.Date.AddHours(4); } } catch (Exception e) { } finally { conn.Close(); } return(FanArt); }
public FanArtVM(FanArt fanart, Admin admin) { FanArt = fanart; Admin = admin; }
public static Hashtable Parse(string id) { Hashtable objResuls = new Hashtable(); try { Uri strUrl = new Uri(string.Format(@"http://musicbrainz.org/ws/2/release/{0}?inc=artist-credits+labels+discids+recordings+release-groups&fmt=json", id)); string results = Util.GetRest(strUrl); //FIX 2.7.12.0 if (string.IsNullOrWhiteSpace(results) == false) { JObject restResponse = JObject.Parse(results); Musicbrainz music = Musicbrainz.ToObject(restResponse); #region FanArt if (string.IsNullOrWhiteSpace(music.GroupID) == false && string.IsNullOrWhiteSpace(music.ArtistId) == false) { FanArt images = FanArtServices.ParseArtist(music.ArtistId, music.GroupID); if (images != null) { if (string.IsNullOrWhiteSpace(images.Albumcover) == false) { objResuls.Add("Image", images.Albumcover); } if (string.IsNullOrWhiteSpace(images.ArtistName) == false) { Artist artist = new Artist(); artist.FulleName = images.ArtistName; artist.Picture = Util.GetImage(images.ArtistCover); objResuls.Add("Artist", artist); } if (string.IsNullOrWhiteSpace(images.ArtistBackground) == false) { objResuls.Add("Background", images.ArtistBackground); } if (string.IsNullOrWhiteSpace(images.Cdart) == false) { objResuls.Add("Cdart", images.Cdart); } } } #endregion objResuls.Add("Links", strUrl); objResuls.Add("Title", music.AlbumName); #region Album objResuls.Add("Album", music.AlbumName); #endregion #region Editor if (music.Studio != null) { objResuls.Add("Editor", music.Studio); } #endregion #region ReleaseDate if (string.IsNullOrWhiteSpace(music.AlbumReleased) == false) { DateTime date; if (DateTime.TryParse(music.AlbumReleased, new CultureInfo("en-US"), DateTimeStyles.None, out date)) { objResuls.Add("Released", date); } } #endregion #region Runtime if (music.AlbumDuration > 0) { objResuls.Add("Runtime", music.AlbumDuration); } #endregion #region Tracks objResuls.Add("Tracks", music.AlbumTracks); #endregion #region BarCode objResuls.Add("BarCode", music.Barcode); #endregion } return(objResuls); } catch (Exception ex) { Util.LogException(ex, id); return(null); } }
public bool FanArtCreate(FanArt n) { return(_FanArtDAL.FanArtCreate(n)); }
// // GET: /FanArt/Update public ActionResult Update(int id_fanart) { FanArt n = _FanArtBLL.FanArtSelect(id_fanart); return(View("update", n)); }
public bool SpotlightUpdate(FanArt n) { return(_FanArtDAL.FanArtUpdate(n)); }
// Changed - covers and the same movie name protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { base.OnClicked(controlId, control, actionType); if (control == btnRefresh) { // Check Internet connection if (!Win32API.IsConnectedToInternet()) { GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); dlgOk.SetHeading(257); dlgOk.SetLine(1, GUILocalizeStrings.Get(703)); dlgOk.DoModal(GUIWindowManager.ActiveWindow); return; } string title = currentMovie.Title; int id = currentMovie.ID; string file = currentMovie.Path + "\\" + currentMovie.File; // Delete covers FanArt.DeleteCovers(title, id); //Delete fanarts FanArt.DeleteFanarts(file, title); if (IMDBFetcher.RefreshIMDB(this, ref currentMovie, false, false, true)) { if ((imageSearchThread != null) && (imageSearchThread.IsAlive)) { imageSearchThread.Abort(); imageSearchThread = null; } imdbCoverArtUrl = currentMovie.ThumbURL; coverArtUrls = new string[1]; coverArtUrls[0] = imdbCoverArtUrl; ResetSpinControl(); Refresh(false); Update(); // Start images search thread SearchImages(); } return; } if (control == spinImages) { int item = spinImages.Value - 1; if (item < 0 || item >= coverArtUrls.Length) { item = 0; } if (currentMovie.ThumbURL == coverArtUrls[item]) { return; } currentMovie.ThumbURL = coverArtUrls[item]; // Title suffix for problem with covers and movie with the same name string titleExt = currentMovie.Title + "{" + currentMovie.ID + "}"; string coverArtImage = Util.Utils.GetCoverArtName(Thumbs.MovieTitle, titleExt); string largeCoverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt); Util.Utils.FileDelete(coverArtImage); // // 07.11.2010 Deda: Cache entry Flag change for cover thumb file // Util.Utils.DoInsertNonExistingFileIntoCache(coverArtImage); // Util.Utils.FileDelete(largeCoverArtImage); Refresh(false); Update(); int idMovie = currentMovie.ID; if (idMovie >= 0) { VideoDatabase.SetThumbURL(idMovie, currentMovie.ThumbURL); } return; } if (control == btnCast) { viewmode = ViewMode.Cast; Update(); } if (control == btnPlot) { viewmode = ViewMode.Plot; Update(); } if (control == btnReview) { viewmode = ViewMode.Review; Update(); } if (control == btnWatched) { if (currentMovie.Watched > 0) { GUIPropertyManager.SetProperty("#iswatched", "no"); currentMovie.Watched = 0; VideoDatabase.SetMovieWatchedStatus(currentMovie.ID, false); ArrayList files = new ArrayList(); VideoDatabase.GetFiles(currentMovie.ID, ref files); foreach (string file in files) { int fileId = VideoDatabase.GetFileId(file); VideoDatabase.DeleteMovieStopTime(fileId); } } else { GUIPropertyManager.SetProperty("#iswatched", "yes"); currentMovie.Watched = 1; VideoDatabase.SetMovieWatchedStatus(currentMovie.ID, true); } VideoDatabase.SetWatched(currentMovie); } if (control == spinDisc) { string selectedItem = spinDisc.GetLabel(); int idMovie = currentMovie.ID; if (idMovie > 0) { if (selectedItem != "HD" && selectedItem != "share") { VideoDatabase.SetDVDLabel(idMovie, selectedItem); } else { VideoDatabase.SetDVDLabel(idMovie, "HD"); } } } if (control == btnPlay) { int id = currentMovie.ID; ArrayList files = new ArrayList(); VideoDatabase.GetFiles(id, ref files); if (files.Count > 1) { GUIVideoFiles._stackedMovieFiles = files; GUIVideoFiles._isStacked = true; GUIVideoFiles.MovieDuration(files); } GUIVideoFiles.PlayMovie(id, false); return; } }