After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 342655 - Show local daap shares if daap's user owner is different from one starting rhythmbox
Show local daap shares if daap's user owner is different from one starting rh...
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: DAAP
HEAD
Other Linux
: Normal enhancement
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
: 332088 551618 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-05-23 05:05 UTC by Nguyen Thai Ngoc Duy
Modified: 2008-11-15 23:55 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
patch (5.82 KB, patch)
2006-06-25 08:13 UTC, Jonathan Matthew
none Details | Review

Description Nguyen Thai Ngoc Duy 2006-05-23 05:05:36 UTC
IIRC rhythmbox used to display local daap share (shared by rhythmbox itself) but now it doesn't. It would be better if the condition is restricted to "the same host and the same user" because I have two users logging on the same machine and one can not see the other's daap share.
Comment 1 Nguyen Thai Ngoc Duy 2006-05-23 05:39:22 UTC
I looked at rb-daap-mdns-browser-avahi.c a bit. If it's hard to do that, an option to show local shares would be appreciated.
Comment 2 James "Doc" Livingston 2006-05-23 06:16:27 UTC
We currently uses Avahi's "is local" flag for determining whether to show the share. If we want to replace this, we'd need some code that accurately determines whether a share is our own or not.
Comment 3 Jonathan Matthew 2006-05-23 07:19:19 UTC
I think we could put the username (or uid?) in the mdns text record for the share and then only ignore local shares with the same username/uid.  The code for adding the password-required flag to the mdns record shows how to do this.  I'm not sure what the default behaviour would be for records with no username/uid field.
Comment 4 James "Doc" Livingston 2006-05-23 14:13:37 UTC
I'm not sure putting usernames in mdns records is a good idea, as it will let everyone on your (possibly untrusted) network know a valid username for your machine.
Comment 5 Jonathan Matthew 2006-05-23 23:22:42 UTC
I agree.  Using the uid would be better.  It's not useful information (except when it's 0), and the uid of the user running rhythmbox would be 1000 for just about every typical single-user linux machine out there.
Comment 6 Jonathan Matthew 2006-06-25 08:13:31 UTC
Created attachment 67964 [details] [review]
patch

Adds "User ID" key to our mdns records, and uses them to decide whether to ignore local daap shares or not.  Shares with no "User ID" key are not ignored, but I'm not sure if this is the right thing to do.
Comment 7 James "Doc" Livingston 2006-06-25 12:22:43 UTC
Looks sane to me.

This is probably the kind of thing we should bring up on gnome-multimedia, as it's probably more likely the user will running two different things that can be DAAP servers (e.g. RB and Tangerine) than two instances of RB.
Comment 8 Lennart Poettering 2006-06-25 16:30:48 UTC
Please try to implement your own is_local() function like this:


int is_local(char* cb_sn, char*cb_st, char *cb_dn, char *cf_sn, char *cf_st) {
        char domain1[AVAHI_DOMAIN_NAME_MAX9], domain2[...];

        avahi_service_name_join(domain1, sizeof(domain1), cb_sn, cb_st, cb_dn);
        avahi_service_name_join(domain2, sizeof(domain2), cf_sn, cf_st, avahi_client_get_domain_name(client));

        return avahi_domain_equal(domain1, domain2);
}


cb_sn: service name you got on the browse callback
cb_st: service type you got on the browse callback
cb_dn: domain you got on the browse callback

cf_sn: the configured service name of the local rb service
cf_st: the service type (_daap._tcp)
Comment 9 David 2006-09-10 17:33:33 UTC
This enhancement sounds like a great idea to me. I've had to rewrite the rhythmbox code in the past two versions I've downloaded to get it to see my local mt-daapd server.

In my case, I've got about 100GB of music, and it's just too much for Rhythmbox to both play it and serve it to others without a huge delay on startup. Plus, using the mt-daapd server means that the iTunes share is always on, not just when I'm logged in.

Anyway, adding this enhancement would definitely make my life easier.
Comment 10 Michael Ekstrand 2006-10-21 18:56:08 UTC
Ignoring the no-userID shares is probably a bad idea.

