Inheritance: IItem, IGroupingItem
Example #1
0
 public FoldersResponse(string error, Folder containingFolder, IList<Folder> folders, IList<Song> songs, IList<Video>videos, PairList<string, int> sectionPositions)
 {
     Error = error;
     ContainingFolder = containingFolder;
     Folders = folders;
     Songs = songs;
     Videos = videos;
     SectionPositions = sectionPositions;
 }
Example #2
0
        private Folder CreateFolder(string path, bool mediafolder)
        {
            if (path == null || path == "")
            {
                // No path so just return a folder
                return new Folder();
            }

            ISQLiteConnection conn = null;
            try
            {
                // Trim all trailing slashes from paths, to prevent potential constraint issues
                path = path.TrimEnd('/', '\\');

                conn = Injection.Kernel.Get<IDatabase>().GetSqliteConnection();
                IList<Folder> result = conn.Query<Folder>("SELECT * FROM Folder WHERE FolderPath = ? AND MediaFolderId IS NULL", path);

                foreach (Folder f in result)
                {
                    if (path.Equals(f.FolderPath))
                    {
                        return f;
                    }
                }
            }
            catch (Exception e)
            {
                logger.Error(e);
            }
            finally
            {
                Injection.Kernel.Get<IDatabase>().CloseSqliteConnection(conn);
            }

            // If not in database, return a folder object with the specified parameters
            Folder folder = new Folder();
            folder.FolderPath = path;
            folder.FolderName = Path.GetFileName(path);
            return folder;
        }
Example #3
0
 public static int CompareFolderByName(Folder x, Folder y)
 {
     return(StringComparer.OrdinalIgnoreCase.Compare(x.FolderName, y.FolderName));
 }
Example #4
0
 public static int CompareFolderByName(Folder x, Folder y)
 {
     return StringComparer.OrdinalIgnoreCase.Compare(x.FolderName, y.FolderName);
 }
Example #5
0
        private string FolderArtPath(Folder folder)
        {
            string artPath = null;

            foreach (string fileName in Injection.Kernel.Get<IServerSettings>().FolderArtNames)
            {
                string path = folder.FolderPath + Path.DirectorySeparatorChar + fileName;
                if (System.IO.File.Exists(path))
                {
                    // Use this one
                    artPath = path;
                }
            }

            if ((object)artPath == null)
            {
                // Check for any images
                FolderContainsImages(folder.FolderPath, out artPath);
            }

            return artPath;
        }