It is currently Sat Nov 26, 2011 8:33 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: FS#281 - mac: torrents can only save to boot drive
PostPosted: Thu Oct 29, 2009 8:12 am 
Offline

Joined: Thu Oct 29, 2009 7:56 am
Posts: 3
Location: San Francisco
Hi, I'm relatively new to ted but I'm already a pretty heavy user. I thought I'd try lending a hand as I'm pretty excited about upcoming features (web interface, yeah!).
I spent the last couple hours just setting up my build environment (on a mac) and familiarizing myself with the code. I thought I'd tackle a small bug to get my feet wet.

This bug actually does affect me as I have ted running on my mac mini which uses a large external raid as its storage that I can't select in the folder selection dialog!

The root problem here is the swing JFileChooser. It simply doesn't allow changing drives on a mac. The solution is to use the awt FileDialog (which uses the native Apple open dialog). Its a pretty simple swap and I have it running quite well on my machine.

The only thing is that I have neither a pc nor linux box to test on. It should work fine... but, well, you know.

Of course, maybe we'd rather keep using the swing interface for windows and linux though nothing in the code is using the extra swing extensibility in this case AFAIK.
In either case we have 2 options:
1. Only use the awt code for the mac (would require logic to detect which platform we're on, which I assume is possible but I haven't delved into the code that much yet)
2. Use awt for all platforms (someone else will need to test windows and linux)

Anyway, if you let me know I can send you a patch with my fix.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 29, 2009 11:06 am 
Offline
Lead Developer
User avatar

Joined: Mon Jan 16, 2006 5:46 pm
Posts: 904
Location: Netherlands
Hi, thanks for the effort! Please send the patch to . I'll have a look at how it works and looks like on Windows and come back to you.

Any more bugs you feel like working on ?:)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 31, 2009 9:48 am 
Offline
Lead Developer
User avatar

Joined: Mon Jan 16, 2006 5:46 pm
Posts: 904
Location: Netherlands
Vincer, did you already sent the patch? I did not receive anything by mail.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 01, 2009 8:23 pm 
Offline

Joined: Thu Oct 29, 2009 7:56 am
Posts: 3
Location: San Francisco
Just sent the patch now.

I got completely swamped at work the past couple days. On the other hand I was able to test on Windows and found that the AWT FileDialog isn't a good option there as FilenameFilters are not supported so there's not way to get a directories only chooser dialog there. Sadly, as far as I can tell, there's no dialog class that will work properly across all OS's.

So, I'm using AWT for the mac only and defaulting to Swing for everyone else.

We should probably abstract this out into another class so that we can use it in other places easily (i.e. import/export).

I think I'll take a look at FS#45 (show specific download folder) next which I think would be a neat feature to have.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 02, 2009 11:15 pm 
Offline
Lead Developer
User avatar

Joined: Mon Jan 16, 2006 5:46 pm
Posts: 904
Location: Netherlands
vincer wrote:
Just sent the patch now.
Quote:
Received it, thanks! I'll have a look at in tomorrow :)

Quote:
So, I'm using AWT for the mac only and defaulting to Swing for everyone else.

But then the Mac doesn't have file filters? Is that a big problem in your opinion?

Quote:
We should probably abstract this out into another class so that we can use it in other places easily (i.e. import/export).

How do you mean?

Quote:
I think I'll take a look at FS#45 (show specific download folder) next which I think would be a neat feature to have.

It would :)How do you envision this? Is this a global setting or a setting per show? Would you let the user define some kind of path or do this yourself?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 03, 2009 1:01 am 
Offline

Joined: Thu Oct 29, 2009 7:56 am
Posts: 3
Location: San Francisco
Quote:
But then the Mac doesn't have file filters? Is that a big problem in your opinion?

Sorry, I wasn't clear. Only Windows with the AWT FileDialog doesn't support filters. Windows with the Swing FileChooser does support filters. The mac supports file filters on both. Not sure where Linux stands.
So, on the mac we need to use AWT, and on Windows (and probably Linux) we need to use Swing.
Quote:
Quote:
We should probably abstract this out into another class so that we can use it in other places easily (i.e. import/export).


How do you mean?

I mean have a set of functions to choose files/directorys in a delegate class (maybe TedIO) that return file paths as strings. e.g. directoryPath = TedIO.chooseDirectory()
This way we have our AWT/Swing/whatever dialog logic in a centralized location.

Quote:
It would Smile How do you envision this? Is this a global setting or a setting per show? Would you let the user define some kind of path or do this yourself?

So I actually have this working already. I followed the comments in the bug as a guideline (which I generally agree with) and made the option global to all shows. In the general preference pane there's a "download to show folder" option and a suboption for "use season folders". Depending on what the user chooses you could end up with <base download dir>/file.torrent, <base download dir>/30 Rock/file.torrent or <base download dir>/30 Rock/Season 4/file.torrent

The format is fixed to be <show name>/Season <season num>. I suppose we could make that customizable, but personally I think that'll just make the interface too cluttered.

It wouldn't be too difficult to make this a show specific option. I think we'd still want a general option in the general pref pane, in addition to an option in the edit show dialog to override the general pref. Again, though, I'm inclined to go with a simpler, cleaner interface.

Oh, and for daily shows I just ignore the season option. So daily shows will either go in <base download dir>/<show name> or just <base download dir> if the option is off completely.

I also ended up refactoring the downloadTorrent function a bit so that it takes a URL, TedSerie, and a StandardStructure and from those it creates the proper file name, etc.

Anyway, I can send you a patch for this a little later. I am having some problems running the code in general right now though. I can run it straight from eclipse, but running it as a jar gives me a ClassNotFoundException for org/jdom/Document. I think it has to do with checkin 870 as I reverted back to 869 and was able to run it fine.
This is stopping me from testing on Windows, but it looks good on the mac.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 03, 2009 3:26 am 
Offline
Developer

Joined: Thu Oct 08, 2009 1:18 am
Posts: 62
In relation to the ClassNotFoundException. From the cli run:

mvn dependency:copy-dependencies

Then copy all those jar files from target/dependency/ to the location of roam.jar.

Build a new ted.jar with:

mvn package

and copy target/ted-0.98-SNAPSHOT.jar to wherever/ted.jar

This should get you running.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 03, 2009 10:14 pm 
Offline
Lead Developer
User avatar

Joined: Mon Jan 16, 2006 4:11 pm
Posts: 645
Location: Netherlands
I like your ideas for the 'save torrent to separate folder'. I want to add you to our bugtracker so you can add your comments on the functionality there. Could you PM me your email address and desired username?

_________________
Roel

i watch: simpsons, south park, lost, top gear, true blood & fringe
download - documentation - bugs/feature requests - sourceforge -


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 04, 2009 8:24 pm 
Offline
Lead Developer
User avatar

Joined: Mon Jan 16, 2006 5:46 pm
Posts: 904
Location: Netherlands
I added the Mac boot drive fix, see revision 890.

Made some small changes to the layout of the code but that was it. Thanks again!

Note that it could some time for the revision to appear in Fisheye


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group