value = props.lookup ("URLs");
var uris = (string[]) value;
if (uris != null && uris[0] != null) {
- thumbnail.uri = uris[0].replace ("@ADDRESS@", host_ip);
+ thumbnail.uri = uris[0];
}
value = props.lookup ("Size");
var uris = (string[]) props.lookup ("URLs");
if (uris != null) {
for (var i = 0; uris[i] != null; i++) {
- item.add_uri (uris[i].replace ("@ADDRESS@", host_ip));
+ item.add_uri (uris[i]);
}
}
var value = props.lookup ("URLs");
var uris = (string[]) value;
if (uris != null && uris[0] != null) {
- thumbnail.uri = uris[0].replace ("@ADDRESS@", host_ip);
+ thumbnail.uri = uris[0];
}
value = props.lookup ("Size");
}
}
+ protected Regex address_regex;
+
public MediaItem (string id,
MediaContainer parent,
string title,
this.parent = parent;
this.title = title;
this.upnp_class = upnp_class;
+
+ try {
+ this.address_regex = new Regex (Regex.escape_string ("@ADDRESS@"));
+ } catch (GLib.RegexError err) {
+ assert_not_reached ();
+ }
}
// Live media items need to provide a nice working implementation of this
*/
this.add_proxy_resources (http_server, didl_item);
if (!this.place_holder) {
+ var host_ip = http_server.context.host_ip;
+
// then original URIs
bool internal_allowed;
internal_allowed = http_server.context.interface == "lo" ||
- http_server.context.host_ip == "127.0.0.1";
+ host_ip == "127.0.0.1";
this.add_resources (didl_item, internal_allowed);
+
+ foreach (var res in didl_item.get_resources ()) {
+ res.uri = this.address_regex.replace_literal (res.uri, -1, 0, host_ip);
+ }
}
return didl_item;
didl_item.genre = this.genre;
}
+ if (didl_item.album_art != null) {
+ didl_item.album_art = this.address_regex.replace_literal
+ (didl_item.album_art,
+ -1,
+ 0,
+ http_server.context.host_ip);
+ }
+
return didl_item;
}