예제 #1
0
 public XbmcFile(Xbmc parent)
 {
     _parent          = parent;
     _workerDownloads = new BackgroundWorker {
         WorkerSupportsCancellation = true
     };
     _workerDownloads.DoWork += AsyncImagesDownloadsWorker;
 }
예제 #2
0
        public Collection <ApiAudioArtist> GetArtists()
        {
            _parent.Trace("JRiver Get Artists Running");
            var artists = new Collection <ApiAudioArtist>();

            return(artists);

            try
            {
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Type]=[Audio]");
                foreach (var Field in Allitems)
                {
                    string result = "";
                    if (Field.TryGetValue("Album", out result))
                    {
                        if (result != "" & result != null)
                        {
                            //Only take Artists from those entries that have Album Name -

                            string GenreName = Field.ValueOrDefault("Genre");
                            string Artist    = Field.ValueOrDefault("Artist");

                            if (Artist != "" && Artist != null)
                            {
                                var artist = new ApiAudioArtist
                                {
                                    IdArtist  = (long)Xbmc.IDstringtoNumber(Artist),
                                    Name      = Artist,
                                    Thumb     = "",
                                    Fanart    = "",
                                    Biography = ""
                                };


                                if (!artists.Any(a => a.Name == Artist))
                                {
                                    artists.Add(artist);
                                }
                            }
                        }
                    }
                }
                return(artists);
            }
            catch (Exception ex)
            {
                _parent.Trace("JRiver GetArtists:" + ex);
                return(artists);
            }
        }
예제 #3
0
        public Collection <ApiAudioGenre> GetGenres()
        {
            _parent.Trace("JRiver Get Genres Running");
            var genres = new Collection <ApiAudioGenre>();

            return(genres);


            try
            {
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Type]=[Audio]");
                foreach (var Field in Allitems)
                {
                    string result = "";
                    if (Field.TryGetValue("Genre", out result))
                    {
                        if (result != "" && result != null)
                        {
                            //Only take Genre from those entries that have Album Name -

                            string GenreName = Field.ValueOrDefault("Genre");

                            if (GenreName != "" && GenreName != null)
                            {
                                var gen = new ApiAudioGenre
                                {
                                    IdGenre    = (long)Xbmc.IDstringtoNumber(GenreName),
                                    Name       = GenreName.ToString(),
                                    AlbumCount = 0,
                                    Thumb      = ""
                                };

                                if (!genres.Any(a => a.Name == GenreName))  //check Genre doesnt already exisit
                                {
                                    genres.Add(gen);
                                }
                            }
                        }
                    }
                }

                return(genres);
            }
            catch (Exception ex)
            {
                _parent.Trace("JRiver GetGenre:" + ex);
                return(genres);
            }
        }
예제 #4
0
 public XbmcSystem(Xbmc parent)
 {
     _parent = parent;
 }
