Opened 10 years ago

Closed 10 years ago

#5013 closed Enhancement (fixed)

WebUI Inspector file tree

Reported by: PsychoMario Owned by: jordan
Priority: Normal Milestone: 2.70
Component: Web Client Version: 2.61
Severity: Normal Keywords: webui inspector heirarchy tree
Cc:

Description

I noticed that in the latest branch of transmission webui there still isn't any possibility to view directories in torrents, and therefore no possibility for expanding/collapsing directories, or setting download and priority attributes.

So I wrote a patch. The patch creates a hierarchical view of the files and directories inside the torrent, and allows for collapsing any directory, setting a directory priority and choosing whether or not to download a directory

Attachments (2)

webheirarchy.patch (7.1 KB) - added by PsychoMario 10 years ago.
Screen Shot 2012-09-22 at 2.14.36 PM.png (63.2 KB) - added by livings124 10 years ago.
incorrect order

Download all attachments as: .zip

Change History (12)

Changed 10 years ago by PsychoMario

comment:1 Changed 10 years ago by jordan

  • Milestone changed from None Set to 2.70
  • Owner set to jordan
  • Status changed from new to assigned
  • Version changed from 2.61+ to 2.61

This patch looks really good. Thanks!

comment:2 Changed 10 years ago by jordan

  • Resolution set to fixed
  • Status changed from assigned to closed

Added in r13437

comment:3 Changed 10 years ago by cfpp2p

  • Resolution fixed deleted
  • Status changed from closed to reopened
        for (parentid in parents) {
            $($('.inspector_torrent_file_list_entry_name',$('#'+parentid))[0]).click(function() { $($(this).parent()).children('li').toggle(); })

            sum = 0
            matches = $('#'+parentid).children('li').text().match(/\([^\)]+\)/g)
            if (matches == null) { continue; }
            matches.map(function(word) {return parseFloat(word.slice(1,-2)) }).map(function(perc) {sum+=perc})
            count = $('#'+parentid).children('li').text().match(/\([^\)]+\)/g).length
            totalcomplete = (sum/count).toFixed(1)

            $($('.inspector_torrent_file_list_entry_progress',$('#'+parentid))[0]).text('('+totalcomplete+'%)')
        }

There is a problem with this code when a file within the directory has the same name as the directory (excluding any file extension). Example: Directory sample example contains a file sample example.tst

When this is the case totalcomplete will the be incorrect displaying an inflated percentage or sometimes NaN% for the directories.

On second thought, this is not always the reason for incorrect percentage. Now seeing also under-inflated percentages and unrelated directory/filenames, but the section of code is still at fault as far as I can tell.

Last edited 10 years ago by cfpp2p (previous) (diff)

comment:4 Changed 10 years ago by cfpp2p

Ok...

match(/\([^\)]+\)/g)

doesn't work correct.

Use

match(/\([^\.]+\)/g)

instead. Use the code below to include descriptions of what the values displayed indicate. This was not clear with the original.

        for (parentid in parents) {
            $($('.inspector_torrent_file_list_entry_name',$('#'+parentid))[0]).click(function() { $($(this).parent()).children('li').toggle(); })

            sum = 0
            sumt = 0
            matches = $('#'+parentid).children('li').text().match(/\([^\.]+\)/g)
            if (matches == null) { continue; }
            matches.map(function(word) {return parseFloat(word.slice(1,-2)) }).map(function(perc) {sum+=perc})
            matches.map(function(word) {return parseFloat(word.slice(1,-2)) }).map(function(perc) {sumt+=(perc == 100)})
            count = $('#'+parentid).children('li').text().match(/\([^\.]+\)/g).length
            totalcomplete = (sum/count).toFixed(1)
            $($('.inspector_torrent_file_list_entry_progress',$('#'+parentid))[0]).text('(averaged percent of file completion: '+totalcomplete+'%     complete files: '+sumt+'     total file count: '+count+')')
        }

Directories containing parenthesis ( ) don't parse correctly with the original. My code still has problems but might be better than the original. Here is a test torrent and files to see the problems: http://computerfixpro.com/5013test.zip.

The code posted here fixes some problems you'll see with the original as shown by the 5013test files but it doesn't fix'em-all.

Hope this helps the original reporter and owner.

Last edited 10 years ago by cfpp2p (previous) (diff)

comment:5 Changed 10 years ago by jordan

Expanding the inspector text probably ought to go into a separate feature ticket, but thanks for the regex fix :)

comment:6 Changed 10 years ago by jordan

  • Resolution set to fixed
  • Status changed from reopened to closed

regex fixed in r13505.

comment:7 Changed 10 years ago by livings124

This is displaying incorrectly for me. In the attached image, the first three files should be below the fourth listed.

Changed 10 years ago by livings124

incorrect order

comment:8 Changed 10 years ago by livings124

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:9 Changed 10 years ago by jordan

$ transmission-show ~/Downloads/364-bill-gates---how-im-trying-to-change-the-world-now.torrent.added 
Name: TED - Bill Gates - How I'm trying to change the world now
File: /home/charles/Downloads/364-bill-gates---how-im-trying-to-change-the-world-now.torrent.added

GENERAL

  Name: TED - Bill Gates - How I'm trying to change the world now
  Hash: c484b2ea5a9de149467a09770a5774fc55109a99
  Created by: 
  Created on: Sun Feb  8 23:08:29 2009
  Comment: LegalTorrents(TM) is an online community for members to discover and distribute Creative Commons licensed digital media.
  Piece Count: 2211
  Piece Size: 128.0 KiB
  Total Size: 289.7 MB
  Privacy: Public torrent

TRACKERS

  Tier #1
  http://tracker001.legaltorrents.com:7070/announce

FILES

  TED - Bill Gates - How I'm trying to change the world now/Content/BillGates_2009_480.mp4 (289.7 MB)
  TED - Bill Gates - How I'm trying to change the world now/Description.txt (0.55 kB)
  TED - Bill Gates - How I'm trying to change the world now/LegalTorrents.txt (0.67 kB)
  TED - Bill Gates - How I'm trying to change the world now/License.txt (0.13 kB)

comment:10 Changed 10 years ago by livings124

  • Resolution set to fixed
  • Status changed from reopened to closed

This looks to be fixed with r13523 through r13525

Note: See TracTickets for help on using tickets.