public string Transform(string albumName, AlbumDescriptor descriptor)
        {
            if (descriptor.ProviderKey != AlbumProviderKeys.People)
                return albumName;

            return regex.Replace(albumName, this.replacement);
        }
Example #2
0
        public void TestGetAlbumIDIsConsistent()
        {
            var idmap = new MemoryFile();

            var testDescriptor = new AlbumDescriptor("testKey", "testPath");

            var firstProvider = CreateProvider(idmap);
            var id = firstProvider.GetAlbumID("test", testDescriptor);
            var secondProvider = CreateProvider(idmap);
            var resultDescriptor = secondProvider.GetAlbumDescriptor(id);

            Assert.AreEqual(testDescriptor, resultDescriptor);
        }
Example #3
0
        public string GetAlbumID(string name, AlbumDescriptor descriptor)
        {
            var pair = this.idMap.Select(p => (KeyValuePair<string, AlbumDescriptor>?)p)
                                 .SingleOrDefault(p => p.Value.Equals(descriptor));

            if (pair != null)
                return pair.Value.Key;

            var id = Regex.Replace(name, @"(:?[\s'""]|:)", "_");
            if (this.idMap.TryAdd(id, descriptor))
                this.idMapFile.AppendAllText(id + "\t" + descriptor.ProviderKey + "\t" + descriptor.ProviderSpecificPath + Environment.NewLine);

            return id;
        }
Example #4
0
 public FileSystemAlbum(AlbumDescriptor descriptor, string name, ILocation location, IValue<IEnumerable<AlbumItem>> items)
     : base(descriptor, name, items)
 {
     this.Location = location;
 }