예제 #5
0
        public Collection <ApiTvShow> GetTvShows()
        {
            //var MovieId = GetMainSelection("TV");
            var shows = new Collection <ApiTvShow>();

            return(shows);

            //

            try
            {
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Sub%20Type]=[TV%20Show]");
                _parent.Trace("GetTVEpisodes : Parent IP: " + _parent.IP);
                // iterate through Items
                foreach (var Field in Allitems)
                {
                    var result   = "";
                    var isTVshow = false;
                    if (Field.TryGetValue("Media Sub Type", out result))
                    {
                        if (result == "TV Show")
                        {
                            isTVshow = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    long   PlayCount = 0;
                    string Plays     = "";
                    if (Field.TryGetValue("Number Plays", out Plays))
                    {
                        PlayCount = long.TryParse(Plays, out PlayCount) ? PlayCount : 0;
                    }
                    long   SeasonNumber = 0;
                    string Season       = "";
                    if (Field.TryGetValue("Season", out Season))
                    {
                        SeasonNumber = long.TryParse(Season, out SeasonNumber) ? SeasonNumber : 0;
                    }
                    long   EpisodeNumber = 0;
                    string EpisodeNo     = "";
                    if (Field.TryGetValue("Episode", out EpisodeNo))
                    {
                        EpisodeNumber = long.TryParse(EpisodeNo, out EpisodeNumber) ? EpisodeNumber : 0;
                    }
                    string FileKey   = "";
                    string Thumb2    = "";
                    string Fanart2   = "";
                    string LogoArt   = "";
                    string BannerArt = "";
                    if (Field.TryGetValue("Key", out FileKey))
                    {
                        Thumb2  = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                        Fanart2 = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                    }
                    var filename = Field.ValueOrDefault("Filename");
                    if (filename != null & filename != "")
                    {
                        var filePath                = Path.GetDirectoryName(Field.ValueOrDefault("Filename"));
                        var fanartPath              = Path.Combine(filePath, "fanart.jpg");
                        var LogoPath                = Path.Combine(filePath, "logo.png");
                        var ThumbPath               = Path.Combine(filePath, "poster.jpg");
                        var BannerPath              = Path.Combine(filePath, "banner.jpg");
                        System.IO.FileInfo fi       = new System.IO.FileInfo(fanartPath);
                        System.IO.FileInfo fiLogo   = new System.IO.FileInfo(LogoPath);
                        System.IO.FileInfo fiThumb  = new System.IO.FileInfo(ThumbPath);
                        System.IO.FileInfo fiBanner = new System.IO.FileInfo(BannerPath);
                        //   _parent.Trace("JRiver: ** filePath ** :" + filePath);
                        //   _parent.Trace("JRiver: ** fanArt.Jpg ** :" + fanartPath);
                        //   _parent.Trace("JRiver: ** Logo.Png ** :" + LogoPath);
                        if (fi.Exists)
                        {
                            Fanart2 = fanartPath;  //if fanart.jpg exisits in directory with movie use this otherwise default to JRiver Thumb
                        }
                        if (fiLogo.Exists)
                        {
                            LogoArt = LogoPath;
                        }
                        if (fiThumb.Exists)
                        {
                            Thumb2 = ThumbPath;
                        }
                        if (fiBanner.Exists)
                        {
                            BannerArt = BannerPath;
                        }
                    }
                    string ShowName = Field.ValueOrDefault("Series");

                    if (ShowName == "")
                    {
                        ShowName = "Unknown Series";
                    }
                    long idShow = Xbmc.IDstringtoNumber(ShowName);

                    var tvShow = new ApiTvShow
                    {
                        Title      = ShowName,
                        Plot       = Field.ValueOrDefault("Comment"),
                        Rating     = "",
                        Mpaa       = Field.ValueOrDefault("MPAA Rating"),
                        Studio     = Field.ValueOrDefault("Studio"),
                        Path       = Field.ValueOrDefault("Filename"),
                        IdScraper  = "",
                        Genre      = Field.ValueOrDefault("Genre"),
                        IdShow     = idShow,
                        TotalCount = 0,
                        Premiered  = Field.ValueOrDefault("Date (readable)"),
                        Thumb      = Thumb2,
                        Fanart     = Fanart2,
                        Banner     = BannerArt,
                        Logo       = LogoArt,
                        Hash       = Xbmc.Hash(FileKey)
                    };

                    if (isTVshow && !shows.Any(a => a.IdShow == idShow))
                    {
                        _parent.Trace("JRiver: New Show Found: Adding Show:" + ShowName);
                        shows.Add(tvShow);
                    }
                }
            }
            catch (Exception ex)
            {
                _parent.Trace("TV Shows REFRESH Exception Caught " + ex);
            }
            return(shows);
        }
예제 #6
0
 public XbmcPicturePlayer(Xbmc parent)
 {
     _parent = parent;
 }
예제 #7
0
 public XbmcPlayer(Xbmc parent)
 {
     _parent = parent;
 }
예제 #8
0
        public Collection <ApiTvEpisode> GetTvEpisodesRefresh()
        {
            var episodes = new Collection <ApiTvEpisode>();

            return(episodes);

            // no refresh possible

            try
            {
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Sub%20Type]=[TV%20Show]");
                _parent.Trace("GetTVEpisodes : Parent IP: " + _parent.IP);
                // iterate through Items
                foreach (var Field in Allitems)
                {
                    var result   = "";
                    var isTVshow = false;
                    if (Field.TryGetValue("Media Sub Type", out result))
                    {
                        if (result == "TV Show")
                        {
                            isTVshow = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    long   PlayCount = 0;
                    string Plays     = "";
                    if (Field.TryGetValue("Number Plays", out Plays))
                    {
                        PlayCount = long.TryParse(Plays, out PlayCount) ? PlayCount : 0;
                    }
                    long   SeasonNumber = 0;
                    string Season       = "";
                    if (Field.TryGetValue("Season", out Season))
                    {
                        SeasonNumber = long.TryParse(Season, out SeasonNumber) ? SeasonNumber : 0;
                    }
                    long   EpisodeNumber = 0;
                    string EpisodeNo     = "";
                    if (Field.TryGetValue("Episode", out EpisodeNo))
                    {
                        EpisodeNumber = long.TryParse(EpisodeNo, out EpisodeNumber) ? EpisodeNumber : 0;
                    }
                    string FileKey = "";
                    string Thumb   = "";
                    string Fanart  = "";
                    if (Field.TryGetValue("Key", out FileKey))
                    {
                        Thumb  = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                        Fanart = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                    }
                    DateTime myDateTime = new DateTime();
                    try
                    {
                        string datestring = "01/01/1900";

                        if (Field.TryGetValue("Date Created", out datestring))
                        {
                            myDateTime = DateTime.Parse(datestring);
                        }
                    }
                    catch (Exception ex)
                    {
                        // _parent.Trace("JRiver Error:  dateTime Exception: " + ex);
                        myDateTime = DateTime.Parse("1900-01-01");
                    }

                    string sqlFormattedDate = myDateTime.ToString("s");
                    string tvdb             = "0";
                    if (Field.TryGetValue("TheTVDB Series ID", out tvdb))
                    {
                        tvdb = tvdb;
                    }


                    var tvShow = new ApiTvEpisode
                    {
                        Title     = Field.ValueOrDefault("Name"),
                        Plot      = Field.ValueOrDefault("Comment"),
                        Rating    = "",
                        Mpaa      = Field.ValueOrDefault("MPAA Rating"),
                        Date      = sqlFormattedDate,
                        Director  = Field.ValueOrDefault("Director"),
                        PlayCount = PlayCount,
                        Studio    = Field.ValueOrDefault("Studio"),
                        IdEpisode = Xbmc.IDtoNumber(FileKey),
                        IdShow    = Xbmc.IDtoNumber(tvdb),
                        Season    = SeasonNumber,
                        Episode   = EpisodeNumber,
                        Path      = Field.ValueOrDefault("Filename"),
                        ShowTitle = Field.ValueOrDefault("Series"),
                        Thumb     = Thumb,
                        Fanart    = Fanart,
                        Hash      = Xbmc.Hash(FileKey)
                    };
                    if (isTVshow)
                    {
                        episodes.Add(tvShow);
                    }
                }
            }
            catch (Exception Ex)
            {
                _parent.Trace("Another tV Episodes exception" + Ex);
            }

            return(episodes);
        }
예제 #9
0
        public Collection <ApiMovie> GetMovies()
        {
            var movies = new Collection <ApiMovie>();

            //testing only

            return(movies);

            // testing okay
            // delete

            try
            {
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Sub%20Type]=[Movie]");
                var isMovie = false;
                _parent.Trace("GetMoviesRefresh  : Parent IP: " + _parent.IP);
                // iterate through Items
                foreach (var Field in Allitems)
                {
                    var Logoutput = "";
                    Field.TryGetValue("Name", out Logoutput);
                    _parent.Trace("************* Logging : " + Logoutput);

                    var result = "";
                    if (Field.TryGetValue("Media Sub Type", out result))
                    {
                        if (result == "Movie")
                        {
                            isMovie = true;
                            _parent.Trace("Movie:  " + isMovie);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    long   PlayCount = 0;
                    string Plays     = "";
                    if (Field.TryGetValue("Number Plays", out Plays))
                    {
                        PlayCount = long.TryParse(Plays, out PlayCount) ? PlayCount : 0;
                    }
                    long   SeasonNumber = 0;
                    string Season       = "";
                    if (Field.TryGetValue("Season", out Season))
                    {
                        SeasonNumber = long.TryParse(Season, out SeasonNumber) ? SeasonNumber : 0;
                    }
                    long   EpisodeNumber = 0;
                    string EpisodeNo     = "";
                    if (Field.TryGetValue("Episode", out EpisodeNo))
                    {
                        EpisodeNumber = long.TryParse(EpisodeNo, out EpisodeNumber) ? EpisodeNumber : 0;
                    }
                    string FileKey   = "";
                    string Thumb2    = "";
                    string Fanart2   = "";
                    string LogoArt   = "";
                    string BannerArt = "";
                    if (Field.TryGetValue("Key", out FileKey))
                    {
                        Thumb2  = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                        Fanart2 = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                    }
                    // use directory for fanart if exists
                    var filename = Field.ValueOrDefault("Filename");
                    if (filename != null & filename != "")
                    {
                        var filePath                = Path.GetDirectoryName(Field.ValueOrDefault("Filename"));
                        var fanartPath              = Path.Combine(filePath, "fanart.jpg");
                        var LogoPath                = Path.Combine(filePath, "logo.png");
                        var ThumbPath               = Path.Combine(filePath, "poster.jpg");
                        var BannerPath              = Path.Combine(filePath, "banner.jpg");
                        System.IO.FileInfo fi       = new System.IO.FileInfo(fanartPath);
                        System.IO.FileInfo fiLogo   = new System.IO.FileInfo(LogoPath);
                        System.IO.FileInfo fiThumb  = new System.IO.FileInfo(ThumbPath);
                        System.IO.FileInfo fiBanner = new System.IO.FileInfo(BannerPath);

                        _parent.Trace("JRiver: ** filePath ** :" + filePath);
                        _parent.Trace("JRiver: ** fanArt.Jpg ** :" + fanartPath);
                        _parent.Trace("JRiver: ** Logo.Png ** :" + LogoPath);

                        if (fi.Exists)
                        {
                            Fanart2 = fanartPath;  //if fanart.jpg exisits in directory with movie use this otherwise default to JRiver Thumb
                        }

                        if (fiLogo.Exists)
                        {
                            LogoArt = LogoPath;
                        }

                        if (fiThumb.Exists)
                        {
                            Thumb2 = ThumbPath;
                        }
                        if (fiBanner.Exists)
                        {
                            BannerArt = BannerPath;
                        }
                    }
                    //** uses directories for fanart if present


                    DateTime myDateTime = new DateTime();
                    try
                    {
                        string datestring = "01/01/1900";

                        if (Field.TryGetValue("Date Created", out datestring))
                        {
                            myDateTime = DateTime.Parse(datestring);
                        }
                    }
                    catch (Exception ex)
                    {
                        // _parent.Trace("JRiver Error:  dateTime Exception: " + ex);
                        myDateTime = DateTime.Parse("1900-01-01");
                    }

                    string sqlFormattedDate = myDateTime.ToString("s");

                    //      List<string> MovieIcons = new List<string>();

                    // if null equals null-  doesn't make much sense but no harm.  Perhaps change to empty later.
                    // needs to be empty otherwise will fail with null exception down further
                    //

                    //     MovieIcons = GetMovieIcons(Movieitem);
                    int    DurationNumber = 0;
                    string Duration       = "";
                    if (Field.TryGetValue("Duration", out Duration))
                    {
                        DurationNumber = int.TryParse(Duration, out DurationNumber) ? DurationNumber : 0;
                    }

                    var movie = new ApiMovie
                    {
                        Title         = Field.ValueOrDefault("Name"),
                        Plot          = Field.ValueOrDefault("Comment"),
                        Votes         = "0",
                        Rating        = "Unrated",
                        Year          = 0,
                        Tagline       = Field.ValueOrDefault("Tag Line"),
                        IdScraper     = Field.ValueOrDefault("IMDB Id"),
                        Length        = new TimeSpan(0, 0, 0, DurationNumber).ToString() ?? "Unknown",
                        Mpaa          = Field.ValueOrDefault("MPAA Rating"),
                        Genre         = Field.ValueOrDefault("Genre"),
                        Director      = Field.ValueOrDefault("Director"),
                        OriginalTitle = Field.ValueOrDefault("Original Title"),
                        Studio        = Field.ValueOrDefault("Studio"),
                        IdFile        = Xbmc.IDtoNumber(FileKey),
                        IdMovie       = Xbmc.IDtoNumber(FileKey),
                        FileName      = Field.ValueOrDefault("Filename"),
                        Path          = Field.ValueOrDefault("Filename"),
                        PlayCount     = PlayCount,
                        Thumb         = Thumb2,
                        Banner        = BannerArt,
                        Logo          = LogoArt,
                        Fanart        = Fanart2,
                        Hash          = Xbmc.Hash(FileKey),
                        DateAdded     = sqlFormattedDate,
                        MovieIcons    = ""
                    };
                    if (isMovie)
                    {
                        movies.Add(movie);
                        _parent.Trace(movies.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                _parent.Trace("Exception with Movie Name :" + ex);
            }

            return(movies);
        }
예제 #10
0
 public XbmcAudioLibrary(Xbmc parent)
 {
     _parent = parent;
 }
예제 #11
0
 public MpcHcRemote(Xbmc parent)
 {
     _parent = parent;
 }
예제 #12
0
        public Collection <ApiTvShow> GetTvShowsRefresh()
        {
            //var MovieId = GetMainSelection("TV");



            var shows = new Collection <ApiTvShow>();

            return(shows);

            // No refresh possible for Jriver that I can see

            try
            {
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Sub%20Type]=[TV%20Show]");
                _parent.Trace("GetTVEpisodes : Parent IP: " + _parent.IP);
                // iterate through Items
                foreach (var Field in Allitems)
                {
                    var result   = "";
                    var isTVshow = false;
                    if (Field.TryGetValue("Media Sub Type", out result))
                    {
                        if (result == "TV Show")
                        {
                            isTVshow = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    long   PlayCount = 0;
                    string Plays     = "";
                    if (Field.TryGetValue("Number Plays", out Plays))
                    {
                        PlayCount = long.TryParse(Plays, out PlayCount) ? PlayCount : 0;
                    }
                    long   SeasonNumber = 0;
                    string Season       = "";
                    if (Field.TryGetValue("Season", out Season))
                    {
                        SeasonNumber = long.TryParse(Season, out SeasonNumber) ? SeasonNumber : 0;
                    }
                    long   EpisodeNumber = 0;
                    string EpisodeNo     = "";
                    if (Field.TryGetValue("Episode", out EpisodeNo))
                    {
                        EpisodeNumber = long.TryParse(EpisodeNo, out EpisodeNumber) ? EpisodeNumber : 0;
                    }
                    string FileKey = "";
                    string Thumb2  = "";
                    string Fanart2 = "";
                    if (Field.TryGetValue("Key", out FileKey))
                    {
                        Thumb2  = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                        Fanart2 = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                    }

                    string tvdb = "0";
                    if (Field.TryGetValue("TheTVDB Series ID", out tvdb))
                    {
                        _parent.Trace("TVDB found");
                    }
                    _parent.Trace(" *****************");
                    _parent.Trace(Field.ValueOrDefault("Series"));
                    _parent.Trace(Field.ValueOrDefault("Comment"));
                    _parent.Trace(Field.ValueOrDefault("MPAA Rating"));
                    _parent.Trace(Field.ValueOrDefault("Studio"));
                    _parent.Trace("2" + Field.ValueOrDefault("Genre"));
                    _parent.Trace("3" + Field.ValueOrDefault("Filename"));
                    _parent.Trace("4" + Field.ValueOrDefault("Genre"));
                    _parent.Trace("5" + Xbmc.IDtoNumber(tvdb).ToString());
                    _parent.Trace("6" + Field.ValueOrDefault(@"Date (readable)"));
                    _parent.Trace(Thumb2);
                    _parent.Trace(Fanart2);
                    _parent.Trace(Xbmc.Hash(FileKey));

                    var tvShow = new ApiTvShow
                    {
                        Title      = Field.ValueOrDefault("Series"),
                        Plot       = Field.ValueOrDefault("Comment"),
                        Rating     = "",
                        Mpaa       = Field.ValueOrDefault("MPAA Rating"),
                        Studio     = Field.ValueOrDefault("Studio"),
                        Path       = Field.ValueOrDefault("Filename"),
                        IdScraper  = "",
                        Genre      = Field.ValueOrDefault("Genre"),
                        IdShow     = Xbmc.IDtoNumber(tvdb),
                        TotalCount = 0,
                        Premiered  = Field.ValueOrDefault("Date (readable)"),
                        Thumb      = Thumb2,
                        Fanart     = Fanart2,
                        Banner     = "NoBannerAddCodetoCheckPath",
                        Logo       = "NoLogoCheckCodetoCheckLogo",
                        Hash       = Xbmc.Hash(FileKey)
                    };
                    if (isTVshow && !shows.Contains(tvShow))
                    {
                        shows.Add(tvShow);
                    }
                }
            }
            catch (Exception ex)
            {
                _parent.Trace("TV Shows REFRESH Exception Caught " + ex);
            }
            return(shows);
        }
예제 #13
0
        public Collection <ApiAudioAlbum> GetAlbums()
        {
            _parent.Trace("JRiver GetAlbums Running");
            var albums = new Collection <ApiAudioAlbum>();

            return(albums);

            try
            {
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Type]=[Audio]");
                foreach (var Field in Allitems)
                {
                    string result = "";
                    if (Field.TryGetValue("Album", out result))
                    {
                        if (result != "" & result != null)
                        {
                            //Only take Artists from those entries that have Album Name -
                            string Name = Field.ValueOrDefault("Name");
                            long   Year;
                            if (Field.ValueOrDefault("Year") != "")
                            {
                                Year = Convert.ToInt64(Field.ValueOrDefault("Date (readable)"));
                            }
                            else
                            {
                                Year = 1900;
                            }
                            string FileKey  = "";
                            string Thumb2   = "";
                            string Fanart2  = "";
                            string cdart    = "";
                            string Frontjpg = "";
                            if (Field.TryGetValue("Key", out FileKey))
                            {
                                Thumb2  = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                                Fanart2 = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                            }
                            // use directory for fanart if exists
                            var filename = Field.ValueOrDefault("Filename");
                            if (filename != null & filename != "")
                            {
                                FileInfo[] fiJpgs = new System.IO.FileInfo(filename).Directory.GetFiles("*.jpg");
                                FileInfo[] fiPngs = new System.IO.FileInfo(filename).Directory.GetFiles("*.png");
                                if (fiJpgs.Length == 0 && fiPngs.Length == 0)
                                {
                                    _parent.Trace("No Jpgs or PngsFound");
                                }
                                else
                                {
                                    if (fiJpgs.Any(item => item.FullName.Contains("Front")))
                                    {
                                        Thumb2 = fiJpgs.First(item => item.FullName.Contains("Front")).FullName;
                                    }
                                    else if (fiJpgs.Any(item => item.FullName.Contains("folder")))
                                    {
                                        Thumb2 = fiJpgs.First(item => item.FullName.Contains("folder")).FullName;
                                    }
                                    else if (fiPngs.Any(item => item.FullName.Contains("cdart")))
                                    {
                                        Thumb2 = fiPngs.First(item => item.FullName.Contains("cdart")).FullName;
                                    }
                                    else if (fiJpgs.Any(item => item.FullName.Contains("jpg")))
                                    {
                                        Thumb2 = fiJpgs.First(item => item.FullName.Contains("jpg")).FullName;
                                    }
                                    // ****************************************************
                                    if (fiJpgs.Any(item => item.FullName.Contains("fanart")))
                                    {
                                        Fanart2 = fiJpgs.First(item => item.FullName.Contains(@"*fanart*")).FullName;
                                    }
                                    else if (fiPngs.Any(item => item.FullName.Contains("fanart.png")))
                                    {
                                        Fanart2 = fiPngs.First(item => item.FullName.Contains("fanart")).FullName;
                                    }
                                    else if (fiJpgs.Any(item => item.FullName.Contains("jpg")))
                                    {
                                        Fanart2 = fiJpgs.First(item => item.FullName.Contains("jpg")).FullName;
                                    }

                                    //var filePath = Path.GetDirectoryName(Field.ValueOrDefault("Filename"));
                                    //var fanartPath = Path.Combine(filePath, "fanart.jpg");
                                    //var cdartpath = Path.Combine(filePath, "cdart.png");
                                    //var ThumbPath = Path.Combine(filePath, "folder.jpg");
                                    //var BannerPath = Path.Combine(filePath, "banner.jpg");
                                    //var Frontpath = Path.Combine(filePath, "*Front.jpg");
                                    //System.IO.FileInfo fi = new System.IO.FileInfo(fanartPath);
                                    //System.IO.FileInfo ficdart = new System.IO.FileInfo(cdartpath);
                                    //System.IO.FileInfo fiThumb = new System.IO.FileInfo(ThumbPath);

                                    //if (fi.Exists)
                                    //{
                                    //    Fanart2 = fanartPath;  //if fanart.jpg exisits in directory with movie use this otherwise default to JRiver Thumb
                                    //}

                                    //if (fiThumb.Exists)
                                    //{
                                    //    Thumb2 = ThumbPath;
                                    //}
                                }
                            }


                            _parent.Trace("GetAlbum Art: " + Thumb2);
                            string GenreName = "Unknown";
                            if (Field.TryGetValue("Genre", out result))
                            {
                                GenreName = Field.ValueOrDefault("Genre");
                            }
                            string Album = "Unknown";
                            if (Field.TryGetValue("Album", out result))
                            {
                                Album = Field.ValueOrDefault("Album");
                            }
                            string Artist = "Unknown";
                            if (Field.TryGetValue("Artist", out result))
                            {
                                Artist = Field.ValueOrDefault("Artist");
                            }
                            if (Album != "" && Album != null)
                            {
                                var album = new ApiAudioAlbum
                                {
                                    IdAlbum  = (long)Xbmc.IDstringtoNumber(Album),
                                    Title    = Album,
                                    IdGenre  = (long)Xbmc.IDstringtoNumber(GenreName),
                                    IdArtist = (long)Xbmc.IDstringtoNumber(Artist),
                                    Artist   = Artist,
                                    Genre    = GenreName,
                                    Year     = Year,
                                    Thumb    = Thumb2,
                                    Fanart   = Fanart2,
                                    Hash     = Xbmc.Hash(Album)
                                };
                                if (!albums.Any(a => a.Title == Album))
                                {
                                    albums.Add(album);
                                }
                            }
                        }
                    }
                }
                return(albums);
            }
            catch (Exception ex)
            {
                _parent.Trace("JRiver GetALbums:" + ex);
                return(albums);
            }
        }
예제 #14
0
        public Collection <ApiTvEpisode> GetTvEpisodes()
        {
            var episodes = new Collection <ApiTvEpisode>();

            //
            return(episodes);

            //

            try
            {
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Sub%20Type]=[TV%20Show]");
                _parent.Trace("GetTVEpisodes : Parent IP: " + _parent.IP);
                // iterate through Items
                foreach (var Field in Allitems)
                {
                    var result   = "";
                    var isTVshow = false;
                    if (Field.TryGetValue("Media Sub Type", out result))
                    {
                        if (result == "TV Show")
                        {
                            isTVshow = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    long   PlayCount = 0;
                    string Plays     = "";
                    if (Field.TryGetValue("Number Plays", out Plays))
                    {
                        PlayCount = long.TryParse(Plays, out PlayCount) ? PlayCount : 0;
                    }
                    long   SeasonNumber = 0;
                    string Season       = "";
                    if (Field.TryGetValue("Season", out Season))
                    {
                        SeasonNumber = long.TryParse(Season, out SeasonNumber) ? SeasonNumber : 0;
                    }
                    long   EpisodeNumber = 0;
                    string EpisodeNo     = "";
                    if (Field.TryGetValue("Episode", out EpisodeNo))
                    {
                        EpisodeNumber = long.TryParse(EpisodeNo, out EpisodeNumber) ? EpisodeNumber : 0;
                    }
                    string FileKey   = "";
                    string Thumb2    = "";
                    string Fanart2   = "";
                    string LogoArt   = "";
                    string BannerArt = "";
                    if (Field.TryGetValue("Key", out FileKey))
                    {
                        Thumb2  = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                        Fanart2 = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                    }
                    var filename = Field.ValueOrDefault("Filename");
                    if (filename != null & filename != "")
                    {
                        var filePath          = Path.GetDirectoryName(Field.ValueOrDefault("Filename"));
                        var fanartPath        = Path.Combine(filePath, "fanart.jpg");
                        System.IO.FileInfo fi = new System.IO.FileInfo(fanartPath);
                        if (fi.Exists)
                        {
                            Fanart2 = fanartPath;  //if fanart.jpg exisits in directory with movie use this otherwise default to JRiver Thumb
                        }
                    }
                    DateTime myDateTime = new DateTime();
                    try
                    {
                        string datestring = "01/01/1900";

                        if (Field.TryGetValue("Date Created", out datestring))
                        {
                            myDateTime = DateTime.Parse(datestring);
                        }
                    }
                    catch (Exception ex)
                    {
                        //       _parent.Trace("JRiver Error:  dateTime Exception: " + ex);
                        myDateTime = DateTime.Parse("1900-01-01");
                    }
                    string sqlFormattedDate = myDateTime.ToString("s");

                    string tvdb     = "0";
                    string ShowName = Field.ValueOrDefault("Series");

                    if (ShowName == "")
                    {
                        ShowName = "Unknown Series";
                    }

                    if (isTVshow)
                    {
                        var tvShow = new ApiTvEpisode
                        {
                            Title     = Field.ValueOrDefault("Name"),
                            Plot      = Field.ValueOrDefault("Comment"),
                            Rating    = "",
                            Mpaa      = Field.ValueOrDefault("MPAA Rating"),
                            Date      = sqlFormattedDate,
                            Director  = Field.ValueOrDefault("Director"),
                            PlayCount = PlayCount,
                            Studio    = Field.ValueOrDefault("Studio"),
                            IdEpisode = Xbmc.IDtoNumber(FileKey),
                            IdShow    = Xbmc.IDstringtoNumber(ShowName),
                            Season    = SeasonNumber,
                            Episode   = EpisodeNumber,
                            Path      = Field.ValueOrDefault("Filename"),
                            ShowTitle = ShowName,
                            Thumb     = Thumb2,
                            Fanart    = Fanart2,
                            FileName  = filename,
                            Hash      = Xbmc.Hash(FileKey)
                        };
                        episodes.Add(tvShow);
                    }
                }
            }
            catch (Exception Ex)
            {
                _parent.Trace("Another tV Episodes exception" + Ex);
            }

            return(episodes);
        }
예제 #15
0
        public Collection <ApiTvSeason> GetTvSeasons()
        {
            var seasons = new Collection <ApiTvSeason>();

            //
            return(seasons);

            //

            try
            {
                // Load full database...
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Sub%20Type]=[TV%20Show]");

                // iterate through Items
                foreach (var Field in Allitems)
                {
                    var result   = "";
                    var isTVshow = false;
                    if (Field.TryGetValue("Media Sub Type", out result))
                    {
                        if (result == "TV Show")
                        {
                            isTVshow = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    var SeriesName = "";
                    if (Field.TryGetValue("Series", out result))
                    {
                        SeriesName = result;
                    }
                    long   SeasonNumber = 0;
                    string Season       = "";
                    if (Field.TryGetValue("Season", out Season))
                    {
                        SeasonNumber = long.TryParse(Season, out SeasonNumber) ? SeasonNumber : 0;
                    }
                    string FileKey = "";
                    string Thumb2  = "";
                    string Fanart2 = "";
                    if (Field.TryGetValue("Key", out FileKey))
                    {
                        Thumb2  = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                        Fanart2 = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                    }
                    var filename = Field.ValueOrDefault("Filename");
                    if (filename != null & filename != "")
                    {
                        var filePath               = Path.GetDirectoryName(Field.ValueOrDefault("Filename"));
                        var fanartPath             = Path.Combine(filePath, "fanart.jpg");
                        var ThumbPath              = Path.Combine(filePath, "poster.jpg");
                        System.IO.FileInfo fi      = new System.IO.FileInfo(fanartPath);
                        System.IO.FileInfo fiThumb = new System.IO.FileInfo(ThumbPath);
                        if (fi.Exists)
                        {
                            Fanart2 = fanartPath;  //if fanart.jpg exisits in directory with movie use this otherwise default to JRiver Thumb
                        }
                        if (fiThumb.Exists)
                        {
                            Thumb2 = ThumbPath;
                        }
                    }
                    string tvdb = "0";

                    string ShowName = Field.ValueOrDefault("Series");

                    if (ShowName == "")
                    {
                        ShowName = "Unknown Series";
                    }

                    var tvShow = new ApiTvSeason
                    {
                        SeasonNumber = SeasonNumber,
                        IdShow       = Xbmc.IDstringtoNumber(ShowName),
                        Show         = SeriesName ?? "",
                        Thumb        = Thumb2 ?? "",
                        EpisodeCount = 1,   //bit of a hack but if date sorted - latest episode should be highest - so for most should be right.
                        Fanart       = Fanart2 ?? "",
                        Hash         = Xbmc.Hash(ShowName)
                    };
                    // need to check is season and make sure isn't already added

                    if (isTVshow && !seasons.Contains(tvShow))
                    {
                        seasons.Add(tvShow);
                    }
                }
            }
            catch (Exception ex)
            {
                _parent.Trace("TV Shows Exception Caught " + ex);
            }
            return(seasons);
        }
예제 #16
0
        public Collection <ApiTvSeason> GetTvSeasonsRefresh()
        {
            var seasons = new Collection <ApiTvSeason>();

            return(seasons);

            // no refresh possible for Jrvier

            try
            {
                // Load full database...
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Sub%20Type]=[TV%20Show]");

                // iterate through Items
                foreach (var Field in Allitems)
                {
                    var result   = "";
                    var isTVshow = false;
                    if (Field.TryGetValue("Media Sub Type", out result))
                    {
                        if (result == "TV Show")
                        {
                            isTVshow = true;
                        }
                    }
                    var SeriesName = "";
                    if (Field.TryGetValue("Series", out result))
                    {
                        SeriesName = result;
                    }
                    long   SeasonNumber = 0;
                    string Season       = "";
                    if (Field.TryGetValue("Season", out Season))
                    {
                        SeasonNumber = long.TryParse(Season, out SeasonNumber) ? SeasonNumber : 0;
                    }
                    string tvdb = "0";
                    if (Field.TryGetValue("TheTVDB Series ID", out tvdb))
                    {
                        tvdb = tvdb;
                    }

                    string FileKey = "";
                    string Thumb   = "";
                    string Fanart  = "";
                    if (Field.TryGetValue("Key", out FileKey))
                    {
                        Thumb  = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                        Fanart = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                    }
                    //var SingleTVData = GetSingleTVFromSeries(genre.Id);
                    //_parent.Trace("---Emby QuickRefresh GetTVSeasons--- Season Number:" + SeasonNumber);
                    //_parent.Trace("---Emby QuickRefresh GetTVSeasons--- ID Show:" + Xbmc.IDtoNumber(SeriesName));
                    //_parent.Trace("---Emby QuickRefresh GetTVSeasons--- Series Name:" + SeriesName);
                    //_parent.Trace("---Emby QuickRefresh GetTVSeasons--- Thumb:" + Thumb);
                    //_parent.Trace("---Emby QuickRefresh GetTVSeasons--- Child Count:" + 1);
                    //_parent.Trace("---Emby QuickRefresh GetTVSeasons--- Fanart:" + Fanart);
                    //_parent.Trace("---Emby QuickRefresh GetTVSeasons--- Hash:" + Xbmc.Hash(SeriesName));

                    var tvShow = new ApiTvSeason
                    {
                        SeasonNumber = SeasonNumber,
                        IdShow       = Xbmc.IDtoNumber(tvdb),
                        Show         = SeriesName ?? "",
                        Thumb        = Thumb ?? "",
                        EpisodeCount = 1,   //bit of a hack but if date sorted - latest episode should be highest - so for most should be right.
                        Fanart       = Fanart ?? "",
                        Hash         = Xbmc.Hash(SeriesName)
                    };
                    // need to check is season and make sure isn't already added

                    if (isTVshow && !seasons.Contains(tvShow))
                    {
                        seasons.Add(tvShow);
                    }
                }
            }
            catch (Exception ex)
            {
                _parent.Trace("TV Shows Exception Caught " + ex);
            }
            return(seasons);
        }
예제 #17
0
 public XbmcVideoPlayer(Xbmc parent)
 {
     _parent = parent;
 }
예제 #18
0
 public XbmcRemote(Xbmc parent)
 {
     _parent = parent;
 }
예제 #19
0
        public Collection <ApiAudioSong> GetSongs()
        {
            _parent.Trace("JRiver GetSongs Running");
            var songs = new Collection <ApiAudioSong>();

            return(songs);

            try
            {
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Type]=[Audio]");
                foreach (var Field in Allitems)
                {
                    string result = "";
                    if (Field.TryGetValue("Name", out result))
                    {
                        if (result != "" && result != null)
                        {
                            //Only take Artists from those entries that have Album Name -
                            string GenreName = Field.ValueOrDefault("Genre");
                            string Artist    = Field.ValueOrDefault("Artist");
                            string Name      = Field.ValueOrDefault("Name");
                            string Album     = Field.ValueOrDefault("Album");
                            string Filename  = Field.ValueOrDefault("Filename");
                            long   Year;
                            try
                            {
                                if (Field.ValueOrDefault("Year") != "")
                                {
                                    Year = Convert.ToInt64(Field.ValueOrDefault("Date (readable)"));
                                }
                                else
                                {
                                    Year = 1900;
                                }
                            }
                            catch
                            {
                                _parent.Trace("Error Date Conversion: Using 1900");
                                Year = 1900;
                            }
                            long TrackNo;
                            try
                            {
                                if (Field.ValueOrDefault("Track #") != "")
                                {
                                    TrackNo = Convert.ToInt64(Field.ValueOrDefault("Track #"));
                                }
                                else
                                {
                                    TrackNo = 1;
                                }
                            }
                            catch
                            {
                                _parent.Trace("Error TrackNo Using 1");
                                TrackNo = 1;
                            }
                            int    DurationNumber = 0;
                            string Duration       = "";
                            if (Field.TryGetValue("Duration", out Duration))
                            {
                                DurationNumber = int.TryParse(Duration, out DurationNumber) ? DurationNumber : 0;
                            }

                            string FileKey = "";
                            string Thumb2  = "";
                            string Fanart2 = "";
                            string cdart   = "";
                            if (Field.TryGetValue("Key", out FileKey))
                            {
                                Thumb2  = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                                Fanart2 = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                            }
                            // use directory for fanart if exists
                            var filename = Field.ValueOrDefault("Filename");
                            if (filename != null & filename != "")
                            {
                                var filePath   = Path.GetDirectoryName(Field.ValueOrDefault("Filename"));
                                var fanartPath = Path.Combine(filePath, "fanart.jpg");
                                var cdartpath  = Path.Combine(filePath, "cdart.png");
                                var ThumbPath  = Path.Combine(filePath, "folder.jpg");
                                var BannerPath = Path.Combine(filePath, "banner.jpg");

                                System.IO.FileInfo fi      = new System.IO.FileInfo(fanartPath);
                                System.IO.FileInfo ficdart = new System.IO.FileInfo(cdartpath);
                                System.IO.FileInfo fiThumb = new System.IO.FileInfo(ThumbPath);

                                if (fi.Exists)
                                {
                                    Fanart2 = fanartPath;  //if fanart.jpg exisits in directory with movie use this otherwise default to JRiver Thumb
                                }

                                if (fiThumb.Exists)
                                {
                                    Thumb2 = ThumbPath;
                                }

                                if (ficdart.Exists)
                                {
                                    cdart = cdartpath;
                                }

                                // use cdart or album
                                if (cdart != "")  // use this else Thumb (folder.jpg currently) or failing that Thumb from JRiver
                                                  // can access mp3 file data??
                                {
                                    Thumb2 = cdart;
                                }
                            }

                            if (Name != "")
                            {
                                var song = new ApiAudioSong
                                {
                                    IdSong   = (long)Xbmc.IDstringtoNumber(Name),
                                    Title    = Name,
                                    Track    = TrackNo,
                                    Duration = (long)DurationNumber,
                                    Year     = (long)Year,
                                    FileName = "",
                                    IdAlbum  = (long)Xbmc.IDstringtoNumber(Album),
                                    Album    = Album,
                                    Path     = Filename,
                                    IdArtist = (long)Xbmc.IDstringtoNumber(Artist),
                                    Artist   = Artist,
                                    IdGenre  = (long)Xbmc.IDstringtoNumber(GenreName),
                                    Genre    = GenreName,
                                    Thumb    = Thumb2,
                                };
                                songs.Add(song);
                            }
                        }
                    }
                }

                return(songs);
            }
            catch (Exception ex)
            {
                _parent.Trace("JRiver GetSongs:" + ex);
                return(songs);
            }
        }
예제 #20
0
 public XbmcVideoLibrary(Xbmc parent)
 {
     _parent = parent;
 }
예제 #21
0
        public Collection <ApiMovie> GetMoviesRefresh()
        {
            var movies = new Collection <ApiMovie>();

            //
            return(movies);

            //

            try
            {
                getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Sub%20Type]=[Movie]");
                _parent.Trace("GetMoviesRefresh  : Parent IP: " + _parent.IP);
                // iterate through Items
                foreach (var Field in Allitems)
                {
                    var isMovie = false;
                    //_parent.Trace(Field.Values.ToString());
                    var Logoutput = "";
                    Field.TryGetValue("Name", out Logoutput);
                    // _parent.Trace("************* Logging : " + Logoutput);

                    var result = "";

                    if (Field.TryGetValue("Media Sub Type", out result))
                    {
                        if (result == "Movie")
                        {
                            isMovie = true;
                            _parent.Trace("Movie Found: " + Logoutput + " and isMovie true");
                        }
                        else
                        {
                            continue;
                        }
                    }

                    long   PlayCount = 0;
                    string Plays     = "";
                    if (Field.TryGetValue("Number Plays", out Plays))
                    {
                        PlayCount = long.TryParse(Plays, out PlayCount) ? PlayCount : 0;
                    }
                    long   SeasonNumber = 0;
                    string Season       = "";
                    if (Field.TryGetValue("Season", out Season))
                    {
                        SeasonNumber = long.TryParse(Season, out SeasonNumber) ? SeasonNumber : 0;
                    }
                    long   EpisodeNumber = 0;
                    string EpisodeNo     = "";
                    if (Field.TryGetValue("Episode", out EpisodeNo))
                    {
                        EpisodeNumber = long.TryParse(EpisodeNo, out EpisodeNumber) ? EpisodeNumber : 0;
                    }
                    string FileKey = "";
                    string Thumb2  = "";
                    string Fanart2 = "";
                    if (Field.TryGetValue("Key", out FileKey))
                    {
                        Thumb2  = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                        Fanart2 = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? "";
                    }

                    DateTime myDateTime = new DateTime();
                    try
                    {
                        string datestring = "01/01/1900";

                        if (Field.TryGetValue("Date Created", out datestring))
                        {
                            myDateTime = DateTime.Parse(datestring);
                        }
                    }
                    catch (Exception ex)
                    {
                        // _parent.Trace("JRiver Caught Error:  dateTime:Exception: " + ex);
                        myDateTime = DateTime.Parse("1900-01-01");
                    }

                    string sqlFormattedDate = myDateTime.ToString("s");

                    //      List<string> MovieIcons = new List<string>();

                    // if null equals null-  doesn't make much sense but no harm.  Perhaps change to empty later.
                    // needs to be empty otherwise will fail with null exception down further
                    //

                    //     MovieIcons = GetMovieIcons(Movieitem);
                    int    DurationNumber = 0;
                    string Duration       = "";
                    if (Field.TryGetValue("Duration", out Duration))
                    {
                        DurationNumber = int.TryParse(Duration, out DurationNumber) ? DurationNumber : 0;
                    }

                    var movie = new ApiMovie
                    {
                        Title         = Field.ValueOrDefault("Name"),
                        Plot          = Field.ValueOrDefault("Comment"),
                        Votes         = "0",
                        Rating        = "Unrated",
                        Year          = 0,
                        Tagline       = Field.ValueOrDefault("Tag Line"),
                        IdScraper     = Field.ValueOrDefault("IMDB Id"),
                        Length        = new TimeSpan(0, 0, 0, DurationNumber).ToString() ?? "Unknown",
                        Mpaa          = Field.ValueOrDefault("MPAA Rating"),
                        Genre         = Field.ValueOrDefault("Genre"),
                        Director      = Field.ValueOrDefault("Director"),
                        OriginalTitle = Field.ValueOrDefault("Original Title"),
                        Studio        = Field.ValueOrDefault("Studio"),
                        IdFile        = Xbmc.IDtoNumber(FileKey),
                        IdMovie       = Xbmc.IDtoNumber(FileKey),
                        FileName      = Field.ValueOrDefault("Filename"),
                        Path          = Field.ValueOrDefault("Filename"),
                        PlayCount     = PlayCount,
                        Thumb         = Thumb2,
                        Banner        = "NoBanner",
                        Logo          = "NoLogo",
                        Fanart        = Fanart2,
                        Hash          = Xbmc.Hash(FileKey),
                        DateAdded     = sqlFormattedDate,
                        MovieIcons    = ""
                    };
                    if (isMovie)
                    {
                        movies.Add(movie);
                    }
                }
            }
            catch (Exception ex)
            {
                _parent.Trace("Uncaught Exception with Movie Name :" + ex);
            }

            return(movies);
        }
예제 #22
0
 public XbmcAudioPlayer(Xbmc parent)
 {
     _parent     = parent;
     _bw.DoWork += AsyncPlayFilesWorker;
 }