package com.peterjosling.scroball.transforms;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
import com.peterjosling.scroball.Track;

import java.util.Collection;

public class MetadataTransformers {

  private static final MetadataTransform VIDEO_TITLE_CLEANER = new VideoTitleCleaner();
  private static final MetadataTransform TITLE_EXTRACTOR = new TitleExtractor();

  private static final ImmutableMultimap<String, MetadataTransform> APP_TRANSFORMS =
      ImmutableMultimap.<String, MetadataTransform>builder()
          .putAll(
              "com.google.android.youtube", ImmutableList.of(TITLE_EXTRACTOR, VIDEO_TITLE_CLEANER))
          .build();

  public Track transformForPackageName(String packageName, Track track) {
    Collection<MetadataTransform> transforms = APP_TRANSFORMS.get(packageName);

    for (MetadataTransform transform : transforms) {
      track = transform.transform(track);
    }
    return track;
  }
}

@@ -209,16 +209,39 @@
 lection;
+%0Aimport java.util.List;
 %0A%0Apublic
@@ -441,16 +441,144 @@
 tor();%0A%0A
+  private static final List%3CMetadataTransform%3E VIDEO_TRANSFORMS =%0A      ImmutableList.of(TITLE_EXTRACTOR, VIDEO_TITLE_CLEANER);%0A
   privat
@@ -733,21 +733,64 @@
 .putAll(
-%0A    
+%22com.google.android.youtube%22, VIDEO_TRANSFORMS)%0A
         
@@ -791,16 +791,24 @@
         
+.putAll(
 %22com.goo
@@ -830,65 +830,30 @@
 tube
-%22, ImmutableList.of(TITLE_EXTRACTOR, VIDEO_TITLE_CLEANER)
+.tv%22, VIDEO_TRANSFORMS
 )%0A  

Add support for Android TV YouTube app