private List <string> CreditsReader(SQLiteDataReader reader, int idx) { return(((string)DataReaders.ReadString(reader, idx)) .Split('/') .Select(x => x.Trim()) .ToList()); }
private List <WebExternalId> ExternalIdReader(SQLiteDataReader reader, int idx, object site) { List <WebExternalId> list = new List <WebExternalId>(); string val = (string)DataReaders.ReadString(reader, idx); if (!String.IsNullOrEmpty(val)) { list.Add(new WebExternalId() { Site = (string)site, Id = val }); } return(list); }
private List <WebArtworkDetailed> CoverReader(SQLiteDataReader reader, int idx) { int i = 0; var preferred = (string)DataReaders.ReadString(reader, idx + 1); return((DataReaders.ReadPipeList(reader, idx) as List <string>).Select(x => new WebArtworkDetailed() { Offset = i++, Type = WebFileType.Cover, Path = x, Id = x.GetHashCode().ToString(), Filetype = Path.GetExtension(x).Substring(1), Rating = x == preferred ? 2 : 1 }).ToList()); }
private WebArtworkDetailed ArtworkReader(SQLiteDataReader reader, int index, object param) { string path = (string)DataReaders.ReadString(reader, index); if (String.IsNullOrEmpty(path)) { return(null); } return(new WebArtworkDetailed() { Type = (WebFileType)param, Path = path, Offset = 0, Filetype = Path.GetExtension(path).Substring(1), Rating = 1, Id = path.GetHashCode().ToString() }); }
public static List <WebArtworkDetailed> PreferedArtworkReader(SQLiteDataReader reader, int index, object param) { ArtworkReaderParameters args = (ArtworkReaderParameters)param; int i = 0; var items = (IEnumerable <string>)DataReaders.ReadPipeList(reader, index); string preferedItem = (string)DataReaders.ReadString(reader, index + 1); if (!String.IsNullOrEmpty(preferedItem)) { if (preferedItem.StartsWith("\\")) { preferedItem = preferedItem.Substring(1); } if (!items.Contains(preferedItem)) { items = items.Concat(new List <string>() { preferedItem }); } } return(items.Select(filename => { if (filename.StartsWith("\\")) { filename = filename.Substring(1); } string path = Path.Combine(args.DirectoryName, filename.Replace('/', '\\')); return new WebArtworkDetailed() { Type = args.FileType, Path = path, Offset = i++, Filetype = Path.GetExtension(path).Length > 0 ? Path.GetExtension(path).Substring(1) : String.Empty, Rating = filename == preferedItem ? 2 : 1, Id = path.GetHashCode().ToString() }; }).ToList()); }