Notices


Reply
Thread Tools
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#61
Originally Posted by pipeline View Post
Lotta cool tech i'd like to reverse engineer! Thanks for continuing to improve it.
My contributions are all in the shell scripts. And they're all commented and open source.

Any way you send me or upload the file you uploaded to maemo (without any personal keys or data which might be sensistive)?

I literally just uploaded the .deb produced by PyPackager. If your .deb installs OK (and you have dependencies), you can follow my instructions and it will upload.
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#62
OK, someone asked in another thread about listening to MP3 files from the browser (GrandCentral's Inbox) via a program other than the Media Player. I tried hacking around, and I discovered that I had to change defaults.list, uri-action-defaults, AND mimeinfo.cache. What a pain!

I used leafpad as root, and I just did a search and replace in mimeinfo.cache.

search:
=
replace:
=hildon-dbus-switchboard.desktop;

pipeline, I'm really thinking that, for this program to really be "easy", you're going to have to replace the three mime-related files in /usr/share/applications with your own version, and run everything through the switchboard. It means a lot of the default stuff has to be brought into your config files, but it also means that users can make all of their changes from the switchboard GUI. At the moment, you still have to hack around as root on the text files before you can start using the GUI. But a new user will try to use the GUI, think they've added a new mime type, and get frustrated when it doesn't do anything.
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 
pipeline's Avatar
Posts: 693 | Thanked: 502 times | Joined on Jul 2007
#63
I agree... no doubt new people would be frustrated at inability to reroute 'already known/handled' types, and this would be good to add. The main reason i havent made it 'that easy' is simply that i dont know the linux command (regex/sed?) to search/replace a pattern within a file so that i can comment out existing mime types as needed. Perhaps someone could provide example?

Next, I went through the use-case of using xmms and noticed i dont have the right 'sample mime type' of audio/x-mp3. I also didn't have an xref to use xmms, so I'll add both of those to next version. After doing that it was as easy as editing the defaults.list for that one type and then rebooting (to regenerate the mime cache) and i had filemanager support and internet browser support (this is not a streaming file so no need to edit uri-actions-defaults... it just downloads to /var/tmp and plays from there. This simple process could be made automated if i knew how to search/replace the defaults.list and if i added mime-registration to dbus-switchboard gui. I will also probably need to determine command to regenerate mime-cache (i think its 'update-mime-cache /usr/share/mime' as root) to avoid needing reboot.

But there are a few questions remaining :

- Why does the Media Player (in the thread you referenced) not like the file when its streamed but it does work when saved? That in and of itself should be fixed with a maemo bug report.
- What alternative mp3 player would you use? Perhaps if theres an app not in my apps list it would help to add that. As far as I know theres just XMMS that is a viable alternative (aside from other apps working around media player bugs).
- How far do you go to undo the behavior which maemo is pushing? Should i completely hijaak the mime system because its not 'easy'... this should really be resolved with maemo solution and/or careful coexistence otherwise this whole framework is one SSU away from being obsolete.

I think a registration list in the gui to 'opt-in' for each mime-type is best way to not hijaak... especially since maemo apps have not published their dbus interfaces and to hijaak media player and not work as well with media player is a net loss for someone who never wanted to change that in the first place.

Now... how about getting free to put xmms into extras! After all... my only viable handler requires gronmayer! This cannot be tolerated!
 
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#64
Originally Posted by pipeline View Post
- Why does the Media Player (in the thread you referenced) not like the file when its streamed but it does work when saved? That in and of itself should be fixed with a maemo bug report.
XMMS gets an error trying to stream it, too. An error 400 trying to contact www.grandcentral.com

Originally Posted by pipeline View Post
- How far do you go to undo the behavior which maemo is pushing? Should i completely hijaak the mime system because its not 'easy'... this should really be resolved with maemo solution and/or careful coexistence otherwise this whole framework is one SSU away from being obsolete.
Then perhaps let your GUI do the editing of the system files, using sudo to get root access.

You could also have a GUI button to restore the default mime files.

Originally Posted by pipeline View Post
... especially since maemo apps have not published their dbus interfaces and to hijaak media player and not work as well with media player is a net loss for someone who never wanted to change that in the first place.
So there's no way to simply pass-thru the dbus calls for unchanged apps? That would be ideal; everything goes through your app, but all default maemo stuff just passes through unchanged.

Originally Posted by pipeline View Post
Now... how about getting free to put xmms into extras! After all... my only viable handler requires gronmayer! This cannot be tolerated!
Agreed!
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 
pipeline's Avatar
Posts: 693 | Thanked: 502 times | Joined on Jul 2007
#65
Originally Posted by qole View Post
So there's no way to simply pass-thru the dbus calls for unchanged apps? That would be ideal; everything goes through your app, but all default maemo stuff just passes through unchanged.
Well i can launch media player but the behavior isnt always right... i launch it with one dbus-send command when normally maemo does all sorts of multiple commands to set up the interface.... but its very tough to reverse engineer the dbus-monitor message stream... would be better for nokia to officially publish these interfaces... or for the community to agree on best known methods/commands.
 
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#66
Originally Posted by pipeline View Post
... but its very tough to reverse engineer the dbus-monitor message stream... would be better for nokia to officially publish these interfaces... or for the community to agree on best known methods/commands.
Well, the best thing would be for Nokia to let us insert our own file-type handlers as part of the maemo system. The fact that we have to use this kind of reverse-engineered shim is a bit of an embarassment to Nokia. I get the feeling that this part of the OS was rushed through; they just got it working, but didn't have time to make it properly flexible.
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!

Last edited by qole; 2008-10-21 at 03:19.
 
Posts: 134 | Thanked: 57 times | Joined on Mar 2008 @ South Bend IN
#67
OK, so I just managed to catch up with every thing you two have posted (I was sick for a bit, and the meds were messing with me while I was taking them for a couple days after).

First off: I think that pypackager will actually upload to the extras or extras-devel repo for you (I haven't tried obviously) but the settings are there on the second to last tab. If you can get that figured out, that will be great (for this and for the various mono related works).

Second: I have an idea for the defaults.list. mlbviewer, which I based my gui app off of and whose config file I use verbatim, uses a trick where they read and write the file in dictionary context.
Code:
dct = {}
fp = open("path")
for line in fp:
    if line.startswith('#'):
        pass
    key = line.split('=')[0]
    val = line.split('=')[1:]
    dct[key] = val

...

fp = open("path", 'w')
for k in dct.keys():  ##I think that using k in dct works too
    fp.write(k+'='+dct[k]+'\n'
fp.close()
So if you can get write access to the defaults list (using the sudoers file or by requiring becomeroot/easyroot/easy etc.) then we can just read and write the entire dictionary, and modify any entry quickly through the key. Obviously, you would want to backup the defaults.list file prior to any editing, and warn out the wazoo.

And third: I use a different method for launching media from mlbviewer. I don't us dbus-send, I use the python osso.Rpc class, and it works for streaming audio and streaming video:
Code:
rpc = osso.Rpc(self.osso_c)
service = 'com.nokia.mediaplayer'
path = '/com/nokia/mediaplayer'
method = 'mime_open'
rpc.rpc_run(service, path, service, method, (url,))
(technically i think that the second service is the "interface")

From my understanding, if you want a local file you have to include 'file://' prior to '/home/whatever' so that you have 'file:///home/whatever'

But that does invoke the media player ui, so I don't know that it really helps with xmms. It does, however, tell me that some where there is a definition telling maemo to use that same command when you open a file. Looking at the service file for mediaplayer, I can't find anything that defines 'mime_open' so I am guessing that it is an assumed method for opening files. This seems to correspond to what khertan has worked out with his mime handling in pygtkeditor. So the pass through to existing apps should just be their service, with the 'mime_open' method.

I think...

I could be very very wrong.
 
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#68
Originally Posted by hvacengi View Post
First off: I think that pypackager will actually upload to the extras or extras-devel repo for you (I haven't tried obviously) but the settings are there on the second to last tab. If you can get that figured out, that will be great (for this and for the various mono related works).
Sadly, they've changed how the repositories work, and PyPackager can no longer upload to extras(-devel) automatically. I keep hoping Khertan will update PyPackager, but I had to use the method I outline here. I'm not sure that would be the best way for this project, since it is all source.


Originally Posted by hvacengi View Post
Second: I have an idea for the defaults.list...

So if you can get write access to the defaults list (using the sudoers file or by requiring becomeroot/easyroot/easy etc.) then we can just read and write the entire dictionary, and modify any entry quickly through the key. Obviously, you would want to backup the defaults.list file prior to any editing, and warn out the wazoo.
I think this is an excellent idea!

The best way to give your app root access is to drop a little file into /etc/sudoers.d, something like: /etc/sudoers.d/switchboard.sudoers

The most generic thing to do is just make "sudo" work for everything:

Code:
user ALL = NOPASSWD: ALL
but you may want to be more conservative, and just allow access to 'your' files:

Code:
user ALL = NOPASSWD: /usr/share/applications/defaults.list
user ALL = NOPASSWD: /usr/share/applications/uri-action-defaults.list
(You then have to run "update-sudoers" in your postinstall script.)

Originally Posted by hvacengi View Post
And third: .... So the pass through to existing apps should just be their service, with the 'mime_open' method.
Perhaps this method is the way to pass through everything we don't want to redirect to default apps.


I look forward to your next version! I want to do a write up about this on my blog (for Planet Maemo) but I feel that it still needs that little bit extra tweaking before it's ready for the average user's tablet...
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!

Last edited by qole; 2008-10-22 at 16:42.
 
Posts: 134 | Thanked: 57 times | Joined on Mar 2008 @ South Bend IN
#69
Thanks for the info on sudoers Qole! I've been too busy (lazy) to look up that info for myself, but I think it will be very helpful (again for both this and for working with Mono).

If pipeline hasn't started on it already, I'll start working on that tonight to see if I can get it up and running with the gui. Maybe I'll actually make some of the changes I've been wanting to make while I'm at it.
 

The Following User Says Thank You to hvacengi For This Useful Post:
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#70
I'm having second thoughts about the "conservative" sudoers settings. You may have to experiment with that, to find out exactly what you need to include. I suspect you'll need to at least include the app you use to edit your system files, too.
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 
Reply


 
Forum Jump


All times are GMT. The time now is 04:17.