This patch addresses a problem where the metadata wouldn't be displayed at the top of the screen, nor the current position or duration.
Code:
Index: MyClass.cs
===================================================================
--- MyClass.cs (revision 627)
+++ MyClass.cs (working copy)
@@ -75,19 +75,21 @@
}
MainLoop loop;
- public bool play (int instance, string url, OpenMobile.eMediaType type)
+ public bool play (int instance, string location, OpenMobile.eMediaType type)
{
error=false;
stop(instance);
+ string url;
switch(type)
{
case eMediaType.Local:
- url="file://"+url;
+ url="file://"+location;
break;
case eMediaType.DVD:
url="dvd://";
break;
case eMediaType.AudioCD:
+ url=location;
break;
default:
return false;
@@ -105,9 +107,9 @@
player.SetState(State.Playing);
if (type==eMediaType.Local)
{
- nowPlaying=TagReader.getInfo(url);
+ nowPlaying=TagReader.getInfo(location);
if (nowPlaying == null)
- nowPlaying = new mediaInfo(url);
+ nowPlaying = new mediaInfo(location);
nowPlaying.Type = eMediaType.Local;
if (nowPlaying.coverArt == null)
nowPlaying.coverArt = TagReader.getCoverFromDB(nowPlaying.Artist, nowPlaying.Album, theHost);
@@ -115,7 +117,7 @@
nowPlaying.coverArt = TagReader.getFolderImage(nowPlaying.Location);
if (nowPlaying.coverArt == null)
nowPlaying.coverArt = TagReader.getLastFMImage(nowPlaying.Artist, nowPlaying.Album);
- if (nowPlaying.Length==0)
+ if (nowPlaying.Length<=0)
setDuration();
}else
{
@@ -128,7 +130,7 @@
}
if (nowPlaying==null)
nowPlaying=new mediaInfo(url);
- if (nowPlaying.Length==0)
+ if (nowPlaying.Length<=0)
setDuration();
if (string.IsNullOrEmpty(nowPlaying.Name))
nowPlaying.Name=url;
The main problem was TagLib doesn't like "file://" at the beginning of filenames. Also, nowPlaying.Length would be -1, not 0 in that case, causing setDuration to not be called. So I changed the == 0 comparison to <= 0.
-- Kevin
Bookmarks