ronie/script.cu.lrclyrics — pull request #3 by mazkolain (2013-12-02 20:08:33+00:00)
Title: Add an additional check when searching for embedded lyrics (Gotham)

Hi,

(The same as PR #2, but changes ported to the Gotham branch)

This PR is targeted to fix some conflicts between script.cu.lrclyrics and Spotimc (a XBMC Spotify addon I work on) when the "search for embedded lyrics" option of the first one is enabled.

A brief explanation of how Spotimc works and how both addons conflict each other:

Spotimc serves audio streams to XBMC through an embedded http server which proxies raw pcm data encapsulated as a Wave file. Due to some design constraints on Spotify's api side, the previously mentioned proxy server is only able to stream a track at once (and even that track can only be read once per playback).

Since script.cu.lrclyrics (with the search option enabled) opens an additional stream in order to search for embedded lyrics, it may affect to the other track stream already opened by XBMC, causing it to skip prematurely or get silenced.

Resolving that one-stream-at-a-time limitation on Spotify's api side is difficult, so my approach is to create a pseudo-protocol to deal with this issue. Spotimc just sets a generic do_not_analyze infolabel on tracks and script.cu.lrclyrics checks for this flag. If this flag is absent script.cu.lrclyrics will work as usual, but if present, it will avoid scanning the file (bypassing the config setting) since it was explicitly told to do so.

I'm aware that the solution is not elegant, but at least I tried to keep it generic so other addons can adhere to the workaround if necessary.

Thanks in advance,

Mikel