improve the files table in the add torrent window
add some mimetype support in improve the merge_changes.py script
This commit is contained in:
parent
52485af4f7
commit
c59d0e348e
|
@ -12,8 +12,8 @@
|
|||
<script src="$base/static/mooui.js" type="text/javascript"></script>
|
||||
<script src="$base/gettext.js" type="text/javascript"></script>
|
||||
<script src="$base/template/static/js/deluge.js" type="text/javascript"></script>
|
||||
<script src="$base/template/static/js/deluge-filepicker.js" type="text/javascript"></script>
|
||||
<script src="$base/template/static/js/deluge-menus.js" type="text/javascript"></script>
|
||||
<script src="$base/template/static/js/deluge-mime.js" type="text/javascript"></script>
|
||||
<script src="$base/template/static/js/deluge-add.js" type="text/javascript"></script>
|
||||
<script src="$base/template/static/js/deluge-bars.js" type="text/javascript"></script>
|
||||
<script src="$base/template/static/js/deluge-details.js" type="text/javascript"></script>
|
||||
|
|
|
@ -276,9 +276,15 @@ Deluge.Widgets.AddTorrent.FilesTab = new Class({
|
|||
if (!torrent) return;
|
||||
$each(torrent['files'], function(file) {
|
||||
row = new Element('tr');
|
||||
new Element('td').inject(row);
|
||||
new Element('td').set('text', file['path']).inject(row);
|
||||
new Element('td').set('text', file['size'].toBytes()).inject(row);
|
||||
new Element('td').addClass('fileSelect').inject(row).grab(new Element('input', {
|
||||
'type': 'checkbox',
|
||||
'checked': 'checked'
|
||||
}));
|
||||
var icon = new Element('td').addClass('fileIcon').inject(row);
|
||||
var mimetype = Deluge.Mime.getMimeType(file['path']);
|
||||
if (mimetype) icon.addClass(mimetype.replace('/', '_'));
|
||||
new Element('td').addClass('fileName').set('text', file['path']).inject(row);
|
||||
new Element('td').addClass('fileSize').set('text', file['size'].toBytes()).inject(row);
|
||||
this.table.grab(row);
|
||||
}, this);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
Script: deluge-mime.js
|
||||
Library for converting mimetypes to extensions and vica versa.
|
||||
|
||||
License:
|
||||
General Public License v3
|
||||
|
||||
Copyright:
|
||||
Damien Churchill (c) 2008 <damoxc@gmail.com>
|
||||
|
||||
|
||||
Object: Deluge.Mime
|
||||
Object containing all mime related functions.
|
||||
|
||||
*/
|
||||
|
||||
Deluge.Mime = {
|
||||
types_map: new Hash({
|
||||
'.doc': 'application/msword',
|
||||
'.dot': 'application/msword',
|
||||
'.wiz': 'application/msword',
|
||||
'.a': 'application/octet-stream',
|
||||
'.bin': 'application/octet-stream',
|
||||
'.dll': 'application/octet-stream',
|
||||
'.exe': 'application/octet-stream',
|
||||
'.o': 'application/octet-stream',
|
||||
'.obj': 'application/octet-stream',
|
||||
'.so': 'application/octet-stream',
|
||||
'.oda': 'application/oda',
|
||||
'.pdf': 'application/pdf',
|
||||
'.p7c': 'application/pkcs7-mime',
|
||||
'.ai': 'application/postscript',
|
||||
'.eps': 'application/postscript',
|
||||
'.ps': 'application/postscript',
|
||||
'.xlb': 'application/vnd.ms-excel',
|
||||
'.xls': 'application/vnd.ms-excel',
|
||||
'.pot': 'application/vnd.ms-powerpoint',
|
||||
'.ppa': 'application/vnd.ms-powerpoint',
|
||||
'.pps': 'application/vnd.ms-powerpoint',
|
||||
'.ppt': 'application/vnd.ms-powerpoint',
|
||||
'.pwz': 'application/vnd.ms-powerpoint',
|
||||
'.bcpio': 'application/x-bcpio',
|
||||
'.cpio': 'application/x-cpio',
|
||||
'.csh': 'application/x-csh',
|
||||
'.dvi': 'application/x-dvi',
|
||||
'.gtar': 'application/x-gtar',
|
||||
'.hdf': 'application/x-hdf',
|
||||
'.js': 'application/x-javascript',
|
||||
'.latex': 'application/x-latex',
|
||||
'.mif': 'application/x-mif',
|
||||
'.cdf': 'application/x-netcdf',
|
||||
'.nc': 'application/x-netcdf',
|
||||
'.p12': 'application/x-pkcs12',
|
||||
'.pfx': 'application/x-pkcs12',
|
||||
'.ram': 'application/x-pn-realaudio',
|
||||
'.pyc': 'application/x-python-code',
|
||||
'.pyo': 'application/x-python-code',
|
||||
'.sh': 'application/x-sh',
|
||||
'.shar': 'application/x-shar',
|
||||
'.swf': 'application/x-shockwave-flash',
|
||||
'.sv4cpio': 'application/x-sv4cpio',
|
||||
'.sv4crc': 'application/x-sv4crc',
|
||||
'.tar': 'application/x-tar',
|
||||
'.tcl': 'application/x-tcl',
|
||||
'.tex': 'application/x-tex',
|
||||
'.texi': 'application/x-texinfo',
|
||||
'.texinfo': 'application/x-texinfo',
|
||||
'.roff': 'application/x-troff',
|
||||
'.t': 'application/x-troff',
|
||||
'.tr': 'application/x-troff',
|
||||
'.man': 'application/x-troff-man',
|
||||
'.me': 'application/x-troff-me',
|
||||
'.ms': 'application/x-troff-ms',
|
||||
'.ustar': 'application/x-ustar',
|
||||
'.src': 'application/x-wais-source',
|
||||
'.rdf': 'application/xml',
|
||||
'.wsdl': 'application/xml',
|
||||
'.xpdl': 'application/xml',
|
||||
'.xsl': 'application/xml',
|
||||
'.zip': 'application/zip',
|
||||
'.au': 'audio/basic',
|
||||
'.snd': 'audio/basic',
|
||||
'.mp2': 'audio/mpeg',
|
||||
'.mp3': 'audio/mpeg',
|
||||
'.aif': 'audio/x-aiff',
|
||||
'.aifc': 'audio/x-aiff',
|
||||
'.aiff': 'audio/x-aiff',
|
||||
'.ra': 'audio/x-pn-realaudio',
|
||||
'.wav': 'audio/x-wav',
|
||||
'.gif': 'image/gif',
|
||||
'.ief': 'image/ief',
|
||||
'.jpe': 'image/jpeg',
|
||||
'.jpeg': 'image/jpeg',
|
||||
'.jpg': 'image/jpeg',
|
||||
'.png': 'image/png',
|
||||
'.tif': 'image/tiff',
|
||||
'.tiff': 'image/tiff',
|
||||
'.ras': 'image/x-cmu-raster',
|
||||
'.bmp': 'image/x-ms-bmp',
|
||||
'.pnm': 'image/x-portable-anymap',
|
||||
'.pbm': 'image/x-portable-bitmap',
|
||||
'.pgm': 'image/x-portable-graymap',
|
||||
'.ppm': 'image/x-portable-pixmap',
|
||||
'.rgb': 'image/x-rgb',
|
||||
'.xbm': 'image/x-xbitmap',
|
||||
'.xpm': 'image/x-xpixmap',
|
||||
'.xwd': 'image/x-xwindowdump',
|
||||
'.eml': 'message/rfc822',
|
||||
'.mht': 'message/rfc822',
|
||||
'.mhtml': 'message/rfc822',
|
||||
'.nws': 'message/rfc822',
|
||||
'.css': 'text/css',
|
||||
'.htm': 'text/html',
|
||||
'.html': 'text/html',
|
||||
'.bat': 'text/plain',
|
||||
'.c': 'text/plain',
|
||||
'.h': 'text/plain',
|
||||
'.ksh': 'text/plain',
|
||||
'.pl': 'text/plain',
|
||||
'.txt': 'text/plain',
|
||||
'.rtx': 'text/richtext',
|
||||
'.tsv': 'text/tab-separated-values',
|
||||
'.py': 'text/x-python',
|
||||
'.etx': 'text/x-setext',
|
||||
'.sgm': 'text/x-sgml',
|
||||
'.sgml': 'text/x-sgml',
|
||||
'.vcf': 'text/x-vcard',
|
||||
'.xml': 'text/xml',
|
||||
'.m1v': 'video/mpeg',
|
||||
'.mpa': 'video/mpeg',
|
||||
'.mpe': 'video/mpeg',
|
||||
'.mpeg': 'video/mpeg',
|
||||
'.mpg': 'video/mpeg',
|
||||
'.mov': 'video/quicktime',
|
||||
'.qt': 'video/quicktime',
|
||||
'.avi': 'video/x-msvideo',
|
||||
'.movie': 'video/x-sgi-movie'
|
||||
}),
|
||||
|
||||
getMimeType: function(filename) {
|
||||
var extension = filename.match(/^.*(\.\w+)$/)
|
||||
if (extension) extension = extension[1]
|
||||
else return null;
|
||||
|
||||
if (this.types_map.has(extension)) return this.types_map[extension];
|
||||
else return null;
|
||||
}
|
||||
}
|
|
@ -358,6 +358,28 @@ label.fluid {
|
|||
color: Black;
|
||||
background: #99acc3;
|
||||
border:1px solid #23344b;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#addTorrent .filesTable .fileIcon {
|
||||
width: 20px;
|
||||
background: url(mime_icons/unknown.png) 2px 2px no-repeat;
|
||||
}
|
||||
|
||||
#addTorrent .filesTable .fileSelect {
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
#addTorrent .filesTable .fileName {
|
||||
width: 410px;
|
||||
}
|
||||
|
||||
#addTorrent .filesTable .fileSize {
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
#addTorrent .filesTable .image_jpeg {
|
||||
background-image: url(mime_icons/image.png);
|
||||
}
|
||||
|
||||
#addTorrent #buttons {
|
||||
|
|
Loading…
Reference in New Issue