Kodi Community Forum

Full Version: Return the correct path to external players when in library mode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
concerning http://www.xbmc.org/forum/showthread.php...post411613

the problem is that it is not possible to use an external player when in library mode because of the following issue:

when in library mode XBMC returns a musicdb-uri like
Quote:musicdb://3/411/5093.wma
which can't be used by external players

it would be nice if there i'll be some xml-tag or some new operator like {3}
for
Quote:playercorefactory.xml
which tells XBMC to return the correct path

The correct path can be computed by the following database query

Code:
SELECT path.strPath, song.strFileName from song,path where idSong=NUMBER RETURNED IN URI and path.idPath=song.idPath;

which in the above case would be:
Code:
SELECT path.strPath, song.strFileName from song,path where idSong=5093 and path.idPath=song.idPath;

this indieed returns the correct path which any external player should be able to use.
(for unix spaces need to be escaped with
Code:
\
of course)

the output of the above query is:

Quote:/media/LACIE/multimedia/audio/Eigene Musik/The Beatles/Anthology 1 Disc 2/19 You Know What to Do.wma

and as already stated this is indeed correct

EDIT as temporary hack until the suggested feature is implemented i wrote a little script which will do that:

Code:
DATABASE_URI="$1"
#TEST STRING WHEN     IN LIBRARY MODE: DATABASE_URI="/musicdb://3/411/5093.wma"
#TEST STRING WHEN NOT IN LIBRARY MODE: DATABASE_URI="/media/LACIE/multimedia/audio/Eigene Musik/The Beatles/Anthology 1 Disc 2/19 You Know What to Do.wma"

DATABASE_URI_PREFIX=`echo $DATABASE_URI | sed "s/:.*//g"`
if [ "/musicdb" = $DATABASE_URI_PREFIX ];
then
  echo "XBMC IN LIBRARY MODE"
  DATABASE_SONGID=`echo "$DATABASE_URI" | sed "s/\/.*\///" |  sed 's/\(.*\)\..*/\1/'`
  DATABASE_PATH="$HOME/.xbmc/userdata/Database/MyMusic7.db"
  totem "`sqlite3 -separator "" $DATABASE_PATH "SELECT path.strPath, song.strFileName from song,path where idSong=$DATABASE_SONGID and path.idPath=song.idPath;"`"
else
  echo "XBMC NOT IN LIBRARY MODE"
  totem "$DATABASE_URI"
fi

you may replace totem by any player you wanna use
cheers