When I'm on my laptop, I frequently SSH in to my desktop with the DAAP port forwarded, then use avahi-publish-service to publish the service as coming from my laptop, so that I can use DAAP to play my music locally on my laptop.  In this case, I wouldn't have a UserID field, but want to play the share from Rhythmbox.

I currently work around this by running a locally patched Rhythmbox with the skip-local-share code removed.  I've been thinking about reworking it so that the local skip is controlled by a GConf key.  Would this be a decent solution, and then have an option in the preferences to show/hide local shares?

Alternatively, would it work to have Rhythmbox generate a random cookie value, and skip any share published with the same cookie as the rhythmbox looking at reading the share?
Comment 11 beerfan 2007-10-08 04:21:46 UTC
Just to give another use case:

I use firefly/mt-daapd on my home lan so I can access my music from whatever machine I happen to be using so I have my dynamic playlists set up in it. Furthermore, firefly has greater flexibility in creating playlists than Rhythmbox does (supports more meta tags and more complex logic) so I would prefer to use Firefly's daap share even when using Rhythmbox on the same host over a local library.

It is not possible for me to see a local daap share from mt-daapd with RB 0.11.2 so I hope this is changed in a future release.
Comment 12 beerfan 2007-10-24 15:59:14 UTC
I've given this a little more thought.

Hiding shares, even local ones, isn't really in the spirit of Zeroconf. If I have local web shares or other services I very much expect my local apps to see them so there's no justifiable reason for Rhythmbox to ignore local music shares. For comparison, iTunes does not hide local daap shares (not provided by itself).

If there is no way for Rhythmbox to detect its own share (a header perhaps) perhaps a solution would be for Rythmbox to simply hide a local share if it has the same name as the one it is providing?
Comment 13 Lennart Poettering 2007-10-25 17:03:32 UTC
The cleanest solution is to use the same AvahiClient object for both browsing and registering the DAAP service (which would be more resource-friendly anyway). Then you'd just have to check for the flag AVAHI_LOOKUP_RESULT_OUR_OWN everytime you get a NEW notification from the AvahiServiceBrowser object. It will tell you if the service you just discovered has been registered from the same AvahiClient context.
Comment 14 Bastien Nocera 2007-10-25 17:17:25 UTC
That sounds like the right option, but for that, we'd need to make Avahi more public. Maybe we could remove the old mDNS support, and do that?
Comment 15 Bastien Nocera 2008-09-10 08:49:33 UTC
*** Bug 551618 has been marked as a duplicate of this bug. ***
Comment 16 Jonathan Matthew 2008-11-09 08:47:32 UTC
A bit of a hack in some places, but it's nothing compared to the rest of the daap code..

2008-11-09  Jonathan Matthew  <jonathan@d14n.org>

        * plugins/daap/Makefile.am:
        * plugins/daap/rb-daap-mdns-avahi.c: (client_cb),
        (rb_daap_mdns_avahi_get_client),
        (rb_daap_mdns_avahi_set_entry_group):
        * plugins/daap/rb-daap-mdns-avahi.h:
        Add some machinery to create a single avahi client to use for both
        browsing and publishing.

        * plugins/daap/rb-daap-mdns-browser-avahi.c: (browse_cb),
        (rb_daap_mdns_browser_init), (rb_daap_mdns_browser_finalize):
        * plugins/daap/rb-daap-mdns-publisher-avahi.c: (create_service),
        (rb_daap_mdns_publisher_withdraw), (rb_daap_mdns_publisher_init),
        (rb_daap_mdns_publisher_finalize):
        Use the shared avahi client.  Since we publish and browse using the
        same client, we can use the AVAHI_LOOKUP_RESULT_OUR_OWN flag (rather
        than AVAHI_LOOKUP_RESULT_LOCAL) to ignore just our own share.
        Previously, we ignored all shares on the same machine.  Fixes #342655.
Comment 17 Jonathan Matthew 2008-11-15 23:55:28 UTC
*** Bug 332088 has been marked as a duplicate of this bug. ***