New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typefinding / MIME guess to scan code. #1033

Merged
merged 13 commits into from Mar 13, 2015

Conversation

2 participants
@adamcik
Member

adamcik commented Mar 12, 2015

With this in place we can scan a playlist without our playlist elements installed, check if it's text/* or application/xml try and urlopen it and parse it as a playlist (that is until we switch to totemplparser) without any gstreamer element magic.

This also improves:

  • Missing plugin messages on errors.
  • Seekable lookup which I want to try and use.
  • Got rid of some code that wasn't really doing much for us.

Changelog entry will be forthcoming tomorrow :-)

adamcik added some commits Mar 11, 2015

audio: Add support for checking seekable state in scanner
Return type of scanner changed to a named tuple with (uri, tags, duration,
seekable). This should help with #872 and the related "live" issues.

Tests, local scan and stream metadata lookup have been updated to account for
the changes.
audio: Switch to decodebin2 in scanner and handle our own sources
This is needed to be able to put in our own typefind and catch playlists before
they make it to the decoder.
audio: Add typefinder to scanner and add mime to result
This should allow us to move playlist handling out of GStreamer
as we will short circuit for text/* and application/xml now.
audio: Recreate scan pipeline for each scan
Turns out this code runs a lot faster when we fully destroy the decodebins
between scans. And since going to NULL isn't enough I opted to just go for
redoing the whole pipeline instead of adding and removing decodebins all the
time.

As part of this almost all the logic has been ripped out of the scan class and
into internal functions. The external interface has been kept the same for now.
But we could easily switch to `scan(uri, timeout=1000, proxy=None)`
_missing_plugin_desc(message))
elif message.type == gst.MESSAGE_APPLICATION:
mime = message.structure.get_name()
if mime.startswith('text/') or mime == 'application/xml':

This comment has been minimized.

@adamcik

adamcik Mar 12, 2015

Member

From the decodebin2 code I know that the only thing the explicitly mess with, and break for us is text/plain other things I might be able to let through and handle in a more generic way. Waiting for the error and then using the MIME, though that being said that could probably also be done for the text/plain case.

So the contract would basically be that we raise ScannerError(message, mime=mime) and then you can do stuff based on that instead of having MIME in the result.

@jodal

This comment has been minimized.

Member

jodal commented Mar 13, 2015

Reviewed both commit by commit and everything together. Looks good to me. No comments on anything in particular.

@adamcik

This comment has been minimized.

Member

adamcik commented Mar 13, 2015

Two more quick code change, and the changelog as promised.

@adamcik adamcik added this to the v0.20 - Audio cleanup 1 milestone Mar 13, 2015

jodal added a commit that referenced this pull request Mar 13, 2015

Merge pull request #1033 from adamcik/feature/scanner-with-typefind
Add typefinding / MIME guess to scan code.

@jodal jodal merged commit 30badf6 into mopidy:develop Mar 13, 2015

2 checks passed

Scrutinizer 2 updated code elements
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@adamcik adamcik added the 3 - Done label Mar 13, 2015

@jodal jodal removed the 3 - Done label Mar 13, 2015

@adamcik adamcik deleted the adamcik:feature/scanner-with-typefind branch Mar 13, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment