gremlin/gremlin.in: Refactor content-type guessing.
[autoys] / gremlin / gremlin.in
index 4992599..0a76641 100644 (file)
@@ -834,7 +834,7 @@ class AudioIdentifier (object):
       if pad.get_caps()[0].get_name().startswith('audio/'):
         elt.link_pads(pad.get_name(), sink, 'sink')
     dpaid = decoder.connect('pad-added', decoder_pad_arrived)
-    me._pipe.add(source, decoder, sink)
+    for i in [source, decoder, sink]: me._pipe.add(i)
     link_elements([source, decoder])
 
     ## Arrange to collect tags from the pipeline's bus as they're reported.
@@ -998,7 +998,7 @@ class AudioFormat (BaseFormat):
     """
     elts = me.encoder_chain()
     bin = GS.Bin()
-    bin.add(*elts)
+    for i in elts: bin.add(i)
     link_elements(elts)
     bin.add_pad(GS.GhostPad('sink', elts[0].get_pad('sink')))
     bin.add_pad(GS.GhostPad('src', elts[-1].get_pad('src')))
@@ -1035,7 +1035,7 @@ class AudioFormat (BaseFormat):
     convert = make_element('audioconvert', 'convert')
     encoder = me.encoder()
     sink = make_element('filesink', 'sink', location = new)
-    pipe.add(source, decoder, convert, encoder, sink)
+    for i in [source, decoder, convert, encoder, sink]: pipe.add(i)
     link_elements([source, decoder])
     link_elements([convert, encoder, sink])
 
@@ -1513,8 +1513,9 @@ def grobble(master, targets, noact = False):
           ## the appropriate categories.  Later, we'll apply policy to the
           ## files, by category, and work out what to do with them all.
           else:
-            gf = GIO.File(masterfile)
-            mime = gf.query_info('standard::content-type').get_content_type()
+            mime = GIO.File(masterfile) \
+                      .query_info('standard::content-type') \
+                      .get_content_type()
             cats = []
             for cat in pmap.iterkeys():
               id = cat.identify(masterfile, mime)